Compare commits

..

1 Commits

14 changed files with 60 additions and 75 deletions

View File

@ -58,6 +58,9 @@ class CwtchNotifier {
// EnvironmentConfig.debugLog("NewEvent $type $data");
switch (type) {
case "CwtchStarted":
if (data["Reload"] == "true" && profileCN.num > 0) {
// don't reload...
// unless we have loaded no profiles...then there isnt a risk and this

View File

@ -106,12 +106,11 @@ class FlwtchState extends State<Flwtch> with WindowListener {
// Cwtch.start can take time, we don't want it blocking first splash screen draw, so postpone a smidge to let splash render
Future.delayed(const Duration(milliseconds: 100), () {
print("initState delayed: invoking cwtch.Start()");
cwtch.Start().then((v) {
cwtch.Start();
cwtch.getCwtchDir().then((dir) {
globalSettings.themeloader.LoadThemes(dir);
});
});
});
print("initState: starting connectivityListener");
if (EnvironmentConfig.TEST_MODE == false) {
startConnectivityListener();

View File

@ -212,8 +212,7 @@ ThemeData mkThemeData(Settings opaque) {
actionsIconTheme: IconThemeData(
color: opaque.current().mainTextColor,
)),
listTileTheme: ListTileThemeData(
titleTextStyle: defaultFormLabelTextStyle.copyWith(color: opaque.current().mainTextColor), subtitleTextStyle: defaultMessageTextStyle.copyWith(color: opaque.current().mainTextColor)),
listTileTheme: ListTileThemeData(titleTextStyle: defaultFormLabelTextStyle, subtitleTextStyle: defaultMessageTextStyle),
iconButtonTheme: IconButtonThemeData(style: ButtonStyle(textStyle: MaterialStateProperty.all(defaultFormLabelTextStyle))),
//bottomNavigationBarTheme: BottomNavigationBarThemeData(type: BottomNavigationBarType.fixed, backgroundColor: opaque.current().backgroundHilightElementColor), // Can't determine current use
textButtonTheme: TextButtonThemeData(
@ -236,35 +235,9 @@ ThemeData mkThemeData(Settings opaque) {
enableFeedback: true,
textStyle: MaterialStateProperty.all(opaque.scaleFonts(defaultTextButtonStyle)),
padding: MaterialStateProperty.all(EdgeInsets.all(20)),
),
),
filledButtonTheme: FilledButtonThemeData(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.disabled) ? opaque.current().defaultButtonDisabledColor : opaque.current().defaultButtonColor),
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor),
overlayColor: MaterialStateProperty.resolveWith((states) => (states.contains(MaterialState.pressed) && states.contains(MaterialState.hovered))
? opaque.current().defaultButtonActiveColor
: states.contains(MaterialState.disabled)
? opaque.current().defaultButtonDisabledColor
: null),
enableFeedback: true,
textStyle: MaterialStateProperty.all(opaque.scaleFonts(defaultTextButtonStyle)),
padding: MaterialStateProperty.all(EdgeInsets.all(20)),
),
),
outlinedButtonTheme: OutlinedButtonThemeData(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.resolveWith((states) => states.contains(MaterialState.disabled) ? opaque.current().defaultButtonDisabledColor : opaque.current().backgroundMainColor),
foregroundColor: MaterialStateProperty.all(opaque.current().mainTextColor),
side: MaterialStateProperty.all(BorderSide(color: opaque.current().defaultButtonColor)),
overlayColor: MaterialStateProperty.resolveWith((states) => (states.contains(MaterialState.pressed) && states.contains(MaterialState.hovered))
? opaque.current().defaultButtonActiveColor
: states.contains(MaterialState.disabled)
? opaque.current().defaultButtonDisabledColor
: null),
enableFeedback: true,
textStyle: MaterialStateProperty.all(opaque.scaleFonts(defaultTextButtonStyle)),
padding: MaterialStateProperty.all(EdgeInsets.all(20)),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6.0),
)),
),
),
scrollbarTheme: ScrollbarThemeData(thumbVisibility: MaterialStateProperty.all(false), thumbColor: MaterialStateProperty.all(opaque.current().scrollbarDefaultColor)),
@ -272,8 +245,8 @@ ThemeData mkThemeData(Settings opaque) {
labelColor: opaque.current().mainTextColor,
unselectedLabelColor: opaque.current().mainTextColor,
indicator: UnderlineTabIndicator(borderSide: BorderSide(color: opaque.current().defaultButtonActiveColor)),
labelStyle: opaque.scaleFonts(defaultTextButtonStyle).copyWith(color: opaque.current().mainTextColor),
unselectedLabelStyle: opaque.scaleFonts(defaultTextStyle).copyWith(color: opaque.current().mainTextColor),
labelStyle: opaque.scaleFonts(defaultTextButtonStyle),
unselectedLabelStyle: opaque.scaleFonts(defaultTextStyle),
tabAlignment: TabAlignment.center),
dialogTheme: DialogTheme(
backgroundColor: opaque.current().backgroundPaneColor,

View File

@ -414,10 +414,11 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
visible: Provider.of<ProfileInfoState>(context, listen: false).onion.isNotEmpty,
child: Tooltip(
message: AppLocalizations.of(context)!.exportProfileTooltip,
child: OutlinedButton.icon(
style: OutlinedButton.styleFrom(
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
minimumSize: Size(400, 75),
maximumSize: Size(800, 75),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))),
),
onPressed: () {
if (Platform.isAndroid) {
@ -444,9 +445,10 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
visible: Provider.of<ProfileInfoState>(context, listen: false).onion.isNotEmpty,
child: Tooltip(
message: AppLocalizations.of(context)!.enterCurrentPasswordForDelete,
child: FilledButton.icon(
style: FilledButton.styleFrom(
child: ElevatedButton.icon(
style: ElevatedButton.styleFrom(
minimumSize: Size(400, 75),
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
maximumSize: Size(800, 75),
shape: RoundedRectangleBorder(
side: BorderSide(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor, width: 2.0),
@ -456,7 +458,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
showAlertDialog(context);
},
icon: Icon(Icons.delete_forever),
label: Text(AppLocalizations.of(context)!.deleteBtn),
label: Text(AppLocalizations.of(context)!.deleteBtn, style: TextStyle(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor)),
)))
]))))));
});

