Compare commits
92 changed files with 919 additions and 3134 deletions
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -15,8 +15,6 @@
|
|||
"underride",
|
||||
"unifiedpush",
|
||||
"unredact",
|
||||
"webpush",
|
||||
"subprofile",
|
||||
"subprofiles"
|
||||
"webpush"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,12 +47,6 @@
|
|||
|
||||
<data android:scheme="matrix" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme"
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
|||
libFileName = "libgomuks.dylib";
|
||||
final iosConfig = codeConfig.iOS;
|
||||
iosSdk = iosConfig.targetSdk;
|
||||
final minVersion = iosConfig.deploymentVersion.major;
|
||||
final minVersion = iosConfig.targetVersion;
|
||||
iosSdkPath = await getXCodeTool(sdkType: iosSdk.type);
|
||||
|
||||
final archTriple = switch (targetArch) {
|
||||
|
|
@ -53,8 +53,7 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
|||
libFileName = "libgomuks.dylib";
|
||||
extraEnv = {
|
||||
"SDKROOT": await getXCodeTool(),
|
||||
"MACOSX_DEPLOYMENT_TARGET": codeConfig.macOS.deploymentVersion.major
|
||||
.toString(),
|
||||
"MACOSX_DEPLOYMENT_TARGET": codeConfig.macOS.targetVersion.toString(),
|
||||
};
|
||||
break;
|
||||
case OS.windows:
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
5A4E00000000000000000008 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A4E00000000000000000001 /* ShareViewController.swift */; };
|
||||
5A4E00000000000000000009 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A4E00000000000000000007 /* MainInterface.storyboard */; };
|
||||
5A4E0000000000000000000A /* ShareExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 5A4E00000000000000000005 /* ShareExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
5A4E0000000000000000000B /* better-share-handler-models in Frameworks */ = {isa = PBXBuildFile; productRef = 5A4E00000000000000000015 /* better-share-handler-models */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
|
|
@ -30,13 +26,6 @@
|
|||
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
||||
remoteInfo = Runner;
|
||||
};
|
||||
5A4E00000000000000000012 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 5A4E0000000000000000000D;
|
||||
remoteInfo = ShareExtension;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
|
|
@ -50,17 +39,6 @@
|
|||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E00000000000000000011 /* Embed App Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
5A4E0000000000000000000A /* ShareExtension.appex in Embed App Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
|
|
@ -81,12 +59,6 @@
|
|||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000001 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000002 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000003 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000004 /* ShareExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = ShareExtension.entitlements; sourceTree = "<group>"; };
|
||||
5A4E00000000000000000005 /* ShareExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = ShareExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5A4E00000000000000000006 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
|
|
@ -105,14 +77,6 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E0000000000000000000F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A4E0000000000000000000B /* better-share-handler-models in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
|
|
@ -143,7 +107,6 @@
|
|||
97C146F01CF9000F007C117D /* Runner */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||
5A4E0000000000000000000C /* ShareExtension */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
|
@ -152,7 +115,6 @@
|
|||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
||||
5A4E00000000000000000005 /* ShareExtension.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -169,22 +131,10 @@
|
|||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */,
|
||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||
5A4E00000000000000000006 /* Runner.entitlements */,
|
||||
);
|
||||
path = Runner;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5A4E0000000000000000000C /* ShareExtension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5A4E00000000000000000001 /* ShareViewController.swift */,
|
||||
5A4E00000000000000000007 /* MainInterface.storyboard */,
|
||||
5A4E00000000000000000003 /* Info.plist */,
|
||||
5A4E00000000000000000004 /* ShareExtension.entitlements */,
|
||||
);
|
||||
path = ShareExtension;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
|
|
@ -215,13 +165,11 @@
|
|||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
5A4E00000000000000000011 /* Embed App Extensions */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5A4E00000000000000000013 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Runner;
|
||||
packageProductDependencies = (
|
||||
|
|
@ -231,26 +179,6 @@
|
|||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
5A4E0000000000000000000D /* ShareExtension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 5A4E00000000000000000016 /* Build configuration list for PBXNativeTarget "ShareExtension" */;
|
||||
buildPhases = (
|
||||
5A4E0000000000000000000E /* Sources */,
|
||||
5A4E0000000000000000000F /* Frameworks */,
|
||||
5A4E00000000000000000010 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = ShareExtension;
|
||||
packageProductDependencies = (
|
||||
5A4E00000000000000000015 /* better-share-handler-models */,
|
||||
);
|
||||
productName = ShareExtension;
|
||||
productReference = 5A4E00000000000000000005 /* ShareExtension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
|
|
@ -269,9 +197,6 @@
|
|||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
5A4E0000000000000000000D = {
|
||||
CreatedOnToolsVersion = 15.0;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
|
|
@ -285,7 +210,6 @@
|
|||
mainGroup = 97C146E51CF9000F007C117D;
|
||||
packageReferences = (
|
||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
|
||||
5A4E00000000000000000014 /* XCLocalSwiftPackageReference "better_share_handler" */,
|
||||
);
|
||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||
projectDirPath = "";
|
||||
|
|
@ -293,7 +217,6 @@
|
|||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
331C8080294A63A400263BE5 /* RunnerTests */,
|
||||
5A4E0000000000000000000D /* ShareExtension */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
|
@ -317,14 +240,6 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E00000000000000000010 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A4E00000000000000000009 /* MainInterface.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
|
|
@ -380,14 +295,6 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
5A4E0000000000000000000E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
5A4E00000000000000000008 /* ShareViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
|
|
@ -396,11 +303,6 @@
|
|||
target = 97C146ED1CF9000F007C117D /* Runner */;
|
||||
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
||||
};
|
||||
5A4E00000000000000000013 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 5A4E0000000000000000000D /* ShareExtension */;
|
||||
targetProxy = 5A4E00000000000000000012 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
|
|
@ -420,14 +322,6 @@
|
|||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5A4E00000000000000000007 /* MainInterface.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
5A4E00000000000000000002 /* Base */,
|
||||
);
|
||||
name = MainInterface.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
|
|
@ -474,7 +368,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
|
|
@ -492,7 +386,6 @@
|
|||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
ENABLE_BITCODE = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
@ -602,7 +495,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
|
|
@ -653,7 +546,7 @@
|
|||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SUPPORTED_PLATFORMS = iphoneos;
|
||||
|
|
@ -673,7 +566,6 @@
|
|||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
ENABLE_BITCODE = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
@ -697,7 +589,6 @@
|
|||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
ENABLE_BITCODE = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
|
@ -711,87 +602,6 @@
|
|||
};
|
||||
name = Release;
|
||||
};
|
||||
5A4E00000000000000000017 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus.ShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
5A4E00000000000000000018 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus.ShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
5A4E00000000000000000019 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
CODE_SIGN_ENTITLEMENTS = ShareExtension/ShareExtension.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = PK66NJM372;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = ShareExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = "$(FLUTTER_BUILD_NAME)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = nexus.federated.nexus.ShareExtension;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
|
|
@ -825,16 +635,6 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
5A4E00000000000000000016 /* Build configuration list for PBXNativeTarget "ShareExtension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
5A4E00000000000000000017 /* Debug */,
|
||||
5A4E00000000000000000018 /* Release */,
|
||||
5A4E00000000000000000019 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCLocalSwiftPackageReference section */
|
||||
|
|
@ -842,10 +642,6 @@
|
|||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
5A4E00000000000000000014 /* XCLocalSwiftPackageReference "better_share_handler" */ = {
|
||||
isa = XCLocalSwiftPackageReference;
|
||||
relativePath = "Flutter/ephemeral/Packages/.packages/better_share_handler-1.1.1";
|
||||
};
|
||||
/* End XCLocalSwiftPackageReference section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
|
|
@ -853,11 +649,6 @@
|
|||
isa = XCSwiftPackageProductDependency;
|
||||
productName = FlutterGeneratedPluginSwiftPackage;
|
||||
};
|
||||
5A4E00000000000000000015 /* better-share-handler-models */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 5A4E00000000000000000014 /* XCLocalSwiftPackageReference "better_share_handler" */;
|
||||
productName = "better-share-handler-models";
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
|
|
|
|||
|
|
@ -31,15 +31,6 @@
|
|||
<string>matrix</string>
|
||||
</array>
|
||||
</dict>
|
||||
<!-- Opened by the share extension, see ShareRequestController -->
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>ShareMedia-$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
<?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.application-groups</key>
|
||||
<array>
|
||||
<string>group.nexus.federated.nexus</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
<?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="j1y-V4-xli">
|
||||
<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>
|
||||
<!--Share View Controller-->
|
||||
<scene sceneID="ceB-am-kn3">
|
||||
<objects>
|
||||
<viewController id="j1y-V4-xli" customClass="ShareViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" opaque="NO" contentMode="scaleToFill" id="wbc-yd-nQP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="1Xd-am-t49"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="CEy-Cv-SGf" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
<?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>CFBundleDisplayName</key>
|
||||
<string>Nexus</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>PHSupportedMediaTypes</key>
|
||||
<array>
|
||||
<string>Video</string>
|
||||
<string>Image</string>
|
||||
</array>
|
||||
<!-- One of each at most, as the composer takes one attachment -->
|
||||
<key>NSExtensionActivationRule</key>
|
||||
<dict>
|
||||
<key>NSExtensionActivationSupportsText</key>
|
||||
<true/>
|
||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsFileWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
<string>MainInterface</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.share-services</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
<?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.application-groups</key>
|
||||
<array>
|
||||
<string>group.nexus.federated.nexus</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import better_share_handler_models
|
||||
|
||||
// Saves what was shared to the App Group, then opens Nexus, which asks which
|
||||
// room to send it to. See ShareRequestController.
|
||||
class ShareViewController: ShareHandlerIosViewController {}
|
||||
|
|
@ -5,9 +5,6 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
|||
import "package:flutter/foundation.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/controllers/pending_subprofiles.dart";
|
||||
import "package:nexus/controllers/rooms.dart";
|
||||
import "package:nexus/models/per_message_profiles.dart";
|
||||
import "package:nexus/models/account_data.dart";
|
||||
import "package:nexus/models/push_rules.dart";
|
||||
import "package:nexus/models/requests/update_push_rule.dart";
|
||||
|
|
@ -76,45 +73,6 @@ class AccountDataController extends Notifier<AccountData> {
|
|||
(data) => data.ignoredUserList.contains(userId) == ignored,
|
||||
);
|
||||
|
||||
Future<void> setPerMessageProfiles(PerMessageProfiles profiles) =>
|
||||
_sendAndWait(
|
||||
() => ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.setAccountData(
|
||||
.new(type: AccountData.perMessageProfilesKey, content: profiles),
|
||||
),
|
||||
(data) => data.perMessageProfiles == profiles,
|
||||
);
|
||||
|
||||
Future<void> setRoomProfile(String roomId, String profileId) {
|
||||
const type = AccountData.perMessageProfilesKey;
|
||||
const key = "default_profile_id";
|
||||
final current = ref
|
||||
.read(RoomsController.provider)[roomId]
|
||||
?.accountData[type];
|
||||
|
||||
return ref.read(PendingSubprofilesController.provider.notifier).track(
|
||||
roomId,
|
||||
profileId,
|
||||
() async {
|
||||
await ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.setAccountData(
|
||||
.new(
|
||||
type: type,
|
||||
roomId: roomId,
|
||||
content: {...?current, key: profileId},
|
||||
),
|
||||
);
|
||||
await ref
|
||||
.read(RoomsController.provider.notifier)
|
||||
.awaitRooms(
|
||||
(rooms) => rooms[roomId]?.accountData[type]?[key] == profileId,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Saves [rule] of [kind], creating it if it's new, or otherwise changing only
|
||||
/// its actions and whether it's enabled.
|
||||
Future<void> savePushRule(PushRuleKind kind, PushRule rule) {
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/controllers/client_state.dart";
|
||||
import "package:nexus/models/account_management.dart";
|
||||
|
||||
/// Where the homeserver lets the user manage their account, if it says.
|
||||
class AccountManagementController extends AsyncNotifier<AccountManagement?> {
|
||||
@override
|
||||
Future<AccountManagement?> build() async {
|
||||
final homeserver = ref.watch(
|
||||
ClientStateController.provider.select((state) => state?.homeserverUrl),
|
||||
);
|
||||
if (homeserver == null) return null;
|
||||
|
||||
return ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.getAccountManagement(.parse(homeserver));
|
||||
}
|
||||
|
||||
static final provider =
|
||||
AsyncNotifierProvider<AccountManagementController, AccountManagement?>(
|
||||
AccountManagementController.new,
|
||||
);
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ class BotArgumentSuggestionsController(final ComposerParams composer)
|
|||
),
|
||||
) =>
|
||||
BotArgumentSuggestion(
|
||||
title: displayName ?? userId.localpart!,
|
||||
title: displayName ?? userId.localpart,
|
||||
subtitle: userId,
|
||||
avatar: avatarUrl,
|
||||
text: userId,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class BotCommandsController(final String roomId)
|
|||
) =>
|
||||
BotCommand(
|
||||
sender: sender,
|
||||
botName: displayName ?? sender.localpart!,
|
||||
botName: displayName ?? sender.localpart,
|
||||
botAvatar: avatarUrl,
|
||||
description: description,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@ import "package:nexus/models/requests/get_mentions.dart";
|
|||
import "package:nexus/models/requests/get_related_events.dart";
|
||||
import "package:nexus/models/requests/get_room_state.dart";
|
||||
import "package:nexus/models/requests/get_specific_room_state.dart";
|
||||
import "package:nexus/models/content/content.dart";
|
||||
import "package:nexus/models/account_management.dart";
|
||||
import "package:nexus/models/requests/get_space_hierarchy.dart";
|
||||
import "package:nexus/models/requests/get_room_directory.dart";
|
||||
import "package:nexus/models/requests/get_threads.dart";
|
||||
|
|
@ -282,19 +280,24 @@ class ClientController(final String? accountId) extends AsyncNotifier<int> {
|
|||
Future<void> resetEncryption(RecoveryKey key) =>
|
||||
sendCommand("reset_encryption", key.toJson());
|
||||
|
||||
Future<AccountManagement?> getAccountManagement(Uri homeserver) async =>
|
||||
switch ((await sendCommand("get_login_flows", {
|
||||
"homeserver_url": homeserver.toString(),
|
||||
}))["oauth"]) {
|
||||
{"account_management_uri": final String uri} && final oauth => .new(
|
||||
.parse(uri),
|
||||
.new(
|
||||
(oauth["account_management_actions_supported"] as List? ?? [])
|
||||
.whereType<String>(),
|
||||
),
|
||||
),
|
||||
_ => null,
|
||||
};
|
||||
Future<Uri?> getCrossSigningResetUrl(Uri homeserver) async {
|
||||
const action = "org.matrix.cross_signing_reset";
|
||||
final oauth = (await sendCommand("get_login_flows", {
|
||||
"homeserver_url": homeserver.toString(),
|
||||
}))["oauth"];
|
||||
|
||||
if (oauth?["account_management_uri"] case final String uri
|
||||
when (oauth["account_management_actions_supported"] as List?)?.contains(
|
||||
action,
|
||||
) ??
|
||||
false) {
|
||||
final parsed = Uri.parse(uri);
|
||||
return parsed.replace(
|
||||
queryParameters: {...parsed.queryParameters, "action": action},
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<String> joinRoom(JoinRoomRequest request) async =>
|
||||
(await sendCommand("join_room", request.toJson()))["room_id"];
|
||||
|
|
@ -333,50 +336,15 @@ class ClientController(final String? accountId) extends AsyncNotifier<int> {
|
|||
);
|
||||
}
|
||||
|
||||
/// The raw JSON of the events [request] asks for, for when the parsed
|
||||
/// content would lose fields.
|
||||
Future<List> getSpecificRoomStateJson(
|
||||
GetSpecificRoomStateRequest request,
|
||||
) async =>
|
||||
(await sendCommand("get_specific_room_state", request.toJson()))
|
||||
as List? ??
|
||||
[];
|
||||
|
||||
Future<IList<Event>> getSpecificRoomState(
|
||||
GetSpecificRoomStateRequest request,
|
||||
) async => .new(
|
||||
(await getSpecificRoomStateJson(request)).map((event) => .fromJson(event)),
|
||||
((await sendCommand("get_specific_room_state", request.toJson()))
|
||||
as List? ??
|
||||
[])
|
||||
.map((event) => .fromJson(event)),
|
||||
);
|
||||
|
||||
Future<String?> updateMembership(
|
||||
String roomId,
|
||||
String userId,
|
||||
IMap<String, Object?> changes,
|
||||
) async {
|
||||
final type = EventType.membership.type;
|
||||
final current = switch ((await getSpecificRoomStateJson(
|
||||
.new(
|
||||
keys: .new([.new(roomId: roomId, type: type, stateKey: userId)]),
|
||||
),
|
||||
)).firstOrNull) {
|
||||
{"content": final Map content} => content.cast<String, Object?>(),
|
||||
_ => throw Exception("You aren't a member of this room"),
|
||||
};
|
||||
|
||||
return await sendCommand("set_state", {
|
||||
"room_id": roomId,
|
||||
"type": type,
|
||||
"state_key": userId,
|
||||
"content": current.lock
|
||||
.addAll(changes)
|
||||
.removeWhere(
|
||||
(key, value) =>
|
||||
value == null || key == "join_authorised_via_users_server",
|
||||
)
|
||||
.unlock,
|
||||
});
|
||||
}
|
||||
|
||||
Future<IList<Event>?> getRelatedEvents(
|
||||
GetRelatedEventsRequest request,
|
||||
) async {
|
||||
|
|
@ -446,17 +414,17 @@ class ClientController(final String? accountId) extends AsyncNotifier<int> {
|
|||
Future<void> registerPusher(RegisterPusherRequest request) =>
|
||||
sendCommand("register_homeserver_push", request.toJson());
|
||||
|
||||
Future<void> deregisterPusher(DeregisterPusherRequest request) => sendCommand(
|
||||
"register_homeserver_push",
|
||||
{...request.toJson(), "kind": null},
|
||||
);
|
||||
Future<void> deregisterPusher(DeregisterPusherRequest request) =>
|
||||
sendCommand("register_homeserver_push", {
|
||||
...request.toJson(),
|
||||
"kind": null,
|
||||
});
|
||||
|
||||
Future<MessageContent> uploadMedia(UploadMediaRequest request) async =>
|
||||
.fromJson(await sendCommand("upload_media", request.toJson()));
|
||||
|
||||
Future<File> downloadMedia(DownloadMediaRequest request) async {
|
||||
if (accountId == null &&
|
||||
!isInBackground &&
|
||||
ref.read(ClientStateController.provider)?.isLoggedIn != true) {
|
||||
throw StateError("Can't download media while logged out");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:fluttertagger/fluttertagger.dart";
|
||||
import "package:nexus/controllers/attachment.dart";
|
||||
import "package:nexus/controllers/bot_command_draft.dart";
|
||||
import "package:nexus/controllers/rooms.dart";
|
||||
import "package:nexus/helpers/extensions/get_filename.dart";
|
||||
import "package:nexus/helpers/extensions/get_localpart.dart";
|
||||
import "package:nexus/helpers/extensions/is_media.dart";
|
||||
import "package:nexus/helpers/extensions/with_latest_edit.dart";
|
||||
import "package:nexus/models/composer_draft.dart";
|
||||
|
|
@ -52,10 +49,8 @@ class ComposerDraftController(final ComposerParams composer)
|
|||
},
|
||||
);
|
||||
|
||||
final tagged = _restoreTags(text);
|
||||
state = ComposerDraft(
|
||||
text: tagged.text,
|
||||
tags: tagged.tags,
|
||||
text: text,
|
||||
textCommands: commands,
|
||||
relatedEvent: rowId,
|
||||
relationType: .edit,
|
||||
|
|
@ -81,52 +76,6 @@ class ComposerDraftController(final ComposerParams composer)
|
|||
_botCommand.clear();
|
||||
}
|
||||
|
||||
static final _tagPattern = RegExp(
|
||||
r"\[@[^\]]*\]\(matrix:u/([^)\s]+)\)"
|
||||
r"|\[#[^\]]*\]\(matrix:roomid/([^)?\s]+)[^)\s]*\)"
|
||||
r"|\[#[^\]]*\]\(matrix:r/([^)?\s]+)[^)\s]*\)"
|
||||
r'|!\[:([^\]\s]+):\]\(mxc://[^)\s]+(?: "(?:[^"\\]|\\.)*")?\)',
|
||||
);
|
||||
|
||||
/// Turns the mentions and custom emoji in [text], an edit source, back into
|
||||
/// tags, formatted like the composer's tagTextFormatter.
|
||||
({String text, IList<Tag> tags}) _restoreTags(String text) {
|
||||
final rooms = ref.read(RoomsController.provider);
|
||||
Tag tagOf(Match match) =>
|
||||
switch ((match[1], match[2], match[3], match[4])) {
|
||||
(final userId?, _, _, _) => .new(
|
||||
id: match[0]!,
|
||||
text: userId.split(":").first,
|
||||
triggerCharacter: "@",
|
||||
),
|
||||
(_, final roomId?, _, _) => .new(
|
||||
id: match[0]!,
|
||||
text:
|
||||
rooms["!$roomId"]?.metadata?.canonicalAlias?.localpart ??
|
||||
"!$roomId",
|
||||
triggerCharacter: "#",
|
||||
),
|
||||
(_, _, final alias?, _) => .new(
|
||||
id: match[0]!,
|
||||
text: "#$alias".localpart!,
|
||||
triggerCharacter: "#",
|
||||
),
|
||||
(_, _, _, final shortcode) => .new(
|
||||
id: match[0]!,
|
||||
text: shortcode!,
|
||||
triggerCharacter: ":",
|
||||
),
|
||||
};
|
||||
|
||||
return (
|
||||
text: text.replaceAllMapped(_tagPattern, (match) {
|
||||
final tag = tagOf(match);
|
||||
return "${tag.triggerCharacter}${tag.id}#${tag.text}#";
|
||||
}),
|
||||
tags: _tagPattern.allMatches(text).map(tagOf).toISet().toIList(),
|
||||
);
|
||||
}
|
||||
|
||||
void dismiss() {
|
||||
if (state.isEditing) return _restoreBeforeEdit();
|
||||
state = state.copyWith(relatedEvent: null);
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
class LaunchScopeController extends Notifier<bool> {
|
||||
@override
|
||||
bool build() => true;
|
||||
|
||||
static final provider = NotifierProvider<LaunchScopeController, bool>(
|
||||
LaunchScopeController.new,
|
||||
);
|
||||
}
|
||||
|
|
@ -2,15 +2,11 @@ import "dart:async";
|
|||
import "dart:convert";
|
||||
import "dart:io";
|
||||
|
||||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter/services.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:nexus/controllers/active_account.dart";
|
||||
import "package:nexus/controllers/launch_scope.dart";
|
||||
import "package:nexus/controllers/portal.dart";
|
||||
import "package:nexus/controllers/rooms.dart";
|
||||
import "package:nexus/controllers/sidebar_page.dart";
|
||||
import "package:nexus/helpers/shown_notifications_helper.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:flutter_local_notifications/flutter_local_notifications.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
|
@ -30,17 +26,7 @@ class NotificationController
|
|||
Future<FlutterLocalNotificationsPlugin> build() async {
|
||||
final notifications = FlutterLocalNotificationsPlugin();
|
||||
|
||||
if (Platform.isLinux) {
|
||||
const MethodChannel("nexus/notifications")
|
||||
.setMethodCallHandler((call) async {
|
||||
if (call case MethodCall(
|
||||
method: "notificationClicked",
|
||||
arguments: final String payload,
|
||||
)) {
|
||||
_open(payload);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if (!Platform.isLinux) {
|
||||
final darwin = DarwinInitializationSettings();
|
||||
|
||||
await notifications.initialize(
|
||||
|
|
@ -58,89 +44,26 @@ class NotificationController
|
|||
if (details.payload case final payload?) _open(payload);
|
||||
},
|
||||
);
|
||||
|
||||
await notifications
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.deleteNotificationChannel(channelId: "messages");
|
||||
|
||||
// Taps that launched the app don't reach the callback above
|
||||
if (!isInBackground && ref.read(LaunchScopeController.provider)) {
|
||||
if (await notifications.getNotificationAppLaunchDetails()
|
||||
case NotificationAppLaunchDetails(
|
||||
didNotificationLaunchApp: true,
|
||||
notificationResponse: NotificationResponse(:final payload?),
|
||||
)) {
|
||||
_open(payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Reading a room, here or on another client, dismisses its notifications
|
||||
if (!isInBackground) {
|
||||
ref.listen(
|
||||
RoomsController.provider.select(
|
||||
(rooms) => rooms
|
||||
.where((_, room) => room.metadata?.unreadNotifications == 0)
|
||||
.keys
|
||||
.toISet(),
|
||||
),
|
||||
(previous, read) {
|
||||
final newlyRead = read.difference(previous ?? const ISetConst({}));
|
||||
if (newlyRead.isEmpty) return;
|
||||
if (Platform.isLinux) {
|
||||
const notificationChannel = MethodChannel("nexus/notifications");
|
||||
|
||||
final accountId = ref.read(ActiveAccountController.provider);
|
||||
dismiss(
|
||||
newlyRead.map((roomId) => threadIdFor(accountId, roomId)).toISet(),
|
||||
).onError(showError);
|
||||
},
|
||||
fireImmediately: true,
|
||||
);
|
||||
notificationChannel.setMethodCallHandler((call) async {
|
||||
if (call.method != "notificationClicked") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (call.arguments case final String payload) _open(payload);
|
||||
});
|
||||
}
|
||||
|
||||
return notifications;
|
||||
}
|
||||
|
||||
static String threadIdFor(String accountId, String roomId) =>
|
||||
"$accountId/$roomId";
|
||||
|
||||
static String payloadFor(String accountId, int rowId) => "$accountId:$rowId";
|
||||
|
||||
static const _messagesChannel = "messages_v2";
|
||||
static const _androidGroup = "nexus.federated.nexus.MESSAGES";
|
||||
|
||||
/// Dismisses the notifications shown for [threadIds].
|
||||
Future<void> dismiss(ISet<String> threadIds) async {
|
||||
final ids = await ref
|
||||
.read(ShownNotificationsHelper.provider)
|
||||
.remove(threadIds);
|
||||
if (ids.isEmpty) return;
|
||||
|
||||
if (Platform.isLinux) {
|
||||
final portal = await ref.read(PortalController.provider.future);
|
||||
await Future.wait(
|
||||
ids.map((id) => portal.notification.removeNotification(id.toString())),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final controller = await future;
|
||||
await Future.wait(ids.map((id) => controller.cancel(id: id)));
|
||||
|
||||
// The summary would otherwise outlive its group
|
||||
if (Platform.isAndroid &&
|
||||
(await controller.getActiveNotifications()).every(
|
||||
(notification) => notification.id == 0,
|
||||
)) {
|
||||
await controller.cancel(id: 0);
|
||||
}
|
||||
}
|
||||
|
||||
void _open(String payload) {
|
||||
navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
||||
ref.read(SidebarPageController.provider.notifier).set(.notifications);
|
||||
|
||||
final (accountId, rowId) = switch (payload.split(":")) {
|
||||
[final accountId, final rowId] => (accountId, int.tryParse(rowId)),
|
||||
// From before notifications were per account
|
||||
|
|
@ -149,6 +72,9 @@ class NotificationController
|
|||
};
|
||||
if (rowId == null) return;
|
||||
|
||||
navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
||||
ref.read(SidebarPageController.provider.notifier).set(.notifications);
|
||||
|
||||
ref
|
||||
.read(ActiveAccountController.provider.notifier)
|
||||
.switchTo(
|
||||
|
|
@ -158,50 +84,73 @@ class NotificationController
|
|||
.onError(showError);
|
||||
}
|
||||
|
||||
// Each resolves to null except on its own platform
|
||||
Future<bool> requestPermissions() async {
|
||||
if (Platform.isLinux) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final controller = await future;
|
||||
|
||||
return await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
IOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
||||
await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
MacOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
||||
await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.requestNotificationsPermission() ??
|
||||
true;
|
||||
if (Platform.isIOS) {
|
||||
return await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
IOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
||||
true;
|
||||
} else if (Platform.isMacOS) {
|
||||
return await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
MacOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
||||
true;
|
||||
} else if (Platform.isAndroid) {
|
||||
return await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.requestNotificationsPermission() ??
|
||||
true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Whether notifications can currently be shown, without prompting
|
||||
Future<bool> permissionsGranted() async {
|
||||
if (Platform.isLinux) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final controller = await future;
|
||||
|
||||
return (await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
IOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.checkPermissions())
|
||||
?.isEnabled ??
|
||||
(await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
MacOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.checkPermissions())
|
||||
?.isEnabled ??
|
||||
await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.areNotificationsEnabled() ??
|
||||
true;
|
||||
if (Platform.isIOS) {
|
||||
return (await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
IOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.checkPermissions())
|
||||
?.isEnabled ??
|
||||
true;
|
||||
} else if (Platform.isMacOS) {
|
||||
return (await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
MacOSFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.checkPermissions())
|
||||
?.isEnabled ??
|
||||
true;
|
||||
} else if (Platform.isAndroid) {
|
||||
return await controller
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin
|
||||
>()
|
||||
?.areNotificationsEnabled() ??
|
||||
true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Passing [message] shows it as a chat message in the conversation for
|
||||
|
|
@ -224,7 +173,6 @@ class NotificationController
|
|||
// In DMs the title is already the sender
|
||||
final sender = message == null || message.isDm ? null : message.sender;
|
||||
final prefixedBody = sender == null ? body : "${sender.name}: $body";
|
||||
final shown = ref.read(ShownNotificationsHelper.provider);
|
||||
|
||||
if (Platform.isLinux) {
|
||||
final portal = await ref.read(PortalController.provider.future);
|
||||
|
|
@ -251,7 +199,6 @@ class NotificationController
|
|||
// ),
|
||||
],
|
||||
);
|
||||
if (threadId != null) await shown.add(threadId, id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -267,7 +214,6 @@ class NotificationController
|
|||
.onError((_, _) => null)
|
||||
: null;
|
||||
|
||||
final largeIcon = icon == null ? null : FilePathAndroidBitmap(icon.path);
|
||||
final darwin = DarwinNotificationDetails(
|
||||
subtitle: subtitle,
|
||||
presentSound: sound,
|
||||
|
|
@ -284,24 +230,24 @@ class NotificationController
|
|||
? .new(
|
||||
"general",
|
||||
"General",
|
||||
groupKey: _androidGroup,
|
||||
subText: subtitle,
|
||||
silent: !sound,
|
||||
when: timestamp?.millisecondsSinceEpoch,
|
||||
largeIcon: largeIcon,
|
||||
largeIcon: icon == null
|
||||
? null
|
||||
: FilePathAndroidBitmap(icon.path),
|
||||
styleInformation: BigTextStyleInformation(body),
|
||||
)
|
||||
: .new(
|
||||
_messagesChannel,
|
||||
"messages",
|
||||
"Messages",
|
||||
importance: .high,
|
||||
priority: .high,
|
||||
groupKey: _androidGroup,
|
||||
subText: subtitle,
|
||||
silent: !sound,
|
||||
when: timestamp?.millisecondsSinceEpoch,
|
||||
category: .message,
|
||||
largeIcon: largeIcon,
|
||||
largeIcon: icon == null
|
||||
? null
|
||||
: FilePathAndroidBitmap(icon.path),
|
||||
styleInformation: MessagingStyleInformation(
|
||||
.new(key: message.self.id, name: message.self.name),
|
||||
conversationTitle: message.isDm ? null : title,
|
||||
|
|
@ -314,12 +260,11 @@ class NotificationController
|
|||
.new(
|
||||
key: message.sender.id,
|
||||
name: message.sender.name,
|
||||
icon: switch (message.senderAvatar) {
|
||||
final avatar? => BitmapFilePathAndroidIcon(
|
||||
avatar.path,
|
||||
),
|
||||
null => null,
|
||||
},
|
||||
icon: message.senderAvatar == null
|
||||
? null
|
||||
: BitmapFilePathAndroidIcon(
|
||||
message.senderAvatar!.path,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
@ -336,28 +281,6 @@ class NotificationController
|
|||
),
|
||||
),
|
||||
);
|
||||
|
||||
if (threadId != null) await shown.add(threadId, id);
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
await controller.show(
|
||||
id: 0,
|
||||
title: "Nexus",
|
||||
payload: payload,
|
||||
notificationDetails: const .new(
|
||||
android: .new(
|
||||
_messagesChannel,
|
||||
"Messages",
|
||||
importance: .high,
|
||||
groupKey: _androidGroup,
|
||||
setAsGroupSummary: true,
|
||||
groupAlertBehavior: .children,
|
||||
onlyAlertOnce: true,
|
||||
silent: true,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static final provider =
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
|
||||
typedef PendingSubprofile = ({String id, Future<void> synced});
|
||||
|
||||
/// Subprofiles just chosen for rooms, by room ID, until they come down sync.
|
||||
/// gomuks only learns of them then, so messages sent before would use the
|
||||
/// previous one.
|
||||
class PendingSubprofilesController
|
||||
extends Notifier<IMap<String, PendingSubprofile>> {
|
||||
@override
|
||||
IMap<String, PendingSubprofile> build() => const .empty();
|
||||
|
||||
Future<void> track(
|
||||
String roomId,
|
||||
String id,
|
||||
Future<void> Function() save,
|
||||
) async {
|
||||
final synced = save();
|
||||
state = state.add(roomId, (id: id, synced: synced));
|
||||
|
||||
try {
|
||||
await synced;
|
||||
} finally {
|
||||
// Unless another subprofile was chosen meanwhile
|
||||
if (state[roomId]?.synced == synced) state = state.remove(roomId);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> settled(String roomId) async {
|
||||
try {
|
||||
await state[roomId]?.synced;
|
||||
} catch (_) {
|
||||
throw Exception(
|
||||
"The message wasn't sent, as the subprofile chosen for this room couldn't be saved",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static final provider =
|
||||
NotifierProvider<
|
||||
PendingSubprofilesController,
|
||||
IMap<String, PendingSubprofile>
|
||||
>(PendingSubprofilesController.new);
|
||||
}
|
||||
|
|
@ -7,8 +7,6 @@ import "package:flutter_riverpod/flutter_riverpod.dart";
|
|||
import "package:fluttertagger/fluttertagger.dart";
|
||||
import "package:nexus/controllers/attachment.dart";
|
||||
import "package:nexus/controllers/client.dart";
|
||||
import "package:nexus/controllers/pending_subprofiles.dart";
|
||||
import "package:nexus/controllers/subprofiles.dart";
|
||||
import "package:nexus/controllers/event.dart";
|
||||
import "package:nexus/controllers/rooms.dart";
|
||||
import "package:nexus/controllers/thread_replies.dart";
|
||||
|
|
@ -401,7 +399,6 @@ class RoomChatController(final ChatParams info)
|
|||
required RelationType relationType,
|
||||
int? relatedEventRowId,
|
||||
}) async {
|
||||
final subprofile = subprofileFor(text);
|
||||
final events = ref.read(RoomsController.provider)[info.roomId]?.events;
|
||||
final relatedEvent = relatedEventRowId == null
|
||||
? null
|
||||
|
|
@ -440,7 +437,6 @@ class RoomChatController(final ChatParams info)
|
|||
);
|
||||
|
||||
final client = ref.read(ClientController.provider.notifier);
|
||||
await awaitSubprofile(text, subprofile);
|
||||
final event = await client.sendMessage(
|
||||
SendMessageRequest(
|
||||
roomId: info.roomId,
|
||||
|
|
@ -462,24 +458,6 @@ class RoomChatController(final ChatParams info)
|
|||
addSent(event);
|
||||
}
|
||||
|
||||
String? subprofileFor(String text, {bool synced = false}) {
|
||||
final subprofiles = ref.read(SubprofilesController.provider(info.roomId));
|
||||
return (subprofiles.triggeredBy(text) ??
|
||||
(synced ? subprofiles.synced : subprofiles.current))
|
||||
?.id;
|
||||
}
|
||||
|
||||
Future<void> awaitSubprofile(String text, String? shown) async {
|
||||
await ref
|
||||
.read(PendingSubprofilesController.provider.notifier)
|
||||
.settled(info.roomId);
|
||||
if (subprofileFor(text, synced: true) != shown) {
|
||||
throw Exception(
|
||||
"The message wasn't sent, as it would have been sent as a different subprofile than shown",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows [event], which was just sent, until it comes down sync.
|
||||
void addSent(Event? event) {
|
||||
if (event case final event?) {
|
||||
|
|
@ -636,7 +614,6 @@ class RoomChatController(final ChatParams info)
|
|||
.read(RoomsController.provider)[info.roomId]
|
||||
?.events[repliedEventRowId];
|
||||
|
||||
await awaitSubprofile("", subprofileFor(""));
|
||||
final event = await ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.sendMessage(
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue