diff --git a/assets/flutter_i18n/en.json b/assets/flutter_i18n/en.json index be9fe17e..9e3e9534 100644 --- a/assets/flutter_i18n/en.json +++ b/assets/flutter_i18n/en.json @@ -334,10 +334,10 @@ "experiencing_issues": "Experiencing issues?", "background_service_solution": "Try re-enabling the app or check the battery optimization settings.", "dapp_hooks": "DApp hooks", - "wifi_hooks": "Wi-Fi hooks", + "wifi_hexagon_location_hooks": "Wi-Fi hexagon location hooks", "miner_hooks": "Miner hooks", "location_permission_required_title": "Location permission required.", - "location_permission_required_text": "Oops, location permission is denied, It's essential for us to have location permission in order for Wi-Fi hooks to perform actively, Please grant location permission by going to settings.", + "location_permission_required_text": "Oops, location permission is denied, It's essential for us to have location permission in order for Wi-Fi hexagon location hooks to perform actively, Please grant location permission by going to settings.", "open_settings": "Open settings", "service_launched_successfully": "{0} service launched successfully.", "unable_to_launch_service": "Unable to launch {0} service.", @@ -347,5 +347,7 @@ "auto_claim_execution_dialog_title": "Time Already Passed!", "auto_claim_execution_dialog_text": "The time for auto claim has elapsed. Would you like to execute auto claim now?", "execute": "Execute", - "auto_claim_scheduling_text": "Auto-claim will execute at {0} tomorrow" + "auto_claim_scheduling_text": "Auto-claim will execute at {0} tomorrow", + "mxc_top_up_notification_text": "Hey {0}! You added {1} MXC to your wallet today. Keep it growing!", + "mxc_top_up_notification_title": "Congrats on new Top-Up" } \ No newline at end of file diff --git a/assets/pdf/privacy.pdf b/assets/pdf/privacy.pdf new file mode 100644 index 00000000..7464f96e Binary files /dev/null and b/assets/pdf/privacy.pdf differ diff --git a/lib/common/components/components.dart b/lib/common/components/components.dart index 1ff72247..c7ecee0f 100644 --- a/lib/common/components/components.dart +++ b/lib/common/components/components.dart @@ -5,3 +5,4 @@ export 'balance_panel/balance.dart'; export 'snack_bar.dart'; export 'list/list.dart'; export 'property_item.dart'; +export 'notification.dart'; diff --git a/lib/common/components/notification.dart b/lib/common/components/notification.dart new file mode 100644 index 00000000..56668ca2 --- /dev/null +++ b/lib/common/components/notification.dart @@ -0,0 +1,9 @@ +import 'package:datadashwallet/core/core.dart'; + +showNotification(String title, String? text) { + AXSNotification().showNotification(title, text); +} + +showLowPriorityNotification(String title, String? text) { + AXSNotification().showLowPriorityNotification(title, text); +} diff --git a/lib/features/common/app/launcher_use_case.dart b/lib/features/common/app/launcher_use_case.dart index 87ba9f3c..a7ee5fee 100644 --- a/lib/features/common/app/launcher_use_case.dart +++ b/lib/features/common/app/launcher_use_case.dart @@ -1,11 +1,15 @@ import 'dart:async'; +import 'dart:io'; import 'package:datadashwallet/common/common.dart'; import 'package:datadashwallet/core/core.dart'; import 'package:datadashwallet/features/common/common.dart'; import 'package:datadashwallet/features/settings/subfeatures/chain_configuration/domain/chain_configuration_use_case.dart'; import 'package:mxc_logic/mxc_logic.dart'; +import 'package:open_file/open_file.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'package:flutter/services.dart' show ByteData, rootBundle; import 'package:web3dart/web3dart.dart'; class LauncherUseCase extends ReactiveUseCase { @@ -118,4 +122,16 @@ class LauncherUseCase extends ReactiveUseCase { void openTelegram() => launchUrlInPlatformDefaultWithString(Urls.telegram); void openWeChat() => launchUrlInPlatformDefaultWithString(Urls.weChat); + + void openAXSPrivacy(String path) async { + ByteData data = await rootBundle.load(path); + List bytes = data.buffer.asUint8List(); + String tempDir = (await getTemporaryDirectory()).path; + String tempFilePath = '$tempDir/${path.split('/').last}'; + File tempFile = File(tempFilePath); + await tempFile.writeAsBytes(bytes, flush: true); + openFile(tempFilePath); + } + + void openFile(String path) => OpenFile.open(path); } diff --git a/lib/features/settings/subfeatures/about_page/about_page.dart b/lib/features/settings/subfeatures/about_page/about_page.dart index ee66de2d..a825588c 100644 --- a/lib/features/settings/subfeatures/about_page/about_page.dart +++ b/lib/features/settings/subfeatures/about_page/about_page.dart @@ -45,6 +45,7 @@ class AboutPage extends HookConsumerWidget { const AppTerm( name: 'privacy_policy', externalLink: Urls.axsPrivacy, + isFile: true, ), ], ); diff --git a/lib/features/settings/subfeatures/about_page/widgets/app_term.dart b/lib/features/settings/subfeatures/about_page/widgets/app_term.dart index 1cd9bbac..2ecbccc4 100644 --- a/lib/features/settings/subfeatures/about_page/widgets/app_term.dart +++ b/lib/features/settings/subfeatures/about_page/widgets/app_term.dart @@ -6,22 +6,24 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:mxc_ui/mxc_ui.dart'; class AppTerm extends HookConsumerWidget { - const AppTerm({ - super.key, - required this.name, - required this.externalLink, - }); + const AppTerm( + {super.key, + required this.name, + required this.externalLink, + this.isFile = false}); final String name; final String externalLink; + final bool isFile; @override Widget build(BuildContext context, WidgetRef ref) { late final launcherUseCase = ref.read(launcherUseCaseProvider); return InkWell( - onTap: () => - launcherUseCase.launchUrlInExternalAppWithString(externalLink), + onTap: () => isFile + ? launcherUseCase.openAXSPrivacy(externalLink) + : launcherUseCase.launchUrlInExternalAppWithString(externalLink), child: Padding( padding: const EdgeInsets.symmetric(vertical: Sizes.spaceSmall), child: Row( diff --git a/lib/features/settings/subfeatures/dapp_hooks/dapp_hooks_page.dart b/lib/features/settings/subfeatures/dapp_hooks/dapp_hooks_page.dart index 0f509138..820f89d3 100644 --- a/lib/features/settings/subfeatures/dapp_hooks/dapp_hooks_page.dart +++ b/lib/features/settings/subfeatures/dapp_hooks/dapp_hooks_page.dart @@ -89,7 +89,7 @@ class DAppHooksPage extends HookConsumerWidget { children: [ MXCSwitchRowItem( key: const Key('wifiHookSwitch'), - title: translate('wifi_hooks'), + title: translate('wifi_hexagon_location_hooks'), value: dappHooksState.dAppHooksData!.wifiHooks.enabled, onChanged: dappHooksPresenter.changeWifiHooksEnabled, enabled: isSettingsChangeEnabled, @@ -120,6 +120,7 @@ class DAppHooksPage extends HookConsumerWidget { value: dappHooksState.dAppHooksData!.minerHooks.enabled, onChanged: dappHooksPresenter.changeMinerHooksEnabled, enabled: isMXCChains, + titleStyle: FontTheme.of(context).h6(), ), const SizedBox(height: Sizes.spaceNormal), MXCDropDown( diff --git a/lib/features/settings/subfeatures/notifications/domain/background_fetch_config_use_case.dart b/lib/features/settings/subfeatures/notifications/domain/background_fetch_config_use_case.dart index 6dfed4ce..eb494c29 100644 --- a/lib/features/settings/subfeatures/notifications/domain/background_fetch_config_use_case.dart +++ b/lib/features/settings/subfeatures/notifications/domain/background_fetch_config_use_case.dart @@ -156,7 +156,7 @@ class BackgroundFetchConfigUseCase extends ReactiveUseCase { if (expectedEpochOccurrence <= epochQuantity) { periodicalCallData = periodicalCallData.copyWith(lasEpoch: epochNumber); AXSNotification().showNotification("Epoch Achievement Alert!", - "Congratulations! The anticipated epoch you've been waiting for has just occurred. It's a significant milestone. Let's take the next steps forward.,"); + "Congratulations! The anticipated epoch you've been waiting for has just occurred. It's a significant milestone. Let's take the next steps forward."); } return periodicalCallData; diff --git a/lib/features/wallet/presentation/wallet_page_presenter.dart b/lib/features/wallet/presentation/wallet_page_presenter.dart index f5bdd2c0..ea7f0b8e 100644 --- a/lib/features/wallet/presentation/wallet_page_presenter.dart +++ b/lib/features/wallet/presentation/wallet_page_presenter.dart @@ -169,6 +169,28 @@ class WalletPresenter extends CompletePresenter { break; // coin transfer done case 'transaction': + // final newMXCTx = WannseeTransactionModel.fromJson( + // json.encode(event.payload['transactions'][0])); + + // final newTx = TransactionModel.fromMXCTransaction( + // newMXCTx, state.account!.address); + + // if (newTx.token.symbol == Config.mxcName && + // newTx.type == TransactionType.received) { + // final decimal = newTx.token.decimals ?? Config.ethDecimals; + // final formattedValue = + // MXCFormatter.convertWeiToEth(newTx.value ?? '0', decimal); + // showNotification( + // translate('mxc_top_up_notification_title')!, + // translate('mxc_top_up_notification_text')! + // .replaceFirst( + // '{0}', + // state.account!.mns ?? + // MXCFormatter.formatWalletAddress( + // state.account!.address), + // ) + // .replaceFirst('{1}', formattedValue)); + // } // Sometimes getting the tx list from remote right away, results in having the pending tx in the list too (Which shouldn't be) Future.delayed(const Duration(seconds: 3), () { getMXCTransactions(); diff --git a/packages/shared b/packages/shared index 93c2631d..8a3d5131 160000 --- a/packages/shared +++ b/packages/shared @@ -1 +1 @@ -Subproject commit 93c2631d37c6dd8b280213e583e1ba8a8a4ea9fe +Subproject commit 8a3d513146940f9f839fb1b01497535be6d7f3e2 diff --git a/pubspec.lock b/pubspec.lock index 4e7269e8..4aa35c14 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -983,6 +983,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.2" + open_file: + dependency: "direct main" + description: + name: open_file + sha256: a5a32d44acb7c899987d0999e1e3cbb0a0f1adebbf41ac813ec6d2d8faa0af20 + url: "https://pub.dev" + source: hosted + version: "3.3.2" open_mail_app: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 9ffa8947..5d7a8de0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -73,6 +73,7 @@ dependencies: mxc_ui: path: packages/shared/ui network_info_plus: ^4.1.0 + open_file: ^3.3.2 open_mail_app: ^0.4.5 package_info_plus: ^4.2.0 path_provider: ^2.0.12 @@ -120,6 +121,7 @@ flutter: - assets/svg/settings/ - assets/lottie/ - assets/lottie/gestures/ + - assets/pdf/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware