From d0d4e17b4785fb492f8464fd0c4584a4c67191e3 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Mon, 31 May 2021 16:11:39 -0700 Subject: [PATCH] Fix errors caused by sound null safety (profile setup) --- lib/cwtch/cwtchNotifier.dart | 6 +++--- lib/errorHandler.dart | 2 ++ lib/main.dart | 2 +- lib/model.dart | 4 ++-- lib/widgets/passwordfield.dart | 4 +++- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 62af1167..8d81db66 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -40,10 +40,10 @@ class CwtchNotifier { imagePath: data["picture"], isBlocked: data["authorization"] == "blocked", isInvitation: data["authorization"] == "unknown", - savePeerHistory: data["saveConversationHistory"], + savePeerHistory: data["saveConversationHistory"] == null ? "DeleteHistoryConfirmed" : data["saveConversationHistory"], numMessages: int.parse(data["numMessages"]), numUnread: int.parse(data["unread"]), - isGroup: data["isGroup"], + isGroup: data["isGroup"] == true, server: data["groupServer"], lastMessageTime: DateTime.now(), //show at the top of the contact list even if no messages yet )); @@ -165,7 +165,7 @@ class CwtchNotifier { print("acn status: $data"); torStatus.handleUpdate(int.parse(data["Progress"]), data["Status"]); break; - case "UpdateServerInfo": + case "cp": profileCN.getProfile(data["ProfileOnion"])?.replaceServers(data["ServerList"]); break; case "NewGroup": diff --git a/lib/errorHandler.dart b/lib/errorHandler.dart index ee474e3b..cf26cdef 100644 --- a/lib/errorHandler.dart +++ b/lib/errorHandler.dart @@ -29,6 +29,7 @@ class ErrorHandler extends ChangeNotifier { break; case importBundleErrorPrefix: handleImportBundleError(errorType); + break; } notifyListeners(); @@ -49,6 +50,7 @@ class ErrorHandler extends ChangeNotifier { break; case successErrorType: explicitAddContactSuccess = true; + importBundleSuccess = true; break; } } diff --git a/lib/main.dart b/lib/main.dart index 4e1f94d8..7c366e40 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -102,7 +102,7 @@ class FlwtchState extends State { theme: mkThemeData(settings), // from dan: home: cwtchInit == true ? ProfileMgrView(cwtch) : SplashView(), // from erinn: home: columns.length == 3 ? TripleColumnView() : ProfileMgrView(), - home: cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ShiftRightFixer(child: ProfileMgrView())) : SplashView(), + home: cwtchInit == true ? (columns.length == 3 ? TripleColumnView() : ProfileMgrView()) : SplashView(), ), ); }, diff --git a/lib/model.dart b/lib/model.dart index 977639d9..d7630ef8 100644 --- a/lib/model.dart +++ b/lib/model.dart @@ -253,7 +253,7 @@ class ContactInfoState extends ChangeNotifier { // todo: a nicer way to model contacts, groups and other "entities" late bool _isGroup; - late String _server; + String? _server; ContactInfoState( this.profileOnion, @@ -268,7 +268,7 @@ class ContactInfoState extends ChangeNotifier { numMessages = 0, numUnread = 0, lastMessageTime, - server = "", + server, }) { this._nickname = nickname; this._isGroup = isGroup; diff --git a/lib/widgets/passwordfield.dart b/lib/widgets/passwordfield.dart index d7931efa..7b8804d4 100644 --- a/lib/widgets/passwordfield.dart +++ b/lib/widgets/passwordfield.dart @@ -39,7 +39,9 @@ class _CwtchTextFieldState extends State { decoration: InputDecoration( suffixIcon: IconButton( onPressed: () { - obscureText = !obscureText; + setState(() { + obscureText = !obscureText; + }); }, icon: Icon((obscureText ? Icons.remove_red_eye : Icons.remove_red_eye_outlined), semanticLabel: label), tooltip: label,