Compare commits

...
Author SHA1 Message Date
2e6fa1e7d8
fix nix build 2026-12-03 11:34:52 -05:00
a7a21f4d1a
gate invite behind PL check 2026-12-02 16:08:49 -05:00
f33865962b
fix fluttertagger hash 2026-12-02 15:27:01 -05:00
9d495410f6
make webpush enabled check better
Because Continuwuity sends a VAPID even when webpush is disabled.
2026-12-02 13:50:34 -05:00
7424bec0fb
bump fluttertagger to fix RangeError 2026-12-02 13:44:56 -05:00
32df549215
fixup OSK with patched GTK
I am really looking forward to dropping all this on a new GTK version.
2026-12-01 18:05:00 -05:00
5d15236903
override RUNPATH to put patched gtk3 first 2026-12-01 12:55:50 -05:00
c9fdda41d1
hide the runtime's GTK3 from nix2flatpak, so it bundles our patched one 2026-12-01 12:19:29 -05:00
fb5e14091e
don't rebuild half the world for the gtk3 patch 2026-12-01 11:50:00 -05:00
5b73e998df
backport a GTK patch so the flatpak doesn't crash 2026-12-01 11:10:02 -05:00
784db4f1dd
open reaction image on long press anywhere in its tab 2026-12-01 02:02:14 -05:00
dccbda7870
make all ExpandableImages downloadable
There might have been a reason why I didn't do this but I don't remember it...
2026-12-01 01:59:08 -05:00
d5f04122eb
added subprofile search 2026-11-29 14:16:20 -05:00
7435ecd5f0
don't send empty messages if only a subprofile trigger is sent 2026-11-29 14:13:33 -05:00
9f2d223809
fix inline images not getting spoilered 2026-11-28 11:42:34 -05:00
a7e60b9464
use canonical alias ahead of room id for mentions 2026-11-26 17:49:10 -05:00
6e6bcaaad1
support a lot more events to be rendered
Also adds show hidden events setting.

Fixes #178
2026-11-26 17:19:19 -05:00
3cf0b811bb
PMP race condition fixes 2026-11-26 16:21:43 -05:00
c786344bf2
add dynamic hinting and latching for PMPs 2026-11-26 16:06:08 -05:00
225497030e
fixup PMPs in encrypted rooms 2026-11-26 15:54:51 -05:00
4800123044
tweak PMP support 2026-11-26 15:50:57 -05:00
3b7a4c0cd4
add PMP support
Fixes #175
2026-11-26 15:31:38 -05:00
f80ceb0736
don't pass is_avatar for avatars
This is because Gomuks will not give AVIFs back for avatars./
2026-11-26 15:10:08 -05:00
6e3bc596fd
clean up account management settings 2026-11-26 15:00:51 -05:00
79d556a830
add account management page
Fixes #176
2026-11-26 14:41:58 -05:00
8d4745cc12
add the ability to change your profile per-room
Fixes #177
2026-11-26 14:31:24 -05:00
69f175babe
replace deprecated field in build hook 2026-11-26 13:50:20 -05:00
f6b9deee86
update ordering settings 2026-11-26 12:54:16 -05:00
701024b5f6
fixup subspace ordering 2026-11-26 11:49:33 -05:00
dcb160556e
add space order option to room ordering
Fixes #185
2026-11-26 11:38:04 -05:00
1e25cbf822
adjust emoji search placeholder 2026-11-26 11:29:21 -05:00
cba13aa6c7
fixup room selected fallbacks 2026-11-26 10:53:00 -05:00
77f06005e5
swap sharing library, simplify code 2026-11-26 01:06:47 -05:00
7bae610c05
fixup android sharing 2026-11-26 00:55:00 -05:00
09f9b56e34
fix ios build
(hopefully)
2026-11-26 00:49:07 -05:00
1c533b5330
notif fixups 2026-11-26 00:41:05 -05:00
78c6b2ef46
add sharing support
needs more testing
2026-11-25 16:57:33 -05:00
432064e111
subspace sorting
Fixes #183
2026-11-25 16:29:09 -05:00
b63fcc30b7
Video handling improvements
Fixes #181
2026-11-25 16:15:42 -05:00
5df7c2c00a
improve ctrl+f handling 2026-11-25 15:58:43 -05:00
f2494db2ee
add ctrl+f shortcut for room search
Fixes #179
2026-11-25 15:52:17 -05:00
3ba258d6b4
Clearer revealed spoilers
Fixes #184
2026-11-25 15:50:59 -05:00
36a43a7a36
Restore tags on edit
Fixes #182
2026-11-25 15:48:40 -05:00
2c1ccc4728
use dot shorthands where possible in notif code 2026-11-25 15:28:51 -05:00
c3b39a6294
refactor notif code 2026-11-25 15:23:26 -05:00
23d77ddc60
high importance and high priority for notifications 2026-11-25 15:18:07 -05:00
322217fc20
try to dismiss notifications when read 2026-11-25 15:14:52 -05:00
b680add183
try to fix android group issues 2026-11-25 14:41:24 -05:00
7391a5a50c
fix deprecation warning 2026-11-25 14:37:57 -05:00
812183cc00
fix subsubspaces showing as regular rooms 2026-11-24 13:07:33 -05:00
be69358ea4
hide room header when empty 2026-11-24 13:05:57 -05:00
b0d22e5570
fix issue when mentioning room with invalid canonical aliases 2026-11-24 12:57:19 -05:00
720e538dbc
unfocus textfield when outside tap on mobile 2026-11-23 14:23:00 -05:00
92 changed files with 3134 additions and 919 deletions

