Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
2e6fa1e7d8 |
|||
|
a7a21f4d1a |
|||
|
f33865962b |
|||
|
9d495410f6 |
|||
|
7424bec0fb |
|||
|
32df549215 |
|||
|
5d15236903 |
|||
|
c9fdda41d1 |
|||
|
fb5e14091e |
|||
|
5b73e998df |
|||
|
784db4f1dd |
|||
|
dccbda7870 |
|||
|
d5f04122eb |
|||
|
7435ecd5f0 |
|||
|
9f2d223809 |
|||
|
a7e60b9464 |
|||
|
6e6bcaaad1 |
|||
|
3cf0b811bb |
|||
|
c786344bf2 |
|||
|
225497030e |
|||
|
4800123044 |
|||
|
3b7a4c0cd4 |
|||
|
f80ceb0736 |
|||
|
6e3bc596fd |
|||
|
79d556a830 |
|||
|
8d4745cc12 |
|||
|
69f175babe |
|||
|
f6b9deee86 |
|||
|
701024b5f6 |
|||
|
dcb160556e |
|||
|
1e25cbf822 |
|||
|
cba13aa6c7 |
|||
|
77f06005e5 |
|||
|
7bae610c05 |
|||
|
09f9b56e34 |
|||
|
1c533b5330 |
|||
|
78c6b2ef46 |
|||
|
432064e111 |
|||
|
b63fcc30b7 |
|||
|
5df7c2c00a |
|||
|
f2494db2ee |
|||
|
3ba258d6b4 |
|||
|
36a43a7a36 |
|||
|
2c1ccc4728 |
|||
|
c3b39a6294 |
|||
|
23d77ddc60 |
|||
|
322217fc20 |
|||
|
b680add183 |
|||
|
7391a5a50c |
|||
|
812183cc00 |
|||
|
be69358ea4 |
|||
|
b0d22e5570 |
|||
|
720e538dbc |
92 changed files with 3134 additions and 919 deletions
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
|
|
@ -15,6 +15,8 @@
|
||||||
"underride",
|
"underride",
|
||||||
"unifiedpush",
|
"unifiedpush",
|
||||||
"unredact",
|
"unredact",
|
||||||
"webpush"
|
"webpush",
|
||||||
|
"subprofile",
|
||||||
|
"subprofiles"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,12 @@
|
||||||
|
|
||||||
<data android:scheme="matrix" />
|
<data android:scheme="matrix" />
|
||||||
</intent-filter>
|
</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
|
<meta-data
|
||||||
android:name="io.flutter.embedding.android.NormalTheme"
|
android:name="io.flutter.embedding.android.NormalTheme"
|
||||||
android:resource="@style/NormalTheme"
|
android:resource="@style/NormalTheme"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||||
libFileName = "libgomuks.dylib";
|
libFileName = "libgomuks.dylib";
|
||||||
final iosConfig = codeConfig.iOS;
|
final iosConfig = codeConfig.iOS;
|
||||||
iosSdk = iosConfig.targetSdk;
|
iosSdk = iosConfig.targetSdk;
|
||||||
final minVersion = iosConfig.targetVersion;
|
final minVersion = iosConfig.deploymentVersion.major;
|
||||||
iosSdkPath = await getXCodeTool(sdkType: iosSdk.type);
|
iosSdkPath = await getXCodeTool(sdkType: iosSdk.type);
|
||||||
|
|
||||||
final archTriple = switch (targetArch) {
|
final archTriple = switch (targetArch) {
|
||||||
|
|
@ -53,7 +53,8 @@ Future<void> main(List<String> args) => build(args, (input, output) async {
|
||||||
libFileName = "libgomuks.dylib";
|
libFileName = "libgomuks.dylib";
|
||||||
extraEnv = {
|
extraEnv = {
|
||||||
"SDKROOT": await getXCodeTool(),
|
"SDKROOT": await getXCodeTool(),
|
||||||
"MACOSX_DEPLOYMENT_TARGET": codeConfig.macOS.targetVersion.toString(),
|
"MACOSX_DEPLOYMENT_TARGET": codeConfig.macOS.deploymentVersion.major
|
||||||
|
.toString(),
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case OS.windows:
|
case OS.windows:
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
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 */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
|
@ -26,6 +30,13 @@
|
||||||
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
|
||||||
remoteInfo = Runner;
|
remoteInfo = Runner;
|
||||||
};
|
};
|
||||||
|
5A4E00000000000000000012 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 5A4E0000000000000000000D;
|
||||||
|
remoteInfo = ShareExtension;
|
||||||
|
};
|
||||||
/* End PBXContainerItemProxy section */
|
/* End PBXContainerItemProxy section */
|
||||||
|
|
||||||
/* Begin PBXCopyFilesBuildPhase section */
|
/* Begin PBXCopyFilesBuildPhase section */
|
||||||
|
|
@ -39,6 +50,17 @@
|
||||||
name = "Embed Frameworks";
|
name = "Embed Frameworks";
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
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 */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
|
|
@ -59,6 +81,12 @@
|
||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
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 */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
|
@ -77,6 +105,14 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
5A4E0000000000000000000F /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
5A4E0000000000000000000B /* better-share-handler-models in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
|
|
@ -107,6 +143,7 @@
|
||||||
97C146F01CF9000F007C117D /* Runner */,
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
97C146EF1CF9000F007C117D /* Products */,
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
331C8082294A63A400263BE5 /* RunnerTests */,
|
331C8082294A63A400263BE5 /* RunnerTests */,
|
||||||
|
5A4E0000000000000000000C /* ShareExtension */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
|
@ -115,6 +152,7 @@
|
||||||
children = (
|
children = (
|
||||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||||
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
|
||||||
|
5A4E00000000000000000005 /* ShareExtension.appex */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -131,10 +169,22 @@
|
||||||
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
|
||||||
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */,
|
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */,
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
|
||||||
|
5A4E00000000000000000006 /* Runner.entitlements */,
|
||||||
);
|
);
|
||||||
path = Runner;
|
path = Runner;
|
||||||
sourceTree = "<group>";
|
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 */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
|
@ -165,11 +215,13 @@
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
|
5A4E00000000000000000011 /* Embed App Extensions */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
dependencies = (
|
dependencies = (
|
||||||
|
5A4E00000000000000000013 /* PBXTargetDependency */,
|
||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
packageProductDependencies = (
|
packageProductDependencies = (
|
||||||
|
|
@ -179,6 +231,26 @@
|
||||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||||
productType = "com.apple.product-type.application";
|
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 */
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
/* Begin PBXProject section */
|
/* Begin PBXProject section */
|
||||||
|
|
@ -197,6 +269,9 @@
|
||||||
CreatedOnToolsVersion = 7.3.1;
|
CreatedOnToolsVersion = 7.3.1;
|
||||||
LastSwiftMigration = 1100;
|
LastSwiftMigration = 1100;
|
||||||
};
|
};
|
||||||
|
5A4E0000000000000000000D = {
|
||||||
|
CreatedOnToolsVersion = 15.0;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||||
|
|
@ -210,6 +285,7 @@
|
||||||
mainGroup = 97C146E51CF9000F007C117D;
|
mainGroup = 97C146E51CF9000F007C117D;
|
||||||
packageReferences = (
|
packageReferences = (
|
||||||
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
|
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
|
||||||
|
5A4E00000000000000000014 /* XCLocalSwiftPackageReference "better_share_handler" */,
|
||||||
);
|
);
|
||||||
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
|
||||||
projectDirPath = "";
|
projectDirPath = "";
|
||||||
|
|
@ -217,6 +293,7 @@
|
||||||
targets = (
|
targets = (
|
||||||
97C146ED1CF9000F007C117D /* Runner */,
|
97C146ED1CF9000F007C117D /* Runner */,
|
||||||
331C8080294A63A400263BE5 /* RunnerTests */,
|
331C8080294A63A400263BE5 /* RunnerTests */,
|
||||||
|
5A4E0000000000000000000D /* ShareExtension */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
|
|
@ -240,6 +317,14 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
5A4E00000000000000000010 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
5A4E00000000000000000009 /* MainInterface.storyboard in Resources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXShellScriptBuildPhase section */
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
|
|
@ -295,6 +380,14 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
5A4E0000000000000000000E /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
5A4E00000000000000000008 /* ShareViewController.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
/* End PBXSourcesBuildPhase section */
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXTargetDependency section */
|
/* Begin PBXTargetDependency section */
|
||||||
|
|
@ -303,6 +396,11 @@
|
||||||
target = 97C146ED1CF9000F007C117D /* Runner */;
|
target = 97C146ED1CF9000F007C117D /* Runner */;
|
||||||
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
5A4E00000000000000000013 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 5A4E0000000000000000000D /* ShareExtension */;
|
||||||
|
targetProxy = 5A4E00000000000000000012 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
/* End PBXTargetDependency section */
|
/* End PBXTargetDependency section */
|
||||||
|
|
||||||
/* Begin PBXVariantGroup section */
|
/* Begin PBXVariantGroup section */
|
||||||
|
|
@ -322,6 +420,14 @@
|
||||||
name = LaunchScreen.storyboard;
|
name = LaunchScreen.storyboard;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
5A4E00000000000000000007 /* MainInterface.storyboard */ = {
|
||||||
|
isa = PBXVariantGroup;
|
||||||
|
children = (
|
||||||
|
5A4E00000000000000000002 /* Base */,
|
||||||
|
);
|
||||||
|
name = MainInterface.storyboard;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
/* End PBXVariantGroup section */
|
/* End PBXVariantGroup section */
|
||||||
|
|
||||||
/* Begin XCBuildConfiguration section */
|
/* Begin XCBuildConfiguration section */
|
||||||
|
|
@ -368,7 +474,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
|
|
@ -386,6 +492,7 @@
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = PK66NJM372;
|
DEVELOPMENT_TEAM = PK66NJM372;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
|
@ -495,7 +602,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
|
|
@ -546,7 +653,7 @@
|
||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = iphoneos;
|
SDKROOT = iphoneos;
|
||||||
SUPPORTED_PLATFORMS = iphoneos;
|
SUPPORTED_PLATFORMS = iphoneos;
|
||||||
|
|
@ -566,6 +673,7 @@
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = PK66NJM372;
|
DEVELOPMENT_TEAM = PK66NJM372;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
|
@ -589,6 +697,7 @@
|
||||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||||
DEVELOPMENT_TEAM = PK66NJM372;
|
DEVELOPMENT_TEAM = PK66NJM372;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
|
|
@ -602,6 +711,87 @@
|
||||||
};
|
};
|
||||||
name = Release;
|
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 */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
|
|
@ -635,6 +825,16 @@
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
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 */
|
/* End XCConfigurationList section */
|
||||||
|
|
||||||
/* Begin XCLocalSwiftPackageReference section */
|
/* Begin XCLocalSwiftPackageReference section */
|
||||||
|
|
@ -642,6 +842,10 @@
|
||||||
isa = XCLocalSwiftPackageReference;
|
isa = XCLocalSwiftPackageReference;
|
||||||
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
|
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 */
|
/* End XCLocalSwiftPackageReference section */
|
||||||
|
|
||||||
/* Begin XCSwiftPackageProductDependency section */
|
/* Begin XCSwiftPackageProductDependency section */
|
||||||
|
|
@ -649,6 +853,11 @@
|
||||||
isa = XCSwiftPackageProductDependency;
|
isa = XCSwiftPackageProductDependency;
|
||||||
productName = FlutterGeneratedPluginSwiftPackage;
|
productName = FlutterGeneratedPluginSwiftPackage;
|
||||||
};
|
};
|
||||||
|
5A4E00000000000000000015 /* better-share-handler-models */ = {
|
||||||
|
isa = XCSwiftPackageProductDependency;
|
||||||
|
package = 5A4E00000000000000000014 /* XCLocalSwiftPackageReference "better_share_handler" */;
|
||||||
|
productName = "better-share-handler-models";
|
||||||
|
};
|
||||||
/* End XCSwiftPackageProductDependency section */
|
/* End XCSwiftPackageProductDependency section */
|
||||||
};
|
};
|
||||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,15 @@
|
||||||
<string>matrix</string>
|
<string>matrix</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</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>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||||
|
|
|
||||||
10
ios/Runner/Runner.entitlements
Normal file
10
ios/Runner/Runner.entitlements
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?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>
|
||||||
24
ios/ShareExtension/Base.lproj/MainInterface.storyboard
Normal file
24
ios/ShareExtension/Base.lproj/MainInterface.storyboard
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?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>
|
||||||
41
ios/ShareExtension/Info.plist
Normal file
41
ios/ShareExtension/Info.plist
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?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>
|
||||||
10
ios/ShareExtension/ShareExtension.entitlements
Normal file
10
ios/ShareExtension/ShareExtension.entitlements
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?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>
|
||||||
5
ios/ShareExtension/ShareViewController.swift
Normal file
5
ios/ShareExtension/ShareViewController.swift
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
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,6 +5,9 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/foundation.dart";
|
import "package:flutter/foundation.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:nexus/controllers/client.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/account_data.dart";
|
||||||
import "package:nexus/models/push_rules.dart";
|
import "package:nexus/models/push_rules.dart";
|
||||||
import "package:nexus/models/requests/update_push_rule.dart";
|
import "package:nexus/models/requests/update_push_rule.dart";
|
||||||
|
|
@ -73,6 +76,45 @@ class AccountDataController extends Notifier<AccountData> {
|
||||||
(data) => data.ignoredUserList.contains(userId) == ignored,
|
(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
|
/// Saves [rule] of [kind], creating it if it's new, or otherwise changing only
|
||||||
/// its actions and whether it's enabled.
|
/// its actions and whether it's enabled.
|
||||||
Future<void> savePushRule(PushRuleKind kind, PushRule rule) {
|
Future<void> savePushRule(PushRuleKind kind, PushRule rule) {
|
||||||
|
|
|
||||||
24
lib/controllers/account_management.dart
Normal file
24
lib/controllers/account_management.dart
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
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(
|
BotArgumentSuggestion(
|
||||||
title: displayName ?? userId.localpart,
|
title: displayName ?? userId.localpart!,
|
||||||
subtitle: userId,
|
subtitle: userId,
|
||||||
avatar: avatarUrl,
|
avatar: avatarUrl,
|
||||||
text: userId,
|
text: userId,
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class BotCommandsController(final String roomId)
|
||||||
) =>
|
) =>
|
||||||
BotCommand(
|
BotCommand(
|
||||||
sender: sender,
|
sender: sender,
|
||||||
botName: displayName ?? sender.localpart,
|
botName: displayName ?? sender.localpart!,
|
||||||
botAvatar: avatarUrl,
|
botAvatar: avatarUrl,
|
||||||
description: description,
|
description: description,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,8 @@ import "package:nexus/models/requests/get_mentions.dart";
|
||||||
import "package:nexus/models/requests/get_related_events.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_room_state.dart";
|
||||||
import "package:nexus/models/requests/get_specific_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_space_hierarchy.dart";
|
||||||
import "package:nexus/models/requests/get_room_directory.dart";
|
import "package:nexus/models/requests/get_room_directory.dart";
|
||||||
import "package:nexus/models/requests/get_threads.dart";
|
import "package:nexus/models/requests/get_threads.dart";
|
||||||
|
|
@ -280,24 +282,19 @@ class ClientController(final String? accountId) extends AsyncNotifier<int> {
|
||||||
Future<void> resetEncryption(RecoveryKey key) =>
|
Future<void> resetEncryption(RecoveryKey key) =>
|
||||||
sendCommand("reset_encryption", key.toJson());
|
sendCommand("reset_encryption", key.toJson());
|
||||||
|
|
||||||
Future<Uri?> getCrossSigningResetUrl(Uri homeserver) async {
|
Future<AccountManagement?> getAccountManagement(Uri homeserver) async =>
|
||||||
const action = "org.matrix.cross_signing_reset";
|
switch ((await sendCommand("get_login_flows", {
|
||||||
final oauth = (await sendCommand("get_login_flows", {
|
|
||||||
"homeserver_url": homeserver.toString(),
|
"homeserver_url": homeserver.toString(),
|
||||||
}))["oauth"];
|
}))["oauth"]) {
|
||||||
|
{"account_management_uri": final String uri} && final oauth => .new(
|
||||||
if (oauth?["account_management_uri"] case final String uri
|
.parse(uri),
|
||||||
when (oauth["account_management_actions_supported"] as List?)?.contains(
|
.new(
|
||||||
action,
|
(oauth["account_management_actions_supported"] as List? ?? [])
|
||||||
) ??
|
.whereType<String>(),
|
||||||
false) {
|
),
|
||||||
final parsed = Uri.parse(uri);
|
),
|
||||||
return parsed.replace(
|
_ => null,
|
||||||
queryParameters: {...parsed.queryParameters, "action": action},
|
};
|
||||||
);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> joinRoom(JoinRoomRequest request) async =>
|
Future<String> joinRoom(JoinRoomRequest request) async =>
|
||||||
(await sendCommand("join_room", request.toJson()))["room_id"];
|
(await sendCommand("join_room", request.toJson()))["room_id"];
|
||||||
|
|
@ -336,15 +333,50 @@ 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(
|
Future<IList<Event>> getSpecificRoomState(
|
||||||
GetSpecificRoomStateRequest request,
|
GetSpecificRoomStateRequest request,
|
||||||
) async => .new(
|
) async => .new(
|
||||||
((await sendCommand("get_specific_room_state", request.toJson()))
|
(await getSpecificRoomStateJson(request)).map((event) => .fromJson(event)),
|
||||||
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(
|
Future<IList<Event>?> getRelatedEvents(
|
||||||
GetRelatedEventsRequest request,
|
GetRelatedEventsRequest request,
|
||||||
) async {
|
) async {
|
||||||
|
|
@ -414,17 +446,17 @@ class ClientController(final String? accountId) extends AsyncNotifier<int> {
|
||||||
Future<void> registerPusher(RegisterPusherRequest request) =>
|
Future<void> registerPusher(RegisterPusherRequest request) =>
|
||||||
sendCommand("register_homeserver_push", request.toJson());
|
sendCommand("register_homeserver_push", request.toJson());
|
||||||
|
|
||||||
Future<void> deregisterPusher(DeregisterPusherRequest request) =>
|
Future<void> deregisterPusher(DeregisterPusherRequest request) => sendCommand(
|
||||||
sendCommand("register_homeserver_push", {
|
"register_homeserver_push",
|
||||||
...request.toJson(),
|
{...request.toJson(), "kind": null},
|
||||||
"kind": null,
|
);
|
||||||
});
|
|
||||||
|
|
||||||
Future<MessageContent> uploadMedia(UploadMediaRequest request) async =>
|
Future<MessageContent> uploadMedia(UploadMediaRequest request) async =>
|
||||||
.fromJson(await sendCommand("upload_media", request.toJson()));
|
.fromJson(await sendCommand("upload_media", request.toJson()));
|
||||||
|
|
||||||
Future<File> downloadMedia(DownloadMediaRequest request) async {
|
Future<File> downloadMedia(DownloadMediaRequest request) async {
|
||||||
if (accountId == null &&
|
if (accountId == null &&
|
||||||
|
!isInBackground &&
|
||||||
ref.read(ClientStateController.provider)?.isLoggedIn != true) {
|
ref.read(ClientStateController.provider)?.isLoggedIn != true) {
|
||||||
throw StateError("Can't download media while logged out");
|
throw StateError("Can't download media while logged out");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
|
import "package:fluttertagger/fluttertagger.dart";
|
||||||
import "package:nexus/controllers/attachment.dart";
|
import "package:nexus/controllers/attachment.dart";
|
||||||
import "package:nexus/controllers/bot_command_draft.dart";
|
import "package:nexus/controllers/bot_command_draft.dart";
|
||||||
import "package:nexus/controllers/rooms.dart";
|
import "package:nexus/controllers/rooms.dart";
|
||||||
import "package:nexus/helpers/extensions/get_filename.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/is_media.dart";
|
||||||
import "package:nexus/helpers/extensions/with_latest_edit.dart";
|
import "package:nexus/helpers/extensions/with_latest_edit.dart";
|
||||||
import "package:nexus/models/composer_draft.dart";
|
import "package:nexus/models/composer_draft.dart";
|
||||||
|
|
@ -49,8 +52,10 @@ class ComposerDraftController(final ComposerParams composer)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final tagged = _restoreTags(text);
|
||||||
state = ComposerDraft(
|
state = ComposerDraft(
|
||||||
text: text,
|
text: tagged.text,
|
||||||
|
tags: tagged.tags,
|
||||||
textCommands: commands,
|
textCommands: commands,
|
||||||
relatedEvent: rowId,
|
relatedEvent: rowId,
|
||||||
relationType: .edit,
|
relationType: .edit,
|
||||||
|
|
@ -76,6 +81,52 @@ class ComposerDraftController(final ComposerParams composer)
|
||||||
_botCommand.clear();
|
_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() {
|
void dismiss() {
|
||||||
if (state.isEditing) return _restoreBeforeEdit();
|
if (state.isEditing) return _restoreBeforeEdit();
|
||||||
state = state.copyWith(relatedEvent: null);
|
state = state.copyWith(relatedEvent: null);
|
||||||
|
|
|
||||||
10
lib/controllers/launch_scope.dart
Normal file
10
lib/controllers/launch_scope.dart
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
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,11 +2,15 @@ import "dart:async";
|
||||||
import "dart:convert";
|
import "dart:convert";
|
||||||
import "dart:io";
|
import "dart:io";
|
||||||
|
|
||||||
|
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||||
import "package:flutter/services.dart";
|
import "package:flutter/services.dart";
|
||||||
import "package:material_ui/material_ui.dart";
|
import "package:material_ui/material_ui.dart";
|
||||||
import "package:nexus/controllers/active_account.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/portal.dart";
|
||||||
|
import "package:nexus/controllers/rooms.dart";
|
||||||
import "package:nexus/controllers/sidebar_page.dart";
|
import "package:nexus/controllers/sidebar_page.dart";
|
||||||
|
import "package:nexus/helpers/shown_notifications_helper.dart";
|
||||||
import "package:nexus/main.dart";
|
import "package:nexus/main.dart";
|
||||||
import "package:flutter_local_notifications/flutter_local_notifications.dart";
|
import "package:flutter_local_notifications/flutter_local_notifications.dart";
|
||||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
|
|
@ -26,7 +30,17 @@ class NotificationController
|
||||||
Future<FlutterLocalNotificationsPlugin> build() async {
|
Future<FlutterLocalNotificationsPlugin> build() async {
|
||||||
final notifications = FlutterLocalNotificationsPlugin();
|
final notifications = FlutterLocalNotificationsPlugin();
|
||||||
|
|
||||||
if (!Platform.isLinux) {
|
if (Platform.isLinux) {
|
||||||
|
const MethodChannel("nexus/notifications")
|
||||||
|
.setMethodCallHandler((call) async {
|
||||||
|
if (call case MethodCall(
|
||||||
|
method: "notificationClicked",
|
||||||
|
arguments: final String payload,
|
||||||
|
)) {
|
||||||
|
_open(payload);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
final darwin = DarwinInitializationSettings();
|
final darwin = DarwinInitializationSettings();
|
||||||
|
|
||||||
await notifications.initialize(
|
await notifications.initialize(
|
||||||
|
|
@ -44,26 +58,89 @@ class NotificationController
|
||||||
if (details.payload case final payload?) _open(payload);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Platform.isLinux) {
|
// Reading a room, here or on another client, dismisses its notifications
|
||||||
const notificationChannel = MethodChannel("nexus/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;
|
||||||
|
|
||||||
notificationChannel.setMethodCallHandler((call) async {
|
final accountId = ref.read(ActiveAccountController.provider);
|
||||||
if (call.method != "notificationClicked") {
|
dismiss(
|
||||||
return;
|
newlyRead.map((roomId) => threadIdFor(accountId, roomId)).toISet(),
|
||||||
}
|
).onError(showError);
|
||||||
|
},
|
||||||
if (call.arguments case final String payload) _open(payload);
|
fireImmediately: true,
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return notifications;
|
return notifications;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String threadIdFor(String accountId, String roomId) =>
|
||||||
|
"$accountId/$roomId";
|
||||||
|
|
||||||
static String payloadFor(String accountId, int rowId) => "$accountId:$rowId";
|
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) {
|
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, rowId) = switch (payload.split(":")) {
|
||||||
[final accountId, final rowId] => (accountId, int.tryParse(rowId)),
|
[final accountId, final rowId] => (accountId, int.tryParse(rowId)),
|
||||||
// From before notifications were per account
|
// From before notifications were per account
|
||||||
|
|
@ -72,9 +149,6 @@ class NotificationController
|
||||||
};
|
};
|
||||||
if (rowId == null) return;
|
if (rowId == null) return;
|
||||||
|
|
||||||
navigatorKey.currentState?.popUntil((route) => route.isFirst);
|
|
||||||
ref.read(SidebarPageController.provider.notifier).set(.notifications);
|
|
||||||
|
|
||||||
ref
|
ref
|
||||||
.read(ActiveAccountController.provider.notifier)
|
.read(ActiveAccountController.provider.notifier)
|
||||||
.switchTo(
|
.switchTo(
|
||||||
|
|
@ -84,29 +158,21 @@ class NotificationController
|
||||||
.onError(showError);
|
.onError(showError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Each resolves to null except on its own platform
|
||||||
Future<bool> requestPermissions() async {
|
Future<bool> requestPermissions() async {
|
||||||
if (Platform.isLinux) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
final controller = await future;
|
final controller = await future;
|
||||||
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
return await controller
|
return await controller
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
IOSFlutterLocalNotificationsPlugin
|
IOSFlutterLocalNotificationsPlugin
|
||||||
>()
|
>()
|
||||||
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
||||||
true;
|
await controller
|
||||||
} else if (Platform.isMacOS) {
|
|
||||||
return await controller
|
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
MacOSFlutterLocalNotificationsPlugin
|
MacOSFlutterLocalNotificationsPlugin
|
||||||
>()
|
>()
|
||||||
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
?.requestPermissions(alert: true, badge: true, sound: true) ??
|
||||||
true;
|
await controller
|
||||||
} else if (Platform.isAndroid) {
|
|
||||||
return await controller
|
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
AndroidFlutterLocalNotificationsPlugin
|
AndroidFlutterLocalNotificationsPlugin
|
||||||
>()
|
>()
|
||||||
|
|
@ -114,35 +180,23 @@ class NotificationController
|
||||||
true;
|
true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Whether notifications can currently be shown, without prompting
|
/// Whether notifications can currently be shown, without prompting
|
||||||
Future<bool> permissionsGranted() async {
|
Future<bool> permissionsGranted() async {
|
||||||
if (Platform.isLinux) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
final controller = await future;
|
final controller = await future;
|
||||||
|
|
||||||
if (Platform.isIOS) {
|
|
||||||
return (await controller
|
return (await controller
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
IOSFlutterLocalNotificationsPlugin
|
IOSFlutterLocalNotificationsPlugin
|
||||||
>()
|
>()
|
||||||
?.checkPermissions())
|
?.checkPermissions())
|
||||||
?.isEnabled ??
|
?.isEnabled ??
|
||||||
true;
|
(await controller
|
||||||
} else if (Platform.isMacOS) {
|
|
||||||
return (await controller
|
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
MacOSFlutterLocalNotificationsPlugin
|
MacOSFlutterLocalNotificationsPlugin
|
||||||
>()
|
>()
|
||||||
?.checkPermissions())
|
?.checkPermissions())
|
||||||
?.isEnabled ??
|
?.isEnabled ??
|
||||||
true;
|
await controller
|
||||||
} else if (Platform.isAndroid) {
|
|
||||||
return await controller
|
|
||||||
.resolvePlatformSpecificImplementation<
|
.resolvePlatformSpecificImplementation<
|
||||||
AndroidFlutterLocalNotificationsPlugin
|
AndroidFlutterLocalNotificationsPlugin
|
||||||
>()
|
>()
|
||||||
|
|
@ -150,9 +204,6 @@ class NotificationController
|
||||||
true;
|
true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Passing [message] shows it as a chat message in the conversation for
|
/// Passing [message] shows it as a chat message in the conversation for
|
||||||
/// [threadId], naming the sender in group chats. [subtitle] is shown on
|
/// [threadId], naming the sender in group chats. [subtitle] is shown on
|
||||||
/// platforms that support it.
|
/// platforms that support it.
|
||||||
|
|
@ -173,6 +224,7 @@ class NotificationController
|
||||||
// In DMs the title is already the sender
|
// In DMs the title is already the sender
|
||||||
final sender = message == null || message.isDm ? null : message.sender;
|
final sender = message == null || message.isDm ? null : message.sender;
|
||||||
final prefixedBody = sender == null ? body : "${sender.name}: $body";
|
final prefixedBody = sender == null ? body : "${sender.name}: $body";
|
||||||
|
final shown = ref.read(ShownNotificationsHelper.provider);
|
||||||
|
|
||||||
if (Platform.isLinux) {
|
if (Platform.isLinux) {
|
||||||
final portal = await ref.read(PortalController.provider.future);
|
final portal = await ref.read(PortalController.provider.future);
|
||||||
|
|
@ -199,6 +251,7 @@ class NotificationController
|
||||||
// ),
|
// ),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
if (threadId != null) await shown.add(threadId, id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,6 +267,7 @@ class NotificationController
|
||||||
.onError((_, _) => null)
|
.onError((_, _) => null)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
final largeIcon = icon == null ? null : FilePathAndroidBitmap(icon.path);
|
||||||
final darwin = DarwinNotificationDetails(
|
final darwin = DarwinNotificationDetails(
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
presentSound: sound,
|
presentSound: sound,
|
||||||
|
|
@ -230,24 +284,24 @@ class NotificationController
|
||||||
? .new(
|
? .new(
|
||||||
"general",
|
"general",
|
||||||
"General",
|
"General",
|
||||||
|
groupKey: _androidGroup,
|
||||||
subText: subtitle,
|
subText: subtitle,
|
||||||
silent: !sound,
|
silent: !sound,
|
||||||
when: timestamp?.millisecondsSinceEpoch,
|
when: timestamp?.millisecondsSinceEpoch,
|
||||||
largeIcon: icon == null
|
largeIcon: largeIcon,
|
||||||
? null
|
|
||||||
: FilePathAndroidBitmap(icon.path),
|
|
||||||
styleInformation: BigTextStyleInformation(body),
|
styleInformation: BigTextStyleInformation(body),
|
||||||
)
|
)
|
||||||
: .new(
|
: .new(
|
||||||
"messages",
|
_messagesChannel,
|
||||||
"Messages",
|
"Messages",
|
||||||
|
importance: .high,
|
||||||
|
priority: .high,
|
||||||
|
groupKey: _androidGroup,
|
||||||
subText: subtitle,
|
subText: subtitle,
|
||||||
silent: !sound,
|
silent: !sound,
|
||||||
when: timestamp?.millisecondsSinceEpoch,
|
when: timestamp?.millisecondsSinceEpoch,
|
||||||
category: .message,
|
category: .message,
|
||||||
largeIcon: icon == null
|
largeIcon: largeIcon,
|
||||||
? null
|
|
||||||
: FilePathAndroidBitmap(icon.path),
|
|
||||||
styleInformation: MessagingStyleInformation(
|
styleInformation: MessagingStyleInformation(
|
||||||
.new(key: message.self.id, name: message.self.name),
|
.new(key: message.self.id, name: message.self.name),
|
||||||
conversationTitle: message.isDm ? null : title,
|
conversationTitle: message.isDm ? null : title,
|
||||||
|
|
@ -260,11 +314,12 @@ class NotificationController
|
||||||
.new(
|
.new(
|
||||||
key: message.sender.id,
|
key: message.sender.id,
|
||||||
name: message.sender.name,
|
name: message.sender.name,
|
||||||
icon: message.senderAvatar == null
|
icon: switch (message.senderAvatar) {
|
||||||
? null
|
final avatar? => BitmapFilePathAndroidIcon(
|
||||||
: BitmapFilePathAndroidIcon(
|
avatar.path,
|
||||||
message.senderAvatar!.path,
|
|
||||||
),
|
),
|
||||||
|
null => null,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -281,6 +336,28 @@ 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 =
|
static final provider =
|
||||||
|
|
|
||||||
45
lib/controllers/pending_subprofiles.dart
Normal file
45
lib/controllers/pending_subprofiles.dart
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
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,6 +7,8 @@ import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||||
import "package:fluttertagger/fluttertagger.dart";
|
import "package:fluttertagger/fluttertagger.dart";
|
||||||
import "package:nexus/controllers/attachment.dart";
|
import "package:nexus/controllers/attachment.dart";
|
||||||
import "package:nexus/controllers/client.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/event.dart";
|
||||||
import "package:nexus/controllers/rooms.dart";
|
import "package:nexus/controllers/rooms.dart";
|
||||||
import "package:nexus/controllers/thread_replies.dart";
|
import "package:nexus/controllers/thread_replies.dart";
|
||||||
|
|
@ -399,6 +401,7 @@ class RoomChatController(final ChatParams info)
|
||||||
required RelationType relationType,
|
required RelationType relationType,
|
||||||
int? relatedEventRowId,
|
int? relatedEventRowId,
|
||||||
}) async {
|
}) async {
|
||||||
|
final subprofile = subprofileFor(text);
|
||||||
final events = ref.read(RoomsController.provider)[info.roomId]?.events;
|
final events = ref.read(RoomsController.provider)[info.roomId]?.events;
|
||||||
final relatedEvent = relatedEventRowId == null
|
final relatedEvent = relatedEventRowId == null
|
||||||
? null
|
? null
|
||||||
|
|
@ -437,6 +440,7 @@ class RoomChatController(final ChatParams info)
|
||||||
);
|
);
|
||||||
|
|
||||||
final client = ref.read(ClientController.provider.notifier);
|
final client = ref.read(ClientController.provider.notifier);
|
||||||
|
await awaitSubprofile(text, subprofile);
|
||||||
final event = await client.sendMessage(
|
final event = await client.sendMessage(
|
||||||
SendMessageRequest(
|
SendMessageRequest(
|
||||||
roomId: info.roomId,
|
roomId: info.roomId,
|
||||||
|
|
@ -458,6 +462,24 @@ class RoomChatController(final ChatParams info)
|
||||||
addSent(event);
|
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.
|
/// Shows [event], which was just sent, until it comes down sync.
|
||||||
void addSent(Event? event) {
|
void addSent(Event? event) {
|
||||||
if (event case final event?) {
|
if (event case final event?) {
|
||||||
|
|
@ -614,6 +636,7 @@ class RoomChatController(final ChatParams info)
|
||||||
.read(RoomsController.provider)[info.roomId]
|
.read(RoomsController.provider)[info.roomId]
|
||||||
?.events[repliedEventRowId];
|
?.events[repliedEventRowId];
|
||||||
|
|
||||||
|
await awaitSubprofile("", subprofileFor(""));
|
||||||
final event = await ref
|
final event = await ref
|
||||||
.read(ClientController.provider.notifier)
|
.read(ClientController.provider.notifier)
|
||||||
.sendMessage(
|
.sendMessage(
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue