Merge pull request 'Remove Group "Address" - it is badly named, and no longer relavent' (#482) from fix_308 into trunk
continuous-integration/drone/push Build was killed Details

Reviewed-on: #482
Reviewed-by: Dan Ballard <dan@openprivacy.ca>
This commit is contained in:
Dan Ballard 2022-06-21 22:12:14 +00:00
commit 40b3207e2d
9 changed files with 169 additions and 129 deletions

View File

@ -223,9 +223,9 @@ class FlwtchState extends State<Flwtch> with WindowListener {
Provider.of<AppState>(navKey.currentContext!, listen: false).selectedConversation = convoId; Provider.of<AppState>(navKey.currentContext!, listen: false).selectedConversation = convoId;
Navigator.of(navKey.currentContext!).push( Navigator.of(navKey.currentContext!).push(
MaterialPageRoute<void>( PageRouteBuilder(
settings: RouteSettings(name: "conversations"), settings: RouteSettings(name: "conversations"),
builder: (BuildContext buildcontext) { pageBuilder: (c, a1, a2) {
return OrientationBuilder(builder: (orientationBuilderContext, orientation) { return OrientationBuilder(builder: (orientationBuilderContext, orientation) {
return MultiProvider( return MultiProvider(
providers: [ChangeNotifierProvider<ProfileInfoState>.value(value: profile), ChangeNotifierProvider<ContactListState>.value(value: profile.contactList)], providers: [ChangeNotifierProvider<ProfileInfoState>.value(value: profile), ChangeNotifierProvider<ContactListState>.value(value: profile.contactList)],
@ -236,6 +236,8 @@ class FlwtchState extends State<Flwtch> with WindowListener {
}); });
}); });
}, },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
), ),
); );
} }

View File