View File

@ -281,16 +281,20 @@ class _AddEditServerViewState extends State<AddEditServerView> {
height: 20,
),
Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [
ElevatedButton(
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: ElevatedButton(
onPressed: serverInfoState.onion.isEmpty ? _createPressed : _savePressed,
child: Text(
serverInfoState.onion.isEmpty ? AppLocalizations.of(context)!.addServerTitle : AppLocalizations.of(context)!.saveServerButton,
textAlign: TextAlign.center,
),
),
]),
),
],
),
Visibility(
visible: serverInfoState.onion.isNotEmpty,
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [

View File

@ -118,7 +118,7 @@ class _GlobalSettingsAppearanceViewState extends State<GlobalSettingsAppearanceV
//.fileSharingSettingsDownloadFolderDescription,
trailing: Container(
width: MediaQuery.of(context).size.width / 4,
child: OutlinedButton.icon(
child: ElevatedButton.icon(
label: Text(AppLocalizations.of(context)!.settingsImportThemeButton),
onPressed: Provider.of<AppState>(context).disableFilePicker
? null

View File

@ -152,7 +152,7 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
),
Tooltip(
message: AppLocalizations.of(context)!.archiveConversation,
child: OutlinedButton.icon(
child: ElevatedButton.icon(
onPressed: () {
var profileOnion = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
var handle = Provider.of<ContactInfoState>(context, listen: false).identifier;
@ -173,13 +173,17 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
Row(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, children: [
Tooltip(
message: AppLocalizations.of(context)!.leaveConversation,
child: OutlinedButton.icon(
child: TextButton.icon(
onPressed: () {
showAlertDialog(context);
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.backgroundPaneColor),
foregroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.mainTextColor)),
icon: Icon(CwtchIcons.leave_group),
label: Text(
AppLocalizations.of(context)!.leaveConversation,
style: settings.scaleFonts(defaultTextButtonStyle.copyWith(decoration: TextDecoration.underline)),
),
))
])

View File

@ -624,7 +624,7 @@ class _MessageViewState extends State<MessageView> {
var vline = Padding(
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 2),
child: Container(height: 16, width: 1, decoration: BoxDecoration(color: Provider.of<Settings>(context).theme.toolbarIconColor)));
child: Container(height: 16, width: 1, decoration: BoxDecoration(color: Provider.of<Settings>(context).theme.messageFromMeTextColor)));
var formattingToolbar = Container(
decoration: BoxDecoration(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor),
@ -920,7 +920,7 @@ class _MessageViewState extends State<MessageView> {
height: 10,
)),
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
OutlinedButton(
ElevatedButton(
child: Text(AppLocalizations.of(context)!.cancel, semanticsLabel: AppLocalizations.of(context)!.cancel),
onPressed: () {
Navigator.pop(bcontext);
@ -929,7 +929,7 @@ class _MessageViewState extends State<MessageView> {
SizedBox(
width: 20,
),
FilledButton(
ElevatedButton(
child: Text(AppLocalizations.of(context)!.btnSendFile, semanticsLabel: AppLocalizations.of(context)!.btnSendFile),
onPressed: () {
_sendFile(path);

View File

@ -294,7 +294,7 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
Row(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, children: [
Tooltip(
message: AppLocalizations.of(context)!.archiveConversation,
child: OutlinedButton.icon(
child: ElevatedButton.icon(
onPressed: () {
var profileOnion = Provider.of<ContactInfoState>(context, listen: false).profileOnion;
var handle = Provider.of<ContactInfoState>(context, listen: false).identifier;
@ -316,13 +316,17 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
Row(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.end, children: [
Tooltip(
message: AppLocalizations.of(context)!.leaveConversation,
child: OutlinedButton.icon(
child: TextButton.icon(
onPressed: () {
showAlertDialog(context);
},
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.backgroundPaneColor),
foregroundColor: MaterialStateProperty.all(Provider.of<Settings>(context).theme.mainTextColor)),
icon: Icon(CwtchIcons.leave_group),
label: Text(
AppLocalizations.of(context)!.leaveConversation,
style: settings.scaleFonts(defaultTextButtonStyle.copyWith(decoration: TextDecoration.underline)),
),
))
]),

View File

@ -89,7 +89,6 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
icon: TorIcon(),
onPressed: _pushTorStatus,
splashRadius: Material.defaultSplashRadius / 2,
color: Provider.of<ProfileListState>(context).profiles.isEmpty ? Provider.of<Settings>(context).theme.defaultButtonColor : Provider.of<Settings>(context).theme.mainTextColor,
tooltip: Provider.of<TorStatus>(context).progress == 100
? AppLocalizations.of(context)!.networkStatusOnline
: (Provider.of<TorStatus>(context).progress == 0 ? AppLocalizations.of(context)!.networkStatusDisconnected : AppLocalizations.of(context)!.networkStatusAttemptingTor),
@ -243,9 +242,10 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
Expanded(
child: Tooltip(
message: AppLocalizations.of(context)!.importProfileTooltip,
child: OutlinedButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(399, 20),
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
maximumSize: Size(400, 20),
shape: RoundedRectangleBorder(
side: BorderSide(color: Provider.of<Settings>(context).theme.defaultButtonActiveColor, width: 2.0),
@ -253,7 +253,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
),
child: Text(AppLocalizations.of(context)!.importProfile,
semanticsLabel: AppLocalizations.of(context)!.importProfile,
),
style: TextStyle(color: Provider.of<Settings>(context).theme.mainTextColor, fontWeight: FontWeight.bold)),
onPressed: () {
// 10GB profiles should be enough for anyone?
showFilePicker(context, MaxGeneralFileSharingSize, (file) {
@ -359,8 +359,8 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
Tooltip(
message: AppLocalizations.of(context)!.tooltipUnlockProfiles,
child: FilledButton.icon(
icon: Icon(CwtchIcons.lock_open_24px),
child: TextButton.icon(
icon: Icon(CwtchIcons.lock_open_24px, color: Provider.of<Settings>(context).current().defaultButtonTextColor),
style: TextButton.styleFrom(
minimumSize: Size(MediaQuery.of(context).size.width * 0.79, 80),
maximumSize: Size(MediaQuery.of(context).size.width * 0.8, 80),
@ -369,7 +369,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
label: Text(
AppLocalizations.of(context)!.unlock,
semanticsLabel: AppLocalizations.of(context)!.unlock,
style: TextStyle(fontWeight: FontWeight.bold),
style: TextStyle(fontWeight: FontWeight.bold, color: Provider.of<Settings>(context).current().defaultButtonTextColor),
),
onPressed: () {
_modalUnlockProfiles();
@ -395,8 +395,8 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
Tooltip(
message: AppLocalizations.of(context)!.addProfileTitle,
child: FilledButton.icon(
icon: Icon(Icons.add),
child: TextButton.icon(
icon: Icon(Icons.add, color: Provider.of<Settings>(context).current().mainTextColor),
style: TextButton.styleFrom(
minimumSize: Size(MediaQuery.of(context).size.width * 0.79, 80),
maximumSize: Size(MediaQuery.of(context).size.width * 0.8, 80),

View File

@ -56,7 +56,8 @@ class _SplashViewState extends State<SplashView> {
: appState.modalState == ModalState.storageMigration
? AppLocalizations.of(context)!.storageMigrationModalMessage
: AppLocalizations.of(context)!.shuttingDownApp, // Todo l10n AppLocalizations.of(context)!.storageMigrationModalMessage
style: defaultTextButtonStyle.copyWith(fontSize: 16.0, fontFamily: "Inter", color: appState.appError == "" ? whiteishPurple : hotPink))),
style: defaultTextButtonStyle.copyWith(
fontSize: 16.0, fontFamily: "Inter", color: appState.appError == "" ? whiteishPurple : hotPink))),
Visibility(
visible: appState.modalState == ModalState.storageMigration || appState.modalState == ModalState.shutdown,
child: LinearProgressIndicator(

View File

@ -63,7 +63,7 @@ class _ContactRowState extends State<ContactRow> {
enableFeedback: true,
splashFactory: InkSplash.splashFactory,
child: Ink(
color: selected ? (Provider.of<Settings>(context).theme.backgroundHilightElementColor as Color).withOpacity(0.8) : Colors.transparent,
color: selected ? Provider.of<Settings>(context).theme.backgroundHilightElementColor : Colors.transparent,
child: Container(
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [
Padding(
@ -123,8 +123,8 @@ class _ContactRowState extends State<ContactRow> {
height: contact.isInvitation ? Provider.of<Settings>(context).fontScaling * 14.0 + 35.0 : Provider.of<Settings>(context).fontScaling * 14.0 + 5.0,
child: contact.isInvitation == true
? FittedBox(
fit: BoxFit.scaleDown,
child: Wrap(children: <Widget>[
fit: BoxFit.cover,
child: Row(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: <Widget>[
Padding(
padding: EdgeInsets.all(2),
child: TextButton.icon(

View File

@ -40,19 +40,12 @@ endif()
# default. In most cases, you should add new options to specific targets instead
# of modifying this function.
function(APPLY_STANDARD_SETTINGS TARGET)
# Not ideal, there doesn't appear to be a way to get target arch so getting host arch. won't work for cross compiling
execute_process(COMMAND uname -m OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE ARCH)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
# -Os -fno-ident (optimize for size, and strip idents, don't generate a build-id, fix hash style)
target_compile_options(${TARGET} PRIVATE -Wall -Werror -Os -fno-ident)
# on x86_64 use an included elf_x86_64.x for reproducibility. for other arches don't (and then don't be reproducible)
if(${ARCH} STREQUAL "x86_64")
target_link_libraries(${TARGET} PRIVATE -Qn -Os -Wl,-s,--hash-style=gnu,--build-id=none,--script=${PROJECT_BUILD_DIR}/../elf_x86_64.x)
else()
target_link_libraries(${TARGET} PRIVATE -Qn -Os -Wl,-s,--hash-style=gnu,--build-id=none)
endif()
endfunction()
# Flutter library and tool build rules.

View File

@ -10,7 +10,6 @@
#include <pwd.h>
#include <flutter_linux/flutter_linux.h>
#include <flutter_linux/fl_dart_project.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
@ -88,6 +87,7 @@ static void my_application_activate(GApplication* application) {
if( stat("lib/cwtch", &info) == 0) {
// use local dir structure
fl_dart_project_set_assets_path(project, g_build_filename("data", "flutter_assets", nullptr));
//project->aot_library_path = g_build_filename("lib", "libapp.so", nullptr);
fl_dart_project_set_aot_library_path(project, g_build_filename("lib", "libapp.so", nullptr));
fl_dart_project_set_icu_data_path(project, g_build_filename("data", "icudtl.dat", nullptr));
gtk_window_set_icon_from_file(window, "./cwtch.png", NULL);
@ -98,6 +98,7 @@ static void my_application_activate(GApplication* application) {
// /home/$USER/.local/share/cwtch/data/flutter_assets
fl_dart_project_set_assets_path(project, g_build_filename(homedir, ".local", "share", "cwtch", "data", "flutter_assets", nullptr));
// /home/$USER/.local/lib/cwtch/
//project->aot_library_path = g_build_filename(homedir, ".local", "lib", "cwtch", "libapp.so", nullptr);
fl_dart_project_set_aot_library_path(project, g_build_filename(homedir, ".local", "lib", "cwtch", "libapp.so", nullptr));
// /home/$USER/.local/share/cwtch/data
fl_dart_project_set_icu_data_path(project, g_build_filename(homedir, ".local", "share", "cwtch", "data", "icudtl.dat", nullptr));
@ -107,6 +108,7 @@ static void my_application_activate(GApplication* application) {
// /usr/share/cwtch/data/flutter_assets
fl_dart_project_set_assets_path(project, g_build_filename("/", "usr", "share", "cwtch", "data", "flutter_assets", nullptr));
// /usr/lib/cwtch
//project->aot_library_path = g_build_filename("/", "usr", "lib", "cwtch", "libapp.so", nullptr);
fl_dart_project_set_aot_library_path(project, g_build_filename("/", "usr", "lib", "cwtch", "libapp.so", nullptr));
// /usr/share/cwtch/data
fl_dart_project_set_icu_data_path(project, g_build_filename("/", "usr", "share", "cwtch", "data", "icudtl.dat", nullptr));