Launcher Shortcuts

This commit is contained in:
Hanh 2021-10-09 14:12:51 +08:00
parent 13cbabbebf
commit 73a052fbc5
23 changed files with 107 additions and 46 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -5,6 +5,7 @@
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">false</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
@ -15,4 +16,7 @@
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
<style name="QuickActions">
<item name="android:windowBackground">@drawable/quick_actions</item>
</style>
</resources>

View File

@ -369,10 +369,7 @@ class _AccountPageState extends State<AccountPage>
}
_onReceive() async {
await showDialog(context: context,
barrierColor: Colors.black,
builder: (context) =>
Dialog(child: PaymentURIPage(_address())));
Navigator.of(context).pushNamed('/receive', arguments: _address());
}
_unconfirmedStyle() {

View File

@ -27,17 +27,19 @@ class MessageLookup extends MessageLookupByLibrary {
static String m2(ticker) =>
"Do you want to transfer your entire transparent balance to your shielded address? A Network fee of 0.01 m${ticker} will be deducted.";
static String m3(ticker) => "Send ${ticker}";
static String m3(ticker) => "Receive ${ticker}";
static String m4(ticker) => "Send ${ticker} to...";
static String m4(ticker) => "Send ${ticker}";
static String m5(amount, ticker, count) =>
static String m5(ticker) => "Send ${ticker} to...";
static String m6(amount, ticker, count) =>
"Sending a total of ${amount} ${ticker} to ${count} recipients";
static String m6(aZEC, ticker, address) =>
static String m7(aZEC, ticker, address) =>
"Sending ${aZEC} ${ticker} to ${address}";
static String m7(currency) => "Use ${currency}";
static String m8(currency) => "Use ${currency}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@ -185,6 +187,7 @@ class MessageLookup extends MessageLookupByLibrary {
"purple": MessageLookupByLibrary.simpleMessage("Purple"),
"qty": MessageLookupByLibrary.simpleMessage("Qty"),
"realized": MessageLookupByLibrary.simpleMessage("Realized"),
"receive": m3,
"receivePayment":
MessageLookupByLibrary.simpleMessage("Receive Payment"),
"rescan": MessageLookupByLibrary.simpleMessage("Rescan"),
@ -208,10 +211,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage(
"Select notes to EXCLUDE from payments"),
"send": MessageLookupByLibrary.simpleMessage("Send"),
"sendCointicker": m3,
"sendCointickerTo": m4,
"sendingATotalOfAmountCointickerToCountRecipients": m5,
"sendingAzecCointickerToAddress": m6,
"sendCointicker": m4,
"sendCointickerTo": m5,
"sendingATotalOfAmountCointickerToCountRecipients": m6,
"sendingAzecCointickerToAddress": m7,
"server": MessageLookupByLibrary.simpleMessage("Server"),
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
"shieldTranspBalance":
@ -266,7 +269,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Unshielded Balance"),
"unsignedTransactionFile":
MessageLookupByLibrary.simpleMessage("Unsigned Transaction File"),
"useSettingscurrency": m7,
"useSettingscurrency": m8,
"useUa": MessageLookupByLibrary.simpleMessage("Use UA"),
"version": MessageLookupByLibrary.simpleMessage("Version"),
"viewingKey": MessageLookupByLibrary.simpleMessage("Viewing Key")

View File

@ -27,17 +27,19 @@ class MessageLookup extends MessageLookupByLibrary {
static String m2(ticker) =>
"¿Quiere transferir su saldo transparente a su dirección blindada? ";
static String m3(ticker) => "Enviar ${ticker}";
static String m3(ticker) => "Receive ${ticker}";
static String m4(ticker) => "Enviar ${ticker} a…";
static String m4(ticker) => "Enviar ${ticker}";
static String m5(amount, ticker, count) =>
static String m5(ticker) => "Enviar ${ticker} a…";
static String m6(amount, ticker, count) =>
"Enviando un total de ${amount} ${ticker} a ${count} direcciones";
static String m6(aZEC, ticker, address) =>
static String m7(aZEC, ticker, address) =>
"Enviado ${aZEC} ${ticker} a ${address}";
static String m7(currency) => "Utilizar ${currency}";
static String m8(currency) => "Utilizar ${currency}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@ -186,6 +188,7 @@ class MessageLookup extends MessageLookupByLibrary {
"purple": MessageLookupByLibrary.simpleMessage("Morada"),
"qty": MessageLookupByLibrary.simpleMessage("Cantidad"),
"realized": MessageLookupByLibrary.simpleMessage("Dio Cuenta"),
"receive": m3,
"receivePayment":
MessageLookupByLibrary.simpleMessage("Recibir un pago"),
"rescan": MessageLookupByLibrary.simpleMessage("Escanear"),
@ -211,10 +214,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage(
"Seleccionar Notas a EXCLUIR de los pagos"),
"send": MessageLookupByLibrary.simpleMessage("Enviar"),
"sendCointicker": m3,
"sendCointickerTo": m4,
"sendingATotalOfAmountCointickerToCountRecipients": m5,
"sendingAzecCointickerToAddress": m6,
"sendCointicker": m4,
"sendCointickerTo": m5,
"sendingATotalOfAmountCointickerToCountRecipients": m6,
"sendingAzecCointickerToAddress": m7,
"server": MessageLookupByLibrary.simpleMessage("Servidor"),
"settings": MessageLookupByLibrary.simpleMessage("Ajustes"),
"shieldTranspBalance":
@ -266,7 +269,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Saldo sin blindaje"),
"unsignedTransactionFile": MessageLookupByLibrary.simpleMessage(
"Archivo de transaccion sin firmar"),
"useSettingscurrency": m7,
"useSettingscurrency": m8,
"useUa": MessageLookupByLibrary.simpleMessage("Usar UA"),
"version": MessageLookupByLibrary.simpleMessage("Versión"),
"viewingKey": MessageLookupByLibrary.simpleMessage("Llave Lectura")

View File

@ -27,17 +27,19 @@ class MessageLookup extends MessageLookupByLibrary {
static String m2(ticker) =>
"Voulez-vous transférer l\'intégralité de votre solde transparent à votre adresse protégée?";
static String m3(ticker) => "Envoyer ${ticker}";
static String m3(ticker) => "Recevoir ${ticker}";
static String m4(ticker) => "Envoyer ${ticker} à...";
static String m4(ticker) => "Envoyer ${ticker}";
static String m5(amount, ticker, count) =>
static String m5(ticker) => "Envoyer ${ticker} à...";
static String m6(amount, ticker, count) =>
"Envoi d\'un total de ${amount} ${ticker} à ${count} destinataires";
static String m6(aZEC, ticker, address) =>
static String m7(aZEC, ticker, address) =>
"Envoi de ${aZEC} ${ticker} à ${address}";
static String m7(currency) => "Utiliser ${currency}";
static String m8(currency) => "Utiliser ${currency}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@ -186,6 +188,7 @@ class MessageLookup extends MessageLookupByLibrary {
"purple": MessageLookupByLibrary.simpleMessage("Violet"),
"qty": MessageLookupByLibrary.simpleMessage("Quantité"),
"realized": MessageLookupByLibrary.simpleMessage("Réalisé"),
"receive": m3,
"receivePayment":
MessageLookupByLibrary.simpleMessage("Recevoir un payment"),
"rescan": MessageLookupByLibrary.simpleMessage("Parcourir à nouveau"),
@ -210,10 +213,10 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage(
"Sélectionnez les billets à EXCLURE des paiements"),
"send": MessageLookupByLibrary.simpleMessage("Envoyer"),
"sendCointicker": m3,
"sendCointickerTo": m4,
"sendingATotalOfAmountCointickerToCountRecipients": m5,
"sendingAzecCointickerToAddress": m6,
"sendCointicker": m4,
"sendCointickerTo": m5,
"sendingATotalOfAmountCointickerToCountRecipients": m6,
"sendingAzecCointickerToAddress": m7,
"server": MessageLookupByLibrary.simpleMessage("Serveur"),
"settings": MessageLookupByLibrary.simpleMessage("Paramètres"),
"shieldTranspBalance": MessageLookupByLibrary.simpleMessage(
@ -266,7 +269,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Solde Transparent"),
"unsignedTransactionFile": MessageLookupByLibrary.simpleMessage(
"Fichier de transaction non signée"),
"useSettingscurrency": m7,
"useSettingscurrency": m8,
"useUa": MessageLookupByLibrary.simpleMessage("Utiliser UA"),
"version": MessageLookupByLibrary.simpleMessage("Version"),
"viewingKey":

View File

@ -1581,6 +1581,16 @@ class S {
args: [],
);
}
/// `Receive {ticker}`
String receive(Object ticker) {
return Intl.message(
'Receive $ticker',
name: 'receive',
desc: '',
args: [ticker],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@ -151,5 +151,6 @@
"rescanNeeded": "Rescan Needed",
"tapTransactionForDetails": "Tap Transaction for Details",
"transactionHistory": "Transaction History",
"help": "Help"
"help": "Help",
"receive": "Receive {ticker}"
}

View File

@ -151,5 +151,6 @@
"rescanNeeded": "Necesita Escanear",
"tapTransactionForDetails": "Tap Transaction for Details",
"transactionHistory": "Transaction History",
"help": "Help"
"help": "Help",
"receive": "Receive {ticker}"
}

View File

@ -151,5 +151,6 @@
"rescanNeeded": "Scan nécessaire",
"tapTransactionForDetails": "Presser sur une Transaction pour plus de details",
"transactionHistory": "Historique des Transactions",
"help": "Aide"
"help": "Aide",
"receive": "Recevoir {ticker}"
}

View File

@ -14,11 +14,11 @@ import 'package:path/path.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:rate_my_app/rate_my_app.dart';
import 'package:sqflite/sqflite.dart';
import 'package:warp/payment_uri.dart';
import 'package:warp_api/warp_api.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:uni_links/uni_links.dart';
import 'package:quick_actions/quick_actions.dart';
import 'package:flutter/services.dart' show PlatformException;
import 'generated/l10n.dart';
@ -27,6 +27,7 @@ import 'account_manager.dart';
import 'backup.dart';
import 'coin/coindef.dart';
import 'multisend.dart';
import 'payment_uri.dart';
import 'settings.dart';
import 'restore.dart';
import 'send.dart';
@ -68,6 +69,17 @@ Future<void> initUniLinks(BuildContext context) async {
}
}
void handleQuickAction(BuildContext context, String shortcut) {
switch (shortcut) {
case 'receive':
Navigator.of(context).pushNamed('/receive');
break;
case 'send':
Navigator.of(context).pushNamed('/send');
break;
}
}
void main() {
WidgetsFlutterBinding.ensureInitialized();
final home = ZWalletApp();
@ -99,6 +111,7 @@ void main() {
'/restore': (context) => RestorePage(),
'/send': (context) =>
SendPage(settings.arguments as SendPageArgs?),
'/receive': (context) => PaymentURIPage(settings.arguments as String?),
'/accounts': (context) => AccountManagerPage(),
'/settings': (context) => SettingsPage(),
'/tx': (context) =>
@ -139,6 +152,7 @@ class ZWalletAppState extends State<ZWalletApp> {
}
Future<bool> _init(BuildContext context) async {
final s = S.of(this.context);
if (!initialized) {
initialized = true;
final dbPath = await getDatabasesPath();
@ -148,6 +162,12 @@ class ZWalletAppState extends State<ZWalletApp> {
await contacts.init(db);
await syncStatus.init();
await initUniLinks(context);
final quickActions = QuickActions();
quickActions.setShortcutItems(<ShortcutItem>[
ShortcutItem(type: 'receive', localizedTitle: s.receive(coin.ticker), icon: 'receive'),
ShortcutItem(type: 'send', localizedTitle: s.sendCointicker(coin.ticker), icon: 'send'),
]);
quickActions.initialize((type) { handleQuickAction(this.context, type); });
}
return true;
}

View File

@ -9,7 +9,7 @@ import 'generated/l10n.dart';
class PaymentURIPage extends StatefulWidget {
final String address;
PaymentURIPage(this.address);
PaymentURIPage(String? _address): address = _address ?? accountManager.active.address;
@override
PaymentURIState createState() => PaymentURIState();
@ -24,7 +24,7 @@ class PaymentURIState extends State<PaymentURIPage> {
@override
void initState() {
super.initState();
qrText = widget.address;
qrText = widget.address ;
}
@override
@ -33,7 +33,9 @@ class PaymentURIState extends State<PaymentURIPage> {
return Form(
key: _formKey,
child: SingleChildScrollView(
child: Scaffold(
appBar: AppBar(title: Text(S.of(context).receive(coin.ticker))),
body: GestureDetector(
child: GestureDetector(
onTap: () { FocusScope.of(context).unfocus(); },
child: Padding(
@ -73,7 +75,7 @@ class PaymentURIState extends State<PaymentURIPage> {
onPressed: _ok,
),
]),
])))));
]))))));
}
String? _checkAmount(String? vs) {

View File

@ -828,6 +828,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.0"
quick_actions:
dependency: "direct main"
description:
name: quick_actions
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.0+7"
quick_actions_platform_interface:
dependency: transitive
description:
name: quick_actions_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
rate_my_app:
dependency: "direct main"
description:
@ -1226,5 +1240,5 @@ packages:
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.13.0 <3.0.0"
flutter: ">=2.0.0"
dart: ">=2.14.0 <3.0.0"
flutter: ">=2.5.0"

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.12+166
version: 1.0.12+168
environment:
sdk: ">=2.12.0 <3.0.0"
@ -62,6 +62,7 @@ dependencies:
sensors_plus: ^1.1.0
connectivity_plus: ^1.1.0
uni_links: ^0.5.1
quick_actions: ^0.6.0
csv: ^5.0.0
flutter_localizations:
sdk: flutter

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.12+166
version: 1.0.12+168
environment:
sdk: ">=2.12.0 <3.0.0"
@ -62,6 +62,7 @@ dependencies:
sensors_plus: ^1.1.0
connectivity_plus: ^1.1.0
uni_links: ^0.5.1
quick_actions: ^0.6.0
csv: ^5.0.0
flutter_localizations:
sdk: flutter