Merge pull request #204 from cypherstack/desktop

isFavorite bandaid fix for https://github.com/cypherstack/stack_walle
This commit is contained in:
Diego Salazar 2022-11-07 10:09:32 -07:00 committed by GitHub
commit 7f65072225
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 414 additions and 248 deletions

View file

@ -4,7 +4,10 @@ import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -18,10 +21,16 @@ class SupportView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final isDesktop = Util.isDesktop;
debugPrint("BUILD: $runtimeType"); debugPrint("BUILD: $runtimeType");
return ConditionalParent(
condition: !isDesktop,
builder: (child) {
return Scaffold( return Scaffold(
backgroundColor: Theme.of(context).extension<StackColors>()!.background, backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar( appBar: AppBar(
leading: AppBarBackButton( leading: AppBarBackButton(
onPressed: () { onPressed: () {
@ -35,6 +44,10 @@ class SupportView extends StatelessWidget {
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(16), padding: const EdgeInsets.all(16),
child: child,
),
);
},
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
@ -44,7 +57,11 @@ class SupportView extends StatelessWidget {
style: STextStyles.smallMed12(context), style: STextStyles.smallMed12(context),
), ),
), ),
const SizedBox( isDesktop
? const SizedBox(
height: 24,
)
: const SizedBox(
height: 12, height: 12,
), ),
RoundedWhiteContainer( RoundedWhiteContainer(
@ -58,10 +75,12 @@ class SupportView extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
if (!isDesktop) {
launchUrl( launchUrl(
Uri.parse("https://t.me/stackwallet"), Uri.parse("https://t.me/stackwallet"),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
}
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -69,6 +88,9 @@ class SupportView extends StatelessWidget {
vertical: 20, vertical: 20,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
Assets.socials.telegram, Assets.socials.telegram,
@ -88,6 +110,17 @@ class SupportView extends StatelessWidget {
), ),
], ],
), ),
BlueTextButton(
text: isDesktop ? "@stackwallet" : "",
onTap: () {
launchUrl(
Uri.parse("https://t.me/stackwallet"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
), ),
), ),
), ),
@ -105,10 +138,12 @@ class SupportView extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
if (!isDesktop) {
launchUrl( launchUrl(
Uri.parse("https://discord.gg/RZMG3yUm"), Uri.parse("https://discord.gg/RZMG3yUm"),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
}
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -116,6 +151,9 @@ class SupportView extends StatelessWidget {
vertical: 20, vertical: 20,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
Assets.socials.discord, Assets.socials.discord,
@ -135,6 +173,18 @@ class SupportView extends StatelessWidget {
), ),
], ],
), ),
BlueTextButton(
text: isDesktop ? "Stack Wallet" : "",
onTap: () {
launchUrl(
Uri.parse(
"https://discord.gg/RZMG3yUm"), //expired link?
mode: LaunchMode.externalApplication,
);
},
),
],
),
), ),
), ),
), ),
@ -152,10 +202,12 @@ class SupportView extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
if (!isDesktop) {
launchUrl( launchUrl(
Uri.parse("https://www.reddit.com/r/stackwallet/"), Uri.parse("https://www.reddit.com/r/stackwallet/"),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
}
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -163,6 +215,9 @@ class SupportView extends StatelessWidget {
vertical: 20, vertical: 20,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
Assets.socials.reddit, Assets.socials.reddit,
@ -182,6 +237,17 @@ class SupportView extends StatelessWidget {
), ),
], ],
), ),
BlueTextButton(
text: isDesktop ? "r/stackwallet" : "",
onTap: () {
launchUrl(
Uri.parse("https://www.reddit.com/r/stackwallet/"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
), ),
), ),
), ),
@ -199,10 +265,12 @@ class SupportView extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
if (!isDesktop) {
launchUrl( launchUrl(
Uri.parse("https://twitter.com/stack_wallet"), Uri.parse("https://twitter.com/stack_wallet"),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
}
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -210,6 +278,9 @@ class SupportView extends StatelessWidget {
vertical: 20, vertical: 20,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
Assets.socials.twitter, Assets.socials.twitter,
@ -229,6 +300,17 @@ class SupportView extends StatelessWidget {
), ),
], ],
), ),
BlueTextButton(
text: isDesktop ? "@stack_wallet" : "",
onTap: () {
launchUrl(
Uri.parse("https://twitter.com/stack_wallet"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
), ),
), ),
), ),
@ -246,10 +328,12 @@ class SupportView extends StatelessWidget {
), ),
), ),
onPressed: () { onPressed: () {
if (!isDesktop) {
launchUrl( launchUrl(
Uri.parse("mailto://support@stackwallet.com"), Uri.parse("mailto://support@stackwallet.com"),
mode: LaunchMode.externalApplication, mode: LaunchMode.externalApplication,
); );
}
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
@ -257,6 +341,9 @@ class SupportView extends StatelessWidget {
vertical: 20, vertical: 20,
), ),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [ children: [
SvgPicture.asset( SvgPicture.asset(
Assets.svg.envelope, Assets.svg.envelope,
@ -276,12 +363,22 @@ class SupportView extends StatelessWidget {
), ),
], ],
), ),
BlueTextButton(
text: isDesktop ? "support@stackwallet.com" : "",
onTap: () {
launchUrl(
Uri.parse("mailto://support@stackwallet.com"),
mode: LaunchMode.externalApplication,
);
},
),
],
),
), ),
), ),
), ),
], ],
), ),
),
); );
} }
} }

