Skip to content

Commit dae1116

Browse files
authored
re-add deposit pages (MixinNetwork#280)
* re-add deposit pages * re-add deposit pages
1 parent 09ea6fe commit dae1116

File tree

8 files changed

+53
-31
lines changed

8 files changed

+53
-31
lines changed

lib/generated/intl/messages_en.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ class MessageLookup extends MessageLookupByLibrary {
212212
"Do not support smart contract transfers."),
213213
"depositTipTron": MessageLookupByLibrary.simpleMessage(
214214
"This address supports all TRC-10 and TRC-20 tokens, such as TRX, USDT-TRON, etc."),
215+
"depositUnsupported": MessageLookupByLibrary.simpleMessage(
216+
"This address is an old network address, and deposits to this address are no longer supported."),
215217
"depositing": MessageLookupByLibrary.simpleMessage("Depositing"),
216218
"dontHaveAssets":
217219
MessageLookupByLibrary.simpleMessage("Don\'t have assets?"),

lib/generated/intl/messages_zh.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ class MessageLookup extends MessageLookupByLibrary {
189189
MessageLookupByLibrary.simpleMessage("不支持合约充值。"),
190190
"depositTipTron": MessageLookupByLibrary.simpleMessage(
191191
"该充值地址支持 TRX 和所有符合 TRC-10 TRC-20 标准的代币。"),
192+
"depositUnsupported":
193+
MessageLookupByLibrary.simpleMessage("此地址为旧网络地址,已不支持充值到此地址"),
192194
"depositing": MessageLookupByLibrary.simpleMessage("充值中"),
193195
"dontHaveAssets": MessageLookupByLibrary.simpleMessage("没有资产?"),
194196
"dontShowAgain": MessageLookupByLibrary.simpleMessage("不再提醒"),

lib/generated/l10n.dart

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/l10n/intl_en.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,5 +287,6 @@
287287
"authApprovedAccessDate": "Approved: {approve}, Last Accessed: {access}",
288288
"revokeAccess": "Revoke access",
289289
"revokeConfirmation": "Revoke access {name}?",
290-
"selectContact": "Choose a contact"
290+
"selectContact": "Choose a contact",
291+
"depositUnsupported": "This address is an old network address, and deposits to this address are no longer supported."
291292
}

lib/l10n/intl_zh.arb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,6 @@
283283
"authApprovedAccessDate": "授权时间:{approve}, 上次访问:{access}",
284284
"revokeAccess": "取消授权",
285285
"revokeConfirmation": "取消 {name} 的授权?",
286-
"selectContact": "选择联系人"
286+
"selectContact": "选择联系人",
287+
"depositUnsupported": "此地址为旧网络地址,已不支持充值到此地址"
287288
}

