added imessage app, async is hardv2

This commit is contained in:
neon443
2025-10-18 17:09:34 +01:00
parent 409b09eb3e
commit 62ac3ea117
8 changed files with 417 additions and 6 deletions

View File

@@ -14,8 +14,37 @@
A949B1F82EA04F2300215164 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
A949B1FB2EA0518800215164 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
A949B1FD2EA158DB00215164 /* testData.json in Resources */ = {isa = PBXBuildFile; fileRef = A949B1FC2EA158DB00215164 /* testData.json */; };
A969D6942EA3E86500399C05 /* Messages.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A969D6932EA3E86500399C05 /* Messages.framework */; };
A969D6A02EA3E86600399C05 /* StickerSlackiMessageExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = A969D6912EA3E86500399C05 /* StickerSlackiMessageExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
A969D6AC2EA3F1AF00399C05 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A969D6A62EA3F1AF00399C05 /* Assets.xcassets */; };
A969D6AE2EA3F1AF00399C05 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A969D6A92EA3F1AF00399C05 /* MainInterface.storyboard */; };
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
A969D69E2EA3E86600399C05 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = A949B1D72EA04C0B00215164 /* Project object */;
proxyType = 1;
remoteGlobalIDString = A969D6902EA3E86500399C05;
remoteInfo = StickerSlackiMessageExtension;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
A969D6A12EA3E86600399C05 /* Embed Foundation Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 13;
files = (
A969D6A02EA3E86600399C05 /* StickerSlackiMessageExtension.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
A940FE3C2EA232590016870B /* Emoji.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Emoji.swift; sourceTree = "<group>"; };
A949B1DF2EA04C0B00215164 /* StickerSlack.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StickerSlack.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -25,6 +54,12 @@
A949B1F72EA04F2300215164 /* EmojiHoarder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiHoarder.swift; sourceTree = "<group>"; };
A949B1FA2EA0518800215164 /* SlackResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SlackResponse.swift; sourceTree = "<group>"; };
A949B1FC2EA158DB00215164 /* testData.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = testData.json; sourceTree = "<group>"; };
A969D6912EA3E86500399C05 /* StickerSlackiMessageExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = StickerSlackiMessageExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
A969D6932EA3E86500399C05 /* Messages.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Messages.framework; path = Library/Frameworks/Messages.framework; sourceTree = DEVELOPER_DIR; };
A969D6A62EA3F1AF00399C05 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
A969D6A72EA3F1AF00399C05 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A969D6A82EA3F1AF00399C05 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessagesViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -35,6 +70,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A969D68E2EA3E86500399C05 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
A969D6942EA3E86500399C05 /* Messages.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@@ -42,6 +85,8 @@
isa = PBXGroup;
children = (
A949B1F22EA04E8200215164 /* StickerSlack */,
A969D6AB2EA3F1AF00399C05 /* StickerSlackiMessageExtension */,
A969D6922EA3E86500399C05 /* Frameworks */,
A949B1E02EA04C0B00215164 /* Products */,
);
sourceTree = "<group>";
@@ -50,6 +95,7 @@
isa = PBXGroup;
children = (
A949B1DF2EA04C0B00215164 /* StickerSlack.app */,
A969D6912EA3E86500399C05 /* StickerSlackiMessageExtension.appex */,
);
name = Products;
sourceTree = "<group>";
@@ -92,6 +138,25 @@
path = Emoji;
sourceTree = "<group>";
};
A969D6922EA3E86500399C05 /* Frameworks */ = {
isa = PBXGroup;
children = (
A969D6932EA3E86500399C05 /* Messages.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
A969D6AB2EA3F1AF00399C05 /* StickerSlackiMessageExtension */ = {
isa = PBXGroup;
children = (
A969D6A62EA3F1AF00399C05 /* Assets.xcassets */,
A969D6A72EA3F1AF00399C05 /* Info.plist */,
A969D6A92EA3F1AF00399C05 /* MainInterface.storyboard */,
A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */,
);
path = StickerSlackiMessageExtension;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -102,10 +167,12 @@
A949B1DB2EA04C0B00215164 /* Sources */,
A949B1DC2EA04C0B00215164 /* Frameworks */,
A949B1DD2EA04C0B00215164 /* Resources */,
A969D6A12EA3E86600399C05 /* Embed Foundation Extensions */,
);
buildRules = (
);
dependencies = (
A969D69F2EA3E86600399C05 /* PBXTargetDependency */,
);
name = StickerSlack;
packageProductDependencies = (
@@ -114,6 +181,25 @@
productReference = A949B1DF2EA04C0B00215164 /* StickerSlack.app */;
productType = "com.apple.product-type.application";
};
A969D6902EA3E86500399C05 /* StickerSlackiMessageExtension */ = {
isa = PBXNativeTarget;
buildConfigurationList = A969D6A52EA3E86600399C05 /* Build configuration list for PBXNativeTarget "StickerSlackiMessageExtension" */;
buildPhases = (
A969D68D2EA3E86500399C05 /* Sources */,
A969D68E2EA3E86500399C05 /* Frameworks */,
A969D68F2EA3E86500399C05 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = StickerSlackiMessageExtension;
packageProductDependencies = (
);
productName = StickerSlackiMessageExtension;
productReference = A969D6912EA3E86500399C05 /* StickerSlackiMessageExtension.appex */;
productType = "com.apple.product-type.app-extension.messages";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -127,6 +213,9 @@
A949B1DE2EA04C0B00215164 = {
CreatedOnToolsVersion = 26.0.1;
};
A969D6902EA3E86500399C05 = {
CreatedOnToolsVersion = 26.0.1;
};
};
};
buildConfigurationList = A949B1DA2EA04C0B00215164 /* Build configuration list for PBXProject "StickerSlack" */;
@@ -144,6 +233,7 @@
projectRoot = "";
targets = (
A949B1DE2EA04C0B00215164 /* StickerSlack */,
A969D6902EA3E86500399C05 /* StickerSlackiMessageExtension */,
);
};
/* End PBXProject section */
@@ -158,6 +248,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A969D68F2EA3E86500399C05 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A969D6AC2EA3F1AF00399C05 /* Assets.xcassets in Resources */,
A969D6AE2EA3F1AF00399C05 /* MainInterface.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -173,8 +272,35 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
A969D68D2EA3E86500399C05 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
A969D69F2EA3E86600399C05 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = A969D6902EA3E86500399C05 /* StickerSlackiMessageExtension */;
targetProxy = A969D69E2EA3E86600399C05 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
A969D6A92EA3F1AF00399C05 /* MainInterface.storyboard */ = {
isa = PBXVariantGroup;
children = (
A969D6A82EA3F1AF00399C05 /* Base */,
);
name = MainInterface.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
A949B1E82EA04C0C00215164 /* Debug */ = {
isa = XCBuildConfiguration;
@@ -380,6 +506,69 @@
};
name = Release;
};
A969D6A22EA3E86600399C05 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "iMessage App Icon";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 8JGND254B7;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = StickerSlackiMessageExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = StickerSlackiMessageExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.StickerSlack.StickerSlackiMessageExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
A969D6A32EA3E86600399C05 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = "iMessage App Icon";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 8JGND254B7;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = StickerSlackiMessageExtension/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = StickerSlackiMessageExtension;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 26.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.neon443.StickerSlack.StickerSlackiMessageExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -401,6 +590,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A969D6A52EA3E86600399C05 /* Build configuration list for PBXNativeTarget "StickerSlackiMessageExtension" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A969D6A22EA3E86600399C05 /* Debug */,
A969D6A32EA3E86600399C05 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = A949B1D72EA04C0B00215164 /* Project object */;

View File

@@ -61,5 +61,10 @@ struct Emoji: EmojiProtocol {
print(UIImage(data: response.0))
return Emoji(name: name, url: urlString, image: UIImage(data: response.0)!)
}
mutating func grabImageSync() {
let data = try! Data(contentsOf: url)
uiImage = UIImage(data: data)!
}
}