View file

@ -15,6 +15,8 @@
"underride", "underride",
"unifiedpush", "unifiedpush",
"unredact", "unredact",
"webpush" "webpush",
"subprofile",
"subprofiles"
] ]
} }

View file

@ -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"

View file

@ -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:

View file

@ -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 */;

View file

@ -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>

View 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>

View 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>

View 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>

View 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>

View 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 {}

View file

@ -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) {

View 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,
);
}

View file

@ -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,

View file

@ -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,
), ),

View file

@ -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(
.parse(uri),
if (oauth?["account_management_uri"] case final String uri .new(
when (oauth["account_management_actions_supported"] as List?)?.contains( (oauth["account_management_actions_supported"] as List? ?? [])
action, .whereType<String>(),
) ?? ),
false) { ),
final parsed = Uri.parse(uri); _ => null,
return parsed.replace( };
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");
} }

View file

@ -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);

View 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,
);
}

View file

@ -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,73 +158,50 @@ 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) ?? await controller
true; .resolvePlatformSpecificImplementation<
} else if (Platform.isMacOS) { MacOSFlutterLocalNotificationsPlugin
return await controller >()
.resolvePlatformSpecificImplementation< ?.requestPermissions(alert: true, badge: true, sound: true) ??
MacOSFlutterLocalNotificationsPlugin await controller
>() .resolvePlatformSpecificImplementation<
?.requestPermissions(alert: true, badge: true, sound: true) ?? AndroidFlutterLocalNotificationsPlugin
true; >()
} else if (Platform.isAndroid) { ?.requestNotificationsPermission() ??
return await controller true;
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>()
?.requestNotificationsPermission() ??
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 ?? (await controller
true; .resolvePlatformSpecificImplementation<
} else if (Platform.isMacOS) { MacOSFlutterLocalNotificationsPlugin
return (await controller >()
.resolvePlatformSpecificImplementation< ?.checkPermissions())
MacOSFlutterLocalNotificationsPlugin ?.isEnabled ??
>() await controller
?.checkPermissions()) .resolvePlatformSpecificImplementation<
?.isEnabled ?? AndroidFlutterLocalNotificationsPlugin
true; >()
} else if (Platform.isAndroid) { ?.areNotificationsEnabled() ??
return await controller true;
.resolvePlatformSpecificImplementation<
AndroidFlutterLocalNotificationsPlugin
>()
?.areNotificationsEnabled() ??
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
@ -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 =

View 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);
}

View file

@ -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