mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 13:26:17 +00:00
added sticker count to the corner
ps: finally got proof that ts project will work!!!!! "The sticker browser presents the stickers provided by its dataSource property. The data source can dynamically change the list of stickers at runtime." https://developer.apple.com/documentation/messages/msstickerbrowserview#:~:text=The%20data%20source%20can%20dynamically%20change%20the%20list%20of%20stickers%20at%20runtime.
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
A969D6AE2EA3F1AF00399C05 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A969D6A92EA3F1AF00399C05 /* MainInterface.storyboard */; };
|
||||
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A969D6AA2EA3F1AF00399C05 /* MessagesViewController.swift */; };
|
||||
A9773C2F2EA54AF000F3B753 /* EmojiPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9773C2E2EA54AF000F3B753 /* EmojiPreview.swift */; };
|
||||
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1F72EA04F2300215164 /* EmojiHoarder.swift */; };
|
||||
A9BE06DC2EA657C70033B213 /* Emoji.swift in Sources */ = {isa = PBXBuildFile; fileRef = A940FE3C2EA232590016870B /* Emoji.swift */; };
|
||||
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = A949B1FA2EA0518800215164 /* SlackResponse.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -280,7 +283,10 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
A9BE06DC2EA657C70033B213 /* Emoji.swift in Sources */,
|
||||
A9BE06DB2EA656B80033B213 /* EmojiHoarder.swift in Sources */,
|
||||
A969D6AF2EA3F1AF00399C05 /* MessagesViewController.swift in Sources */,
|
||||
A9BE06DD2EA657CF0033B213 /* SlackResponse.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
@@ -15,29 +15,8 @@ class EmojiHoarder: ObservableObject {
|
||||
@Published var emojis: [Emoji]
|
||||
|
||||
init() {
|
||||
// guard let testURL = Bundle.main.url(forResource: "testData", withExtension: "json") else {
|
||||
// fatalError("")
|
||||
// }
|
||||
// guard let data = try? Data(contentsOf: testURL) else {
|
||||
// self.testBundle = SlackResponse(ok: false, emoji: [:])
|
||||
// return
|
||||
// }
|
||||
// guard let decoded = try? JSONDecoder().decode(SlackResponse.self, from: data) else {
|
||||
// fatalError("couldnt decode :sob:")
|
||||
// }
|
||||
// self.testBundle = decoded
|
||||
|
||||
let data = try! Data(contentsOf: endpoint)
|
||||
let decoded: [SlackResponse] = try! JSONDecoder().decode([SlackResponse].self, from: data)
|
||||
self.emojis = decoded.map { Emoji(name: $0.name, url: $0.imageUrl) }
|
||||
// Task {
|
||||
// for i in emojis.indices {
|
||||
// let newEmoji = await emojis[i].grabImage()
|
||||
// DispatchQueue.main.async {
|
||||
// self.emojis[i] = newEmoji
|
||||
// self.emojis = self.emojis
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,45 @@
|
||||
<?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">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24128" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ObA-dk-sSI">
|
||||
<device id="retina6_3" orientation="portrait" appearance="dark"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24063"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.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">
|
||||
<viewController id="ObA-dk-sSI" customClass="MessagesViewController" customModule="StickerSlackiMessageExtension" 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">
|
||||
<rect key="frame" x="116" y="254.00000000000003" width="88" height="20.333333333333343"/>
|
||||
<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"/>
|
||||
<viewLayoutGuide key="safeArea" id="LDy-ih-0nr"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<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>
|
||||
<point key="canvasLocation" x="128" y="96"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -9,7 +9,8 @@ import UIKit
|
||||
import Messages
|
||||
|
||||
class MessagesViewController: MSMessagesAppViewController {
|
||||
|
||||
var hoard: EmojiHoarder = EmojiHoarder()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
@@ -18,6 +19,13 @@ class MessagesViewController: MSMessagesAppViewController {
|
||||
// MARK: - Conversation Handling
|
||||
|
||||
override func willBecomeActive(with conversation: MSConversation) {
|
||||
print(hoard.emojis.count)
|
||||
let l = UILabel()
|
||||
l.frame = CGRect(x: 20, y: 20, width: 1000, height: 40)
|
||||
l.textColor = .systemOrange
|
||||
l.text = "\(hoard.emojis.count)"
|
||||
view.addSubview(l)
|
||||
view.bringSubviewToFront(l)
|
||||
// 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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user