View File

@@ -12,7 +12,7 @@ import Combine
class EmojiHoarder: ObservableObject {
private let endpoint: URL = URL(string: "https://cachet.dunkirk.sh/emojis")!
@Published var emojis: [Emoji] = []
@Published var emojis: [Emoji]
init() {
// guard let testURL = Bundle.main.url(forResource: "testData", withExtension: "json") else {
@@ -29,11 +29,19 @@ class EmojiHoarder: ObservableObject {
let data = try! Data(contentsOf: endpoint)
let decoded: [SlackResponse] = try! JSONDecoder().decode([SlackResponse].self, from: data)
emojis = decoded.prefix(100).map { Emoji(name: $0.name, url: $0.imageUrl) }
Task {
for i in 0..<emojis.count {
await emojis[i] = emojis[i].grabImage()
}
var emojis = decoded.prefix(100).map { Emoji(name: $0.name, url: $0.imageUrl) }
for i in emojis.indices {
emojis[i].grabImageSync()
}
self.emojis = emojis
// Task {
// for i in emojis.indices {
// let newEmoji = await emojis[i].grabImage()
// DispatchQueue.main.async {
// self.emojis[i] = newEmoji
// self.emojis = self.emojis
// }
// }
// }
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,78 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x45"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x45"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "67x50"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "74x55"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "27x20"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "27x20"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "2x",
"size" : "32x24"
},
{
"idiom" : "universal",
"platform" : "ios",
"scale" : "3x",
"size" : "32x24"
},
{
"idiom" : "ios-marketing",
"platform" : "ios",
"scale" : "1x",
"size" : "1024x768"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ObA-dk-sSI">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Messages View Controller-->
<scene sceneID="7MM-of-jgj">
<objects>
<viewController id="ObA-dk-sSI" customClass="MessagesViewController" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="zMn-AG-sqS">
<rect key="frame" x="0.0" y="0.0" width="320" height="528"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Hello World" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="d1e-fi-ked">
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" xcode11CocoaTouchSystemColor="labelColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="centerY" secondItem="d1e-fi-ked" secondAttribute="centerY" id="H0s-hz-dDP"/>
<constraint firstAttribute="centerX" secondItem="d1e-fi-ked" secondAttribute="centerX" id="wFy-hW-Bib"/>
</constraints>
<viewLayoutGuide key="safeArea" id="LDy-ih-0nr"/>
</view>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<size key="freeformSize" width="320" height="528"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSExtension</key>
<dict>
<key>NSExtensionMainStoryboard</key>
<string>MainInterface</string>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.message-payload-provider</string>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,66 @@
//
// MessagesViewController.swift
// StickerSlackiMessageExtension
//
// Created by neon443 on 18/10/2025.
//
import UIKit
import Messages
class MessagesViewController: MSMessagesAppViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
// MARK: - Conversation Handling
override func willBecomeActive(with conversation: MSConversation) {
// Called when the extension is about to move from the inactive to active state.
// This will happen when the extension is about to present UI.
// Use this method to configure the extension and restore previously stored state.
}
override func didResignActive(with conversation: MSConversation) {
// Called when the extension is about to move from the active to inactive state.
// This will happen when the user dismisses the extension, changes to a different
// conversation or quits Messages.
// Use this method to release shared resources, save user data, invalidate timers,
// and store enough state information to restore your extension to its current state
// in case it is terminated later.
}
override func didReceive(_ message: MSMessage, conversation: MSConversation) {
// Called when a message arrives that was generated by another instance of this
// extension on a remote device.
// Use this method to trigger UI updates in response to the message.
}
override func didStartSending(_ message: MSMessage, conversation: MSConversation) {
// Called when the user taps the send button.
}
override func didCancelSending(_ message: MSMessage, conversation: MSConversation) {
// Called when the user deletes the message without sending it.
// Use this to clean up state related to the deleted message.
}
override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
// Called before the extension transitions to a new presentation style.
// Use this method to prepare for the change in presentation style.
}
override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
// Called after the extension transitions to a new presentation style.
// Use this method to finalize any behaviors associated with the change in presentation style.
}
}