mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 06:39:25 +01:00
meow meow
This commit is contained in:
parent
ff19deb7fd
commit
ebf66a043f
@ -0,0 +1,12 @@
|
||||
<?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>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.im.fluffychat.app</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
13
ios/Fluffychat Notifications/Info.plist
Normal file
13
ios/Fluffychat Notifications/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>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.usernotifications.service</string>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>$(PRODUCT_MODULE_NAME).NotificationService</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
39
ios/Fluffychat Notifications/NotificationService.swift
Normal file
39
ios/Fluffychat Notifications/NotificationService.swift
Normal file
@ -0,0 +1,39 @@
|
||||
//
|
||||
// NotificationService.swift
|
||||
// Fluffychat Notifications
|
||||
//
|
||||
// Created by Sorunome on 20.12.2021.
|
||||
//
|
||||
|
||||
import UserNotifications
|
||||
|
||||
class NotificationService: UNNotificationServiceExtension {
|
||||
|
||||
var contentHandler: ((UNNotificationContent) -> Void)?
|
||||
var bestAttemptContent: UNMutableNotificationContent?
|
||||
|
||||
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
||||
self.contentHandler = contentHandler
|
||||
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
||||
|
||||
print("=====================")
|
||||
print("RECEIVED NOTIF")
|
||||
print("\(bestAttemptContent)")
|
||||
|
||||
if let bestAttemptContent = bestAttemptContent {
|
||||
// Modify the notification content here...
|
||||
bestAttemptContent.title = "[modified] \(bestAttemptContent.title)"
|
||||
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
override func serviceExtensionTimeWillExpire() {
|
||||
// Called just before the extension will be terminated by the system.
|
||||
// Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
|
||||
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
|
||||
contentHandler(bestAttemptContent)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -9,6 +9,8 @@
|
||||
/* Begin PBXBuildFile section */
|
||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||
7295DBEF27709370004ECA76 /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7295DBEE27709370004ECA76 /* NotificationService.swift */; };
|
||||
7295DBF327709370004ECA76 /* Fluffychat Notifications.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 7295DBEC27709370004ECA76 /* Fluffychat Notifications.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
@ -21,6 +23,13 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
7295DBF127709370004ECA76 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 7295DBEB27709370004ECA76;
|
||||
remoteInfo = "Fluffychat Notifications";
|
||||
};
|
||||
C1005C4A261071B5002F4F32 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
@ -47,6 +56,7 @@
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
7295DBF327709370004ECA76 /* Fluffychat Notifications.appex in Embed App Extensions */,
|
||||
C1005C4C261071B5002F4F32 /* FluffyChat Share.appex in Embed App Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
@ -59,6 +69,10 @@
|
||||
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||
50DEFC207B70632D9C56ED78 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
72339A3227733E680084AF75 /* Fluffychat Notifications.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Fluffychat Notifications.entitlements"; sourceTree = "<group>"; };
|
||||
7295DBEC27709370004ECA76 /* Fluffychat Notifications.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Fluffychat Notifications.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
7295DBEE27709370004ECA76 /* NotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationService.swift; sourceTree = "<group>"; };
|
||||
7295DBF027709370004ECA76 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
76737C9A857D5FD6D2634A3F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
@ -82,6 +96,13 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
7295DBE927709370004ECA76 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EB1CF9000F007C117D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -108,6 +129,16 @@
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
7295DBED27709370004ECA76 /* Fluffychat Notifications */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
72339A3227733E680084AF75 /* Fluffychat Notifications.entitlements */,
|
||||
7295DBEE27709370004ECA76 /* NotificationService.swift */,
|
||||
7295DBF027709370004ECA76 /* Info.plist */,
|
||||
);
|
||||
path = "Fluffychat Notifications";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -125,6 +156,7 @@
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
C1005C43261071B5002F4F32 /* FluffyChat Share */,
|
||||
7295DBED27709370004ECA76 /* Fluffychat Notifications */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
E89DCAC000D371640E94E65B /* Pods */,
|
||||
075EE1BE25359E34308E0B78 /* Frameworks */,
|
||||
@ -136,6 +168,7 @@
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
C1005C42261071B5002F4F32 /* FluffyChat Share.appex */,
|
||||
7295DBEC27709370004ECA76 /* Fluffychat Notifications.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -181,6 +214,23 @@
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
7295DBEB27709370004ECA76 /* Fluffychat Notifications */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 7295DBF727709370004ECA76 /* Build configuration list for PBXNativeTarget "Fluffychat Notifications" */;
|
||||
buildPhases = (
|
||||
7295DBE827709370004ECA76 /* Sources */,
|
||||
7295DBE927709370004ECA76 /* Frameworks */,
|
||||
7295DBEA27709370004ECA76 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Fluffychat Notifications";
|
||||
productName = "Fluffychat Notifications";
|
||||
productReference = 7295DBEC27709370004ECA76 /* Fluffychat Notifications.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
97C146ED1CF9000F007C117D /* Runner */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
@ -199,6 +249,7 @@
|
||||
);
|
||||
dependencies = (
|
||||
C1005C4B261071B5002F4F32 /* PBXTargetDependency */,
|
||||
7295DBF227709370004ECA76 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
@ -228,10 +279,13 @@
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1240;
|
||||
LastUpgradeCheck = 1020;
|
||||
LastSwiftUpdateCheck = 1320;
|
||||
LastUpgradeCheck = 1300;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
7295DBEB27709370004ECA76 = {
|
||||
CreatedOnToolsVersion = 13.2;
|
||||
};
|
||||
97C146ED1CF9000F007C117D = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
@ -256,11 +310,19 @@
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
C1005C41261071B5002F4F32 /* FluffyChat Share */,
|
||||
7295DBEB27709370004ECA76 /* Fluffychat Notifications */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
7295DBEA27709370004ECA76 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EC1CF9000F007C117D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -354,6 +416,14 @@
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
7295DBE827709370004ECA76 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
7295DBEF27709370004ECA76 /* NotificationService.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
97C146EA1CF9000F007C117D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@ -374,6 +444,11 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
7295DBF227709370004ECA76 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 7295DBEB27709370004ECA76 /* Fluffychat Notifications */;
|
||||
targetProxy = 7295DBF127709370004ECA76 /* PBXContainerItemProxy */;
|
||||
};
|
||||
C1005C4B261071B5002F4F32 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = C1005C41261071B5002F4F32 /* FluffyChat Share */;
|
||||
@ -492,6 +567,114 @@
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
7295DBF427709370004ECA76 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Fluffychat Notifications/Fluffychat Notifications.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 4NXF6Z997G;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Fluffychat Notifications/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Fluffychat Notifications";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "im.fluffychat.app.Fluffychat-Notifications";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
7295DBF527709370004ECA76 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Fluffychat Notifications/Fluffychat Notifications.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 4NXF6Z997G;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Fluffychat Notifications/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Fluffychat Notifications";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "im.fluffychat.app.Fluffychat-Notifications";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
7295DBF627709370004ECA76 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Fluffychat Notifications/Fluffychat Notifications.entitlements";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = 4NXF6Z997G;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Fluffychat Notifications/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Fluffychat Notifications";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "im.fluffychat.app.Fluffychat-Notifications";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
97C147031CF9000F007C117D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@ -765,6 +948,16 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
7295DBF727709370004ECA76 /* Build configuration list for PBXNativeTarget "Fluffychat Notifications" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
7295DBF427709370004ECA76 /* Debug */,
|
||||
7295DBF527709370004ECA76 /* Release */,
|
||||
7295DBF627709370004ECA76 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1020"
|
||||
LastUpgradeVersion = "1300"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
@ -105,6 +105,8 @@
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>flutter_apns.disable_swizzling</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -51,7 +51,7 @@ abstract class AppConfig {
|
||||
'Push notifications for FluffyChat';
|
||||
static const String pushNotificationsAppId = 'chat.fluffy.fluffychat';
|
||||
static const String pushNotificationsGatewayUrl =
|
||||
'https://push.fluffychat.im/_matrix/push/v1/notify';
|
||||
'https://luckyskies.pet/_matrix/push/v1/notify';
|
||||
static const String pushNotificationsPusherFormat = 'event_id_only';
|
||||
static const String emojiFontName = 'Noto Emoji';
|
||||
static const String emojiFontUrl =
|
||||
|
@ -32,6 +32,7 @@ import 'package:http/http.dart' as http;
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:unifiedpush/unifiedpush.dart' hide Message;
|
||||
import 'package:vrouter/vrouter.dart';
|
||||
import 'package:flutter_apns_only/flutter_apns_only.dart';
|
||||
|
||||
import '../config/app_config.dart';
|
||||
import '../config/setting_keys.dart';
|
||||
@ -57,6 +58,7 @@ class BackgroundPush {
|
||||
L10n l10n;
|
||||
Store _store;
|
||||
Store get store => _store ??= Store();
|
||||
final _apnsPushConnector = ApnsPushConnectorOnly();
|
||||
Future<void> loadLocale() async {
|
||||
// inspired by _lookupL10n in .dart_tool/flutter_gen/gen_l10n/l10n.dart
|
||||
l10n ??= (context != null ? L10n.of(context) : null) ??
|
||||
@ -74,11 +76,11 @@ class BackgroundPush {
|
||||
onRoomSync ??= client.onSync.stream
|
||||
.where((s) => s.hasRoomUpdate)
|
||||
.listen((s) => _onClearingPush(getFromServer: false));
|
||||
_fcmSharedIsolate?.setListeners(
|
||||
onMessage: _onFcmMessage,
|
||||
onNewToken: _newFcmToken,
|
||||
);
|
||||
if (Platform.isAndroid) {
|
||||
_fcmSharedIsolate?.setListeners(
|
||||
onMessage: _onFcmMessage,
|
||||
onNewToken: _newFcmToken,
|
||||
);
|
||||
UnifiedPush.initializeWithReceiver(
|
||||
onNewEndpoint: _newUpEndpoint,
|
||||
onRegistrationFailed: _upUnregistered,
|
||||
@ -127,9 +129,6 @@ class BackgroundPush {
|
||||
Set<String> oldTokens,
|
||||
bool useDeviceSpecificAppId = false,
|
||||
}) async {
|
||||
if (PlatformInfos.isIOS) {
|
||||
await _fcmSharedIsolate?.requestPermission();
|
||||
}
|
||||
final clientName = PlatformInfos.clientName;
|
||||
// Just the plain app id, we add the .data_message suffix later
|
||||
var appId = AppConfig.pushNotificationsAppId;
|
||||
@ -143,8 +142,12 @@ class BackgroundPush {
|
||||
if (!useDeviceSpecificAppId && PlatformInfos.isAndroid) {
|
||||
appId += '.data_message';
|
||||
}
|
||||
if (PlatformInfos.isIOS) {
|
||||
appId = 'chat.fluffy.fluffychat.apns.data_message';
|
||||
}
|
||||
final thisAppId = useDeviceSpecificAppId ? deviceAppId : appId;
|
||||
await client.setupPusher(
|
||||
allowEncryption: false,
|
||||
oldTokens: oldTokens,
|
||||
pusher: Pusher(
|
||||
pushkey: token,
|
||||
@ -173,6 +176,8 @@ class BackgroundPush {
|
||||
if (!PlatformInfos.isIOS &&
|
||||
(await UnifiedPush.getDistributors()).isNotEmpty) {
|
||||
await setupUp();
|
||||
} else if (PlatformInfos.isIOS) {
|
||||
await setupApns();
|
||||
} else {
|
||||
await setupFirebase();
|
||||
}
|
||||
@ -214,6 +219,42 @@ class BackgroundPush {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> setupApns() async {
|
||||
Logs().v('[Push] Setup apns');
|
||||
// remove any old fcm tokens
|
||||
/* final oldTokens = <String>{};
|
||||
try {
|
||||
print('before');
|
||||
final fcmToken = await _fcmSharedIsolate?.getToken();
|
||||
print('after');
|
||||
print(fcmToken);
|
||||
oldTokens.add(fcmToken);
|
||||
} catch (_) {}*/
|
||||
|
||||
final completer = Completer();
|
||||
_apnsPushConnector.token.addListener(completer.complete);
|
||||
_apnsPushConnector.configureApns();
|
||||
_apnsPushConnector.requestNotificationPermissions();
|
||||
// TODO: listen to authorizationStatus changes
|
||||
try {
|
||||
await completer.future.timeout(Duration(seconds: 2));
|
||||
} catch (_) {
|
||||
// do nothing
|
||||
}
|
||||
final apnsToken = _apnsPushConnector.token.value;
|
||||
if (apnsToken == null) {
|
||||
Logs().w('[Push] apns token is null');
|
||||
return;
|
||||
}
|
||||
print(apnsToken);
|
||||
|
||||
await setupPusher(
|
||||
gatewayUrl: AppConfig.pushNotificationsGatewayUrl,
|
||||
token: apnsToken,
|
||||
//oldTokens: oldTokens,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> setupFirebase() async {
|
||||
Logs().v('Setup firebase');
|
||||
if (_fcmToken?.isEmpty ?? true) {
|
||||
|
@ -24,6 +24,7 @@ dependencies:
|
||||
file_picker_cross: ^4.5.0
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_apns_only: ^1.5.0
|
||||
flutter_app_badger: ^1.3.0
|
||||
flutter_app_lock: ^2.0.0
|
||||
flutter_blurhash: ^0.6.0
|
||||
@ -50,7 +51,7 @@ dependencies:
|
||||
lottie: ^1.2.1
|
||||
#matrix: ^0.7.0
|
||||
matrix:
|
||||
path: /home/sorunome/repos/famedly/famedlysdk
|
||||
path: ../famedly/frontend/famedlysdk
|
||||
matrix_link_text: ^1.0.2
|
||||
open_noti_settings: ^0.3.0
|
||||
package_info_plus: ^1.2.1
|
||||
|
Loading…
Reference in New Issue
Block a user