mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-03-11 05:19:13 +00:00
remade the imessageextension
updated recticon
This commit is contained in:
6
StickerSlackiMessageApp/Assets.xcassets/Contents.json
Normal file
6
StickerSlackiMessageApp/Assets.xcassets/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
34
StickerSlackiMessageApp/Base.lproj/MainInterface.storyboard
Normal file
34
StickerSlackiMessageApp/Base.lproj/MainInterface.storyboard
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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_12" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<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" customModule="StickerSlackiMessageApp" 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"/>
|
||||
<viewLayoutGuide key="safeArea" id="LDy-ih-0nr"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</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="139" y="92"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
13
StickerSlackiMessageApp/Info.plist
Normal file
13
StickerSlackiMessageApp/Info.plist
Normal 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>
|
||||
75
StickerSlackiMessageApp/MessagesViewController.swift
Normal file
75
StickerSlackiMessageApp/MessagesViewController.swift
Normal file
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// MessagesViewController.swift
|
||||
// StickerSlackiMessageExtension
|
||||
//
|
||||
// Created by neon443 on 18/10/2025.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Messages
|
||||
|
||||
class MessagesViewController: MSMessagesAppViewController {
|
||||
let dataSource: StickerBrowserDataSource = StickerBrowserDataSource()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// Do any additional setup after loading the view.
|
||||
// sleep(5)
|
||||
}
|
||||
|
||||
// MARK: - Conversation Handling
|
||||
|
||||
override func willBecomeActive(with conversation: MSConversation) {
|
||||
let stickerBrowser = MSStickerBrowserView(frame: .zero, stickerSize: .small)
|
||||
stickerBrowser.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: view.frame.height)
|
||||
stickerBrowser.dataSource = dataSource
|
||||
stickerBrowser.autoresizingMask = [.flexibleWidth]
|
||||
view.addSubview(stickerBrowser)
|
||||
stickerBrowser.reloadData()
|
||||
view.bringSubviewToFront(stickerBrowser)
|
||||
// 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.
|
||||
}
|
||||
|
||||
}
|
||||
28
StickerSlackiMessageApp/StickerBrowserDataSource.swift
Normal file
28
StickerSlackiMessageApp/StickerBrowserDataSource.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// StickerBrowserDataSource.swift
|
||||
// StickerSlackiMessageExtension
|
||||
//
|
||||
// Created by neon443 on 29/10/2025.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Messages
|
||||
|
||||
class StickerBrowserDataSource: NSObject, MSStickerBrowserViewDataSource {
|
||||
var hoarder: EmojiHoarder = EmojiHoarder(localOnly: true)
|
||||
|
||||
var emojis: [MSSticker] = []
|
||||
|
||||
func numberOfStickers(in stickerBrowserView: MSStickerBrowserView) -> Int {
|
||||
guard emojis.isEmpty else { return emojis.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 emojis[index]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user