mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 12:44:51 +00:00
emojipacks should save and load
extracted logic into emojhoarder
This commit is contained in:
4 files changed
+39
-25
No files matched your search
@@ -173,7 +173,7 @@ struct EmojiPackDetailView: View {
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
hoarder.
|
||||
hoarder.saveEmojiPacks()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,7 @@ struct EmojiPackImporterView: View {
|
||||
EmojiPackDetailView(hoarder: emojiHoarder, pack: $pack)
|
||||
.overlay(alignment: .bottomLeading) {
|
||||
Button {
|
||||
withAnimation {
|
||||
emojiHoarder.emojiPacks.append(pack)
|
||||
dismiss()
|
||||
}
|
||||
dismiss()
|
||||
} label: {
|
||||
Text("Cancel")
|
||||
.font(.title3)
|
||||
@@ -31,10 +28,8 @@ struct EmojiPackImporterView: View {
|
||||
}
|
||||
.overlay(alignment: .bottomTrailing) {
|
||||
Button {
|
||||
withAnimation {
|
||||
emojiHoarder.emojiPacks.append(pack)
|
||||
dismiss()
|
||||
}
|
||||
emojiHoarder.addEmojiPack(pack)
|
||||
dismiss()
|
||||
} label: {
|
||||
Text("Add")
|
||||
.font(.title3)
|
||||
|
||||
@@ -21,9 +21,7 @@ struct EmojiPackManager: View {
|
||||
}
|
||||
.swipeActions(edge: .trailing) {
|
||||
Button {
|
||||
withAnimation {
|
||||
hoarder.emojiPacks.removeAll { $0.id == pack.id }
|
||||
}
|
||||
hoarder.removeEmojiPack(pack)
|
||||
} label: {
|
||||
Label("Delete", systemImage: "trash")
|
||||
}
|
||||
@@ -42,9 +40,7 @@ struct EmojiPackManager: View {
|
||||
.toolbar {
|
||||
ToolbarItem {
|
||||
Button {
|
||||
withAnimation {
|
||||
hoarder.emojiPacks.append(.new())
|
||||
}
|
||||
hoarder.newEmojiPack()
|
||||
} label: {
|
||||
Image(systemName: "plus")
|
||||
}
|
||||
|
||||