ui updates to emojpackdetailview

added .type to sticker to get its type
added fromappname to stickertype
This commit is contained in:
neon443 committed 2026-04-14 21:18:58 +01:00
1 parent 988ea730d1
commit cf57bccf2f
8 files changed
+45 -33

No files matched your search

@@ -105,10 +105,10 @@ struct EmojiPackDetailView: View {
let emoji = hoarder.trie.dict[name] ?? .test
VStack {
StickerPreview(sticker: emoji)
Spacer()
Text(emoji.UIName)
.multilineTextAlignment(.center)
.font(.caption)
Spacer()
}
.overlay(alignment: .topLeading) {
if edit {
@@ -124,11 +124,6 @@ struct EmojiPackDetailView: View {
.padding(-10)
}
}
// .distortionEffect(
// ShaderLibrary.wiggle(.float(initDate.timeIntervalSinceNow)),
// maxSampleOffset: .zero,
// isEnabled: edit
// )
.rotationEffect(
.degrees(
edit ? sin(initDate.timeIntervalSinceNow*20)*4 : 0
@@ -172,15 +167,21 @@ struct EmojiPackDetailView: View {
}
.animation(.spring, value: pack.items)
.padding()
Text("\(pack.items.count) Emoji\(pack.items.count.plural)")
.bold()
.multilineTextAlignment(.center)
.padding(.bottom)
.padding(.bottom, 32)
}
.transition(.scale)
.navigationTitle(edit ? "Editing" : "Pack Details")
.navigationBarTitleDisplayMode(.inline)
.overlay(alignment: .bottom) {
Text("\(pack.items.count) Emoji\(pack.items.count.plural)")
.bold()
.multilineTextAlignment(.center)
.shadow(radius: 5)
.padding(.bottom)
}
.onDisappear {
hoarder.saveEmojiPacks()
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button(
@@ -219,9 +220,6 @@ struct EmojiPackDetailView: View {
}
}
}
.onDisappear {
hoarder.saveEmojiPacks()
}
}
}
}
@@ -11,6 +11,9 @@ struct EmojiPackImporterView: View {
@ObservedObject var emojiHoarder: EmojiHoarder
@Binding var pack: EmojiPack
@Environment(\.dismiss) var dismiss
var isiPhone: Bool {
return UIDevice().userInterfaceIdiom == .phone
}
var body: some View {
EmojiPackDetailView(hoarder: emojiHoarder, pack: $pack)
@@ -24,6 +27,7 @@ struct EmojiPackImporterView: View {
}
.modifier(glassButtonIfAv())
.padding(.leading)
.padding(.bottom, isiPhone ? 0 : 16)
.tint(.gray)
}
.overlay(alignment: .bottomTrailing) {
@@ -38,6 +42,7 @@ struct EmojiPackImporterView: View {
}
.modifier(glassButtonIfAv())
.padding(.trailing)
.padding(.bottom, isiPhone ? 0 : 16)
.tint(.accentColor)
}
}
@@ -12,23 +12,13 @@ struct StickerPreview: View {
@State var sticker: any StickerProtocol
@State var gifImage: Image?
var type: StickerType {
let type = Swift.type(of: sticker)
if type == Emoji.self {
return .slackEmoji
} else if type == Gif.self {
return .giphyGifs
} else {
fatalError("sticker type unrecognisedd")
}
}
var body: some View {
if sticker.image != nil {
//local
GifView(url: sticker.localImageURL)
} else {
//remote
if type == .slackEmoji {
if sticker.type == .slackEmoji {
GifView(url: sticker.remoteImageURL)
} else {
let gif = sticker as! Gif
+1 -1
View File
@@ -41,7 +41,7 @@ struct StickerRow<T: Hoarder>: View {
}
.tint(isDownloaded ? .red : .accent)
.buttonStyle(.borderless)
.alert("From Slack", isPresented: $showTooltip) {
.alert("From \(sticker.type.fromAppName)", isPresented: $showTooltip) {
Button("Done") {}
}
if isDownloaded {
+2 -2
View File
@@ -26,8 +26,8 @@ struct WelcomeView: View {
.font(.largeTitle.monospaced())
Spacer()
}
.padding(.vertical, 20)
.padding(.leading, 20)
.padding(.vertical, 16)
.padding(.leading, 16)
List {
Section("How to use") {
ListRow(number: 1, text: "Browse or search for an emoji")
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.