diff --git a/.gitignore b/.gitignore index 83f6662..d513c8e 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ libCwtch.so android/cwtch/cwtch.aar coverage test/failures +.gradle \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt b/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt index 5d4062d..568d2aa 100644 --- a/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/flutter_app/MainActivity.kt @@ -157,6 +157,9 @@ class MainActivity: FlutterActivity() { val jsonEvent = (call.argument("jsonEvent") as? String) ?: ""; Cwtch.sendAppEvent(jsonEvent); } + "ResetTor" -> { + Cwtch.resetTor(); + } else -> result.notImplemented() } } diff --git a/android/cwtch/cwtch.aar b/android/cwtch/cwtch.aar index cbde03b..98431a5 100644 Binary files a/android/cwtch/cwtch.aar and b/android/cwtch/cwtch.aar differ diff --git a/assets/core/Tor_icon_error.png b/assets/core/Tor_icon_error.png new file mode 100644 index 0000000..c02c4a9 Binary files /dev/null and b/assets/core/Tor_icon_error.png differ diff --git a/assets/core/Tor_icon_error.svg b/assets/core/Tor_icon_error.svg new file mode 100644 index 0000000..a5b5abb --- /dev/null +++ b/assets/core/Tor_icon_error.svg @@ -0,0 +1,70 @@ + + + +image/svg+xml + + +! + \ No newline at end of file diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 449dba1..b8fcd02 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -39,7 +39,7 @@ class CwtchNotifier { savePeerHistory: data["saveConversationHistory"], numMessages: int.parse(data["numMessages"]), numUnread: int.parse(data["unread"]), - lastMessageTime: DateTime.now(),//show at the top of the contact list even if no messages yet + lastMessageTime: DateTime.now(), //show at the top of the contact list even if no messages yet )); break; case "PeerStateChange": diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index 53631b6..ded564b 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_app/settings.dart'; +import 'package:flutter_app/torstatus.dart'; import 'package:flutter_app/views/torstatusview.dart'; import 'package:flutter_app/widgets/passwordfield.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -37,9 +38,11 @@ class _ProfileMgrViewState extends State { actions: [ IconButton( icon: Image( - image: AssetImage("assets/core/Tor_icon.png"), + image: AssetImage(Provider.of(context).progress == 100 ? "assets/core/Tor_icon.png" : "assets/core/Tor_icon_error.png"), filterQuality: FilterQuality.low, isAntiAlias: false, + color: Provider.of(context).theme.mainTextColor(), + colorBlendMode: BlendMode.srcIn, ), onPressed: _pushTorStatus), IconButton(icon: Icon(Icons.bug_report_outlined), onPressed: _setLoggingLevelDebug), @@ -86,8 +89,8 @@ class _ProfileMgrViewState extends State { void _pushTorStatus() { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) { - return Provider( - create: (_) => Provider.of(context, listen: false), + return MultiProvider( + providers: [Provider.value(value: Provider.of(context))], child: TorStatusView(), ); }, diff --git a/lib/views/torstatusview.dart b/lib/views/torstatusview.dart index bef0767..7e7bcb9 100644 --- a/lib/views/torstatusview.dart +++ b/lib/views/torstatusview.dart @@ -45,7 +45,12 @@ class _TorStatusView extends State { child: Column(children: [ ListTile( leading: Image( - image: AssetImage("assets/core/Tor_icon.png"), + image: AssetImage(torStatus.progress == 100 ? "assets/core/Tor_icon.png" : "assets/core/Tor_icon_error.png"), + filterQuality: FilterQuality.low, + isAntiAlias: false, + // Color the onion per the text color... + color: Provider.of(context).theme.mainTextColor(), + colorBlendMode: BlendMode.srcIn, ), title: Text("Tor Status"), subtitle: Text(torStatus.progress == 100 ? AppLocalizations.of(context).networkStatusOnline : torStatus.status),