View file

@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages_desktop_specific/home/desktop_menu.dart'; import 'package:stackwallet/pages_desktop_specific/home/desktop_menu.dart';
import 'package:stackwallet/pages_desktop_specific/home/desktop_settings_view.dart'; import 'package:stackwallet/pages_desktop_specific/home/desktop_settings_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_view.dart'; import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/my_stack_view.dart';
import 'package:stackwallet/pages_desktop_specific/home/support_and_about_view/desktop_support_view.dart';
import 'package:stackwallet/route_generator.dart'; import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -37,8 +38,10 @@ class _DesktopHomeViewState extends ConsumerState<DesktopHomeView> {
onGenerateRoute: RouteGenerator.generateRoute, onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: DesktopSettingsView.routeName, initialRoute: DesktopSettingsView.routeName,
), ),
Container( const Navigator(
color: Colors.blue, key: Key("desktopSupportHomeKey"),
onGenerateRoute: RouteGenerator.generateRoute,
initialRoute: DesktopSupportView.routeName,
), ),
Container( Container(
color: Colors.pink, color: Colors.pink,

View file

@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import '../../../pages/settings_views/global_settings_view/support_view.dart';
class DesktopSupportView extends ConsumerStatefulWidget {
const DesktopSupportView({Key? key}) : super(key: key);
static const String routeName = "/desktopSupportView";
@override
ConsumerState<DesktopSupportView> createState() => _DesktopSupportView();
}
class _DesktopSupportView extends ConsumerState<DesktopSupportView> {
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
return DesktopScaffold(
background: Theme.of(context).extension<StackColors>()!.background,
appBar: DesktopAppBar(
isCompactHeight: true,
leading: Row(
children: [
const SizedBox(
width: 24,
height: 24,
),
Text(
"Support",
style: STextStyles.desktopH3(context),
)
],
),
),
body: Column(
children: const [
Padding(
padding: EdgeInsets.fromLTRB(24, 10, 377, 270),
child: SupportView(),
),
],
),
);
}
}

View file

@ -99,6 +99,7 @@ import 'package:stackwallet/pages_desktop_specific/home/settings_menu/nodes_sett
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/security_settings.dart'; import 'package:stackwallet/pages_desktop_specific/home/settings_menu/security_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/settings_menu.dart'; import 'package:stackwallet/pages_desktop_specific/home/settings_menu/settings_menu.dart';
import 'package:stackwallet/pages_desktop_specific/home/settings_menu/syncing_preferences_settings.dart'; import 'package:stackwallet/pages_desktop_specific/home/settings_menu/syncing_preferences_settings.dart';
import 'package:stackwallet/pages_desktop_specific/home/support_and_about_view/desktop_support_view.dart';
import 'package:stackwallet/services/coins/manager.dart'; import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart'; import 'package:stackwallet/services/event_bus/events/global/node_connection_status_changed_event.dart';
import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; import 'package:stackwallet/services/event_bus/events/global/wallet_sync_status_changed_event.dart';
@ -1084,6 +1085,12 @@ class RouteGenerator {
builder: (_) => const AdvancedSettings(), builder: (_) => const AdvancedSettings(),
settings: RouteSettings(name: settings.name)); settings: RouteSettings(name: settings.name));
case DesktopSupportView.routeName:
return getRoute(
shouldUseMaterialRoute: useMaterialPageRoute,
builder: (_) => const DesktopSupportView(),
settings: RouteSettings(name: settings.name));
case WalletKeysDesktopPopup.routeName: case WalletKeysDesktopPopup.routeName:
if (args is List<String>) { if (args is List<String>) {
return FadePageRoute( return FadePageRoute(

View file

@ -174,9 +174,10 @@ class BitcoinWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -3376,9 +3376,10 @@ class BitcoinCashWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -2983,9 +2983,10 @@ class DogecoinWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -558,9 +558,10 @@ class EpicCashWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -821,9 +821,10 @@ class FiroWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -174,9 +174,10 @@ class LitecoinWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -1376,9 +1376,10 @@ class MoneroWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -170,9 +170,10 @@ class NamecoinWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }

View file

@ -1382,9 +1382,10 @@ class WowneroWallet extends CoinServiceAPI {
return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite") return DB.instance.get<dynamic>(boxName: walletId, key: "isFavorite")
as bool; as bool;
} catch (e, s) { } catch (e, s) {
Logging.instance Logging.instance.log(
.log("isFavorite fetch failed: $e\n$s", level: LogLevel.Error); "isFavorite fetch failed (returning false by default): $e\n$s",
rethrow; level: LogLevel.Error);
return false;
} }
} }