Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d984f0e

Browse files
committedApr 29, 2024
HOTFIX: SetMetadata button is enabled only for asset owner
1 parent b55ec24 commit d984f0e

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed
 

‎lib/features/wallet_screen/non_native_token_screen/presentation/widgets/poscan_asset_metadata_section.dart

+22-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'package:auto_route/auto_route.dart';
22
import 'package:easy_localization/easy_localization.dart';
33
import 'package:flutter/material.dart';
4+
import 'package:flutter_bloc/flutter_bloc.dart';
5+
import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
46
import 'package:threedpass/core/widgets/buttons/elevated_button.dart';
57
import 'package:threedpass/core/widgets/other/fast_rich_text.dart';
68
import 'package:threedpass/core/widgets/paddings.dart';
@@ -28,18 +30,26 @@ class PoscanAssetMetadataSection extends StatelessWidget {
2830
@override
2931
Widget build(final BuildContext context) {
3032
if (metadata == null) {
31-
return Column(
32-
mainAxisSize: MainAxisSize.min,
33-
crossAxisAlignment: CrossAxisAlignment.start,
34-
children: [
35-
const D3pBodyMediumText('poscan_asset_page_metadata_help'),
36-
const SizedBoxH8(),
37-
D3pElevatedButton(
38-
text: 'poscan_asset_page_metadata_button_label'.tr(),
39-
onPressed: () => onPressed(context),
40-
),
41-
],
42-
);
33+
final account = BlocProvider.of<AppServiceLoaderCubit>(context)
34+
.state
35+
.keyring
36+
.current; // TODO Change this for read-only mode
37+
if (poscanAssetData.owner == account.address) {
38+
return Column(
39+
mainAxisSize: MainAxisSize.min,
40+
crossAxisAlignment: CrossAxisAlignment.start,
41+
children: [
42+
const D3pBodyMediumText('poscan_asset_page_metadata_help'),
43+
const SizedBoxH8(),
44+
D3pElevatedButton(
45+
text: 'poscan_asset_page_metadata_button_label'.tr(),
46+
onPressed: () => onPressed(context),
47+
),
48+
],
49+
);
50+
} else {
51+
return D3pBodyMediumText('No metadata set for this asset');
52+
}
4353
} else {
4454
final children = [
4555
FastRichText(

‎pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ publish_to: 'none'
1010
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1111
# Read more about iOS versioning at
1212
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
13-
version: 2.14.0+36
13+
version: 2.14.1+37
1414

1515
environment:
1616
sdk: ">=3.0.6 <3.0.7"

0 commit comments

Comments
 (0)