mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
ui updates to emojpackdetailview
added .type to sticker to get its type added fromappname to stickertype
This commit is contained in:
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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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")
|
||||
|
||||