diff --git a/assets/core/Tor_Booting_up.png b/assets/core/Tor_Booting_up.png new file mode 100644 index 0000000..bfb300d Binary files /dev/null and b/assets/core/Tor_Booting_up.png differ diff --git a/assets/core/Tor_Booting_up.svg b/assets/core/Tor_Booting_up.svg new file mode 100644 index 0000000..616371d --- /dev/null +++ b/assets/core/Tor_Booting_up.svg @@ -0,0 +1,63 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/assets/core/Tor_OFF.png b/assets/core/Tor_OFF.png new file mode 100644 index 0000000..fc7742f Binary files /dev/null and b/assets/core/Tor_OFF.png differ diff --git a/assets/core/Tor_OFF.svg b/assets/core/Tor_OFF.svg new file mode 100644 index 0000000..d020ce5 --- /dev/null +++ b/assets/core/Tor_OFF.svg @@ -0,0 +1,63 @@ + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/assets/core/Tor_icon.png b/assets/core/Tor_icon.png index 0c03273..0c871e9 100644 Binary files a/assets/core/Tor_icon.png and b/assets/core/Tor_icon.png differ diff --git a/assets/core/Tor_icon.svg b/assets/core/Tor_icon.svg index 605a895..a2bcfa9 100644 --- a/assets/core/Tor_icon.svg +++ b/assets/core/Tor_icon.svg @@ -19,8 +19,8 @@ sodipodi:docname="Tor_icon.svg" inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)" inkscape:export-filename="/home/sarah/AndroidStudioProjects/flutter_app/assets/core/Tor_icon.png" - inkscape:export-xdpi="96" - inkscape:export-ydpi="96">image/svg+xml \ No newline at end of file diff --git a/lib/cwtch/cwtchNotifier.dart b/lib/cwtch/cwtchNotifier.dart index 86417d3..dd4d379 100644 --- a/lib/cwtch/cwtchNotifier.dart +++ b/lib/cwtch/cwtchNotifier.dart @@ -97,13 +97,8 @@ class CwtchNotifier { print("new group invite: $data"); // TODO Add Group Dynamically dynamic groupInvite = jsonDecode(data["GroupInvite"]); - profileCN.getProfile(data["ProfileOnion"]).contactList.add(ContactInfoState( - onion: groupInvite["GroupID"], - isInvitation: true, - imagePath: data["PicturePath"], - nickname: groupInvite["GroupName"], - server: groupInvite["ServerHost"], - isGroup: true)); + profileCN.getProfile(data["ProfileOnion"]).contactList.add( + ContactInfoState(onion: groupInvite["GroupID"], isInvitation: true, imagePath: data["PicturePath"], nickname: groupInvite["GroupName"], server: groupInvite["ServerHost"], isGroup: true)); break; case "ServerStateChange": print("server state change: $data"); diff --git a/lib/main_test.dart b/lib/main_test.dart index b62f734..7ed40f0 100644 --- a/lib/main_test.dart +++ b/lib/main_test.dart @@ -36,9 +36,9 @@ class DiskAssetBundle extends CachingAssetBundle { /// Creates a [DiskAssetBundle] by loading [globs] of assets under `assets/`. static Future loadGlob( - Iterable globs, { - String from = 'assets', - }) async { + Iterable globs, { + String from = 'assets', + }) async { final cache = {}; for (final pattern in globs) { await for (final path in Glob(pattern).list(root: from)) { @@ -68,4 +68,4 @@ class DiskAssetBundle extends CachingAssetBundle { Future load(String key) async { return _cache[key]; } -} \ No newline at end of file +} diff --git a/lib/views/addeditprofileview.dart b/lib/views/addeditprofileview.dart index fb18d8e..9104198 100644 --- a/lib/views/addeditprofileview.dart +++ b/lib/views/addeditprofileview.dart @@ -83,7 +83,12 @@ class _AddEditProfileViewState extends State { Visibility( visible: Provider.of(context).onion.isNotEmpty, child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [ - ProfileImage(imagePath: Provider.of(context).imagePath, diameter: 120, maskOut: false, border: theme.theme.portraitOnlineBorderColor(),) + ProfileImage( + imagePath: Provider.of(context).imagePath, + diameter: 120, + maskOut: false, + border: theme.theme.portraitOnlineBorderColor(), + ) ])), Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ CwtchLabel(label: AppLocalizations.of(context).displayNameLabel), diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index f51556b..2ccbaad 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -70,6 +70,6 @@ class _ContactsViewState extends State { } void _debugFakeMessage() { - Provider.of(context, listen:false).contactList.getContact("44pknjvf4ju46nbuyn5getuayb6dj6z6zoppl56syn7pmscptoahlaid").unreadMessages++; + Provider.of(context, listen: false).contactList.getContact("44pknjvf4ju46nbuyn5getuayb6dj6z6zoppl56syn7pmscptoahlaid").unreadMessages++; } } diff --git a/lib/views/messageview.dart b/lib/views/messageview.dart index d538eb4..be85854 100644 --- a/lib/views/messageview.dart +++ b/lib/views/messageview.dart @@ -97,12 +97,12 @@ class _MessageViewState extends State { child: Row( children: [ Expanded( - child: TextField( - key: Key('txtCompose'), - controller: ctrlrCompose, - focusNode: focusNode, - textInputAction: TextInputAction.send, - onSubmitted: _sendMessage, + child: TextField( + key: Key('txtCompose'), + controller: ctrlrCompose, + focusNode: focusNode, + textInputAction: TextInputAction.send, + onSubmitted: _sendMessage, )), SizedBox( width: 90, diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index ded564b..e9d1c74 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -5,6 +5,7 @@ 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_app/widgets/tor_icon.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_app/widgets/profilerow.dart'; import 'package:provider/provider.dart'; @@ -36,15 +37,7 @@ class _ProfileMgrViewState extends State { appBar: AppBar( title: Text(AppLocalizations.of(context).titleManageProfiles), actions: [ - IconButton( - icon: Image( - 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: TorIcon(), onPressed: _pushTorStatus), IconButton(icon: Icon(Icons.bug_report_outlined), onPressed: _setLoggingLevelDebug), IconButton( icon: Icon(Icons.lock_open), diff --git a/lib/views/torstatusview.dart b/lib/views/torstatusview.dart index 7e7bcb9..63602f0 100644 --- a/lib/views/torstatusview.dart +++ b/lib/views/torstatusview.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_app/settings.dart'; import 'package:flutter_app/torstatus.dart'; +import 'package:flutter_app/widgets/tor_icon.dart'; import 'package:provider/provider.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -44,14 +45,7 @@ class _TorStatusView extends State { ), child: Column(children: [ ListTile( - leading: Image( - 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, - ), + leading: TorIcon(), title: Text("Tor Status"), subtitle: Text(torStatus.progress == 100 ? AppLocalizations.of(context).networkStatusOnline : torStatus.status), trailing: ElevatedButton( diff --git a/lib/widgets/tor_icon.dart b/lib/widgets/tor_icon.dart new file mode 100644 index 0000000..2fb657f --- /dev/null +++ b/lib/widgets/tor_icon.dart @@ -0,0 +1,30 @@ +import 'package:flutter/cupertino.dart'; +import 'package:provider/provider.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import '../settings.dart'; +import '../torstatus.dart'; + +/// A reusable Tor Icon Widget that displays the current status of the underlying Tor connections +class TorIcon extends StatefulWidget { + TorIcon(); + + @override + State createState() => _TorIconState(); +} + +class _TorIconState extends State { + @override + Widget build(BuildContext context) { + return Image( + image: AssetImage(Provider.of(context).progress == 0 + ? "assets/core/Tor_OFF.png" + : (Provider.of(context).progress == 100 ? "assets/core/Tor_icon.png" : "assets/core/Tor_Booting_up.png")), + // Color the onion per the text color... + color: Provider.of(context).theme.mainTextColor(), + colorBlendMode: BlendMode.srcIn, + semanticLabel: Provider.of(context).progress == 100 + ? AppLocalizations.of(context).networkStatusOnline + : (Provider.of(context).progress == 0 ? AppLocalizations.of(context).networkStatusDisconnected : AppLocalizations.of(context).networkStatusAttemptingTor), + ); + } +}