use zxing
This commit is contained in:
parent
63f04f8cf3
commit
074802c2f8
|
@ -10,3 +10,6 @@
|
|||
[submodule "librustzcash"]
|
||||
path = librustzcash
|
||||
url = https://github.com/hhanh00/librustzcash.git
|
||||
[submodule "flutter_zxing"]
|
||||
path = flutter_zxing
|
||||
url = https://github.com/hhanh00/flutter_zxing.git
|
||||
|
|
|
@ -103,9 +103,6 @@ dependencies = [
|
|||
"android-armv7",
|
||||
"android-armv7-release",
|
||||
"post-android-armv7",
|
||||
"android-x86_64",
|
||||
"android-x86_64-release",
|
||||
"post-android-x86_64",
|
||||
"post-android"
|
||||
]
|
||||
|
||||
|
|
|
@ -9,3 +9,5 @@ GeneratedPluginRegistrant.java
|
|||
# Remember to never publicly share your keystore.
|
||||
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
|
||||
key.properties
|
||||
**/*.keystore
|
||||
**/*.jks
|
||||
|
|
|
@ -35,6 +35,16 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
|||
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
ndkVersion "25.1.8937393"
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main.java.srcDirs += 'src/main/kotlin'
|
||||
|
@ -43,11 +53,11 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "me.hanh.ywallet"
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 31
|
||||
targetSdkVersion 33
|
||||
versionCode flutterVersionCode.toInteger()
|
||||
versionName flutterVersionName
|
||||
ndk {
|
||||
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
|
||||
abiFilters 'arm64-v8a', 'armeabi-v7a'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,11 @@ buildscript {
|
|||
ext.kotlin_version = '1.6.10'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.1.0'
|
||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,22 @@ buildscript {
|
|||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.buildDir = '../build'
|
||||
subprojects {
|
||||
project.buildDir = "${rootProject.buildDir}/${project.name}"
|
||||
}
|
||||
subprojects { subproject ->
|
||||
afterEvaluate {
|
||||
if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
|
||||
android {
|
||||
compileSdkVersion 33
|
||||
}
|
||||
}
|
||||
}
|
||||
project.evaluationDependsOn(':app')
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
org.gradle.jvmargs=-Xmx4608m
|
||||
org.gradle.jvmargs=-Xmx1536M
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 6e28546c1c2fdeb77e0fcc920d3cf575327b716c
|
|
@ -4,6 +4,8 @@ PODS:
|
|||
- awesome_notifications (0.0.5):
|
||||
- Flutter
|
||||
- IosAwnCore (= 0.7.1)
|
||||
- camera_avfoundation (0.0.1):
|
||||
- Flutter
|
||||
- connectivity_plus (0.0.1):
|
||||
- Flutter
|
||||
- ReachabilitySwift
|
||||
|
@ -42,8 +44,6 @@ PODS:
|
|||
- DKImagePickerController/PhotoGallery
|
||||
- Flutter
|
||||
- Flutter (1.0.0)
|
||||
- flutter_barcode_scanner (2.0.0):
|
||||
- Flutter
|
||||
- flutter_foreground_task (0.0.1):
|
||||
- Flutter
|
||||
- flutter_keyboard_visibility (0.0.1):
|
||||
|
@ -52,6 +52,8 @@ PODS:
|
|||
- Flutter
|
||||
- flutter_ringtone_player (0.0.1):
|
||||
- Flutter
|
||||
- flutter_zxing (0.0.1):
|
||||
- Flutter
|
||||
- IosAwnCore (0.7.1)
|
||||
- local_auth_ios (0.0.1):
|
||||
- Flutter
|
||||
|
@ -61,8 +63,6 @@ PODS:
|
|||
- Flutter
|
||||
- quick_actions_ios (0.0.1):
|
||||
- Flutter
|
||||
- rate_my_app (1.1.2):
|
||||
- Flutter
|
||||
- ReachabilitySwift (5.0.0)
|
||||
- SDWebImage (5.14.3):
|
||||
- SDWebImage/Core (= 5.14.3)
|
||||
|
@ -84,20 +84,20 @@ PODS:
|
|||
DEPENDENCIES:
|
||||
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`)
|
||||
- awesome_notifications (from `.symlinks/plugins/awesome_notifications/ios`)
|
||||
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
|
||||
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
|
||||
- DKImagePickerController/PhotoGallery (from `https://github.com/zhangao0086/DKImagePickerController.git`)
|
||||
- file_picker (from `.symlinks/plugins/file_picker/ios`)
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_barcode_scanner (from `.symlinks/plugins/flutter_barcode_scanner/ios`)
|
||||
- flutter_foreground_task (from `.symlinks/plugins/flutter_foreground_task/ios`)
|
||||
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
|
||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||
- flutter_ringtone_player (from `.symlinks/plugins/flutter_ringtone_player/ios`)
|
||||
- flutter_zxing (from `.symlinks/plugins/flutter_zxing/ios`)
|
||||
- local_auth_ios (from `.symlinks/plugins/local_auth_ios/ios`)
|
||||
- network_info_plus (from `.symlinks/plugins/network_info_plus/ios`)
|
||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||
- quick_actions_ios (from `.symlinks/plugins/quick_actions_ios/ios`)
|
||||
- rate_my_app (from `.symlinks/plugins/rate_my_app/ios`)
|
||||
- sensors_plus (from `.symlinks/plugins/sensors_plus/ios`)
|
||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
|
||||
|
@ -118,6 +118,8 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/audioplayers_darwin/ios"
|
||||
awesome_notifications:
|
||||
:path: ".symlinks/plugins/awesome_notifications/ios"
|
||||
camera_avfoundation:
|
||||
:path: ".symlinks/plugins/camera_avfoundation/ios"
|
||||
connectivity_plus:
|
||||
:path: ".symlinks/plugins/connectivity_plus/ios"
|
||||
DKImagePickerController:
|
||||
|
@ -126,8 +128,6 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/file_picker/ios"
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_barcode_scanner:
|
||||
:path: ".symlinks/plugins/flutter_barcode_scanner/ios"
|
||||
flutter_foreground_task:
|
||||
:path: ".symlinks/plugins/flutter_foreground_task/ios"
|
||||
flutter_keyboard_visibility:
|
||||
|
@ -136,6 +136,8 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||
flutter_ringtone_player:
|
||||
:path: ".symlinks/plugins/flutter_ringtone_player/ios"
|
||||
flutter_zxing:
|
||||
:path: ".symlinks/plugins/flutter_zxing/ios"
|
||||
local_auth_ios:
|
||||
:path: ".symlinks/plugins/local_auth_ios/ios"
|
||||
network_info_plus:
|
||||
|
@ -144,8 +146,6 @@ EXTERNAL SOURCES:
|
|||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||
quick_actions_ios:
|
||||
:path: ".symlinks/plugins/quick_actions_ios/ios"
|
||||
rate_my_app:
|
||||
:path: ".symlinks/plugins/rate_my_app/ios"
|
||||
sensors_plus:
|
||||
:path: ".symlinks/plugins/sensors_plus/ios"
|
||||
share_plus:
|
||||
|
@ -167,22 +167,22 @@ CHECKOUT OPTIONS:
|
|||
SPEC CHECKSUMS:
|
||||
audioplayers_darwin: 387322cb364026a1782298c982693b1b6aa9fa1b
|
||||
awesome_notifications: 5e8d47907a4b29c182e5732b5ee224ca838f6802
|
||||
camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9
|
||||
connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e
|
||||
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
|
||||
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
|
||||
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
|
||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||
flutter_barcode_scanner: 7a1144744c28dc0c57a8de7218ffe5ec59a9e4bf
|
||||
flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817
|
||||
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
|
||||
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
||||
flutter_ringtone_player: 15eba85187230b87b2512f0e1b92225618bc03e7
|
||||
flutter_zxing: 19a866d17c8a87ee1026d68521c69d2f008635f6
|
||||
IosAwnCore: fd348a51573643e26a194fe20fc78e4190dcadf6
|
||||
local_auth_ios: 0d333dde7780f669e66f19d2ff6005f3ea84008d
|
||||
network_info_plus: b78876159360f5580608c2cea620d6ceffabd0ad
|
||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||
quick_actions_ios: 622e9076602c57f1f937f1c13e5c59c3379347e9
|
||||
rate_my_app: 5c11c00c864fdb2d0d6d4529b1692a2e78a64d0b
|
||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||
SDWebImage: 9c36e66c8ce4620b41a7407698dda44211a96764
|
||||
sensors_plus: 5717760720f7e6acd96fdbd75b7428f5ad755ec2
|
||||
|
|
|
@ -568,4 +568,4 @@
|
|||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,6 +73,25 @@ class AccountList {
|
|||
Account get(int coin, int id) => list.firstWhere((e) => e.coin == coin && e.id == id, orElse: () => emptyAccount);
|
||||
}
|
||||
|
||||
AccountId? getAvailableId(int coin) {
|
||||
final nid = getActiveAccountId(coin);
|
||||
if (nid.id != 0) return nid;
|
||||
for (var coin_data in settings.coins) {
|
||||
// look for an account in any other coin
|
||||
if (coin_data.coin != coin) {
|
||||
final nid = getActiveAccountId(coin_data.coin);
|
||||
if (nid.id != 0) return nid;
|
||||
}
|
||||
}
|
||||
// We have no accounts
|
||||
return null;
|
||||
}
|
||||
|
||||
AccountId getActiveAccountId(int coin) {
|
||||
final id = WarpApi.getActiveAccountId(coin);
|
||||
return AccountId(coin, id);
|
||||
}
|
||||
|
||||
class ActiveAccount = _ActiveAccount with _$ActiveAccount;
|
||||
|
||||
abstract class _ActiveAccount with Store {
|
||||
|
@ -128,7 +147,7 @@ abstract class _ActiveAccount with Store {
|
|||
}
|
||||
|
||||
Future<void> checkAndUpdate() async {
|
||||
final aid = await getAvailableId(active.toId());
|
||||
final aid = await getAvailableId(active.coin);
|
||||
if (aid == null) {
|
||||
setActiveAccount(0, 0);
|
||||
}
|
||||
|
@ -137,26 +156,6 @@ abstract class _ActiveAccount with Store {
|
|||
}
|
||||
}
|
||||
|
||||
AccountId? getAvailableId(AccountId aid) {
|
||||
final nid = getActiveAccountId(aid.coin);
|
||||
if (nid.id != 0) return nid;
|
||||
for (var coin_data in settings.coins) {
|
||||
// look for an account in any other coin
|
||||
if (coin_data.coin != coin) {
|
||||
final nid = getActiveAccountId(coin_data.coin);
|
||||
if (nid.id != 0)
|
||||
return nid;
|
||||
}
|
||||
}
|
||||
// We have no accounts
|
||||
return null;
|
||||
}
|
||||
|
||||
AccountId getActiveAccountId(int coin) {
|
||||
final id = WarpApi.getActiveAccountId(coin);
|
||||
return AccountId(coin, id);
|
||||
}
|
||||
|
||||
@action
|
||||
void setActiveAccount(int coin, int id) {
|
||||
WarpApi.setActiveAccount(coin, id);
|
||||
|
@ -351,7 +350,7 @@ abstract class _ActiveAccount with Store {
|
|||
final dbr = active.dbReader;
|
||||
pnls = dbr.getPNL(active.id);
|
||||
spendings = dbr.getSpending(active.id);
|
||||
accountBalances = dbr.getAccountBalanceTimeSeries(active.id, active.balances?.balance ?? 0);
|
||||
accountBalances = dbr.getAccountBalanceTimeSeries(active.id, active.balances.balance);
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'dart:io';
|
|||
import 'package:audioplayers/audioplayers.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
import 'package:flutter_zxing/flutter_zxing.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:warp_api/warp_api.dart';
|
||||
import 'generated/l10n.dart';
|
||||
|
@ -102,18 +102,20 @@ Future<String?> scanMultiCode(BuildContext context) async {
|
|||
else {
|
||||
final player = AudioPlayer();
|
||||
final ding = AssetSource("ding.mp3");
|
||||
final dropStream = FlutterBarcodeScanner.getBarcodeStreamReceiver('#FF0000', S.of(context).cancel, true, ScanMode.QR);
|
||||
var f = Completer<String>();
|
||||
StreamSubscription? sub;
|
||||
sub = dropStream?.listen((barcode) async {
|
||||
await player.play(ding);
|
||||
final res = WarpApi.mergeData(barcode);
|
||||
if (res.isNotEmpty) {
|
||||
FlutterBarcodeScanner.dismiss();
|
||||
final decoded = utf8.decode(ZLibCodec().decode(base64Decode(res)));
|
||||
sub?.cancel();
|
||||
f.complete(decoded);
|
||||
}
|
||||
final f = Completer<String>();
|
||||
var completed = false;
|
||||
Navigator.of(context).pushNamed('/scanner', arguments: {
|
||||
'onScan': (Code code) {
|
||||
final data = code.text;
|
||||
if (data == null) return;
|
||||
final res = WarpApi.mergeData(data);
|
||||
completed = res.isNotEmpty;
|
||||
if (completed) {
|
||||
final decoded = utf8.decode(ZLibCodec().decode(base64Decode(res)));
|
||||
f.complete(decoded);
|
||||
}
|
||||
},
|
||||
'completed': () => completed
|
||||
});
|
||||
return f.future;
|
||||
}
|
||||
|
|
|
@ -371,6 +371,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
"saveBackup": MessageLookupByLibrary.simpleMessage("Save Backup"),
|
||||
"saveToBlockchain":
|
||||
MessageLookupByLibrary.simpleMessage("Save to Blockchain"),
|
||||
"scanQrCode": MessageLookupByLibrary.simpleMessage("Scan QR Code"),
|
||||
"scanStartingMomentarily":
|
||||
MessageLookupByLibrary.simpleMessage("Scan starting momentarily"),
|
||||
"secondary": MessageLookupByLibrary.simpleMessage("Secondary"),
|
||||
|
|
|
@ -377,6 +377,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Guardar copia de seguridad"),
|
||||
"saveToBlockchain":
|
||||
MessageLookupByLibrary.simpleMessage("Guardar en la blockchain?"),
|
||||
"scanQrCode": MessageLookupByLibrary.simpleMessage("Scan QR Code"),
|
||||
"scanStartingMomentarily": MessageLookupByLibrary.simpleMessage(
|
||||
"Escaneo iniciado momentáneamente"),
|
||||
"secondary": MessageLookupByLibrary.simpleMessage("Secundario"),
|
||||
|
|
|
@ -378,6 +378,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||
MessageLookupByLibrary.simpleMessage("Sauvegarder les comptes"),
|
||||
"saveToBlockchain": MessageLookupByLibrary.simpleMessage(
|
||||
"Sauver les contacts dans la blockchaine"),
|
||||
"scanQrCode": MessageLookupByLibrary.simpleMessage("Scan QR Code"),
|
||||
"scanStartingMomentarily": MessageLookupByLibrary.simpleMessage(
|
||||
"Le scan démarre momentanément"),
|
||||
"secondary": MessageLookupByLibrary.simpleMessage("Secondaire"),
|
||||
|
|
|
@ -2901,6 +2901,16 @@ class S {
|
|||
args: [],
|
||||
);
|
||||
}
|
||||
|
||||
/// `Scan QR Code`
|
||||
String get scanQrCode {
|
||||
return Intl.message(
|
||||
'Scan QR Code',
|
||||
name: 'scanQrCode',
|
||||
desc: '',
|
||||
args: [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||
|
|
|
@ -283,5 +283,6 @@
|
|||
"deleteTemplate": "Delete Template?",
|
||||
"areYouSureYouWantToDeleteThisSendTemplate": "Are you sure you want to delete this send template?",
|
||||
"rewindToCheckpoint": "Rewind to Checkpoint",
|
||||
"selectCheckpoint": "Select Checkpoint"
|
||||
"selectCheckpoint": "Select Checkpoint",
|
||||
"scanQrCode": "Scan QR Code"
|
||||
}
|
||||
|
|
|
@ -281,5 +281,6 @@
|
|||
"deleteTemplate": "Eliminar plantilla?",
|
||||
"areYouSureYouWantToDeleteThisSendTemplate": "¿Está seguro de que desea eliminar esta plantilla de envío?",
|
||||
"rewindToCheckpoint": "Rebobinar",
|
||||
"selectCheckpoint": "Seleccionar Fetcha/Altura"
|
||||
"selectCheckpoint": "Seleccionar Fetcha/Altura",
|
||||
"scanQrCode": "Scan QR Code"
|
||||
}
|
||||
|
|
|
@ -281,5 +281,6 @@
|
|||
"deleteTemplate": "Effacer ce modèle?",
|
||||
"areYouSureYouWantToDeleteThisSendTemplate": "Voulez-vous vraiment supprimer ce modèle?",
|
||||
"rewindToCheckpoint": "Revenir au Bloc",
|
||||
"selectCheckpoint": "Selectionner la date du bloc"
|
||||
"selectCheckpoint": "Selectionner la date du bloc",
|
||||
"scanQrCode": "Scan QR Code"
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import 'dart:io';
|
|||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:flutter_zxing/flutter_zxing.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:csv/csv.dart';
|
||||
import 'package:currency_text_input_formatter/currency_text_input_formatter.dart';
|
||||
|
@ -12,7 +14,6 @@ import 'package:decimal/decimal.dart';
|
|||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:flutter_ringtone_player/flutter_ringtone_player.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
@ -20,7 +21,6 @@ import 'package:local_auth/local_auth.dart';
|
|||
import 'package:key_guardmanager/key_guardmanager.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
import 'package:rate_my_app/rate_my_app.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:warp_api/warp_api.dart';
|
||||
|
@ -43,6 +43,7 @@ import 'multisend.dart';
|
|||
// import 'multisign.dart';
|
||||
import 'payment_uri.dart';
|
||||
import 'pools.dart';
|
||||
import 'qrscanner.dart';
|
||||
import 'rescan.dart';
|
||||
import 'reset.dart';
|
||||
import 'scantaddr.dart';
|
||||
|
@ -265,6 +266,10 @@ void main() {
|
|||
'/txplan': (context) => TxPlanPage.fromPlan(routeSettings.arguments as String, false),
|
||||
'/sign': (context) => TxPlanPage.fromPlan(routeSettings.arguments as String, true),
|
||||
'/syncstats': (context) => SyncChartPage(),
|
||||
'/scanner': (context) {
|
||||
final args = routeSettings.arguments as Map<String, dynamic>;
|
||||
return QRScanner(args['onScan'], completed: args['completed']);
|
||||
},
|
||||
};
|
||||
return MaterialPageRoute(builder: routes[routeSettings.name]!);
|
||||
},
|
||||
|
@ -282,21 +287,11 @@ class ZWalletAppState extends State<ZWalletApp> {
|
|||
bool initialized = false;
|
||||
final progressKey = GlobalKey<LoadProgressState>();
|
||||
|
||||
RateMyApp rateMyApp = RateMyApp(
|
||||
preferencesPrefix: 'rateMyApp_',
|
||||
minDays: 0,
|
||||
minLaunches: 20,
|
||||
);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (isMobile()) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await rateMyApp.init();
|
||||
if (mounted && rateMyApp.shouldOpenDialog) {
|
||||
rateMyApp.showRateDialog(this.context);
|
||||
}
|
||||
final isAllowed = await AwesomeNotifications().isNotificationAllowed();
|
||||
if (!isAllowed) {
|
||||
AwesomeNotifications().requestPermissionToSendNotifications(
|
||||
|
@ -363,7 +358,12 @@ class ZWalletAppState extends State<ZWalletApp> {
|
|||
}
|
||||
|
||||
_setProgress(0.7, 'Restoring Active Account');
|
||||
await active.restore();
|
||||
if (recover) {
|
||||
final aid = getAvailableId(coins[0].coin);
|
||||
if (aid != null)
|
||||
active.setActiveAccount(aid.coin, aid.id);
|
||||
}
|
||||
else await active.restore();
|
||||
|
||||
if (isMobile()) {
|
||||
_setProgress(0.9, 'Setting Dashboard Shortcuts');
|
||||
|
@ -592,11 +592,14 @@ Future<String?> scanCode(BuildContext context) async {
|
|||
return code;
|
||||
}
|
||||
else {
|
||||
final code = await FlutterBarcodeScanner.scanBarcode('#FF0000', S
|
||||
.of(context)
|
||||
.cancel, true, ScanMode.QR);
|
||||
if (code == "-1") return null;
|
||||
return code;
|
||||
final f = Completer();
|
||||
Navigator.of(context).pushNamed('/scanner', arguments: {
|
||||
'onScan': (Code code) {
|
||||
f.complete(code.text);
|
||||
},
|
||||
'completed': () => f.isCompleted,
|
||||
});
|
||||
return await f.future;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -766,10 +769,11 @@ Future<void> saveFile(String data, String filename, String title) async {
|
|||
final context = navigatorKey.currentContext!;
|
||||
Size size = MediaQuery.of(context).size;
|
||||
final tempDir = settings.tempDir;
|
||||
String fn = p.join(tempDir, filename);
|
||||
final file = File(fn);
|
||||
final path = p.join(tempDir, filename);
|
||||
final xfile = XFile(path);
|
||||
final file = File(path);
|
||||
await file.writeAsString(data);
|
||||
return Share.shareFiles([fn], subject: title, sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
|
||||
await Share.shareXFiles([xfile], subject: title, sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
|
||||
}
|
||||
else {
|
||||
final fn = await FilePicker.platform.saveFile();
|
||||
|
@ -786,7 +790,8 @@ Future<void> exportFile(BuildContext context, String path, String title) async {
|
|||
if (isMobile()) {
|
||||
final context = navigatorKey.currentContext!;
|
||||
Size size = MediaQuery.of(context).size;
|
||||
await Share.shareFilesWithResult([path], subject: title, sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
|
||||
final xfile = XFile(path);
|
||||
await Share.shareXFiles([xfile], subject: title, sharePositionOrigin: Rect.fromLTWH(0, 0, size.width, size.height / 2));
|
||||
}
|
||||
else {
|
||||
final fn = await FilePicker.platform.saveFile();
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_zxing/flutter_zxing.dart';
|
||||
import 'package:cross_file/cross_file.dart';
|
||||
|
||||
import 'generated/l10n.dart';
|
||||
|
||||
class QRScanner extends StatefulWidget {
|
||||
final dynamic Function(Code) onScan;
|
||||
final bool Function()? completed;
|
||||
QRScanner(this.onScan, { this.completed });
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => QRScannerState();
|
||||
}
|
||||
|
||||
class QRScannerState extends State<QRScanner> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(appBar: AppBar(title: Text(S.of(context).scanQrCode)),
|
||||
body: ReaderWidget(onScan: _onScan),
|
||||
floatingActionButton: (widget.completed != null) ? FloatingActionButton(
|
||||
onPressed: _onPickImage,
|
||||
child: const Icon(Icons.image)
|
||||
) : null);
|
||||
}
|
||||
|
||||
_onScan(Code code) {
|
||||
widget.onScan(code);
|
||||
final completed = widget.completed?.call() ?? true;
|
||||
if (completed)
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
|
||||
_onPickImage() async {
|
||||
final res = await FilePicker.platform.pickFiles();
|
||||
if (res != null && res.isSinglePick) {
|
||||
final file = res.files.first;
|
||||
final xfile = XFile(file.path!);
|
||||
final Code? result = await zx.readBarcodeImagePath(xfile);
|
||||
if (result != null && result.isValid)
|
||||
_onScan(result);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
import 'package:flutter_form_builder/flutter_form_builder.dart';
|
||||
import 'package:warp_api/warp_api.dart';
|
||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||
|
|
85
pubspec.lock
85
pubspec.lock
|
@ -178,6 +178,41 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.3.0"
|
||||
camera:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.2+1"
|
||||
camera_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.10.2+3"
|
||||
camera_avfoundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_avfoundation
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.10+2"
|
||||
camera_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.4"
|
||||
camera_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: camera_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.1+1"
|
||||
change_app_package_name:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
@ -297,6 +332,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cross_file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.3+2"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -421,15 +463,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
flutter_barcode_scanner:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: c2c79def4f7fa8c17e9432ca43d307ba0b4a75a3
|
||||
resolved-ref: c2c79def4f7fa8c17e9432ca43d307ba0b4a75a3
|
||||
url: "https://github.com/hhanh00/flutter_barcode_scanner.git"
|
||||
source: git
|
||||
version: "2.0.0"
|
||||
flutter_color_models:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -526,13 +559,6 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.6"
|
||||
flutter_rating_bar:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_rating_bar
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0"
|
||||
flutter_ringtone_player:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -566,6 +592,13 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_zxing:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: flutter_zxing
|
||||
relative: true
|
||||
source: path
|
||||
version: "1.0.0-beta.8"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1058,13 +1091,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.0.2"
|
||||
rate_my_app:
|
||||
dependency: "direct main"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: rate_my_app
|
||||
name: quiver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "3.2.1"
|
||||
rational:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1099,7 +1132,7 @@ packages:
|
|||
name: share_plus
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.4"
|
||||
version: "4.5.3"
|
||||
share_plus_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1113,28 +1146,28 @@ packages:
|
|||
name: share_plus_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
share_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
version: "3.1.2"
|
||||
share_plus_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_web
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.1.0"
|
||||
share_plus_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: share_plus_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
shared_preferences:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1457,4 +1490,4 @@ packages:
|
|||
version: "3.1.1"
|
||||
sdks:
|
||||
dart: ">=2.18.0 <3.0.0"
|
||||
flutter: ">=2.11.0"
|
||||
flutter: ">=3.3.0"
|
||||
|
|
|
@ -50,18 +50,15 @@ dependencies:
|
|||
ref: 821f81681f8ee819cd721498f7b28d290f4ebe38
|
||||
grouped_list: ^4.1.0
|
||||
json_annotation: ^4.1.0
|
||||
share_plus: ^4.0.1
|
||||
share_plus: ^4.5.3
|
||||
path_provider: ^2.0.3
|
||||
file_picker: ^4.5.0
|
||||
mustache_template: ^2.0.0
|
||||
rate_my_app: ^1.1.1
|
||||
flutter_palette: ^1.1.0+1
|
||||
flutter_svg: ^1.0.3
|
||||
flutter_typeahead: ^3.2.0
|
||||
flutter_barcode_scanner:
|
||||
git:
|
||||
url: https://github.com/hhanh00/flutter_barcode_scanner.git
|
||||
ref: c2c79def4f7fa8c17e9432ca43d307ba0b4a75a3
|
||||
flutter_zxing:
|
||||
path: flutter_zxing
|
||||
flutter_speed_dial: ^5.0.0
|
||||
currency_text_input_formatter: ^2.1.2
|
||||
sensors_plus: ^2.0.0
|
||||
|
|
Loading…
Reference in New Issue