Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
feat: privacy local pdf & miner hook text
Browse files Browse the repository at this point in the history
  • Loading branch information
reasje committed Mar 18, 2024
1 parent a25de6d commit 71e05bd
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 11 deletions.
4 changes: 2 additions & 2 deletions assets/flutter_i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
Binary file added assets/pdf/privacy.pdf
Binary file not shown.
16 changes: 16 additions & 0 deletions lib/features/common/app/launcher_use_case.dart
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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<int> 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class AboutPage extends HookConsumerWidget {
const AppTerm(
name: 'privacy_policy',
externalLink: Urls.axsPrivacy,
isFile: true,
),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71e05bd

Please sign in to comment.