This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from MXCzkEVM/blueberry_ring
Blueberry ring
- Loading branch information
Showing
15 changed files
with
6,335 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,156 +1,157 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BGTaskSchedulerPermittedIdentifiers</key> | ||
<array> | ||
<string>com.transistorsoft.fetch</string> | ||
<string>com.mxc.axswallet.notificationsTask</string> | ||
<string>com.mxc.axswallet.wifiHooksTask</string> | ||
<string>com.mxc.axswallet.minerAutoClaimTask</string> | ||
</array> | ||
<key>CADisableMinimumFrameDurationOnPhone</key> | ||
<true/> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>AXS</string> | ||
<key>CFBundleDocumentTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleTypeName</key> | ||
<string>FlSharedLink</string> | ||
<key>LSHandlerRank</key> | ||
<string>Default</string> | ||
<key>LSItemContentTypes</key> | ||
<array> | ||
<string>public.file-url</string> | ||
<string>public.image</string> | ||
<string>public.text</string> | ||
<string>public.url</string> | ||
<string>public.data</string> | ||
</array> | ||
</dict> | ||
</array> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleLocalizations</key> | ||
<array> | ||
<string>en</string> | ||
<string>zh_TW</string> | ||
<string>zh_CN</string> | ||
<string>zh_HK</string> | ||
<string>ko</string> | ||
<string>ja</string> | ||
<string>vi</string> | ||
<string>ru</string> | ||
<string>tr</string> | ||
<string>de</string> | ||
<string>es</string> | ||
<string>pt</string> | ||
<string>tl</string> | ||
<string>id</string> | ||
<string>it</string> | ||
<string>fr</string> | ||
</array> | ||
<key>CFBundleName</key> | ||
<string>axs</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(FLUTTER_BUILD_NAME)</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(FLUTTER_BUILD_NUMBER)</string> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>tg</string> | ||
<string>weixin</string> | ||
<string>wechat</string> | ||
<string>googlegmail</string> | ||
<string>x-dispatch</string> | ||
<string>readdle-spark</string> | ||
<string>airmail</string> | ||
<string>ms-outlook</string> | ||
<string>ymail</string> | ||
<string>fastmail</string> | ||
<string>superhuman</string> | ||
<string>protonmail</string> | ||
</array> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>LSSupportsOpeningDocumentsInPlace</key> | ||
<string>No</string> | ||
<key>NSAppTransportSecurity</key> | ||
<dict> | ||
<key>BGTaskSchedulerPermittedIdentifiers</key> | ||
<array> | ||
<string>com.transistorsoft.fetch</string> | ||
<string>com.mxc.axswallet.notificationsTask</string> | ||
<string>com.mxc.axswallet.wifiHooksTask</string> | ||
<string>com.mxc.axswallet.minerAutoClaimTask</string> | ||
<string>com.mxc.axswallet.blueberryAutoSyncTask</string> | ||
</array> | ||
<key>CADisableMinimumFrameDurationOnPhone</key> | ||
<true/> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>AXS</string> | ||
<key>CFBundleDocumentTypes</key> | ||
<array> | ||
<dict> | ||
<key>NSAllowsArbitraryLoads</key> | ||
<true/> | ||
<key>CFBundleTypeName</key> | ||
<string>FlSharedLink</string> | ||
<key>LSHandlerRank</key> | ||
<string>Default</string> | ||
<key>LSItemContentTypes</key> | ||
<array> | ||
<string>public.file-url</string> | ||
<string>public.image</string> | ||
<string>public.text</string> | ||
<string>public.url</string> | ||
<string>public.data</string> | ||
</array> | ||
</dict> | ||
<key>NSAppleMusicUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Media Library?</string> | ||
<key>NSBluetoothPeripheralUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Bluetooth?</string> | ||
<key>NSCalendarsUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Calendar?</string> | ||
<key>NSCameraUsageDescription</key> | ||
<string>AXS Wallet needs access to your camera when the app is in use for services such as RWA minting. Image data is not saved or shared with any third parties.</string> | ||
<key>NSFaceIDUsageDescription</key> | ||
<string>AXS Wallet needs access to your Biometric data when the app is in use for authentication only. Your Biometric data is not saved or shared with any third parties.</string> | ||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> | ||
<string>AXS Wallet needs access to your location for features such as Wi-Fi hooks while the app is in use or running in the background. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSLocationAlwaysUsageDescription</key> | ||
<string>AXS Wallet requires access to your location at all times for services such as Wi-Fi hooks. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSLocationUsageDescription</key> | ||
<string>AXS Wallet needs access to your location to provide services such as Wi-Fi hooks. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSLocationWhenInUseUsageDescription</key> | ||
<string>AXS Wallet needs access to your location when the app is in use for services such as Wi-Fi hooks. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSMotionUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Motion?</string> | ||
<key>NSPhotoLibraryAddUsageDescription</key> | ||
<string>AXS Wallet needs access to your photos to save images such as RWA. Your photos are not saved or shared with any third parties.</string> | ||
<key>NSPhotoLibraryUsageDescription</key> | ||
<string>AXS Wallet needs access to your photos when the app is in use for services such as RWA minting. Your photos are not saved or shared with any third parties.</string> | ||
<key>NSSpeechRecognitionUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Speech Recognition?</string> | ||
<key>PermissionGroupNotification</key> | ||
<string>Would you allow AXS Wallet to use the Notification?</string> | ||
<key>NSBluetoothAlwaysUsageDescription</key> | ||
<string>AXS Wallet needs access to your Bluetooth when the app is in use or running in the background for services such as BluberryRing. Blutooth data is not saved or shared with any third parties.</string> | ||
<key>UIApplicationSupportsIndirectInputEvents</key> | ||
<true/> | ||
<key>UIBackgroundModes</key> | ||
<array> | ||
<string>fetch</string> | ||
<string>location</string> | ||
<string>processing</string> | ||
<string>remote-notification</string> | ||
<string>bluetooth-central</string> | ||
</array> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UIViewControllerBasedStatusBarAppearance</key> | ||
<false/> | ||
<key>UISupportsDocumentBrowser</key> | ||
</array> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleLocalizations</key> | ||
<array> | ||
<string>en</string> | ||
<string>zh_TW</string> | ||
<string>zh_CN</string> | ||
<string>zh_HK</string> | ||
<string>ko</string> | ||
<string>ja</string> | ||
<string>vi</string> | ||
<string>ru</string> | ||
<string>tr</string> | ||
<string>de</string> | ||
<string>es</string> | ||
<string>pt</string> | ||
<string>tl</string> | ||
<string>id</string> | ||
<string>it</string> | ||
<string>fr</string> | ||
</array> | ||
<key>CFBundleName</key> | ||
<string>axs</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>$(FLUTTER_BUILD_NAME)</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>$(FLUTTER_BUILD_NUMBER)</string> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>tg</string> | ||
<string>weixin</string> | ||
<string>wechat</string> | ||
<string>googlegmail</string> | ||
<string>x-dispatch</string> | ||
<string>readdle-spark</string> | ||
<string>airmail</string> | ||
<string>ms-outlook</string> | ||
<string>ymail</string> | ||
<string>fastmail</string> | ||
<string>superhuman</string> | ||
<string>protonmail</string> | ||
</array> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>LSSupportsOpeningDocumentsInPlace</key> | ||
<string>No</string> | ||
<key>NSAppTransportSecurity</key> | ||
<dict> | ||
<key>NSAllowsArbitraryLoads</key> | ||
<true/> | ||
</dict> | ||
<key>NSAppleMusicUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Media Library?</string> | ||
<key>NSBluetoothPeripheralUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Bluetooth?</string> | ||
<key>NSCalendarsUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Calendar?</string> | ||
<key>NSCameraUsageDescription</key> | ||
<string>AXS Wallet needs access to your camera when the app is in use for services such as RWA minting. Image data is not saved or shared with any third parties.</string> | ||
<key>NSFaceIDUsageDescription</key> | ||
<string>AXS Wallet needs access to your Biometric data when the app is in use for authentication only. Your Biometric data is not saved or shared with any third parties.</string> | ||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key> | ||
<string>AXS Wallet needs access to your location for features such as Wi-Fi hooks while the app is in use or running in the background. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSLocationAlwaysUsageDescription</key> | ||
<string>AXS Wallet requires access to your location at all times for services such as Wi-Fi hooks. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSLocationUsageDescription</key> | ||
<string>AXS Wallet needs access to your location to provide services such as Wi-Fi hooks. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSLocationWhenInUseUsageDescription</key> | ||
<string>AXS Wallet needs access to your location when the app is in use for services such as Wi-Fi hooks. Your location data is not saved or shared with any third parties.</string> | ||
<key>NSMotionUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Motion?</string> | ||
<key>NSPhotoLibraryAddUsageDescription</key> | ||
<string>AXS Wallet needs access to your photos to save images such as RWA. Your photos are not saved or shared with any third parties.</string> | ||
<key>NSPhotoLibraryUsageDescription</key> | ||
<string>AXS Wallet needs access to your photos when the app is in use for services such as RWA minting. Your photos are not saved or shared with any third parties.</string> | ||
<key>NSSpeechRecognitionUsageDescription</key> | ||
<string>Would you allow AXS Wallet to use the Speech Recognition?</string> | ||
<key>PermissionGroupNotification</key> | ||
<string>Would you allow AXS Wallet to use the Notification?</string> | ||
<key>NSBluetoothAlwaysUsageDescription</key> | ||
<string>AXS Wallet needs access to your Bluetooth when the app is in use or running in the background for services such as BluberryRing. Blutooth data is not saved or shared with any third parties.</string> | ||
<key>UIApplicationSupportsIndirectInputEvents</key> | ||
<true/> | ||
<key>UIBackgroundModes</key> | ||
<array> | ||
<string>fetch</string> | ||
<string>location</string> | ||
<string>processing</string> | ||
<string>remote-notification</string> | ||
<string>bluetooth-central</string> | ||
</array> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIMainStoryboardFile</key> | ||
<string>Main</string> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UIViewControllerBasedStatusBarAppearance</key> | ||
<false/> | ||
<key>UISupportsDocumentBrowser</key> | ||
<true/> | ||
</dict> | ||
</plist> |
84 changes: 84 additions & 0 deletions
84
lib/features/settings/subfeatures/dapp_hooks/utils/blueberry_ring_helper.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import 'package:datadashwallet/core/core.dart'; | ||
import 'package:datadashwallet/features/common/common.dart'; | ||
import 'package:datadashwallet/features/settings/subfeatures/dapp_hooks/utils/utils.dart'; | ||
import 'package:datadashwallet/features/settings/subfeatures/notifications/domain/background_fetch_config_use_case.dart'; | ||
import 'package:datadashwallet/features/settings/subfeatures/notifications/widgets/background_fetch_dialog.dart'; | ||
import 'package:flutter/material.dart'; | ||
import '../domain/dapp_hooks_use_case.dart'; | ||
|
||
class BlueberryHooksHelper { | ||
BlueberryHooksHelper( | ||
{required this.accountUseCase, | ||
required this.dAppHooksUseCase, | ||
required this.backgroundFetchConfigUseCase, | ||
required this.context, | ||
required this.translate}); | ||
|
||
DAppHooksUseCase dAppHooksUseCase; | ||
BackgroundFetchConfigUseCase backgroundFetchConfigUseCase; | ||
AccountUseCase accountUseCase; | ||
DappHooksSnackBarUtils get dappHooksSnackBarUtils => | ||
DappHooksSnackBarUtils(translate: translate, context: context); | ||
BuildContext? context; | ||
String? Function(String) translate; | ||
|
||
// delay is in minutes, returns true if success | ||
Future<bool> startBlueberryRingHooksService( | ||
{required DateTime time, required bool showBGFetchAlert}) async { | ||
if (showBGFetchAlert) { | ||
final res = await showBackgroundFetchAlertDialog(context: context!); | ||
if (res == null || !res) { | ||
return false; | ||
} | ||
} | ||
|
||
// Check Bluetooth & nearby devices enabled | ||
// After all enabled start service | ||
// listen for state and stop If the bluetooth & nearby device is went off | ||
// The Service will listen to the ad data and do the things on that | ||
final success = await dAppHooksUseCase.scheduleAutoClaimTransaction(time); | ||
|
||
if (success) { | ||
// Time past, need to run the auto claim | ||
|
||
dappHooksSnackBarUtils.showBlueberryRingHooksServiceSuccessSnackBar(); | ||
|
||
return true; | ||
} else { | ||
dappHooksSnackBarUtils.showBlueberryRingHooksServiceFailureSnackBar(); | ||
return false; | ||
} | ||
} | ||
|
||
Future<bool> stopBlueberryRingService({required bool showSnackbar}) async { | ||
final dappHooksData = dAppHooksUseCase.dappHooksData.value; | ||
final periodicalCallData = | ||
backgroundFetchConfigUseCase.periodicalCallData.value; | ||
final turnOffAll = | ||
AXSBackgroundFetch.turnOffAll(dappHooksData, periodicalCallData); | ||
|
||
await dAppHooksUseCase.stopBlueberryAutoSyncService(turnOffAll: turnOffAll); | ||
if (showSnackbar) { | ||
dappHooksSnackBarUtils.showBlueberryRingHooksServiceFailureSnackBar(); | ||
} | ||
return true; | ||
} | ||
|
||
Future<void> changeMinerHooksEnabled( | ||
bool value, | ||
) { | ||
return DAppHooksHelper.shouldUpdateWrapper(() async { | ||
late bool update; | ||
if (value) { | ||
update = await startBlueberryRingHooksService( | ||
time: dAppHooksUseCase.dappHooksData.value.minerHooks.time, | ||
showBGFetchAlert: true); | ||
} else { | ||
update = await stopBlueberryRingService(showSnackbar: true); | ||
} | ||
return update; | ||
}, () { | ||
return dAppHooksUseCase.updateMinerHooksEnabled(value); | ||
}); | ||
} | ||
} |
Oops, something went wrong.