diff --git a/lib/main.dart b/lib/main.dart index 4936376..8aa3a08 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -29,7 +29,7 @@ class FlwtchState extends State { // ignore: non_constant_identifier_names final StartCwtch = startCwtchC.asFunction(); - var cwtchDir = "/home/erinn/.cwtch/dev/"; + var cwtchDir = "/home/sarah/.cwtch/dev/"; StartCwtch(Utf8.toUtf8(cwtchDir), cwtchDir.length); return Provider( diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index 90e352a..3d3aae8 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -37,7 +37,12 @@ class _MessageViewState extends State { final GetMessage = getMessageC.asFunction(); _updateMessageCount(context, NumMessages); - timer = Timer.periodic(Duration(seconds: 1), (Timer t) => _updateMessageCount(context, NumMessages)); + if (timer == null) { + timer = Timer.periodic(Duration(seconds: 1), (Timer t) { + print("tick"); + _updateMessageCount(context, NumMessages); + }); + } return ProxyProvider0( @@ -64,6 +69,11 @@ class _MessageViewState extends State { } Future _updateMessageCount(BuildContext context, GetIntFromStrStrFn cfn) async { + if (!mounted) { + if (timer != null && timer.isActive) timer.cancel(); + return; + } + setState(() { conversationNumMessages = cfn( Utf8.toUtf8(widget.profileOnion), widget.profileOnion.length, diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index 64c86de..dfcb09a 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -84,7 +84,7 @@ class _ProfileMgrViewState extends State { subtitle: Text(profile.onion), onTap: () { setState(() { - var selectProfileC = Provider.of(context).library.lookup>("SelectProfile"); + var selectProfileC = Provider.of(context, listen:false).library.lookup>("SelectProfile"); // ignore: non_constant_identifier_names final SelectProfile = selectProfileC.asFunction();