@ -12,7 +12,6 @@ import 'package:flutter_local_notifications_linux/flutter_local_notifications_li
import 'package:flutter_local_notifications_linux/src/model/hint.dart'; import 'package:flutter_local_notifications_linux/src/model/hint.dart';
import 'package:flutter_local_notifications_linux/src/model/icon.dart'; import 'package:flutter_local_notifications_linux/src/model/icon.dart';
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'config.dart'; import 'config.dart';
@ -83,7 +82,6 @@ class NixNotificationManager implements NotificationsManager {
late Future<void> Function(String, int) notificationSelectConvo; late Future<void> Function(String, int) notificationSelectConvo;
late String linuxAssetsPath; late String linuxAssetsPath;
// Cwtch can install in non flutter supported ways on linux, this code detects where the assets are on Linux // Cwtch can install in non flutter supported ways on linux, this code detects where the assets are on Linux
Future<String> detectLinuxAssetsPath() async { Future<String> detectLinuxAssetsPath() async {
var devStat = FileStat.stat("assets"); var devStat = FileStat.stat("assets");
@ -108,7 +106,6 @@ class NixNotificationManager implements NotificationsManager {
flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
scheduleMicrotask(() async { scheduleMicrotask(() async {
if (Platform.isLinux) { if (Platform.isLinux) {
linuxAssetsPath = await detectLinuxAssetsPath(); linuxAssetsPath = await detectLinuxAssetsPath();
} else { } else {
@ -116,10 +113,9 @@ class NixNotificationManager implements NotificationsManager {
} }
final MacOSInitializationSettings initializationSettingsMacOS = MacOSInitializationSettings(defaultPresentSound: false); final MacOSInitializationSettings initializationSettingsMacOS = MacOSInitializationSettings(defaultPresentSound: false);
var linuxIcon = FilePathLinuxIcon( path.join(linuxAssetsPath, 'assets/knott.png')); var linuxIcon = FilePathLinuxIcon(path.join(linuxAssetsPath, 'assets/knott.png'));
final LinuxInitializationSettings initializationSettingsLinux = final LinuxInitializationSettings initializationSettingsLinux = LinuxInitializationSettings(defaultActionName: 'Open notification', defaultIcon: linuxIcon, defaultSuppressSound: true);
LinuxInitializationSettings(defaultActionName: 'Open notification', defaultIcon: linuxIcon, defaultSuppressSound: true);
final InitializationSettings initializationSettings = InitializationSettings(android: null, iOS: null, macOS: initializationSettingsMacOS, linux: initializationSettingsLinux); final InitializationSettings initializationSettings = InitializationSettings(android: null, iOS: null, macOS: initializationSettingsMacOS, linux: initializationSettingsLinux);
@ -136,8 +132,12 @@ class NixNotificationManager implements NotificationsManager {
Future<void> notify(String message, String profile, int conversationId) async { Future<void> notify(String message, String profile, int conversationId) async {
if (!globalAppState.focus) { if (!globalAppState.focus) {
// Warning: Only use title field on Linux, body field will render links as clickable // Warning: Only use title field on Linux, body field will render links as clickable
await flutterLocalNotificationsPlugin.show(0, message, '', await flutterLocalNotificationsPlugin.show(
NotificationDetails(linux: LinuxNotificationDetails(suppressSound: true, category: LinuxNotificationCategory.imReceived(), icon: FilePathLinuxIcon(path.join(linuxAssetsPath, 'assets/knott.png')))), 0,
message,
'',
NotificationDetails(
linux: LinuxNotificationDetails(suppressSound: true, category: LinuxNotificationCategory.imReceived(), icon: FilePathLinuxIcon(path.join(linuxAssetsPath, 'assets/knott.png')))),
payload: jsonEncode(NotificationPayload(profile, conversationId))); payload: jsonEncode(NotificationPayload(profile, conversationId)));
} }
} }

View File

@ -54,11 +54,11 @@ void selectConversation(BuildContext context, int handle) {
void _pushMessageView(BuildContext context, int handle) { void _pushMessageView(BuildContext context, int handle) {
var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion; var profileOnion = Provider.of<ProfileInfoState>(context, listen: false).onion;
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute<void>( PageRouteBuilder(
builder: (BuildContext builderContext) { settings: RouteSettings(name: "messages"),
// assert we have an actual profile... pageBuilder: (builderContext, a1, a2) {
// We need to listen for updates to the profile in order to update things like invitation message bubbles.
var profile = Provider.of<FlwtchState>(builderContext).profs.getProfile(profileOnion)!; var profile = Provider.of<FlwtchState>(builderContext).profs.getProfile(profileOnion)!;
return MultiProvider( return MultiProvider(
providers: [ providers: [
@ -68,6 +68,8 @@ void _pushMessageView(BuildContext context, int handle) {
builder: (context, child) => MessageView(), builder: (context, child) => MessageView(),
); );
}, },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
), ),
); );
} }
@ -243,29 +245,37 @@ class _ContactsViewState extends State<ContactsView> {
// close modal // close modal
Navigator.popUntil(context, (route) => route.settings.name == "conversations"); Navigator.popUntil(context, (route) => route.settings.name == "conversations");
// open add contact / create group pane Navigator.of(context).push(
Navigator.of(context).push(MaterialPageRoute<void>( PageRouteBuilder(
builder: (BuildContext bcontext) { settings: RouteSettings(name: "addcontact"),
return MultiProvider( pageBuilder: (builderContext, a1, a2) {
providers: [ return MultiProvider(
ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)), providers: [
], ChangeNotifierProvider.value(value: Provider.of<ProfileInfoState>(context)),
child: AddContactView(newGroup: newGroup), ],
); child: AddContactView(newGroup: newGroup),
}, );
)); },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
void _pushServers() { void _pushServers() {
var profile = Provider.of<ProfileInfoState>(context); var profile = Provider.of<ProfileInfoState>(context);
Navigator.of(context).push(MaterialPageRoute<void>( Navigator.of(context).push(
builder: (BuildContext context) { PageRouteBuilder(
return MultiProvider( pageBuilder: (bcontext, a1, a2) {
providers: [ChangeNotifierProvider(create: (context) => profile), Provider.value(value: Provider.of<FlwtchState>(context))], return MultiProvider(
child: ProfileServersView(), providers: [ChangeNotifierProvider(create: (context) => profile), Provider.value(value: Provider.of<FlwtchState>(context))],
); child: ProfileServersView(),
}, );
)); },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
void _modalAddImportChoice() { void _modalAddImportChoice() {

View File

@ -91,22 +91,6 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
tooltip: AppLocalizations.of(context)!.saveBtn, tooltip: AppLocalizations.of(context)!.saveBtn,
) )
]), ]),
// Address Copy Button
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox(
height: 20,
),
CwtchLabel(label: AppLocalizations.of(context)!.groupAddr),
SizedBox(
height: 20,
),
CwtchTextField(
controller: ctrlrGroupAddr,
hintText: '',
validator: (value) {},
)
]),
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [
SizedBox( SizedBox(
height: 20, height: 20,

View File

@ -205,19 +205,31 @@ class _MessageViewState extends State<MessageView> {
var contactInfoState = Provider.of<ContactInfoState>(context, listen: false); var contactInfoState = Provider.of<ContactInfoState>(context, listen: false);
if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) { if (Provider.of<ContactInfoState>(context, listen: false).isGroup == true) {
Navigator.of(context).push(MaterialPageRoute<void>(builder: (BuildContext bcontext) { Navigator.of(context).push(
return MultiProvider( PageRouteBuilder(
providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)], pageBuilder: (builderContext, a1, a2) {
child: GroupSettingsView(), return MultiProvider(
); providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)],
})); child: GroupSettingsView(),
);
},
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} else { } else {
Navigator.of(context).push(MaterialPageRoute<void>(builder: (BuildContext bcontext) { Navigator.of(context).push(
return MultiProvider( PageRouteBuilder(
providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)], pageBuilder: (builderContext, a1, a2) {
child: PeerSettingsView(), return MultiProvider(
); providers: [ChangeNotifierProvider.value(value: profileInfoState), ChangeNotifierProvider.value(value: contactInfoState)],
})); child: PeerSettingsView(),
);
},
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
} }

View File

@ -130,53 +130,71 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
} }
void _pushGlobalSettings() { void _pushGlobalSettings() {
Navigator.of(context).push(MaterialPageRoute<void>( Navigator.of(context).push(
builder: (BuildContext context) { PageRouteBuilder(
return Provider( pageBuilder: (bcontext, a1, a2) {
create: (_) => Provider.of<FlwtchState>(context, listen: false), return Provider(
child: GlobalSettingsView(), create: (_) => Provider.of<FlwtchState>(bcontext, listen: false),
); child: GlobalSettingsView(),
}, );
)); },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
void _pushServers() { void _pushServers() {
Navigator.of(context).push(MaterialPageRoute<void>( Navigator.of(context).push(
settings: RouteSettings(name: "servers"), PageRouteBuilder(
builder: (BuildContext context) { settings: RouteSettings(name: "servers"),
return MultiProvider( pageBuilder: (bcontext, a1, a2) {
providers: [Provider.value(value: Provider.of<FlwtchState>(context))], return MultiProvider(
child: ServersView(), providers: [Provider.value(value: Provider.of<FlwtchState>(context))],
); child: ServersView(),
}, );
)); },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
void _pushTorStatus() { void _pushTorStatus() {
Navigator.of(context).push(MaterialPageRoute<void>( Navigator.of(context).push(
builder: (BuildContext context) { PageRouteBuilder(
return MultiProvider( settings: RouteSettings(name: "torconfig"),
providers: [Provider.value(value: Provider.of<FlwtchState>(context))], pageBuilder: (bcontext, a1, a2) {
child: TorStatusView(), return MultiProvider(
); providers: [Provider.value(value: Provider.of<FlwtchState>(context))],
}, child: TorStatusView(),
)); );
},
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
void _pushAddProfile(bcontext, {onion: ""}) { void _pushAddProfile(bcontext, {onion: ""}) {
Navigator.popUntil(bcontext, (route) => route.isFirst); Navigator.popUntil(bcontext, (route) => route.isFirst);
Navigator.of(bcontext).push(MaterialPageRoute<void>(
builder: (BuildContext context) { Navigator.of(context).push(
return MultiProvider( PageRouteBuilder(
providers: [ pageBuilder: (bcontext, a1, a2) {
ChangeNotifierProvider<ProfileInfoState>( return MultiProvider(
create: (_) => ProfileInfoState(onion: onion), providers: [
), ChangeNotifierProvider<ProfileInfoState>(
], create: (_) => ProfileInfoState(onion: onion),
builder: (context, widget) => AddEditProfileView(key: Key('addprofile')), ),
); ],
}, builder: (context, widget) => AddEditProfileView(key: Key('addprofile')),
)); );
},
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
void _modalAddImportProfiles() { void _modalAddImportProfiles() {

View File

@ -141,17 +141,21 @@ class _ServersView extends State<ServersView> {
} }
void _pushAddServer() { void _pushAddServer() {
Navigator.of(context).push(MaterialPageRoute<void>( Navigator.of(context).push(
builder: (BuildContext context) { PageRouteBuilder(
return MultiProvider( pageBuilder: (bcontext, a1, a2) {
providers: [ return MultiProvider(
ChangeNotifierProvider<ServerInfoState>( providers: [
create: (_) => ServerInfoState(onion: "", serverBundle: "", description: "", autoStart: true, running: false, isEncrypted: true), ChangeNotifierProvider<ServerInfoState>(
) create: (_) => ServerInfoState(onion: "", serverBundle: "", description: "", autoStart: true, running: false, isEncrypted: true),
], )
child: AddEditServerView(), ],
); child: AddEditServerView(),
}, );
)); },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
} }

View File

@ -85,9 +85,9 @@ class _ProfileRowState extends State<ProfileRow> {
void _pushContactList(ProfileInfoState profile, bool isLandscape) { void _pushContactList(ProfileInfoState profile, bool isLandscape) {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute<void>( PageRouteBuilder(
settings: RouteSettings(name: "conversations"), settings: RouteSettings(name: "conversations"),
builder: (BuildContext buildcontext) { pageBuilder: (c, a1, a2) {
return OrientationBuilder(builder: (orientationBuilderContext, orientation) { return OrientationBuilder(builder: (orientationBuilderContext, orientation) {
return MultiProvider( return MultiProvider(
providers: [ChangeNotifierProvider<ProfileInfoState>.value(value: profile), ChangeNotifierProvider<ContactListState>.value(value: profile.contactList)], providers: [ChangeNotifierProvider<ProfileInfoState>.value(value: profile), ChangeNotifierProvider<ContactListState>.value(value: profile.contactList)],
@ -98,24 +98,29 @@ class _ProfileRowState extends State<ProfileRow> {
}); });
}); });
}, },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
), ),
); );
} }
void _pushEditProfile({onion: "", displayName: "", profileImage: "", encrypted: true}) { void _pushEditProfile({onion: "", displayName: "", profileImage: "", encrypted: true}) {
Provider.of<ErrorHandler>(context, listen: false).reset(); Navigator.of(context).push(
Navigator.of(context).push(MaterialPageRoute<void>( PageRouteBuilder(
builder: (BuildContext bcontext) { pageBuilder: (bcontext, a1, a2) {
var profile = Provider.of<FlwtchState>(bcontext).profs.getProfile(onion)!; var profile = Provider.of<FlwtchState>(bcontext).profs.getProfile(onion)!;
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider<ProfileInfoState>.value( ChangeNotifierProvider<ProfileInfoState>.value(
value: profile, value: profile,
), ),
], ],
builder: (context, widget) => AddEditProfileView(), builder: (context, widget) => AddEditProfileView(),
); );
}, },
)); transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
} }
} }

View File

@ -68,14 +68,19 @@ class _RemoteServerRowState extends State<RemoteServerRow> {
)), )),
]), ]),
onTap: () { onTap: () {
Navigator.of(context).push(MaterialPageRoute<void>( Navigator.of(context).push(
PageRouteBuilder(
settings: RouteSettings(name: "remoteserverview"), settings: RouteSettings(name: "remoteserverview"),
builder: (BuildContext context) { pageBuilder: (bcontext, a1, a2) {
return MultiProvider( return MultiProvider(
providers: [Provider.value(value: profile), ChangeNotifierProvider(create: (context) => server), Provider.value(value: Provider.of<FlwtchState>(context))], providers: [Provider.value(value: profile), ChangeNotifierProvider(create: (context) => server), Provider.value(value: Provider.of<FlwtchState>(context))],
child: RemoteServerView(), child: RemoteServerView(),
); );
})); },
transitionsBuilder: (c, anim, a2, child) => FadeTransition(opacity: anim, child: child),
transitionDuration: Duration(milliseconds: 200),
),
);
})); }));
}); });
} }