mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
fixed unnecesary reloads
This commit is contained in:
2 files changed
+5
-21
No files matched your search
@@ -9,7 +9,7 @@ import Foundation
|
|||||||
import SwiftUI
|
import SwiftUI
|
||||||
import UniformTypeIdentifiers
|
import UniformTypeIdentifiers
|
||||||
|
|
||||||
struct EmojiPack: Identifiable, Codable {
|
struct EmojiPack: Identifiable, Codable, Equatable {
|
||||||
var id: UUID
|
var id: UUID
|
||||||
var name: String
|
var name: String
|
||||||
var description: String
|
var description: String
|
||||||
@@ -29,16 +29,6 @@ struct EmojiPack: Identifiable, Codable {
|
|||||||
url.safeHost == "stickerslack.nihaals.me" else {
|
url.safeHost == "stickerslack.nihaals.me" else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// switch url.safeHost {
|
|
||||||
// case "shared.pack":
|
|
||||||
// <#code#>
|
|
||||||
// case "stickerslack.neon443.xyz":
|
|
||||||
// <#code#>
|
|
||||||
// case "stickerslack.nihaals.me":
|
|
||||||
// <#code#>
|
|
||||||
// default:
|
|
||||||
// return nil
|
|
||||||
// }
|
|
||||||
guard let created = EmojiPack.createFrom(url: url) else {
|
guard let created = EmojiPack.createFrom(url: url) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -48,14 +38,6 @@ struct EmojiPack: Identifiable, Codable {
|
|||||||
static func createFrom(url: URL) -> EmojiPack? {
|
static func createFrom(url: URL) -> EmojiPack? {
|
||||||
var pack: EmojiPack = .new()
|
var pack: EmojiPack = .new()
|
||||||
|
|
||||||
// switch type {
|
|
||||||
// case .stickerslack:
|
|
||||||
// <#code#>
|
|
||||||
// case .neon443:
|
|
||||||
// <#code#>
|
|
||||||
// case .nihaals:
|
|
||||||
// <#code#>
|
|
||||||
// }
|
|
||||||
guard let components = URLComponents(string: url.absoluteString),
|
guard let components = URLComponents(string: url.absoluteString),
|
||||||
let queryItems = components.queryItems else {
|
let queryItems = components.queryItems else {
|
||||||
print("no query items or components")
|
print("no query items or components")
|
||||||
|
|||||||
@@ -30,12 +30,14 @@ struct EmojiCollectionView: UIViewRepresentable {
|
|||||||
|
|
||||||
func updateUIView(_ uiView: UICollectionView, context: Context) {
|
func updateUIView(_ uiView: UICollectionView, context: Context) {
|
||||||
context.coordinator.hoarder = hoarder
|
context.coordinator.hoarder = hoarder
|
||||||
context.coordinator.items = items
|
|
||||||
context.coordinator.pack = pack
|
|
||||||
context.coordinator.edit = edit
|
context.coordinator.edit = edit
|
||||||
context.coordinator.onRemove = onRemove
|
context.coordinator.onRemove = onRemove
|
||||||
|
if items != context.coordinator.items || context.coordinator.pack != pack {
|
||||||
|
context.coordinator.items = items
|
||||||
|
context.coordinator.pack = pack
|
||||||
uiView.reloadData()
|
uiView.reloadData()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func makeCoordinator() -> Coordinator {
|
func makeCoordinator() -> Coordinator {
|
||||||
Coordinator(
|
Coordinator(
|
||||||
|
|||||||