diff --git a/assets/flutter_i18n/en.json b/assets/flutter_i18n/en.json index 187c1777..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.", 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/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/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