lib/ui/page/asset_deposit.dart

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import '../../util/web/web_utils.dart';
1919
import '../router/mixin_routes.dart';
2020
import '../widget/action_button.dart';
2121
import '../widget/buttons.dart';
22-
import '../widget/dialog/deposit_choose_network_bottom_sheet.dart';
2322
import '../widget/dialog/request_payment_bottom_sheet.dart';
2423
import '../widget/dialog/request_payment_result_bottom_sheet.dart';
2524
import '../widget/mixin_appbar.dart';
@@ -171,15 +170,10 @@ class _AssetDepositBody extends HookWidget {
171170

172171
useMemoized(() async {
173172
await Future<void>.delayed(Duration.zero);
174-
await showDepositChooseNetworkBottomSheet(context, asset: asset);
175-
if (tag == null || tag.isEmpty) {
176-
return;
177-
}
178173
await showDialog<void>(
179174
context: context,
180175
barrierDismissible: false,
181-
builder: (context) => _MemoWarningDialog(
182-
symbol: asset.symbol,
176+
builder: (context) => _DepositUnsupportedDialog(
183177
onTap: () {
184178
scheduleMicrotask(() {
185179
Navigator.of(context).pop(true);
@@ -209,7 +203,6 @@ class _AssetDepositBody extends HookWidget {
209203
_AddressLayout(
210204
asset: asset,
211205
address: address,
212-
showDepositNotice: tag != null && tag.isNotEmpty,
213206
)
214207
else
215208
const _AddressLoadingWidget(),
@@ -304,7 +297,7 @@ class _MemoLayout extends StatelessWidget {
304297
Align(
305298
alignment: AlignmentDirectional.centerStart,
306299
child: SelectableText(
307-
context.l10n.depositMemoNotice,
300+
context.l10n.depositUnsupported,
308301
enableInteractiveSelection: false,
309302
style: TextStyle(
310303
fontSize: 13,
@@ -319,13 +312,11 @@ class _MemoLayout extends StatelessWidget {
319312
);
320313
}
321314

322-
class _MemoWarningDialog extends StatelessWidget {
323-
const _MemoWarningDialog({
324-
required this.symbol,
315+
class _DepositUnsupportedDialog extends StatelessWidget {
316+
const _DepositUnsupportedDialog({
325317
required this.onTap,
326318
});
327319

328-
final String symbol;
329320
final VoidCallback onTap;
330321

331322
@override
@@ -350,7 +341,7 @@ class _MemoWarningDialog extends StatelessWidget {
350341
Padding(
351342
padding: const EdgeInsets.symmetric(
352343
vertical: 0, horizontal: 32),
353-
child: Text(context.l10n.depositNotice(symbol),
344+
child: Text(context.l10n.depositUnsupported,
354345
textAlign: TextAlign.center,
355346
style: const TextStyle(
356347
color: Color(0xFFFF6550),
@@ -393,14 +384,11 @@ class _AddressLayout extends StatelessWidget {
393384
const _AddressLayout({
394385
required this.asset,
395386
required this.address,
396-
required this.showDepositNotice,
397387
});
398388

399389
final AssetResult asset;
400390
final String address;
401391

402-
final bool showDepositNotice;
403-
404392
@override
405393
Widget build(BuildContext context) => Column(
406394
mainAxisSize: MainAxisSize.min,
@@ -409,21 +397,20 @@ class _AddressLayout extends StatelessWidget {
409397
_HeaderText(context.l10n.address),
410398
const SizedBox(height: 8),
411399
_CopyableText(address),
412-
if (showDepositNotice)
413-
Align(
414-
alignment: AlignmentDirectional.centerStart,
415-
child: Padding(
416-
padding: const EdgeInsets.only(top: 8),
417-
child: SelectableText(
418-
context.l10n.depositNotice(asset.symbol),
419-
enableInteractiveSelection: false,
420-
style: TextStyle(
421-
fontSize: 13,
422-
color: context.colorScheme.red,
423-
),
400+
Align(
401+
alignment: AlignmentDirectional.centerStart,
402+
child: Padding(
403+
padding: const EdgeInsets.only(top: 8),
404+
child: SelectableText(
405+
context.l10n.depositUnsupported,
406+
enableInteractiveSelection: false,
407+
style: TextStyle(
408+
fontSize: 13,
409+
color: context.colorScheme.red,
424410
),
425411
),
426412
),
413+
),
427414
const SizedBox(height: 32),
428415
_QrcodeImage(data: address, asset: asset),
429416
const SizedBox(height: 32),

lib/ui/page/asset_detail.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import 'package:uuid/uuid.dart';
55

66
import '../../db/mixin_database.dart';
77
import '../../service/account_provider.dart';
8+
import '../../service/profile/profile_manager.dart';
9+
import '../../util/constants.dart';
810
import '../../util/extension/extension.dart';
911
import '../../util/hook.dart';
1012
import '../../util/native_scroll.dart';
@@ -304,10 +306,21 @@ class _HeaderButtonBar extends StatelessWidget {
304306
'id': asset.assetId,
305307
})),
306308
),
309+
if (!_shouldHideReceiveButton(asset))
310+
HeaderButton.text(
311+
text: context.l10n.receive,
312+
onTap: () {
313+
lastSelectedAddress = asset.assetId;
314+
context.push(assetDepositPath.toUri({'id': asset.assetId}));
315+
},
316+
),
307317
]),
308318
);
309319
}
310320

321+
// hide receive button for https://mixin.one/snapshots/815b0b1a-2764-3736-8faa-42d694fa620a.
322+
bool _shouldHideReceiveButton(AssetResult asset) => asset.assetId == omniUSDT;
323+
311324
class _AssetTransactionsHeader extends StatelessWidget {
312325
const _AssetTransactionsHeader({
313326
required this.filter,

lib/ui/router/mixin_routes.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import '../../service/account_provider.dart';
55
import '../../util/extension/extension.dart';
66
import '../../util/logger.dart';
77
import '../page/all_transactions.dart';
8+
import '../page/asset_deposit.dart';
89
import '../page/asset_detail.dart';
910
import '../page/auth.dart';
1011
import '../page/authentications.dart';
@@ -97,6 +98,11 @@ List<VRouteElementBuilder> buildMixinRoutes(BuildContext context) => [
9798
path: withdrawalPath,
9899
widget: const Withdrawal(),
99100
),
101+
VWidget(
102+
key: const ValueKey('AssetDeposit'),
103+
path: assetDepositPath,
104+
widget: const AssetDeposit(),
105+
),
100106
VWidget(
101107
key: const ValueKey('NotFound'),
102108
path: notFoundUri.toString(),

0 commit comments

Comments
 (0)