mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 05:19:13 +00:00
using wkwebview - i dont like how it turned out...
takes a second to load and has a white bg :(
This commit is contained in:
@@ -37,6 +37,9 @@
|
|||||||
A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C1792ECE542D00EA3EE9 /* GifManager.swift */; };
|
A957C17A2ECE542D00EA3EE9 /* GifManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C1792ECE542D00EA3EE9 /* GifManager.swift */; };
|
||||||
A957C17B2ECE542D00EA3EE9 /* GifManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C1792ECE542D00EA3EE9 /* GifManager.swift */; };
|
A957C17B2ECE542D00EA3EE9 /* GifManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C1792ECE542D00EA3EE9 /* GifManager.swift */; };
|
||||||
A957C17C2ECE542D00EA3EE9 /* GifManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C1792ECE542D00EA3EE9 /* GifManager.swift */; };
|
A957C17C2ECE542D00EA3EE9 /* GifManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C1792ECE542D00EA3EE9 /* GifManager.swift */; };
|
||||||
|
A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; };
|
||||||
|
A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; };
|
||||||
|
A957C1802ECFAA1100EA3EE9 /* GifView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A957C17D2ECFAA1100EA3EE9 /* GifView.swift */; };
|
||||||
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */; };
|
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */; };
|
||||||
A986A6AE2EB658DF00B6E0FA /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; };
|
A986A6AE2EB658DF00B6E0FA /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; };
|
||||||
A986A6BA2EB658E100B6E0FA /* StickerSlackiMessageApp.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
A986A6BA2EB658E100B6E0FA /* StickerSlackiMessageApp.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||||
@@ -121,6 +124,7 @@
|
|||||||
A957C1732ECCE2CE00EA3EE9 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
A957C1732ECCE2CE00EA3EE9 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
||||||
A957C1762ECD008E00EA3EE9 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
|
A957C1762ECD008E00EA3EE9 /* Bundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Bundle.swift; sourceTree = "<group>"; };
|
||||||
A957C1792ECE542D00EA3EE9 /* GifManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifManager.swift; sourceTree = "<group>"; };
|
A957C1792ECE542D00EA3EE9 /* GifManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifManager.swift; sourceTree = "<group>"; };
|
||||||
|
A957C17D2ECFAA1100EA3EE9 /* GifView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifView.swift; sourceTree = "<group>"; };
|
||||||
A969D6932EA3E86500399C05 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = Library/Frameworks/Messages.framework; sourceTree = DEVELOPER_DIR; };
|
A969D6932EA3E86500399C05 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = Library/Frameworks/Messages.framework; sourceTree = DEVELOPER_DIR; };
|
||||||
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPreview.swift; sourceTree = "<group>"; };
|
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPreview.swift; sourceTree = "<group>"; };
|
||||||
A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageApp.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
A986A6AD2EB658DF00B6E0FA /* StickerSlackiMessageApp.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageApp.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
@@ -290,6 +294,7 @@
|
|||||||
A91C098B2EBBD78700210C34 /* Categorisation */,
|
A91C098B2EBBD78700210C34 /* Categorisation */,
|
||||||
A91C098A2EBBD77B00210C34 /* API */,
|
A91C098A2EBBD77B00210C34 /* API */,
|
||||||
A957C1792ECE542D00EA3EE9 /* GifManager.swift */,
|
A957C1792ECE542D00EA3EE9 /* GifManager.swift */,
|
||||||
|
A957C17D2ECFAA1100EA3EE9 /* GifView.swift */,
|
||||||
);
|
);
|
||||||
path = Emoji;
|
path = Emoji;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -477,6 +482,7 @@
|
|||||||
A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */,
|
A949B1F52EA04E8200215164 /* StickerSlackApp.swift in Sources */,
|
||||||
A9104C802EB4022500D160EA /* MSSticker.swift in Sources */,
|
A9104C802EB4022500D160EA /* MSSticker.swift in Sources */,
|
||||||
A957C1772ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
A957C1772ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
||||||
|
A957C17F2ECFAA1100EA3EE9 /* GifView.swift in Sources */,
|
||||||
A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
|
A957C1742ECCE2CE00EA3EE9 /* SettingsView.swift in Sources */,
|
||||||
A9EB72392EB93FDB00658CEB /* EmojiCollectionView.swift in Sources */,
|
A9EB72392EB93FDB00658CEB /* EmojiCollectionView.swift in Sources */,
|
||||||
A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
|
A955B3EE2EC22C4A00E1732D /* DownloadedView.swift in Sources */,
|
||||||
@@ -505,6 +511,7 @@
|
|||||||
A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */,
|
A9EB724B2EB94A5700658CEB /* Trie.swift in Sources */,
|
||||||
A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */,
|
A986A6CD2EB659E000B6E0FA /* MessagesViewController.swift in Sources */,
|
||||||
A986A6CE2EB659E000B6E0FA /* StickerBrowserDataSource.swift in Sources */,
|
A986A6CE2EB659E000B6E0FA /* StickerBrowserDataSource.swift in Sources */,
|
||||||
|
A957C17E2ECFAA1100EA3EE9 /* GifView.swift in Sources */,
|
||||||
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
|
A9BBC5192EB8FA4500FFE82F /* ViewModifiers.swift in Sources */,
|
||||||
A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */,
|
A986A6C42EB6598500B6E0FA /* SlackResponse.swift in Sources */,
|
||||||
A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */,
|
A986A6C22EB6597600B6E0FA /* Emoji.swift in Sources */,
|
||||||
@@ -533,6 +540,7 @@
|
|||||||
A957C1782ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
A957C1782ECD008E00EA3EE9 /* Bundle.swift in Sources */,
|
||||||
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */,
|
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */,
|
||||||
A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */,
|
A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */,
|
||||||
|
A957C1802ECFAA1100EA3EE9 /* GifView.swift in Sources */,
|
||||||
A9EB72502EB94FAD00658CEB /* EmojiPreview.swift in Sources */,
|
A9EB72502EB94FAD00658CEB /* EmojiPreview.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
|||||||
33
StickerSlack/Emoji/GifView.swift
Normal file
33
StickerSlack/Emoji/GifView.swift
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
//
|
||||||
|
// GifView.swift
|
||||||
|
// StickerSlack
|
||||||
|
//
|
||||||
|
// Created by neon443 on 20/11/2025.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
import SwiftUI
|
||||||
|
import WebKit
|
||||||
|
|
||||||
|
struct GifView: UIViewRepresentable {
|
||||||
|
private let url: URL
|
||||||
|
|
||||||
|
init(url: URL) {
|
||||||
|
self.url = url
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeUIView(context: Context) -> WKWebView {
|
||||||
|
let webview = WKWebView()
|
||||||
|
|
||||||
|
webview.allowsLinkPreview = false
|
||||||
|
webview.allowsBackForwardNavigationGestures = false
|
||||||
|
|
||||||
|
webview.load(URLRequest(url: url))
|
||||||
|
return webview
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateUIView(_ uiView: WKWebView, context: Context) {
|
||||||
|
uiView.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,14 +22,15 @@ struct EmojiPreview: View {
|
|||||||
Group {
|
Group {
|
||||||
if let image = emoji.image {
|
if let image = emoji.image {
|
||||||
if emoji.localImageURLString.contains(".gif") {
|
if emoji.localImageURLString.contains(".gif") {
|
||||||
if let gifImage {
|
GifView(url: emoji.localImageURL)
|
||||||
gifImage
|
// if let gifImage {
|
||||||
.resizable().scaledToFit()
|
// gifImage
|
||||||
} else {
|
// .resizable().scaledToFit()
|
||||||
Text("uhhhh")
|
// } else {
|
||||||
.foregroundStyle(.red)
|
// Text("uhhhh")
|
||||||
.font(.largeTitle)
|
// .foregroundStyle(.red)
|
||||||
}
|
// .font(.largeTitle)
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
Image(uiImage: image)
|
Image(uiImage: image)
|
||||||
.resizable().scaledToFit()
|
.resizable().scaledToFit()
|
||||||
@@ -57,19 +58,19 @@ struct EmojiPreview: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onAppear {
|
// .onAppear {
|
||||||
guard emoji.localImageURLString.contains(".gif") else { return }
|
// guard emoji.localImageURLString.contains(".gif") else { return }
|
||||||
gifImage = nil
|
// gifImage = nil
|
||||||
guard let gifData = try? Data(contentsOf: emoji.localImageURL) as CFData else { return }
|
// guard let gifData = try? Data(contentsOf: emoji.localImageURL) as CFData else { return }
|
||||||
CGAnimateImageDataWithBlock(gifData, nil) { index, cgImage, stop in
|
// CGAnimateImageDataWithBlock(gifData, nil) { index, cgImage, stop in
|
||||||
if stopPointer != stop {
|
// if stopPointer != stop {
|
||||||
stopPointer?.pointee.toggle()
|
// stopPointer?.pointee.toggle()
|
||||||
stopPointer = stop
|
// stopPointer = stop
|
||||||
}
|
// }
|
||||||
guard !stop.pointee else { return }
|
// guard !stop.pointee else { return }
|
||||||
gifImage = Image(uiImage: .init(cgImage: cgImage))
|
// gifImage = Image(uiImage: .init(cgImage: cgImage))
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
.id(id)
|
.id(id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ struct EmojiRow: View {
|
|||||||
HStack {
|
HStack {
|
||||||
VStack {
|
VStack {
|
||||||
HStack(spacing: .zero) {
|
HStack(spacing: .zero) {
|
||||||
// Text
|
|
||||||
Text(emoji.name)
|
Text(emoji.name)
|
||||||
}
|
}
|
||||||
EmojiPreview(hoarder: hoarder, emoji: emoji)
|
EmojiPreview(hoarder: hoarder, emoji: emoji)
|
||||||
|
|||||||
Reference in New Issue
Block a user