From d7e5e27e93fe1c6d5b3e9a00fa737cbd284a1296 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Thu, 12 Sep 2024 15:54:37 +0200 Subject: [PATCH 01/10] support system.remark on account manage page --- app/lib/l10n/arb/app_en.arb | 7 ++ .../profile/account/account_manage_page.dart | 22 +++++ app/lib/page/profile/account/remark.dart | 95 +++++++++++++++++++ .../tx/lib/src/submit_tx_wrappers.dart | 34 +++++++ .../service/tx/lib/src/tx_notification.dart | 5 + 5 files changed, 163 insertions(+) create mode 100644 app/lib/page/profile/account/remark.dart diff --git a/app/lib/l10n/arb/app_en.arb b/app/lib/l10n/arb/app_en.arb index d72ba199f..b7505fb3c 100644 --- a/app/lib/l10n/arb/app_en.arb +++ b/app/lib/l10n/arb/app_en.arb @@ -231,6 +231,13 @@ "registerUntil": "Register before", "remainingNewbieTicketsAsBootStrapper": "Remaining newbie tickets as bootsrapper:", "remainingNewbieTicketsAsReputable": "Remaining newbie tickets as reputable:", + "remarkNotificationTitle": "note submitted", + "remarkNotificationBody": "You have submitted a note.", + "remarks": "Remarks", + "remarksButton": "Add note", + "remarksExplain": "You can submit a note to the network. This note will be public and immutable. It can be read and authenticated by everyone as it will be digitally signed by you.", + "remarksNote": "Note", + "remarksSubmit": "Submit note", "reputableContent": "You used your reputation to get a guaranteed seat. Caution: Should you register, but not show up at the cycle, you become a newbie again.", "reputableTitle": "Registered as reputable - your seat is guaranteed", "reputationAlreadyCommittedTitle": "Reputation already used", diff --git a/app/lib/page/profile/account/account_manage_page.dart b/app/lib/page/profile/account/account_manage_page.dart index e2cee3cf4..9554b9222 100644 --- a/app/lib/page/profile/account/account_manage_page.dart +++ b/app/lib/page/profile/account/account_manage_page.dart @@ -1,3 +1,4 @@ +import 'package:encointer_wallet/page/profile/account/remark.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -192,6 +193,26 @@ class _AccountManagePageState extends State { ); } + // Not an ideal practice, but we only release a dev-version of the faucet, and cleanup can be later ;-) + Widget remarks() { + if (faucets == null) { + return appConfig.isIntegrationTest ? const SizedBox.shrink() : const CupertinoActivityIndicator(); + } + + if (store.account.currentAccountPubKey! != accountToBeEditedPubKey) { + return Column(children: [ + Text(l10n.remarks, style: h3Grey, textAlign: TextAlign.left), + ]); + } + + return Remarks( + store, + userAddress: Address( + pubkey: AddressUtils.pubKeyHexToPubKey(accountToBeEditedPubKey), + prefix: store.settings.currentNetwork.ss58(), + ), + ); + } return Observer( builder: (_) => Scaffold( appBar: AppBar( @@ -277,6 +298,7 @@ class _AccountManagePageState extends State { ), ), benefits(), + remarks(), const Spacer(), DecoratedBox( // width: double.infinity, diff --git a/app/lib/page/profile/account/remark.dart b/app/lib/page/profile/account/remark.dart new file mode 100644 index 000000000..44f747c2a --- /dev/null +++ b/app/lib/page/profile/account/remark.dart @@ -0,0 +1,95 @@ +import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'package:encointer_wallet/store/app.dart'; +import 'package:encointer_wallet/config/consts.dart'; +import 'package:encointer_wallet/l10n/l10.dart'; +import 'package:encointer_wallet/theme/theme.dart'; +import 'package:encointer_wallet/utils/format.dart'; +import 'package:ew_keyring/ew_keyring.dart'; + +import '../../../common/components/submit_button.dart'; +import '../../../service/substrate_api/api.dart'; +import '../../../service/tx/lib/tx.dart'; + +class Remarks extends StatelessWidget { + const Remarks( + this.store, { + required this.userAddress, + super.key, + }); + + final AppStore store; + + final Address userAddress; + + @override + Widget build(BuildContext context) { + final l10n = context.l10n; + final titleLarge = context.titleLarge.copyWith(fontSize: 19, color: AppColors.encointerGrey); + final titleMedium = context.titleMedium.copyWith(color: AppColors.encointerGrey); + + return Column( + children: [ + Text(l10n.remarks, style: titleLarge, textAlign: TextAlign.left), + Text( + l10n.remarksExplain, + textAlign: TextAlign.left, + ), + ElevatedButton( + onPressed: () => _showRemarkDialog(context), + child: Text(l10n.remarksButton), + ), + ], + ); + } + + void _showRemarkDialog(BuildContext context) { + final TextEditingController _remarkController = TextEditingController(); + + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text(context.l10n.remarksNote), + content: TextField( + controller: _remarkController, + decoration: InputDecoration(hintText: context.l10n.remarksNote), + ), + actions: [ + TextButton( + child: Text(context.l10n.cancel), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + TextButton( + child: Text(context.l10n.remarksSubmit), + onPressed: () async { + final remark = _remarkController.text; + if (remark.isNotEmpty) { + await _submitRemarkTx( + context, + remark); + Navigator.of(context).pop(); + } + }, + ), + ], + ); + }, + ); + } + + Future _submitRemarkTx(BuildContext context, String remark) async { + return submitRemark( + context, + store, + webApi, + store.account.getKeyringAccount(store.account.currentAccountPubKey!), + remark, + txPaymentAsset: store.encointer.getTxPaymentAsset(store.encointer.chosenCid), + ); + } +} diff --git a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart index 6445aa41d..a81a81944 100644 --- a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart +++ b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart @@ -89,6 +89,40 @@ Future submitClaimRewards( ); } +Future submitRemark( + BuildContext context, + AppStore store, + Api api, + KeyringAccount signer, + String remark, + { + required CommunityIdentifier? txPaymentAsset, + } + ) async { + final List remarkList = remark.codeUnits; + final call = api.encointer.encointerKusama.tx.system.remarkWithEvent(remark: remarkList); + final xt = await TxBuilder(api.provider).createSignedExtrinsic( + signer.pair, + call, + paymentAsset: txPaymentAsset?.toPolkadart(), + ); + + return submitTx( + context, + store, + api, + OpaqueExtrinsic(xt), + TxNotification.claimRewards(context.l10n), + onFinish: (BuildContext txPageContext, ExtrinsicReport report) { + // Claiming the rewards creates a new reputation if successful. + // Hence, we should update the state afterwards. + store.encointer.getEncointerBalance(); + webApi.encointer.getReputations(); + return report; + }, + ); +} + Future submitEndorseNewcomer( BuildContext context, AppStore store, diff --git a/app/lib/service/tx/lib/src/tx_notification.dart b/app/lib/service/tx/lib/src/tx_notification.dart index a32abe50b..4ac4cb351 100644 --- a/app/lib/service/tx/lib/src/tx_notification.dart +++ b/app/lib/service/tx/lib/src/tx_notification.dart @@ -17,6 +17,11 @@ class TxNotification { body: l10n.claimRewardsNotificationBody, ); + factory TxNotification.remark(AppLocalizations l10n) => TxNotification( + title: l10n.remarkNotificationTitle, + body: l10n.remarkNotificationBody, + ); + factory TxNotification.democracyVote(AppLocalizations l10n) => TxNotification( title: l10n.democracyVotedNotificationTitle, body: l10n.democracyVotedNotificationTitle, From d9e633566d0096c673d864fc1991479666eb02ef Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Fri, 13 Sep 2024 16:37:39 +0200 Subject: [PATCH 02/10] minor mod --- app/lib/l10n/arb/app_en.arb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/l10n/arb/app_en.arb b/app/lib/l10n/arb/app_en.arb index b7505fb3c..09c6e81ea 100644 --- a/app/lib/l10n/arb/app_en.arb +++ b/app/lib/l10n/arb/app_en.arb @@ -234,7 +234,7 @@ "remarkNotificationTitle": "note submitted", "remarkNotificationBody": "You have submitted a note.", "remarks": "Remarks", - "remarksButton": "Add note", + "remarksButton": "submit public note", "remarksExplain": "You can submit a note to the network. This note will be public and immutable. It can be read and authenticated by everyone as it will be digitally signed by you.", "remarksNote": "Note", "remarksSubmit": "Submit note", From d7446ec26fd0c8ce16010907cf2ea1cfa1f9d9e3 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Fri, 13 Sep 2024 16:45:45 +0200 Subject: [PATCH 03/10] fix review comments --- app/lib/page/profile/account/account_manage_page.dart | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/lib/page/profile/account/account_manage_page.dart b/app/lib/page/profile/account/account_manage_page.dart index 9554b9222..77c4e09c6 100644 --- a/app/lib/page/profile/account/account_manage_page.dart +++ b/app/lib/page/profile/account/account_manage_page.dart @@ -195,16 +195,6 @@ class _AccountManagePageState extends State { // Not an ideal practice, but we only release a dev-version of the faucet, and cleanup can be later ;-) Widget remarks() { - if (faucets == null) { - return appConfig.isIntegrationTest ? const SizedBox.shrink() : const CupertinoActivityIndicator(); - } - - if (store.account.currentAccountPubKey! != accountToBeEditedPubKey) { - return Column(children: [ - Text(l10n.remarks, style: h3Grey, textAlign: TextAlign.left), - ]); - } - return Remarks( store, userAddress: Address( From 69c796a3f507291c129545ad7f27e9a6b0426426 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 14 Sep 2024 16:59:22 +0200 Subject: [PATCH 04/10] make account manage page scrollable --- .../profile/account/account_manage_page.dart | 193 +++++++++--------- app/lib/page/profile/account/remark.dart | 4 +- .../tx/lib/src/submit_tx_wrappers.dart | 16 +- .../service/tx/lib/src/tx_notification.dart | 6 +- 4 files changed, 109 insertions(+), 110 deletions(-) diff --git a/app/lib/page/profile/account/account_manage_page.dart b/app/lib/page/profile/account/account_manage_page.dart index 77c4e09c6..ca421b31b 100644 --- a/app/lib/page/profile/account/account_manage_page.dart +++ b/app/lib/page/profile/account/account_manage_page.dart @@ -170,7 +170,6 @@ class _AccountManagePageState extends State { _nameCtrl = TextEditingController(text: accountToBeEdited.name); _nameCtrl!.selection = TextSelection.fromPosition(TextPosition(offset: _nameCtrl!.text.length)); - // Not an ideal practice, but we only release a dev-version of the faucet, and cleanup can be later. Widget benefits() { if (faucets == null) { return appConfig.isIntegrationTest ? const SizedBox.shrink() : const CupertinoActivityIndicator(); @@ -193,7 +192,6 @@ class _AccountManagePageState extends State { ); } - // Not an ideal practice, but we only release a dev-version of the faucet, and cleanup can be later ;-) Widget remarks() { return Remarks( store, @@ -203,6 +201,7 @@ class _AccountManagePageState extends State { ), ); } + return Observer( builder: (_) => Scaffold( appBar: AppBar( @@ -243,55 +242,62 @@ class _AccountManagePageState extends State { ], ), body: SafeArea( - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - children: [ - const SizedBox(height: 20), - if (!isKeyboard) - AddressIcon( - addressSS58, - accountToBeEditedPubKey, - size: 130, - ), - Text( - addressSS58, - key: const Key(EWTestKeys.accountPublicKey), - // Text only read `addressSS58` for integration test - style: const TextStyle(fontSize: 2, color: Colors.transparent), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - Fmt.address(addressSS58)!, - style: const TextStyle(fontSize: 20), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - IconButton( - icon: const Icon(Iconsax.copy), - color: context.colorScheme.secondary, - onPressed: () => UI.copyAndNotify(context, addressSS58), - ), - ], - ), - Text(l10n.communities, style: h3Grey, textAlign: TextAlign.left), - ListView.builder( - shrinkWrap: true, - itemCount: store.encointer.accountStores!.containsKey(addressSS58) - ? store.encointer.accountStores![addressSS58]?.balanceEntries.length ?? 0 - : 0, - itemBuilder: (BuildContext context, int index) => _getBalanceEntryListTile( - index, - addressSS58, + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + padding: const EdgeInsets.all(16), + child: Column( + children: [ + const SizedBox(height: 20), + if (!isKeyboard) + AddressIcon( + addressSS58, + accountToBeEditedPubKey, + size: 130, + ), + Text( + addressSS58, + key: const Key(EWTestKeys.accountPublicKey), + style: const TextStyle(fontSize: 2, color: Colors.transparent), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + Fmt.address(addressSS58)!, + style: const TextStyle(fontSize: 20), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + IconButton( + icon: const Icon(Iconsax.copy), + color: context.colorScheme.secondary, + onPressed: () => UI.copyAndNotify(context, addressSS58), + ), + ], + ), + Text(l10n.communities, style: h3Grey, textAlign: TextAlign.left), + ListView.builder( + shrinkWrap: true, + itemCount: store.encointer.accountStores!.containsKey(addressSS58) + ? store.encointer.accountStores![addressSS58]?.balanceEntries.length ?? 0 + : 0, + itemBuilder: (BuildContext context, int index) => _getBalanceEntryListTile( + index, + addressSS58, + ), + ), + benefits(), + remarks(), + const SizedBox(height: 20), + ], ), ), - benefits(), - remarks(), - const Spacer(), - DecoratedBox( - // width: double.infinity, + ), + Padding( + padding: const EdgeInsets.all(16), + child: DecoratedBox( decoration: BoxDecoration( gradient: AppColors.primaryGradient(context), borderRadius: BorderRadius.circular(20), @@ -301,7 +307,7 @@ class _AccountManagePageState extends State { ElevatedButton( key: const Key(EWTestKeys.goToAccountShare), style: ElevatedButton.styleFrom( - padding: const EdgeInsets.all(16), // make splash animation as high as the container + padding: const EdgeInsets.all(16), backgroundColor: Colors.transparent, foregroundColor: Colors.white, shadowColor: Colors.transparent, @@ -322,55 +328,52 @@ class _AccountManagePageState extends State { ), const Spacer(), PopupMenuButton( - offset: const Offset(-10, -150), - icon: const Icon( - Iconsax.more, - key: Key(EWTestKeys.popupMenuAccountTrashExport), - color: Colors.white, - ), - color: context.colorScheme.background, - padding: const EdgeInsets.all(20), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(20), - ), - onSelected: (AccountAction accountAction) { - return switch (accountAction) { - AccountAction.delete => _onDeleteAccount(context, accountToBeEdited), - AccountAction.export => _showPasswordDialog(context, accountToBeEdited), - }; - }, - itemBuilder: (BuildContext context) => [ - AccountActionItemData( - accountAction: AccountAction.delete, - icon: Iconsax.trash, - title: l10n.deleteAccount, - ), - AccountActionItemData( - accountAction: AccountAction.export, - icon: Iconsax.export, - title: l10n.exportAccount), - ] - .map((AccountActionItemData data) => PopupMenuItem( - key: Key(data.accountAction.name), - value: data.accountAction, - // https://github.com/flutter/flutter/issues/31247 as soon as we use a newer flutter version we might be able to add this to our theme.dart - child: ListTileTheme( - textColor: context.colorScheme.secondary, - iconColor: context.colorScheme.secondary, - child: ListTile( - minLeadingWidth: 0, - title: Text(data.title), - leading: Icon(data.icon), - ), - ), - )) - .toList() //>, + offset: const Offset(-10, -150), + icon: const Icon( + Iconsax.more, + key: Key(EWTestKeys.popupMenuAccountTrashExport), + color: Colors.white, + ), + color: context.colorScheme.background, + padding: const EdgeInsets.all(20), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + onSelected: (AccountAction accountAction) { + return switch (accountAction) { + AccountAction.delete => _onDeleteAccount(context, accountToBeEdited), + AccountAction.export => _showPasswordDialog(context, accountToBeEdited), + }; + }, + itemBuilder: (BuildContext context) => [ + AccountActionItemData( + accountAction: AccountAction.delete, + icon: Iconsax.trash, + title: l10n.deleteAccount, ), + AccountActionItemData( + accountAction: AccountAction.export, icon: Iconsax.export, title: l10n.exportAccount), + ] + .map((AccountActionItemData data) => PopupMenuItem( + key: Key(data.accountAction.name), + value: data.accountAction, + child: ListTileTheme( + textColor: context.colorScheme.secondary, + iconColor: context.colorScheme.secondary, + child: ListTile( + minLeadingWidth: 0, + title: Text(data.title), + leading: Icon(data.icon), + ), + ), + )) + .toList(), + ), ], ), ), - ], - ), + ), + ], ), ), ), diff --git a/app/lib/page/profile/account/remark.dart b/app/lib/page/profile/account/remark.dart index 44f747c2a..2d012de73 100644 --- a/app/lib/page/profile/account/remark.dart +++ b/app/lib/page/profile/account/remark.dart @@ -69,9 +69,7 @@ class Remarks extends StatelessWidget { onPressed: () async { final remark = _remarkController.text; if (remark.isNotEmpty) { - await _submitRemarkTx( - context, - remark); + await _submitRemarkTx(context, remark); Navigator.of(context).pop(); } }, diff --git a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart index a81a81944..4ea0aa1f0 100644 --- a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart +++ b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart @@ -90,15 +90,13 @@ Future submitClaimRewards( } Future submitRemark( - BuildContext context, - AppStore store, - Api api, - KeyringAccount signer, - String remark, - { - required CommunityIdentifier? txPaymentAsset, - } - ) async { + BuildContext context, + AppStore store, + Api api, + KeyringAccount signer, + String remark, { + required CommunityIdentifier? txPaymentAsset, +}) async { final List remarkList = remark.codeUnits; final call = api.encointer.encointerKusama.tx.system.remarkWithEvent(remark: remarkList); final xt = await TxBuilder(api.provider).createSignedExtrinsic( diff --git a/app/lib/service/tx/lib/src/tx_notification.dart b/app/lib/service/tx/lib/src/tx_notification.dart index 4ac4cb351..6720719d9 100644 --- a/app/lib/service/tx/lib/src/tx_notification.dart +++ b/app/lib/service/tx/lib/src/tx_notification.dart @@ -18,9 +18,9 @@ class TxNotification { ); factory TxNotification.remark(AppLocalizations l10n) => TxNotification( - title: l10n.remarkNotificationTitle, - body: l10n.remarkNotificationBody, - ); + title: l10n.remarkNotificationTitle, + body: l10n.remarkNotificationBody, + ); factory TxNotification.democracyVote(AppLocalizations l10n) => TxNotification( title: l10n.democracyVotedNotificationTitle, From b5d46eef27eb86ad3d666df6918063af525e7d85 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 14 Sep 2024 17:12:18 +0200 Subject: [PATCH 05/10] prevent listView scrolling within scrollable page --- app/lib/page/profile/account/account_manage_page.dart | 1 + app/lib/page/profile/account/benefits.dart | 1 + 2 files changed, 2 insertions(+) diff --git a/app/lib/page/profile/account/account_manage_page.dart b/app/lib/page/profile/account/account_manage_page.dart index ca421b31b..3df4225c2 100644 --- a/app/lib/page/profile/account/account_manage_page.dart +++ b/app/lib/page/profile/account/account_manage_page.dart @@ -280,6 +280,7 @@ class _AccountManagePageState extends State { Text(l10n.communities, style: h3Grey, textAlign: TextAlign.left), ListView.builder( shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), itemCount: store.encointer.accountStores!.containsKey(addressSS58) ? store.encointer.accountStores![addressSS58]?.balanceEntries.length ?? 0 : 0, diff --git a/app/lib/page/profile/account/benefits.dart b/app/lib/page/profile/account/benefits.dart index 6219975f1..58042448b 100644 --- a/app/lib/page/profile/account/benefits.dart +++ b/app/lib/page/profile/account/benefits.dart @@ -52,6 +52,7 @@ class Benefits extends StatelessWidget { ), ListView.builder( shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), itemCount: faucets.length, itemBuilder: (BuildContext context, int index) { final faucetPubKeyHex = faucets.keys.elementAt(index); From e4c7b270dabfb24c503b4e2b6c3c86b8f29cf8b3 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 14 Sep 2024 18:42:29 +0200 Subject: [PATCH 06/10] fix CI --- app/lib/page/profile/account/remark.dart | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/lib/page/profile/account/remark.dart b/app/lib/page/profile/account/remark.dart index 2d012de73..fac5a7418 100644 --- a/app/lib/page/profile/account/remark.dart +++ b/app/lib/page/profile/account/remark.dart @@ -1,17 +1,12 @@ -import 'package:flutter_mobx/flutter_mobx.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:encointer_wallet/store/app.dart'; -import 'package:encointer_wallet/config/consts.dart'; import 'package:encointer_wallet/l10n/l10.dart'; import 'package:encointer_wallet/theme/theme.dart'; -import 'package:encointer_wallet/utils/format.dart'; import 'package:ew_keyring/ew_keyring.dart'; -import '../../../common/components/submit_button.dart'; -import '../../../service/substrate_api/api.dart'; -import '../../../service/tx/lib/tx.dart'; +import 'package:encointer_wallet/service/substrate_api/api.dart'; +import 'package:encointer_wallet/service/tx/lib/tx.dart'; class Remarks extends StatelessWidget { const Remarks( @@ -28,7 +23,6 @@ class Remarks extends StatelessWidget { Widget build(BuildContext context) { final l10n = context.l10n; final titleLarge = context.titleLarge.copyWith(fontSize: 19, color: AppColors.encointerGrey); - final titleMedium = context.titleMedium.copyWith(color: AppColors.encointerGrey); return Column( children: [ @@ -46,15 +40,15 @@ class Remarks extends StatelessWidget { } void _showRemarkDialog(BuildContext context) { - final TextEditingController _remarkController = TextEditingController(); + final TextEditingController remarkController = TextEditingController(); - showDialog( + showDialog( context: context, builder: (BuildContext context) { return AlertDialog( - title: Text(context.l10n.remarksNote), + title: Text(context.l10n.remarksSubmit), content: TextField( - controller: _remarkController, + controller: remarkController, decoration: InputDecoration(hintText: context.l10n.remarksNote), ), actions: [ @@ -67,7 +61,7 @@ class Remarks extends StatelessWidget { TextButton( child: Text(context.l10n.remarksSubmit), onPressed: () async { - final remark = _remarkController.text; + final remark = remarkController.text; if (remark.isNotEmpty) { await _submitRemarkTx(context, remark); Navigator.of(context).pop(); From a999d08c36588cc500b8e7f0fe58a3e1c77af508 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 14 Sep 2024 19:07:27 +0200 Subject: [PATCH 07/10] add AI translations --- app/lib/l10n/arb/app_de.arb | 7 +++++++ app/lib/l10n/arb/app_en.arb | 4 ++-- app/lib/l10n/arb/app_fr.arb | 7 +++++++ app/lib/l10n/arb/app_ru.arb | 7 +++++++ app/lib/l10n/arb/app_sw.arb | 7 +++++++ 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/app/lib/l10n/arb/app_de.arb b/app/lib/l10n/arb/app_de.arb index 61c1241fc..bd8d3557a 100644 --- a/app/lib/l10n/arb/app_de.arb +++ b/app/lib/l10n/arb/app_de.arb @@ -231,6 +231,13 @@ "registerUntil": "Registriere dich vor dem", "remainingNewbieTicketsAsBootStrapper": "Verbleibende Newbie Tickets als Bootstrapper:", "remainingNewbieTicketsAsReputable": "Verbleibende Newbie Tickets als Reputable:", + "remarkNotificationTitle": "Notiz eingereicht", + "remarkNotificationBody": "Sie haben eine Notiz eingereicht.", + "remarks": "Notizen", + "remarksButton": "öffentliche Notiz einreichen", + "remarksExplain": "Sie können eine Notiz an das Netzwerk senden. Diese Notiz wird öffentlich und unveränderlich sein. Sie kann von jemensch gelesen und authentifiziert werden, da sie digital von Dir signiert wird.", + "remarksNote": "Notiz", + "remarksSubmit": "Notiz einreichen", "reputableContent": "Du hast deine Reputation genutzt um einen garantierten Platz zu erhalten. Achtung: Solltest Du dich anmelden, aber nicht zur Versammlung erscheinen, wirst du wieder ein Newbie.", "reputableTitle": "Als Reputable registriert. Dein Platz ist garantiert", "reputationAlreadyCommittedTitle": "Reputation bereits benutzt", diff --git a/app/lib/l10n/arb/app_en.arb b/app/lib/l10n/arb/app_en.arb index 0b6e721c9..54eabc695 100644 --- a/app/lib/l10n/arb/app_en.arb +++ b/app/lib/l10n/arb/app_en.arb @@ -231,9 +231,9 @@ "registerUntil": "Register before", "remainingNewbieTicketsAsBootStrapper": "Remaining newbie tickets as bootsrapper:", "remainingNewbieTicketsAsReputable": "Remaining newbie tickets as reputable:", - "remarkNotificationTitle": "note submitted", "remarkNotificationBody": "You have submitted a note.", - "remarks": "Remarks", + "remarkNotificationTitle": "note submitted", + "remarks": "Onchain Remarks", "remarksButton": "submit public note", "remarksExplain": "You can submit a note to the network. This note will be public and immutable. It can be read and authenticated by everyone as it will be digitally signed by you.", "remarksNote": "Note", diff --git a/app/lib/l10n/arb/app_fr.arb b/app/lib/l10n/arb/app_fr.arb index d6c3f9ecd..fa3c6eb14 100644 --- a/app/lib/l10n/arb/app_fr.arb +++ b/app/lib/l10n/arb/app_fr.arb @@ -231,6 +231,13 @@ "registerUntil": "Inscrive-toi avant le", "remainingNewbieTicketsAsBootStrapper": "Novice-Tickets restants en tant que bootstrapper", "remainingNewbieTicketsAsReputable": "Comme Reputable les billets pour Novice restants:", + "remarkNotificationTitle": "Note soumise", + "remarkNotificationBody": "Vous avez soumis une note.", + "remarks": "Remarques en chaine", + "remarksButton": "soumettre une note publique", + "remarksExplain": "Vous pouvez soumettre une note au réseau. Cette note sera publique et immuable. Elle peut être lue et authentifiée par tout le monde car elle sera signée numériquement par toi.", + "remarksNote": "Note", + "remarksSubmit": "Soumettre la note", "reputableContent": "\"Tu as utilisé ta réputation pour obtenir une place garantie. Attention : si tu t'enregistres, mais que tu ne te présentes pas à la réunion, tu redeviens un Novice\".", "reputableTitle": "Enregistré en tant que Reputable. Ta place est garantie", "reputationAlreadyCommittedTitle": "Réputation déjà utilisée", diff --git a/app/lib/l10n/arb/app_ru.arb b/app/lib/l10n/arb/app_ru.arb index fc3f28799..9e688e68f 100644 --- a/app/lib/l10n/arb/app_ru.arb +++ b/app/lib/l10n/arb/app_ru.arb @@ -231,6 +231,13 @@ "registerUntil": "Зарегистрируйтесь до", "remainingNewbieTicketsAsBootStrapper": "Оставшиеся билеты для новичков Бутстреппера:", "remainingNewbieTicketsAsReputable": "Оставшиеся билеты для новичков Уважаемого:", + "remarkNotificationBody": "Вы отправили заметку.", + "remarkNotificationTitle": "заметка отправлена", + "remarks": "Замечания в блокчейне", + "remarksButton": "отправить публичную заметку", + "remarksExplain": "Вы можете отправить заметку в сеть. Эта заметка будет публичной и неизменяемой. Её могут прочитать и аутентифицировать все, так как она будет цифрово подписана вами.", + "remarksNote": "Заметка", + "remarksSubmit": "Отправить заметку", "reputableContent": "Вы воспользовались своей репутаций для получения гарантированного места. Внимание: Если вы зарегистрируетесь, но не явитесь на цикл, вы снова станете новичком.", "reputableTitle": "Зарегистрирован в качестве Уважаемого - ваше место гарантировано.", "reputationAlreadyCommittedTitle": "Репутация уже использована", diff --git a/app/lib/l10n/arb/app_sw.arb b/app/lib/l10n/arb/app_sw.arb index 3bf0fd567..ba7a0dfca 100644 --- a/app/lib/l10n/arb/app_sw.arb +++ b/app/lib/l10n/arb/app_sw.arb @@ -232,6 +232,13 @@ "registerUntil": "Jisajili kabla", "remainingNewbieTicketsAsBootStrapper": "Tiketi za wanachama wapya/wageni zilizobaki kama mwanachama anzilishi:", "remainingNewbieTicketsAsReputable": "Tiketi za wanachama wageni zilizobaki kama mwanachama hai:", + "remarkNotificationBody": "Umetuma kumbuka.", + "remarkNotificationTitle": "kumbuka imetumwa", + "remarks": "Maoni ya Onchain", + "remarksButton": "tuma kumbuka ya umma", + "remarksExplain": "Unaweza kutuma kumbuka kwenye mtandao. Kumbuka hii itakuwa ya umma na isiyobadilika. Inaweza kusomwa na kuthibitishwa na kila mtu kwani itasainiwa kidijitali na wewe.", + "remarksNote": "Kumbuka", + "remarksSubmit": "Tuma kumbuka", "reputableContent": "Umetumia sifa yako kupata kiti kilicho hakikishiwa. Tahadhari: Ikiwa utajiandikisha lakini usijitokeze katika mzunguko, utarudi kuwa mwanachama mpya/mgeni tena..", "reputableTitle": "Umejisajili kama mwenye mwanachama hai - kiti chako kimehakikishiwa", "reputationAlreadyCommittedTitle": "Hadhi yako imetumika", From f5321b0bda13ab3deeaedd1cd1f648de8cb76a84 Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Sat, 14 Sep 2024 19:07:53 +0200 Subject: [PATCH 08/10] add AI translations --- app/lib/l10n/arb/app_de.arb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/l10n/arb/app_de.arb b/app/lib/l10n/arb/app_de.arb index bd8d3557a..d41ea8bea 100644 --- a/app/lib/l10n/arb/app_de.arb +++ b/app/lib/l10n/arb/app_de.arb @@ -233,7 +233,7 @@ "remainingNewbieTicketsAsReputable": "Verbleibende Newbie Tickets als Reputable:", "remarkNotificationTitle": "Notiz eingereicht", "remarkNotificationBody": "Sie haben eine Notiz eingereicht.", - "remarks": "Notizen", + "remarks": "Onchain Notizen", "remarksButton": "öffentliche Notiz einreichen", "remarksExplain": "Sie können eine Notiz an das Netzwerk senden. Diese Notiz wird öffentlich und unveränderlich sein. Sie kann von jemensch gelesen und authentifiziert werden, da sie digital von Dir signiert wird.", "remarksNote": "Notiz", From 5bf8fa9f8a39a76879f7ad9e58d2c382b76c44e5 Mon Sep 17 00:00:00 2001 From: clangenb <37865735+clangenb@users.noreply.github.com> Date: Wed, 18 Sep 2024 07:32:23 +0200 Subject: [PATCH 09/10] fix lints --- app/lib/page/profile/account/remark.dart | 2 +- app/lib/service/tx/lib/src/submit_tx_wrappers.dart | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/lib/page/profile/account/remark.dart b/app/lib/page/profile/account/remark.dart index fac5a7418..e9123f3ef 100644 --- a/app/lib/page/profile/account/remark.dart +++ b/app/lib/page/profile/account/remark.dart @@ -40,7 +40,7 @@ class Remarks extends StatelessWidget { } void _showRemarkDialog(BuildContext context) { - final TextEditingController remarkController = TextEditingController(); + final remarkController = TextEditingController(); showDialog( context: context, diff --git a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart index 4ea0aa1f0..db14bec33 100644 --- a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart +++ b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart @@ -97,7 +97,7 @@ Future submitRemark( String remark, { required CommunityIdentifier? txPaymentAsset, }) async { - final List remarkList = remark.codeUnits; + final remarkList = remark.codeUnits; final call = api.encointer.encointerKusama.tx.system.remarkWithEvent(remark: remarkList); final xt = await TxBuilder(api.provider).createSignedExtrinsic( signer.pair, From 4c37a0dbe8742ecbe3ab49e236897e2989838e30 Mon Sep 17 00:00:00 2001 From: clangenb <37865735+clangenb@users.noreply.github.com> Date: Wed, 18 Sep 2024 07:44:33 +0200 Subject: [PATCH 10/10] [send_tx] fix: use correct notification text and remove needless onFinish callback --- app/lib/service/tx/lib/src/submit_tx_wrappers.dart | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart index db14bec33..ddc526145 100644 --- a/app/lib/service/tx/lib/src/submit_tx_wrappers.dart +++ b/app/lib/service/tx/lib/src/submit_tx_wrappers.dart @@ -110,14 +110,7 @@ Future submitRemark( store, api, OpaqueExtrinsic(xt), - TxNotification.claimRewards(context.l10n), - onFinish: (BuildContext txPageContext, ExtrinsicReport report) { - // Claiming the rewards creates a new reputation if successful. - // Hence, we should update the state afterwards. - store.encointer.getEncointerBalance(); - webApi.encointer.getReputations(); - return report; - }, + TxNotification.remark(context.l10n), ); }