🐛 Fix NSE

This commit is contained in:
2024-07-23 11:18:06 +08:00
parent f69339292b
commit 58b3d75896
9 changed files with 150 additions and 129 deletions

View File

@ -1,4 +1,4 @@
platform :osx, '10.15'
platform :osx, '12.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

View File

@ -8,31 +8,31 @@ PODS:
- FlutterMacOS
- file_selector_macos (0.0.1):
- FlutterMacOS
- Firebase/CoreOnly (10.27.0):
- FirebaseCore (= 10.27.0)
- Firebase/Messaging (10.27.0):
- Firebase/CoreOnly (10.28.1):
- FirebaseCore (= 10.28.1)
- Firebase/Messaging (10.28.1):
- Firebase/CoreOnly
- FirebaseMessaging (~> 10.27.0)
- firebase_core (3.1.1):
- Firebase/CoreOnly (~> 10.27.0)
- FirebaseMessaging (~> 10.28.0)
- firebase_core (3.2.0):
- Firebase/CoreOnly (~> 10.28.0)
- FlutterMacOS
- firebase_messaging (15.0.2):
- Firebase/CoreOnly (~> 10.27.0)
- Firebase/Messaging (~> 10.27.0)
- firebase_messaging (15.0.3):
- Firebase/CoreOnly (~> 10.28.0)
- Firebase/Messaging (~> 10.28.0)
- firebase_core
- FlutterMacOS
- FirebaseCore (10.27.0):
- FirebaseCore (10.28.1):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreInternal (10.28.0):
- FirebaseCoreInternal (10.29.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.28.0):
- FirebaseInstallations (10.29.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.27.0):
- FirebaseMessaging (10.28.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.3)
@ -43,9 +43,9 @@ PODS:
- nanopb (< 2.30911.0, >= 2.30908.0)
- flutter_secure_storage_macos (6.1.1):
- FlutterMacOS
- flutter_webrtc (0.9.36):
- flutter_webrtc (0.11.3):
- FlutterMacOS
- WebRTC-SDK (= 114.5735.10)
- WebRTC-SDK (= 125.6422.04)
- FlutterMacOS (1.0.0)
- GoogleDataTransport (9.4.1):
- GoogleUtilities/Environment (~> 7.7)
@ -76,9 +76,9 @@ PODS:
- GoogleUtilities/UserDefaults (7.13.3):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- livekit_client (2.2.0):
- livekit_client (2.2.1):
- FlutterMacOS
- WebRTC-SDK (= 114.5735.10)
- WebRTC-SDK (= 125.6422.04)
- macos_window_utils (1.0.0):
- FlutterMacOS
- media_kit_libs_macos_video (1.0.4):
@ -104,11 +104,11 @@ PODS:
- FlutterMacOS
- screen_brightness_macos (0.1.0):
- FlutterMacOS
- Sentry/HybridSDK (8.29.0)
- sentry_flutter (8.3.0):
- Sentry/HybridSDK (8.30.1)
- sentry_flutter (8.4.0):
- Flutter
- FlutterMacOS
- Sentry/HybridSDK (= 8.29.0)
- Sentry/HybridSDK (= 8.30.1)
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
@ -116,7 +116,7 @@ PODS:
- FlutterMacOS
- wakelock_plus (0.0.1):
- FlutterMacOS
- WebRTC-SDK (114.5735.10)
- WebRTC-SDK (125.6422.04)
DEPENDENCIES:
- connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/darwin`)
@ -210,19 +210,19 @@ SPEC CHECKSUMS:
desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898
device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720
file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2
Firebase: 26b040b20866a55f55eb3611b9fcf3ae64816b86
firebase_core: df33f64432203e675060e475de6ea8127eb8398a
firebase_messaging: b8921fa4cbbbebab66e98b181a69f2af0692a820
FirebaseCore: a2b95ae4ce7c83ceecfbbbe3b6f1cddc7415a808
FirebaseCoreInternal: 58d07f1362fddeb0feb6a857d1d1d1c5e558e698
FirebaseInstallations: 60c1d3bc1beef809fd1ad1189a8057a040c59f2e
FirebaseMessaging: 585984d0a1df120617eb10b44cad8968b859815e
Firebase: 49e62242b3ae422a002ab647a7e62a332a8c3ec1
firebase_core: d8af40a9c8a9ce3112a94692aac83675627c0486
firebase_messaging: 7871cfa8af1e863324e46ae9e90343c452626c02
FirebaseCore: dfc33f0dffba05f76181da9cc0151171ebb3bd10
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
FirebaseMessaging: 087a7c7cadef7b9239f005bc4db823894844f323
flutter_secure_storage_macos: 59459653abe1adb92abbc8ea747d79f8d19866c9
flutter_webrtc: 823284e171ecb2487b7210c214886a949c122a59
flutter_webrtc: 2b4e4a2de70a1485836e40fd71a7a94c77d49bd9
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
livekit_client: 9b39e0f1b8e1a8ec794bb72a4f9bbfc28c959ece
livekit_client: b8dc024da36a5c1103b6ccdcfb5bb7776a1ee6a1
macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663
media_kit_libs_macos_video: b3e2bbec2eef97c285f2b1baa7963c67c753fb82
media_kit_native_event_loop: 81fd5b45192b72f8b5b69eaf5b540f45777eb8d5
@ -234,13 +234,13 @@ SPEC CHECKSUMS:
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
protocol_handler_macos: d10a6c01d6373389ffd2278013ab4c47ed6d6daa
screen_brightness_macos: 2d6d3af2165592d9a55ffcd95b7550970e41ebda
Sentry: 016de45ee5ce5fca2a829996f1bfafeb5e62e8b4
sentry_flutter: 5fb57c5b7e6427a9dc1fedde4269eb65823982d4
Sentry: 514a3ea653886e9a48c6287d8b7bf05ec24bf3be
sentry_flutter: edc037f7af0dc1512d6c33a5c2c7c838bd0d6806
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269
WebRTC-SDK: 8c0edd05b880a39648118192c252667ea06dea51
WebRTC-SDK: c3d69a87e7185fad3568f6f3cff7c9ac5890acf3
PODFILE CHECKSUM: 9ebaf0ce3d369aaa26a9ea0e159195ed94724cf3
PODFILE CHECKSUM: f0c21717cb7ee9112f915044c74bfceb5b12e02a
COCOAPODS: 1.15.2

View File

@ -71,14 +71,14 @@
};
733796322C4D64880046C275 /* Embed Foundation Extensions */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 8;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 13;
files = (
733796312C4D64880046C275 /* SolianNotifyExt.appex in Embed Foundation Extensions */,
);
name = "Embed Foundation Extensions";
runOnlyForDeploymentPostprocessing = 1;
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
@ -107,6 +107,7 @@
7337962A2C4D64880046C275 /* SolianNotifyExt.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SolianNotifyExt.appex; sourceTree = BUILT_PRODUCTS_DIR; };
7337962C2C4D64880046C275 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
7337962E2C4D64880046C275 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
733F502E2C4D7DB40010FE51 /* SolianNotifyExt.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SolianNotifyExt.entitlements; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
8AB030F50C089DAB14480DBD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
@ -236,6 +237,7 @@
7337962B2C4D64880046C275 /* SolianNotifyExt */ = {
isa = PBXGroup;
children = (
733F502E2C4D7DB40010FE51 /* SolianNotifyExt.entitlements */,
7337962C2C4D64880046C275 /* NotificationService.swift */,
7337962E2C4D64880046C275 /* Info.plist */,
);
@ -693,7 +695,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 12.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
@ -835,7 +837,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 12.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -863,7 +865,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = 12.0;
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
@ -900,6 +902,8 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = SolianNotifyExt/SolianNotifyExt.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = W7HPZ53V6B;
@ -921,6 +925,7 @@
MARKETING_VERSION = 1.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolianNotifyExt;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -942,6 +947,8 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = SolianNotifyExt/SolianNotifyExt.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = W7HPZ53V6B;
@ -962,6 +969,7 @@
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolianNotifyExt;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@ -982,6 +990,8 @@
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = SolianNotifyExt/SolianNotifyExt.entitlements;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = W7HPZ53V6B;
@ -1002,6 +1012,7 @@
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.0;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = dev.solsynth.solian.SolianNotifyExt;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;

View File

@ -29,14 +29,12 @@ class NotificationService: UNNotificationServiceExtension {
guard let metadata = bestAttemptContent.userInfo["metadata"] as? [AnyHashable : Any] else {
throw ParseNotificationPayloadError.noMetadata("The notification has no metadata.")
}
let userId = metadata["user_id"] as! Int
let userName = metadata["user_name"] as? String
guard let avatarUrl = bestAttemptContent.userInfo["avatar"] as? String else {
throw ParseNotificationPayloadError.noMetadata("The notification has no avatar url.")
}
let handle = INPersonHandle(value: String(userId), type: .unknown)
let handle = INPersonHandle(value: String(metadata["user_id"] as! Int), type: .unknown)
let avatar = INImage(
url: URL(string: avatarUrl)!
)!
@ -45,19 +43,22 @@ class NotificationService: UNNotificationServiceExtension {
displayName: bestAttemptContent.title,
image: avatar,
contactIdentifier: nil,
customIdentifier: userName)
customIdentifier: nil)
let intent = INSendMessageIntent(recipients: nil,
outgoingMessageType: .outgoingMessageText,
content: bestAttemptContent.body,
speakableGroupName: nil,
conversationIdentifier: String(metadata["channel_id"] as! Int),
serviceName: "PostPigeon",
serviceName: nil,
sender: sender,
attachments: nil)
let interaction = INInteraction(intent: intent, response: nil)
interaction.direction = .incoming
interaction.donate(completion: nil)
let updatedContent = try request.content.updating(from: intent)
contentHandler(updatedContent)
break
default:
contentHandler(bestAttemptContent)

View File

@ -0,0 +1,8 @@
<?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>com.apple.security.app-sandbox</key>
<true/>
</dict>
</plist>