Default memo

This commit is contained in:
Hanh 2022-02-24 11:36:02 +08:00
parent 1a1d82f19e
commit 304b234398
12 changed files with 99 additions and 36 deletions

View File

@ -39,15 +39,17 @@ class MessageLookup extends MessageLookupByLibrary {
static String m7(ticker) => "Send ${ticker} to...";
static String m8(amount, ticker, count) =>
static String m8(app) => "Sent from ${app}";
static String m9(amount, ticker, count) =>
"Sending a total of ${amount} ${ticker} to ${count} recipients";
static String m9(aZEC, ticker, address) =>
static String m10(aZEC, ticker, address) =>
"Sending ${aZEC} ${ticker} to ${address}";
static String m10(text) => "${text} copied to clipboard";
static String m11(text) => "${text} copied to clipboard";
static String m11(currency) => "Use ${currency}";
static String m12(currency) => "Use ${currency}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@ -135,6 +137,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dark": MessageLookupByLibrary.simpleMessage("Dark"),
"date": MessageLookupByLibrary.simpleMessage("Date"),
"datetime": MessageLookupByLibrary.simpleMessage("Date/Time"),
"defaultMemo": MessageLookupByLibrary.simpleMessage("Default Memo"),
"delete": MessageLookupByLibrary.simpleMessage("DELETE"),
"deleteAccount": MessageLookupByLibrary.simpleMessage("Delete Account"),
"deleteContact": MessageLookupByLibrary.simpleMessage("Delete contact"),
@ -255,8 +258,9 @@ class MessageLookup extends MessageLookupByLibrary {
"send": MessageLookupByLibrary.simpleMessage("Send"),
"sendCointicker": m6,
"sendCointickerTo": m7,
"sendingATotalOfAmountCointickerToCountRecipients": m8,
"sendingAzecCointickerToAddress": m9,
"sendFrom": m8,
"sendingATotalOfAmountCointickerToCountRecipients": m9,
"sendingAzecCointickerToAddress": m10,
"server": MessageLookupByLibrary.simpleMessage("Server"),
"settings": MessageLookupByLibrary.simpleMessage("Settings"),
"shieldTranspBalance":
@ -287,7 +291,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Tap QR Code for Transparent Address"),
"tapTransactionForDetails":
MessageLookupByLibrary.simpleMessage("Tap Transaction for Details"),
"textCopiedToClipboard": m10,
"textCopiedToClipboard": m11,
"theme": MessageLookupByLibrary.simpleMessage("Theme"),
"themeEditor": MessageLookupByLibrary.simpleMessage("Theme Editor"),
"thisAccountAlreadyExists": MessageLookupByLibrary.simpleMessage(
@ -316,7 +320,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Unshielded Balance"),
"unsignedTransactionFile":
MessageLookupByLibrary.simpleMessage("Unsigned Transaction File"),
"useSettingscurrency": m11,
"useSettingscurrency": m12,
"useTransparentBalance":
MessageLookupByLibrary.simpleMessage("Use Transparent Balance"),
"useUa": MessageLookupByLibrary.simpleMessage("Use UA"),

View File

@ -37,15 +37,17 @@ class MessageLookup extends MessageLookupByLibrary {
static String m7(ticker) => "Enviar ${ticker} a…";
static String m8(amount, ticker, count) =>
static String m8(app) => "Enviado desde ${app}";
static String m9(amount, ticker, count) =>
"Enviando un total de ${amount} ${ticker} a ${count} direcciones";
static String m9(aZEC, ticker, address) =>
static String m10(aZEC, ticker, address) =>
"Enviado ${aZEC} ${ticker} a ${address}";
static String m10(text) => "${text} copied to clipboard";
static String m11(text) => "${text} copied to clipboard";
static String m11(currency) => "Utilizar ${currency}";
static String m12(currency) => "Utilizar ${currency}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@ -75,7 +77,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Dirección copiada al portapapeles"),
"addressIsEmpty":
MessageLookupByLibrary.simpleMessage("Dirección está vacía"),
"advanced": MessageLookupByLibrary.simpleMessage("avanzado"),
"advanced": MessageLookupByLibrary.simpleMessage("Avanzado"),
"advancedOptions":
MessageLookupByLibrary.simpleMessage("Opciones Avanzadas"),
"amount": MessageLookupByLibrary.simpleMessage("Monto"),
@ -135,6 +137,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dark": MessageLookupByLibrary.simpleMessage("Noche"),
"date": MessageLookupByLibrary.simpleMessage("Fecha"),
"datetime": MessageLookupByLibrary.simpleMessage("Fecha/Hora"),
"defaultMemo": MessageLookupByLibrary.simpleMessage("Nota"),
"delete": MessageLookupByLibrary.simpleMessage("ELIMINAR"),
"deleteAccount": MessageLookupByLibrary.simpleMessage("Borrar Cuenta"),
"deleteContact":
@ -254,8 +257,9 @@ class MessageLookup extends MessageLookupByLibrary {
"send": MessageLookupByLibrary.simpleMessage("Enviar"),
"sendCointicker": m6,
"sendCointickerTo": m7,
"sendingATotalOfAmountCointickerToCountRecipients": m8,
"sendingAzecCointickerToAddress": m9,
"sendFrom": m8,
"sendingATotalOfAmountCointickerToCountRecipients": m9,
"sendingAzecCointickerToAddress": m10,
"server": MessageLookupByLibrary.simpleMessage("Servidor"),
"settings": MessageLookupByLibrary.simpleMessage("Ajustes"),
"shieldTranspBalance":
@ -283,7 +287,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Pinchar QR para Dirección Transparente"),
"tapTransactionForDetails": MessageLookupByLibrary.simpleMessage(
"Toque Transacción para detalles"),
"textCopiedToClipboard": m10,
"textCopiedToClipboard": m11,
"theme": MessageLookupByLibrary.simpleMessage("Tema"),
"themeEditor": MessageLookupByLibrary.simpleMessage("Editora de temas"),
"thisAccountAlreadyExists":
@ -312,7 +316,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Saldo sin blindaje"),
"unsignedTransactionFile": MessageLookupByLibrary.simpleMessage(
"Archivo de transaccion sin firmar"),
"useSettingscurrency": m11,
"useSettingscurrency": m12,
"useTransparentBalance":
MessageLookupByLibrary.simpleMessage("Usar Saldo Transp"),
"useUa": MessageLookupByLibrary.simpleMessage("Usar UA"),

View File

@ -37,15 +37,17 @@ class MessageLookup extends MessageLookupByLibrary {
static String m7(ticker) => "Envoyer ${ticker} à...";
static String m8(amount, ticker, count) =>
static String m8(app) => "Envoyé via ${app}";
static String m9(amount, ticker, count) =>
"Envoi d\'un total de ${amount} ${ticker} à ${count} destinataires";
static String m9(aZEC, ticker, address) =>
static String m10(aZEC, ticker, address) =>
"Envoi de ${aZEC} ${ticker} à ${address}";
static String m10(text) => "${text} copied to clipboard";
static String m11(text) => "${text} copied to clipboard";
static String m11(currency) => "Utiliser ${currency}";
static String m12(currency) => "Utiliser ${currency}";
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
@ -136,6 +138,7 @@ class MessageLookup extends MessageLookupByLibrary {
"dark": MessageLookupByLibrary.simpleMessage("Sombre"),
"date": MessageLookupByLibrary.simpleMessage("Date"),
"datetime": MessageLookupByLibrary.simpleMessage("Jour/Heure"),
"defaultMemo": MessageLookupByLibrary.simpleMessage("Memo"),
"delete": MessageLookupByLibrary.simpleMessage("SUPPRIMER"),
"deleteAccount":
MessageLookupByLibrary.simpleMessage("Effacer un compte"),
@ -255,8 +258,9 @@ class MessageLookup extends MessageLookupByLibrary {
"send": MessageLookupByLibrary.simpleMessage("Envoyer"),
"sendCointicker": m6,
"sendCointickerTo": m7,
"sendingATotalOfAmountCointickerToCountRecipients": m8,
"sendingAzecCointickerToAddress": m9,
"sendFrom": m8,
"sendingATotalOfAmountCointickerToCountRecipients": m9,
"sendingAzecCointickerToAddress": m10,
"server": MessageLookupByLibrary.simpleMessage("Serveur"),
"settings": MessageLookupByLibrary.simpleMessage("Paramètres"),
"shieldTranspBalance": MessageLookupByLibrary.simpleMessage(
@ -285,7 +289,7 @@ class MessageLookup extends MessageLookupByLibrary {
"Appuyez sur le code QR pour l\'adresse transparente"),
"tapTransactionForDetails": MessageLookupByLibrary.simpleMessage(
"Presser sur une Transaction pour plus de details"),
"textCopiedToClipboard": m10,
"textCopiedToClipboard": m11,
"theme": MessageLookupByLibrary.simpleMessage("Thème"),
"themeEditor": MessageLookupByLibrary.simpleMessage("Editeur de Thème"),
"thisAccountAlreadyExists":
@ -314,7 +318,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Solde Transparent"),
"unsignedTransactionFile": MessageLookupByLibrary.simpleMessage(
"Fichier de transaction non signée"),
"useSettingscurrency": m11,
"useSettingscurrency": m12,
"useTransparentBalance": MessageLookupByLibrary.simpleMessage(
"Utiliser le Solde Transparent"),
"useUa": MessageLookupByLibrary.simpleMessage("Utiliser UA"),

View File

@ -1901,6 +1901,26 @@ class S {
args: [],
);
}
/// `Sent from {app}`
String sendFrom(Object app) {
return Intl.message(
'Sent from $app',
name: 'sendFrom',
desc: '',
args: [app],
);
}
/// `Default Memo`
String get defaultMemo {
return Intl.message(
'Default Memo',
name: 'defaultMemo',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {

View File

@ -183,5 +183,7 @@
"mode": "Mode",
"simple": "Simple",
"advanced": "Advanced",
"changingTheModeWillTakeEffectAtNextRestart": "Changing the mode will take effect at next restart"
"changingTheModeWillTakeEffectAtNextRestart": "Changing the mode will take effect at next restart",
"sendFrom": "Sent from {app}",
"defaultMemo": "Default Memo"
}

View File

@ -180,6 +180,8 @@
"restart": "Reiniciar",
"mode": "Modo",
"simple": "Sencillo",
"advanced": "avanzado",
"changingTheModeWillTakeEffectAtNextRestart": "Cambiar el modo tendrá efecto en el próximo reinicio"
"advanced": "Avanzado",
"changingTheModeWillTakeEffectAtNextRestart": "Cambiar el modo tendrá efecto en el próximo reinicio",
"sendFrom": "Enviado desde {app}",
"defaultMemo": "Nota"
}

View File

@ -181,5 +181,7 @@
"mode": "Mode",
"simple": "Simple",
"advanced": "Avancé",
"changingTheModeWillTakeEffectAtNextRestart": "Changer le mode prendra effet au prochain démarrage"
"changingTheModeWillTakeEffectAtNextRestart": "Changer le mode prendra effet au prochain démarrage",
"sendFrom": "Envoyé via {app}",
"defaultMemo": "Memo"
}

View File

@ -98,6 +98,8 @@ class SendState extends State<SendPage> {
Widget build(BuildContext context) {
final s = S.of(context);
final simpleMode = settings.simpleMode;
_memoController.text = settings.memoSignature ?? s.sendFrom(coin.app);
return Scaffold(
appBar: AppBar(title: Text(s.sendCointicker(coin.ticker))),
body: GestureDetector(

View File

@ -17,6 +17,7 @@ class SettingsState extends State<SettingsPage> {
TextEditingController(text: "${settings.anchorOffset}");
var _thresholdController = TextEditingController(
text: decimalFormat(settings.autoShieldThreshold, 3));
var _memoController = TextEditingController();
var _currency = settings.currency;
var _needAuth = false;
@ -24,6 +25,7 @@ class SettingsState extends State<SettingsPage> {
Widget build(BuildContext context) {
final s = S.of(context);
final simpleMode = settings.simpleMode;
_memoController.text = settings.memoSignature ?? s.sendFrom(coin.app);
List<FormBuilderFieldOption> options = coin.lwd
.map((lwd) => FormBuilderFieldOption<dynamic>(
@ -146,9 +148,7 @@ class SettingsState extends State<SettingsPage> {
]),
if (!simpleMode) FormBuilderTextField(
decoration: InputDecoration(
labelText: S
.of(context)
.numberOfConfirmationsNeededBeforeSpending),
labelText: s.numberOfConfirmationsNeededBeforeSpending),
name: 'anchor',
keyboardType: TextInputType.number,
controller: _anchorController,
@ -192,10 +192,17 @@ class SettingsState extends State<SettingsPage> {
validator: _checkAmount),
if (!simpleMode) FormBuilderCheckbox(
name: 'use_trp',
title: Text(S.of(context).useTransparentBalance),
title: Text(s.useTransparentBalance),
initialValue: settings.shieldBalance,
onSaved: _shieldBalance),
ButtonBar(children: confirmButtons(context, _onSave))
FormBuilderTextField(
decoration: InputDecoration(
labelText: s.defaultMemo),
name: 'memo',
keyboardType: TextInputType.number,
controller: _memoController,
onSaved: _onMemo),
ButtonBar(children: confirmButtons(context, _onSave))
]))))));
}
@ -273,6 +280,10 @@ class SettingsState extends State<SettingsPage> {
settings.updateGetTx(v);
}
_onMemo(v) {
settings.setMemoSignature(v);
}
_editTheme() {
Navigator.of(context).pushNamed('/edit_theme');
}

View File

@ -92,6 +92,9 @@ abstract class _Settings with Store {
@observable
int secondaryVariantColorValue = 0;
@observable
String? memoSignature;
@action
Future<bool> restore() async {
final prefs = await SharedPreferences.getInstance();
@ -122,6 +125,8 @@ abstract class _Settings with Store {
secondaryVariantColorValue =
prefs.getInt('secondary.variant') ?? Colors.greenAccent.value;
memoSignature = prefs.getString('memo_signature');
_updateThemeData();
Future.microtask(_loadCurrencies); // lazily
return true;
@ -346,6 +351,13 @@ abstract class _Settings with Store {
protectSend = v;
prefs.setBool('protect_send', protectSend);
}
@action
Future<void> setMemoSignature(String v) async {
final prefs = await SharedPreferences.getInstance();
memoSignature = v;
prefs.setString('memo_signature', v);
}
}
class AccountManager = _AccountManager with _$AccountManager;

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.1.6+197
version: 1.1.6+198
environment:
sdk: ">=2.12.0 <3.0.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.1.6+197
version: 1.1.6+198
environment:
sdk: ">=2.12.0 <3.0.0"