From 62c7a4f4eb649456c231a3e4210a978893a272ad Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 6 Sep 2023 10:51:02 -0700 Subject: [PATCH 1/4] Fixup Test and FFI --- .../features/04_profile_mgmt/01_create_delete.feature | 4 ++-- lib/cwtch/ffi.dart | 2 +- lib/views/filesharingview.dart | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration_test/features/04_profile_mgmt/01_create_delete.feature b/integration_test/features/04_profile_mgmt/01_create_delete.feature index c656035a..a92572be 100644 --- a/integration_test/features/04_profile_mgmt/01_create_delete.feature +++ b/integration_test/features/04_profile_mgmt/01_create_delete.feature @@ -74,7 +74,7 @@ Feature: Basic Profile Management When I tap the "IconButton" widget with tooltip "Edit Profile Alice (Encrypted)" Then I expect the text 'Display Name' to be present Then I fill the "displayNameFormElement" field with "Carol (Encrypted)" - And I tap the "button" widget with label "Save Profile" + And I tap the widget that contains the text "Save Profile" And I wait until the widget with type 'ProfileMgrView' is present Then I expect a "ProfileRow" widget with text "Carol (Encrypted)" @@ -90,7 +90,7 @@ Feature: Basic Profile Management When I tap the "IconButton" widget with tooltip "Edit Profile Carol (Encrypted)" Then I expect the text 'Display Name' to be present Then I fill the "currentPasswordFormElement" field with "password1" - When I tap the button that contains the text "Delete" + And I tap the widget that contains the text "Delete" Then I wait for 2 seconds When I tap the "button" widget with label "Really Delete Profile" And I wait until the widget with type 'ProfileMgrView' is present diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index 7bcffcfd..ef837140 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -892,7 +892,7 @@ class CwtchFfi implements Cwtch { @override void StopSharing(String profile, String filekey) { - var stopSharingC = library.lookup>("c_StopSharing"); + var stopSharingC = library.lookup>("c_StopFileShare"); // ignore: non_constant_identifier_names final StopSharing = stopSharingC.asFunction(); final utf8profile = profile.toNativeUtf8(); diff --git a/lib/views/filesharingview.dart b/lib/views/filesharingview.dart index 62fda176..50c7fe5e 100644 --- a/lib/views/filesharingview.dart +++ b/lib/views/filesharingview.dart @@ -51,7 +51,7 @@ class _FileSharingViewState extends State { semanticChildCount: sharedFiles.length, itemBuilder: (context, index) { String filekey = sharedFiles[index]["FileKey"]; - EnvironmentConfig.debugLog("$sharedFiles " + sharedFiles[index].toString()); + //EnvironmentConfig.debugLog("$sharedFiles " + sharedFiles[index].toString()); return SwitchListTile( title: Text(sharedFiles[index]["Path"]), subtitle: Text(sharedFiles[index]["DateShared"]), From c0f23fe647c6b1309307e4ff43f229a14a878f7d Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 6 Sep 2023 10:54:05 -0700 Subject: [PATCH 2/4] Upgrade Cwtch --- LIBCWTCH-GO.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LIBCWTCH-GO.version b/LIBCWTCH-GO.version index 0e5f97cb..6184cfee 100644 --- a/LIBCWTCH-GO.version +++ b/LIBCWTCH-GO.version @@ -1 +1 @@ -2023-08-22-14-06-v0.0.6 \ No newline at end of file +2023-08-31-11-56-v0.0.6-2-gf32ad74 \ No newline at end of file From a0a00b1adec9c167ef11e562e51144944c6ed238 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 6 Sep 2023 10:54:24 -0700 Subject: [PATCH 3/4] More clear comment --- lib/views/filesharingview.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/views/filesharingview.dart b/lib/views/filesharingview.dart index 50c7fe5e..3c6a567b 100644 --- a/lib/views/filesharingview.dart +++ b/lib/views/filesharingview.dart @@ -51,7 +51,9 @@ class _FileSharingViewState extends State { semanticChildCount: sharedFiles.length, itemBuilder: (context, index) { String filekey = sharedFiles[index]["FileKey"]; - //EnvironmentConfig.debugLog("$sharedFiles " + sharedFiles[index].toString()); + // This makes the UI *very* slow when enabled. But can be useful for debugging + // Uncomment if necessary. + // EnvironmentConfig.debugLog("$sharedFiles " + sharedFiles[index].toString()); return SwitchListTile( title: Text(sharedFiles[index]["Path"]), subtitle: Text(sharedFiles[index]["DateShared"]), From 60b2b34abc1f0b2a94b9bb7d170106a08d0f6390 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 6 Sep 2023 10:54:51 -0700 Subject: [PATCH 4/4] Formatting --- lib/cwtch/ffi.dart | 3 --- lib/cwtch/gomobile.dart | 1 - lib/models/profile.dart | 1 - lib/settings.dart | 2 +- lib/views/peersettingsview.dart | 20 ++++++++++++-------- lib/views/remoteserverview.dart | 9 +++++---- lib/widgets/messagelist.dart | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index ef837140..665276e4 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -924,9 +924,6 @@ class CwtchFfi implements Cwtch { malloc.free(u1); } - - - @override bool IsServersCompiled() { return library.providesSymbol("c_LoadServers"); diff --git a/lib/cwtch/gomobile.dart b/lib/cwtch/gomobile.dart index 8072c5f4..ada66b34 100644 --- a/lib/cwtch/gomobile.dart +++ b/lib/cwtch/gomobile.dart @@ -365,7 +365,6 @@ class CwtchGomobile implements Cwtch { cwtchPlatform.invokeMethod("DeleteServerInfo", {"ProfileOnion": profile, "handle": handle}); } - @override void UpdateSettings(String json) { cwtchPlatform.invokeMethod("UpdateSettings", {"json": json}); diff --git a/lib/models/profile.dart b/lib/models/profile.dart index d80bcce8..49a3e4c4 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -68,7 +68,6 @@ class ProfileInfoState extends ChangeNotifier { this._contacts.addAll(contacts.map((contact) { this._unreadMessages += contact["numUnread"] as int; - return ContactInfoState(this.onion, contact["identifier"], contact["onion"], nickname: contact["name"], localNickname: contact["attributes"]?["local.profile.name"] ?? "", // contact may not have a local name diff --git a/lib/settings.dart b/lib/settings.dart index 1366f7e9..98514826 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -134,7 +134,7 @@ class Settings extends ChangeNotifier { // Decide whether to enable Experiments var fontScale = settings["FontScaling"]; if (fontScale == null) { - fontScale = 1.0; + fontScale = 1.0; } _fontScaling = double.parse(fontScale.toString()).clamp(0.5, 2.0); diff --git a/lib/views/peersettingsview.dart b/lib/views/peersettingsview.dart index 07031b28..dcf721b4 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -217,12 +217,12 @@ class _PeerSettingsViewState extends State { subtitle: Text(AppLocalizations.of(context)!.savePeerHistoryDescription), leading: Icon(CwtchIcons.peer_history, color: settings.current().mainTextColor), trailing: DropdownButton( - value: (Provider.of(context).savePeerHistory == "DefaultDeleteHistory" || - Provider.of(context).savePeerHistory == "HistoryDefault") - ? AppLocalizations.of(context)!.conversationNotificationPolicyDefault - : (Provider.of(context).savePeerHistory == "SaveHistory" - ? AppLocalizations.of(context)!.savePeerHistory - : AppLocalizations.of(context)!.dontSavePeerHistory), + value: + (Provider.of(context).savePeerHistory == "DefaultDeleteHistory" || Provider.of(context).savePeerHistory == "HistoryDefault") + ? AppLocalizations.of(context)!.conversationNotificationPolicyDefault + : (Provider.of(context).savePeerHistory == "SaveHistory" + ? AppLocalizations.of(context)!.savePeerHistory + : AppLocalizations.of(context)!.dontSavePeerHistory), onChanged: (newValue) { setState(() { // Set whether or not to dave the Contact History... @@ -234,7 +234,7 @@ class _PeerSettingsViewState extends State { const HistoryDefault = "HistoryDefault"; // NOTE: .savePeerHistory is used to show ephemeral warnings so it's state is important to update. - if(newValue == AppLocalizations.of(context)!.conversationNotificationPolicyDefault) { + if (newValue == AppLocalizations.of(context)!.conversationNotificationPolicyDefault) { Provider.of(context, listen: false).savePeerHistory = HistoryDefault; Provider.of(context, listen: false).cwtch.SetConversationAttribute(profileOnion, identifier, SaveHistoryKey, HistoryDefault); } else if (newValue == AppLocalizations.of(context)!.savePeerHistory) { @@ -246,7 +246,11 @@ class _PeerSettingsViewState extends State { } }); }, - items: [AppLocalizations.of(context)!.conversationNotificationPolicyDefault, AppLocalizations.of(context)!.savePeerHistory, AppLocalizations.of(context)!.dontSavePeerHistory].map>((String value) { + items: [ + AppLocalizations.of(context)!.conversationNotificationPolicyDefault, + AppLocalizations.of(context)!.savePeerHistory, + AppLocalizations.of(context)!.dontSavePeerHistory + ].map>((String value) { return DropdownMenuItem( value: value, child: Text(value, style: settings.scaleFonts(defaultDropDownMenuItemTextStyle)), diff --git a/lib/views/remoteserverview.dart b/lib/views/remoteserverview.dart index 859747ec..f4430c43 100644 --- a/lib/views/remoteserverview.dart +++ b/lib/views/remoteserverview.dart @@ -97,9 +97,11 @@ class _RemoteServerViewState extends State { Tooltip( message: serverInfoState.groups.isNotEmpty ? AppLocalizations.of(context)!.cannotDeleteServerIfActiveGroups : AppLocalizations.of(context)!.leaveConversation, child: ElevatedButton.icon( - onPressed: serverInfoState.groups.isNotEmpty ? null : () { - showAlertDialog(context); - }, + onPressed: serverInfoState.groups.isNotEmpty + ? null + : () { + showAlertDialog(context); + }, icon: Icon(CwtchIcons.leave_group), label: Text( AppLocalizations.of(context)!.deleteBtn, @@ -112,7 +114,6 @@ class _RemoteServerViewState extends State { child: Text(AppLocalizations.of(context)!.groupsOnThisServerLabel), ), Expanded(child: _buildGroupsList(serverInfoState)), - ]))); }); } diff --git a/lib/widgets/messagelist.dart b/lib/widgets/messagelist.dart index 2de84486..cc79af9b 100644 --- a/lib/widgets/messagelist.dart +++ b/lib/widgets/messagelist.dart @@ -38,7 +38,7 @@ class _MessageListState extends State { //bool isGroupAndSynced = Provider.of(context).isGroup && Provider.of(context).status == "Synced"; //bool isGroupAndNotAuthenticated = Provider.of(context).isGroup && Provider.of(context).status != "Authenticated"; - bool preserveHistoryByDefault = Provider.of(context, listen:false).preserveHistoryByDefault; + bool preserveHistoryByDefault = Provider.of(context, listen: false).preserveHistoryByDefault; bool showEphemeralWarning = (isP2P && (!preserveHistoryByDefault && Provider.of(context).savePeerHistory != "SaveHistory")); bool showOfflineWarning = Provider.of(context).isOnline() == false; bool showSyncing = isGroupAndSyncing;