diff --git a/Resources/Assets.xcassets/StickerSlack.imageset/Contents.json b/Resources/Assets.xcassets/StickerSlack.imageset/Contents.json new file mode 100644 index 0000000..3346991 --- /dev/null +++ b/Resources/Assets.xcassets/StickerSlack.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "StickerSlack-iOS-Default-1024x1024@1x.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Resources/Assets.xcassets/StickerSlack.imageset/StickerSlack-iOS-Default-1024x1024@1x.png b/Resources/Assets.xcassets/StickerSlack.imageset/StickerSlack-iOS-Default-1024x1024@1x.png new file mode 100644 index 0000000..be357d6 Binary files /dev/null and b/Resources/Assets.xcassets/StickerSlack.imageset/StickerSlack-iOS-Default-1024x1024@1x.png differ diff --git a/Resources/Assets.xcassets/slack.logo.symbolset/Contents.json b/Resources/Assets.xcassets/slack.logo.symbolset/Contents.json index 3bb3f10..759ce7a 100644 --- a/Resources/Assets.xcassets/slack.logo.symbolset/Contents.json +++ b/Resources/Assets.xcassets/slack.logo.symbolset/Contents.json @@ -5,7 +5,7 @@ }, "symbols" : [ { - "filename" : "square.and.arrow.up.svg", + "filename" : "slack.logo.svg", "idiom" : "universal" } ] diff --git a/Resources/Assets.xcassets/slack.logo.symbolset/slack.logo.svg b/Resources/Assets.xcassets/slack.logo.symbolset/slack.logo.svg new file mode 100644 index 0000000..95431d1 --- /dev/null +++ b/Resources/Assets.xcassets/slack.logo.symbolset/slack.logo.svg @@ -0,0 +1,117 @@ + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.4.0 + Requires Xcode 14 or greater + Generated from square.and.arrow.up + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Resources/Assets.xcassets/slack.logo.symbolset/square.and.arrow.up.svg b/Resources/Assets.xcassets/slack.logo.symbolset/square.and.arrow.up.svg deleted file mode 100644 index fd118a9..0000000 --- a/Resources/Assets.xcassets/slack.logo.symbolset/square.and.arrow.up.svg +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - Weight/Scale Variations - Ultralight - Thin - Light - Regular - Medium - Semibold - Bold - Heavy - Black - - - - - - - - - - - Design Variations - Symbols are supported in up to nine weights and three scales. - For optimal layout with text and other symbols, vertically align - symbols with the adjacent text. - - - - - - Margins - Leading and trailing margins on the left and right side of each symbol - can be adjusted by modifying the x-location of the margin guidelines. - Modifications are automatically applied proportionally to all - scales and weights. - - - - Exporting - Symbols should be outlined when exporting to ensure the - design is preserved when submitting to Xcode. - Template v.7.0 - Requires Xcode 26 or greater - Generated from square.and.arrow.up - Typeset at 100.0 points - Small - Medium - Large - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/StickerSlack.xcodeproj/project.pbxproj b/StickerSlack.xcodeproj/project.pbxproj index 9e6b08a..c7afbf1 100644 --- a/StickerSlack.xcodeproj/project.pbxproj +++ b/StickerSlack.xcodeproj/project.pbxproj @@ -640,7 +640,7 @@ }; }; buildConfigurationList = A949B1DA2EA04C0B00215164 /* Build configuration list for PBXProject "StickerSlack" */; - compatibilityVersion = "Xcode 14.0"; + compatibilityVersion = "Xcode 12.0"; developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( diff --git a/StickerSlack/Stickers/Sticker.swift b/StickerSlack/Stickers/Sticker.swift index bbf1b02..dc4996e 100644 --- a/StickerSlack/Stickers/Sticker.swift +++ b/StickerSlack/Stickers/Sticker.swift @@ -120,7 +120,7 @@ extension StickerProtocol { bitsPerComponent: cgImage.bitsPerComponent, bytesPerRow: cgImage.bytesPerRow, space: cgImage.colorSpace ?? CGColorSpaceCreateDeviceRGB(), - bitmapInfo: cgImage.bitmapInfo + bitmapInfo: cgImage.bitmapInfo.rawValue ) else { fatalError() } context.interpolationQuality = .default diff --git a/StickerSlack/SwiftUI/ContentView.swift b/StickerSlack/SwiftUI/ContentView.swift index f8e6c8a..98ae4aa 100644 --- a/StickerSlack/SwiftUI/ContentView.swift +++ b/StickerSlack/SwiftUI/ContentView.swift @@ -12,60 +12,76 @@ struct ContentView: View { @ObservedObject var emojiHoarder: EmojiHoarder @ObservedObject var gifhoarder: GifHoarder + @State var tabSelection: AppTab = .browse + @State var searchTerm: String = "" + + enum AppTab { + case browse + case packs + case downloaded + case settings + case search + } + var body: some View { Group { if #available(iOS 18, *) { - TabView { - Tab("Browse", systemImage: "square.grid.2x2.fill") { + TabView(selection: $tabSelection) { + Tab("Browse", systemImage: "square.grid.2x2.fill", value: AppTab.browse) { BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) } - Tab("Packs", systemImage: "square.stack.3d.up.fill") { + Tab("Packs", systemImage: "square.stack.3d.up.fill", value: AppTab.packs) { EmojiPackManager(hoarder: emojiHoarder) } - Tab("Downloaded", systemImage: "arrow.down.circle.fill") { + Tab("Downloaded", systemImage: "arrow.down.circle.fill", value: AppTab.downloaded) { DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) } - Tab("Settings", systemImage: "gear") { + Tab("Settings", systemImage: "gear", value: AppTab.settings) { SettingsView(hoarder: emojiHoarder) } - Tab(role: .search) { + Tab(value: AppTab.search, role: .search) { NavigationStack { - SearchView(hoarder: emojiHoarder) + SearchView(hoarder: emojiHoarder, searchTerm: $searchTerm) } } } - .tabViewBottomAccessorySafe { - HStack { - Image(systemName: "magnifyingglass") - TextField("", text: .constant("sa"), prompt: Text("Search")) - } - .padding(.horizontal) - } +// .tabViewBottomAccessorySafe() { +// HStack { +// Image(systemName: "magnifyingglass") +// TextField("", text: $searchTerm, prompt: Text("Search")) +// } +// .padding(.horizontal) +// } } else { - TabView { + TabView(selection: $tabSelection) { BrowseView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) + .tag(AppTab.browse) .tabItem { Label("Browse", systemImage: "square.grid.2x2.fill") } EmojiPackManager(hoarder: emojiHoarder) + .tag(AppTab.packs) .tabItem { Label("Packs", systemImage: "square.stack.3d.up.fill") } DownloadedView(emojiHoarder: emojiHoarder, gifHoarder: gifhoarder) + .tag(AppTab.downloaded) .tabItem { Label("Downloaded", systemImage: "arrow.down.circle.fill") } SettingsView(hoarder: emojiHoarder) + .tag(AppTab.settings) .tabItem { Label("Setings", systemImage: "gear") } NavigationView2 { - SearchView(hoarder: emojiHoarder) + SearchView(hoarder: emojiHoarder, searchTerm: $searchTerm) } + .tag(AppTab.search) .tabItem { Label("Search", systemImage: "magnifyingglass") } diff --git a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift index 2ff2f3f..b388670 100644 --- a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift +++ b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackDetailView.swift @@ -12,6 +12,8 @@ struct EmojiPackDetailView: View { @ObservedObject var hoarder: EmojiHoarder @Binding var pack: EmojiPack + @State var searchTerm: String = "" + @State var edit: Bool = false @State var editName: Bool = false @State var editDescription: Bool = false @@ -98,7 +100,6 @@ struct EmojiPackDetailView: View { ) { withAnimation(.spring) { edit.toggle() } } - .modifier(glassButtonIfAv(edit)) .tint(edit ? Color.accentColor : .primary) } ToolbarItem(placement: .topBarLeading) { @@ -110,6 +111,7 @@ struct EmojiPackDetailView: View { NavigationView2 { SearchView( hoarder: hoarder, + searchTerm: $searchTerm, fromPackEditor: true, callback: { pack.add($0) diff --git a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackGridView.swift b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackGridView.swift index 45e2542..e2a2b6a 100644 --- a/StickerSlack/SwiftUI/EmojiPacks/EmojiPackGridView.swift +++ b/StickerSlack/SwiftUI/EmojiPacks/EmojiPackGridView.swift @@ -109,7 +109,7 @@ struct EmojiPackGridView: View { } .sheet(isPresented: $showAdder) { NavigationView2 { - SearchView(hoarder: hoarder, fromPackEditor: true) { selection in + SearchView(hoarder: hoarder, searchTerm: $searchTerm, fromPackEditor: true) { selection in withAnimation(.spring) { pack.add(selection) } diff --git a/StickerSlack/SwiftUI/Misc/ViewModifiers.swift b/StickerSlack/SwiftUI/Misc/ViewModifiers.swift index 039f9d9..abf11c1 100644 --- a/StickerSlack/SwiftUI/Misc/ViewModifiers.swift +++ b/StickerSlack/SwiftUI/Misc/ViewModifiers.swift @@ -18,16 +18,6 @@ struct numericTextCompat: ViewModifier { } } -struct tabViewActivationSearchActivation: ViewModifier { - func body(content: Content) -> some View { - if #available(iOS 26, *) { - content.tabViewSearchActivation(.searchTabSelection) - } else { - content - } - } -} - struct glassButtonIfAv: ViewModifier { var enabled: Bool @@ -36,6 +26,7 @@ struct glassButtonIfAv: ViewModifier { } func body(content: Content) -> some View { +#if compiler(>=6.2) if enabled { if #available(iOS 19, *) { content.buttonStyle(.glassProminent) @@ -45,6 +36,13 @@ struct glassButtonIfAv: ViewModifier { } else { content } +#else + if enabled { + content.buttonStyle(.borderedProminent) + } else { + content + } +#endif } } @@ -125,12 +123,16 @@ struct TabViewBottomAcceessorySafe: ViewModifier { @ViewBuilder var contents: () -> T func body(content: Content) -> some View where Content: View { +#if compiler(>=6.2.1) if #available(iOS 26.1, *) { content .tabViewBottomAccessory(isEnabled: isEnabled, content: contents) } else { content } +#else + content +#endif } } diff --git a/StickerSlack/SwiftUI/SearchView.swift b/StickerSlack/SwiftUI/SearchView.swift index cf8b877..b2447e1 100644 --- a/StickerSlack/SwiftUI/SearchView.swift +++ b/StickerSlack/SwiftUI/SearchView.swift @@ -12,7 +12,7 @@ struct SearchView: View { @FocusState private var searchFocused: Bool @State private var currentSearch: Task? - @State var searchTerm: String = "" + @Binding var searchTerm: String @State var previousSearches: [String] = [] @State var searchResult: [String] = [] @@ -32,26 +32,32 @@ struct SearchView: View { @Environment(\.dismiss) var dismiss + func runSearch(with: String) { + if currentSearch != nil { currentSearch?.cancel() } + guard !searchTerm.isEmpty else { + currentSearch?.cancel() + searchResult = [] + previousSearches = [] + return + } + currentSearch = Task.detached { + let result = await hoarder.trie.search( + for: searchTerm, + previousQuery: previousSearches.last, + previousResult: Set(searchResult) + ) + await MainActor.run { + withAnimation(.snappy) { + searchResult = result + previousSearches.append(searchTerm) + } + } + } + } + var body: some View { VStack { if fromPackEditor { -// GeometryReader { geo in -// let columns: Int = max(1, Int((geo.size.width - 2*spacing) / (minColWidth + spacing))) -// let layout = Array(repeating: col, count: columns) -// ScrollView { -// LazyVGrid(columns: layout, spacing: spacing) { -// ForEach(searchResult, id: \.self) { name in -// let emoji = hoarder.trie.dict[name] ?? .test -// StickerPreview(sticker: emoji) -// .onTapGesture { -// callback(emoji) -// dismiss() -// } -// } -// } -// .padding() -// } -// } EmojiCollectionView( hoarder: hoarder, items: searchResult, @@ -74,37 +80,27 @@ struct SearchView: View { } } .pickerStyle(.segmented) + .padding(.horizontal) } } .searchable(text: $searchTerm) .onChange(of: searchTerm) { new in - if currentSearch != nil { currentSearch?.cancel() } - guard !searchTerm.isEmpty else { - currentSearch?.cancel() - searchResult = [] - previousSearches = [] - return - } - currentSearch = Task.detached { - let result = await hoarder.trie.search( - for: searchTerm, - previousQuery: previousSearches.last, - previousResult: Set(searchResult) - ) - await MainActor.run { - withAnimation(.snappy) { - searchResult = result - previousSearches.append(searchTerm) - } - } - } + runSearch(with: new) + } + .onAppear { + guard !searchTerm.isEmpty else { return } + runSearch(with: searchTerm) } } } +@available(iOS 17, *) #Preview { + @Previewable @State var searchTerm: String = "" + SearchView( hoarder: EmojiHoarder(localOnly: true), + searchTerm: $searchTerm, fromPackEditor: true ) { print($0) diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/Contents.json b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/Contents.json new file mode 100644 index 0000000..5689a46 --- /dev/null +++ b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/Contents.json @@ -0,0 +1,67 @@ +{ + "images" : [ + { + "filename" : "rectIcon120.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x45" + }, + { + "filename" : "rectIcon180.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x45" + }, + { + "filename" : "rectIcon134.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "67x50" + }, + { + "filename" : "rectIcon148.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "74x55" + }, + { + "filename" : "rectIcon54.png", + "idiom" : "universal", + "platform" : "ios", + "scale" : "2x", + "size" : "27x20" + }, + { + "filename" : "rectIcon81.png", + "idiom" : "universal", + "platform" : "ios", + "scale" : "3x", + "size" : "27x20" + }, + { + "filename" : "rectIcon64.png", + "idiom" : "universal", + "platform" : "ios", + "scale" : "2x", + "size" : "32x24" + }, + { + "filename" : "rectIcon96.png", + "idiom" : "universal", + "platform" : "ios", + "scale" : "3x", + "size" : "32x24" + }, + { + "filename" : "rectIcon.png", + "idiom" : "ios-marketing", + "platform" : "ios", + "scale" : "1x", + "size" : "1024x768" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon.png new file mode 100644 index 0000000..ae39e11 Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon120.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon120.png new file mode 100644 index 0000000..07b1a1e Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon120.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon134.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon134.png new file mode 100644 index 0000000..8377960 Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon134.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon148.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon148.png new file mode 100644 index 0000000..7bd000f Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon148.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon180.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon180.png new file mode 100644 index 0000000..31452e3 Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon180.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon54.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon54.png new file mode 100644 index 0000000..33a85e8 Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon54.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon64.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon64.png new file mode 100644 index 0000000..ee4470c Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon64.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon81.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon81.png new file mode 100644 index 0000000..add4135 Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon81.png differ diff --git a/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon96.png b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon96.png new file mode 100644 index 0000000..68e936f Binary files /dev/null and b/StickerSlackiMessageApp/Assets.xcassets/iMessageAppIcon.stickersiconset/rectIcon96.png differ