mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 05:19:13 +00:00
better performance in stickerbroswer
Emoji.sticker can return nil added tests to measure .sticker perfomance delete redundant stickerbrowserviewcontroller
This commit is contained in:
@@ -26,7 +26,12 @@
|
||||
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */; };
|
||||
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */; };
|
||||
A9B9A81C2EB2BCE4004C9245 /* StickerBrowserDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9B9A81B2EB2BCE4004C9245 /* StickerBrowserDataSource.swift */; };
|
||||
A9B9A81E2EB2BEF1004C9245 /* StickerBroswerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9B9A81D2EB2BEF1004C9245 /* StickerBroswerViewController.swift */; };
|
||||
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */; };
|
||||
A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
||||
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A924C3712EA9127200F20781 /* Emoji.swift */; };
|
||||
A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = A935437A2EB2A3C800BB80A4 /* FilterCategory.swift */; };
|
||||
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
|
||||
A9B9A8332EB2CD4B004C9245 /* ApiEmoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A940FE3C2EA232590016870B /* ApiEmoji.swift */; };
|
||||
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
||||
A9BE06DC2EA657C70033B213 /* ApiEmoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A940FE3C2EA232590016870B /* ApiEmoji.swift */; };
|
||||
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
|
||||
@@ -42,6 +47,13 @@
|
||||
remoteGlobalIDString = A969D6902EA3E86500399C05;
|
||||
remoteInfo = StickerSlackiMessageExtension;
|
||||
};
|
||||
A9B9A8272EB2CCB5004C9245 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A949B1D72EA04C0B00215164 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = A949B1DE2EA04C0B00215164;
|
||||
remoteInfo = StickerSlack;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@@ -78,7 +90,8 @@
|
||||
A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
|
||||
A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPreview.swift; sourceTree = "<group>"; };
|
||||
A9B9A81B2EB2BCE4004C9245 /* StickerBrowserDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBrowserDataSource.swift; sourceTree = "<group>"; };
|
||||
A9B9A81D2EB2BEF1004C9245 /* StickerBroswerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerBroswerViewController.swift; sourceTree = "<group>"; };
|
||||
A9B9A8232EB2CCB5004C9245 /* StickerSlackTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = StickerSlackTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StickerSlackTests.swift; sourceTree = "<group>"; };
|
||||
A9D15B892EB1142C00404792 /* EmojiPack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiPack.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
@@ -100,6 +113,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
A9B9A8202EB2CCB5004C9245 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@@ -108,6 +128,7 @@
|
||||
children = (
|
||||
A949B1F22EA04E8200215164 /* StickerSlack */,
|
||||
A969D6AB2EA3F1AF00399C05 /* StickerSlackiMessageExtension */,
|
||||
A9B9A82D2EB2CCBE004C9245 /* StickerSlackTests */,
|
||||
A969D6922EA3E86500399C05 /* Frameworks */,
|
||||
A949B1E02EA04C0B00215164 /* Products */,
|
||||
);
|
||||
@@ -118,6 +139,7 @@
|
||||
children = (
|
||||
A949B1DF2EA04C0B00215164 /* StickerSlack.app */,
|
||||
A969D6912EA3E86500399C05 /* StickerSlackiMessageExtension.appex */,
|
||||
A9B9A8232EB2CCB5004C9245 /* StickerSlackTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@@ -181,11 +203,18 @@
|
||||
A969D6A92EA3F1AF00399C05 /* MainInterface.storyboard */,
|
||||
A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */,
|
||||
A9B9A81B2EB2BCE4004C9245 /* StickerBrowserDataSource.swift */,
|
||||
A9B9A81D2EB2BEF1004C9245 /* StickerBroswerViewController.swift */,
|
||||
);
|
||||
path = StickerSlackiMessageExtension;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9B9A82D2EB2CCBE004C9245 /* StickerSlackTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9B9A82C2EB2CCBE004C9245 /* StickerSlackTests.swift */,
|
||||
);
|
||||
path = StickerSlackTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -231,6 +260,26 @@
|
||||
productReference = A969D6912EA3E86500399C05 /* StickerSlackiMessageExtension.appex */;
|
||||
productType = "com.apple.product-type.app-extension.messages";
|
||||
};
|
||||
A9B9A8222EB2CCB5004C9245 /* StickerSlackTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = A9B9A8292EB2CCB5004C9245 /* Build configuration list for PBXNativeTarget "StickerSlackTests" */;
|
||||
buildPhases = (
|
||||
A9B9A81F2EB2CCB5004C9245 /* Sources */,
|
||||
A9B9A8202EB2CCB5004C9245 /* Frameworks */,
|
||||
A9B9A8212EB2CCB5004C9245 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
A9B9A8282EB2CCB5004C9245 /* PBXTargetDependency */,
|
||||
);
|
||||
name = StickerSlackTests;
|
||||
packageProductDependencies = (
|
||||
);
|
||||
productName = StickerSlackTests;
|
||||
productReference = A9B9A8232EB2CCB5004C9245 /* StickerSlackTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
@@ -247,6 +296,10 @@
|
||||
A969D6902EA3E86500399C05 = {
|
||||
CreatedOnToolsVersion = 26.0.1;
|
||||
};
|
||||
A9B9A8222EB2CCB5004C9245 = {
|
||||
CreatedOnToolsVersion = 26.0.1;
|
||||
TestTargetID = A949B1DE2EA04C0B00215164;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = A949B1DA2EA04C0B00215164 /* Build configuration list for PBXProject "StickerSlack" */;
|
||||
@@ -268,6 +321,7 @@
|
||||
targets = (
|
||||
A949B1DE2EA04C0B00215164 /* StickerSlack */,
|
||||
A969D6902EA3E86500399C05 /* StickerSlackiMessageExtension */,
|
||||
A9B9A8222EB2CCB5004C9245 /* StickerSlackTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@@ -290,6 +344,13 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
A9B9A8212EB2CCB5004C9245 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -313,7 +374,6 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A9B9A81E2EB2BEF1004C9245 /* StickerBroswerViewController.swift in Sources */,
|
||||
A924C3722EA9127200F20781 /* Emoji.swift in Sources */,
|
||||
A9BE06DC2EA657C70033B213 /* ApiEmoji.swift in Sources */,
|
||||
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */,
|
||||
@@ -325,6 +385,19 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
A9B9A81F2EB2CCB5004C9245 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A9B9A8302EB2CD0B004C9245 /* Emoji.swift in Sources */,
|
||||
A9B9A82F2EB2CCED004C9245 /* EmojiHoarder.swift in Sources */,
|
||||
A9B9A8322EB2CD29004C9245 /* SlackResponse.swift in Sources */,
|
||||
A9B9A82E2EB2CCBE004C9245 /* StickerSlackTests.swift in Sources */,
|
||||
A9B9A8312EB2CD14004C9245 /* FilterCategory.swift in Sources */,
|
||||
A9B9A8332EB2CD4B004C9245 /* ApiEmoji.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
@@ -333,6 +406,11 @@
|
||||
target = A969D6902EA3E86500399C05 /* StickerSlackiMessageExtension */;
|
||||
targetProxy = A969D69E2EA3E86600399C05 /* PBXContainerItemProxy */;
|
||||
};
|
||||
A9B9A8282EB2CCB5004C9245 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = A949B1DE2EA04C0B00215164 /* StickerSlack */;
|
||||
targetProxy = A9B9A8272EB2CCB5004C9245 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
@@ -618,6 +696,53 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
A9B9A82A2EB2CCB5004C9245 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 8JGND254B7;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.StickerSlackTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StickerSlack.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StickerSlack";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
A9B9A82B2EB2CCB5004C9245 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 8JGND254B7;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.StickerSlackTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = iphoneos;
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = NO;
|
||||
SWIFT_APPROACHABLE_CONCURRENCY = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = NO;
|
||||
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StickerSlack.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/StickerSlack";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@@ -648,6 +773,15 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
A9B9A8292EB2CCB5004C9245 /* Build configuration list for PBXNativeTarget "StickerSlackTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
A9B9A82A2EB2CCB5004C9245 /* Debug */,
|
||||
A9B9A82B2EB2CCB5004C9245 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCRemoteSwiftPackageReference section */
|
||||
|
||||
@@ -29,6 +29,19 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A9B9A8222EB2CCB5004C9245"
|
||||
BuildableName = "StickerSlackTests.xctest"
|
||||
BlueprintName = "StickerSlackTests"
|
||||
ReferencedContainer = "container:StickerSlack.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
|
||||
@@ -44,6 +44,19 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
shouldAutocreateTestPlan = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO"
|
||||
parallelizable = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A9B9A8222EB2CCB5004C9245"
|
||||
BuildableName = "StickerSlackTests.xctest"
|
||||
BlueprintName = "StickerSlackTests"
|
||||
ReferencedContainer = "container:StickerSlack.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@@ -57,8 +70,18 @@
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
launchAutomaticallySubstyle = "2">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "1"
|
||||
BundleIdentifier = "com.apple.MobileSMS">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A969D6902EA3E86500399C05"
|
||||
BuildableName = "StickerSlackiMessageExtension.appex"
|
||||
BlueprintName = "StickerSlackiMessageExtension"
|
||||
ReferencedContainer = "container:StickerSlack.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "A949B1DE2EA04C0B00215164"
|
||||
@@ -66,7 +89,7 @@
|
||||
BlueprintName = "StickerSlack"
|
||||
ReferencedContainer = "container:StickerSlack.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</MacroExpansion>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@@ -27,11 +27,11 @@ struct Emoji: Codable, Identifiable, Hashable {
|
||||
return (try? Data(contentsOf: localImageURL)) != nil
|
||||
}
|
||||
|
||||
var sticker: MSSticker {
|
||||
var sticker: MSSticker? {
|
||||
guard isLocal else {
|
||||
fatalError("sticker \(name) isnt local")
|
||||
return nil
|
||||
}
|
||||
return try! MSSticker(contentsOfFileURL: localImageURL, localizedDescription: name)
|
||||
return try? MSSticker(contentsOfFileURL: localImageURL, localizedDescription: name)
|
||||
}
|
||||
|
||||
var image: UIImage? {
|
||||
|
||||
20
StickerSlackTests/StickerSlackTests.swift
Normal file
20
StickerSlackTests/StickerSlackTests.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// StickerSlackTests.swift
|
||||
// StickerSlackTests
|
||||
//
|
||||
// Created by neon443 on 29/10/2025.
|
||||
//
|
||||
|
||||
import Testing
|
||||
|
||||
struct StickerSlackTests {
|
||||
var hoarder = EmojiHoarder()
|
||||
|
||||
@Test func example() async throws {
|
||||
// Write your test here and use APIs like `#expect(...)` to check expected conditions.
|
||||
for emoji in hoarder.emojis {
|
||||
print(emoji.sticker)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ class MessagesViewController: MSMessagesAppViewController {
|
||||
let stickerBrowser = MSStickerBrowserView(frame: .zero, stickerSize: .regular)
|
||||
stickerBrowser.frame = CGRect(x: 60, y: 20, width: 200, height: 600)
|
||||
stickerBrowser.dataSource = dataSource
|
||||
stickerBrowser.autoresizingMask = [.flexibleWidth]
|
||||
view.addSubview(stickerBrowser)
|
||||
stickerBrowser.reloadData()
|
||||
view.bringSubviewToFront(stickerBrowser)
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// StickerBroswerViewController.swift
|
||||
// StickerSlackiMessageExtension
|
||||
//
|
||||
// Created by neon443 on 29/10/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Messages
|
||||
|
||||
class StickerBroswerViewController: MSStickerBrowserViewController {
|
||||
var hoarder: EmojiHoarder = EmojiHoarder()
|
||||
|
||||
var emojis: [Emoji] = []
|
||||
|
||||
override func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
|
||||
emojis = hoarder.emojis.filter { $0.isLocal }
|
||||
return emojis.count
|
||||
}
|
||||
|
||||
override func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
|
||||
return emojis[index].sticker
|
||||
}
|
||||
}
|
||||
@@ -11,11 +11,17 @@ import Messages
|
||||
class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource {
|
||||
var hoarder: EmojiHoarder = EmojiHoarder()
|
||||
|
||||
var emojis: [MSSticker] = []
|
||||
|
||||
func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
|
||||
return hoarder.emojis.filter { $0.isLocal }.count
|
||||
for emoji in hoarder.emojis {
|
||||
guard let sticker = emoji.sticker else { continue }
|
||||
emojis.append(sticker)
|
||||
}
|
||||
return emojis.count
|
||||
}
|
||||
|
||||
func stickerBrowserView(_ stickerBrowserView: MSStickerBrowserView, stickerAt index: Int) -> MSSticker {
|
||||
return hoarder.emojis.filter { $0.isLocal }[index].sticker
|
||||
return emojis[index]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user