Updates, fix timer bug
This commit is contained in:
parent
062e5af108
commit
258093903f
|
@ -29,7 +29,7 @@ class FlwtchState extends State<Flwtch> {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final StartCwtch = startCwtchC.asFunction<StartCwtchFn>();
|
final StartCwtch = startCwtchC.asFunction<StartCwtchFn>();
|
||||||
|
|
||||||
var cwtchDir = "/home/erinn/.cwtch/dev/";
|
var cwtchDir = "/home/sarah/.cwtch/dev/";
|
||||||
StartCwtch(Utf8.toUtf8(cwtchDir), cwtchDir.length);
|
StartCwtch(Utf8.toUtf8(cwtchDir), cwtchDir.length);
|
||||||
|
|
||||||
return Provider<FlwtchState>(
|
return Provider<FlwtchState>(
|
||||||
|
|
|
@ -37,7 +37,12 @@ class _MessageViewState extends State<MessageView> {
|
||||||
final GetMessage = getMessageC.asFunction<GetJsonBlobFromStrStrIntFn>();
|
final GetMessage = getMessageC.asFunction<GetJsonBlobFromStrStrIntFn>();
|
||||||
|
|
||||||
_updateMessageCount(context, NumMessages);
|
_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(
|
return ProxyProvider0(
|
||||||
|
@ -64,6 +69,11 @@ class _MessageViewState extends State<MessageView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _updateMessageCount(BuildContext context, GetIntFromStrStrFn cfn) async {
|
Future _updateMessageCount(BuildContext context, GetIntFromStrStrFn cfn) async {
|
||||||
|
if (!mounted) {
|
||||||
|
if (timer != null && timer.isActive) timer.cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
conversationNumMessages = cfn(
|
conversationNumMessages = cfn(
|
||||||
Utf8.toUtf8(widget.profileOnion), widget.profileOnion.length,
|
Utf8.toUtf8(widget.profileOnion), widget.profileOnion.length,
|
||||||
|
|
|
@ -84,7 +84,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
|
||||||
subtitle: Text(profile.onion),
|
subtitle: Text(profile.onion),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
var selectProfileC = Provider.of<FlwtchState>(context).library.lookup<NativeFunction<get_json_blob_string_function>>("SelectProfile");
|
var selectProfileC = Provider.of<FlwtchState>(context, listen:false).library.lookup<NativeFunction<get_json_blob_string_function>>("SelectProfile");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final SelectProfile = selectProfileC.asFunction<GetJsonBlobStringFn>();
|
final SelectProfile = selectProfileC.asFunction<GetJsonBlobStringFn>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue