Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merchandise support #1332

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8274551
merchandise support
phuocbitmark Oct 24, 2023
bfe1aa7
use env
phuocbitmark Oct 24, 2023
39e89e2
close web view
phuocbitmark Oct 25, 2023
e573e57
set localStorage
phuocbitmark Oct 25, 2023
4e0f822
change type name
phuocbitmark Oct 26, 2023
120ce83
support ios, pass jwt token via param
phuocbitmark Oct 26, 2023
e280de2
fix ui text
phuocbitmark Oct 30, 2023
8974bec
allow view-only
phuocbitmark Oct 31, 2023
0290fb3
pay to mint
phuocbitmark Oct 27, 2023
c3278fc
must select
phuocbitmark Oct 30, 2023
43f32b3
select address then open irl
phuocbitmark Oct 31, 2023
e88b6d5
first claim is moma
phuocbitmark Oct 31, 2023
c396c60
refactor constant color
phuocbitmark Oct 31, 2023
1995573
change domain
phuocbitmark Oct 31, 2023
577b566
fix navigate
phuocbitmark Nov 1, 2023
7fb3d10
change path
phuocbitmark Nov 1, 2023
16b0df1
assets
phuocbitmark Nov 3, 2023
c0ecb6a
add artwork metadata in dummy asset
phuocbitmark Nov 3, 2023
a999f0a
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 3, 2023
090ace8
fix conflict
phuocbitmark Nov 3, 2023
7975689
dummy asset
phuocbitmark Nov 3, 2023
39dc91c
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 3, 2023
a6f3232
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 6, 2023
39651ee
fix conflict
phuocbitmark Nov 6, 2023
32f85f7
fix lint
phuocbitmark Nov 6, 2023
52f8b21
Update lib/screen/irl_screen/webview_irl_screen.dart
phuocbitmark Nov 6, 2023
d94b115
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 6, 2023
670e525
support branch link
phuocbitmark Nov 6, 2023
6145253
pay to mint: token id, address
phuocbitmark Nov 6, 2023
824ee21
logging
phuocbitmark Nov 6, 2023
a533aa8
set token pending
phuocbitmark Nov 6, 2023
73d364b
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 6, 2023
6c1ba23
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 8, 2023
6aab795
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 10, 2023
9b23443
Merge branch 'develop' into merchandise_support
phuocbitmark Nov 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/android-release-appcenter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
echo TZKT_TESTNET_URL=${{ secrets.TZKT_TESTNET_URL }} >> .env
echo TZKT_MAINNET_URL=${{ secrets.TZKT_MAINNET_URL }} >> .env
${{ github.event.inputs.testnet == 'true' }} && echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_TESTNET }} >> .env || echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_MAINNET }} >> .env
${{ github.event.inputs.testnet == 'true' }} && echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_TESTNET }} >> .env || echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_MAINNET }} >> .env
${{ github.event.inputs.testnet == 'true' }} && echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_TESTNET }} >> .env || echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_MAINNET }} >> .env

echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bmvn_build_appcenter_android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ jobs:
echo TZKT_TESTNET_URL=${{ secrets.TZKT_TESTNET_URL }} >> .env
echo TZKT_MAINNET_URL=${{ secrets.TZKT_MAINNET_URL }} >> .env
${{ inputs.testnet == true }} && echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_TESTNET }} >> .env || echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_MAINNET }} >> .env
${{ inputs.testnet == true }} && echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_TESTNET }} >> .env || echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_MAINNET }} >> .env
${{ inputs.testnet == true }} && echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_TESTNET }} >> .env || echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_MAINNET }} >> .env

echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bmvn_build_appcenter_ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ jobs:
echo TZKT_TESTNET_URL=${{ secrets.TZKT_TESTNET_URL }} >> .env
echo TZKT_MAINNET_URL=${{ secrets.TZKT_MAINNET_URL }} >> .env
${{ inputs.testnet == true }} && echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_TESTNET }} >> .env || echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_MAINNET }} >> .env
${{ inputs.testnet == true }} && echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_TESTNET }} >> .env || echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_MAINNET }} >> .env
${{ inputs.testnet == true }} && echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_TESTNET }} >> .env || echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_MAINNET }} >> .env

echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ios-release-appstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ jobs:
echo TZKT_TESTNET_URL=${{ secrets.TZKT_TESTNET_URL }} >> .env
echo TZKT_MAINNET_URL=${{ secrets.TZKT_MAINNET_URL }} >> .env
${{ github.event.inputs.testnet == 'true' }} && echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_TESTNET }} >> .env || echo POSTCARD_CONTRACT_ADDRESS=${{ secrets.POSTCARD_CONTRACT_ADDRESS_MAINNET }} >> .env
${{ github.event.inputs.testnet == 'true' }} && echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_TESTNET }} >> .env || echo AUTONOMY_MERCHANDISE_BASE_URL=${{ secrets.AUTONOMY_MERCHANDISE_BASE_URL_MAINNET }} >> .env
${{ github.event.inputs.testnet == 'true' }} && echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_TESTNET }} >> .env || echo PAY_TO_MINT_BASE_URL=${{ secrets.PAY_TO_MINT_BASE_URL_MAINNET }} >> .env

echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
Expand Down
6 changes: 6 additions & 0 deletions lib/common/environment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ class Environment {
static String get postcardContractAddress =>
dotenv.env['POSTCARD_CONTRACT_ADDRESS'] ?? '';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

static String get merchandiseBaseUrl =>
dotenv.env["AUTONOMY_MERCHANDISE_BASE_URL"] ?? "";
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

static String get payToMintBaseUrl =>
dotenv.env["PAY_TO_MINT_BASE_URL"] ?? "";
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

static String get chatServerHmacKey =>
dotenv.env['CHAT_SERVER_HMAC_KEY'] ?? '';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
41 changes: 37 additions & 4 deletions lib/model/postcard_claim.dart
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,7 @@ class RequestPostcardRequest {
final String id;
final String? otp;

RequestPostcardRequest({
required this.id,
this.otp
});
RequestPostcardRequest({required this.id, this.otp});

// fromJson method
factory RequestPostcardRequest.fromJson(Map<String, dynamic> json) {
Expand Down Expand Up @@ -223,3 +220,39 @@ class RequestPostcardResponse {
};
}
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
}

class PayToMintRequest extends RequestPostcardResponse {
final String address;
final String tokenId;

//constructor
PayToMintRequest({
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
required this.address,
required this.tokenId,
required super.claimID,
required super.name,
required super.previewURL,
});

@override
Map<String, dynamic> toJson() {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
return <String, dynamic>{
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
'claimID': claimID,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
'name': name,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
'previewURL': previewURL,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
'address': address,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
'tokenId': tokenId,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
};
}
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

// fromJson method
factory PayToMintRequest.fromJson(Map<String, dynamic> json) {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
return PayToMintRequest(
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
claimID: json['claimID'] as String,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
name: json['name'] as String,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
previewURL: json['previewURL'] as String,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
address: json['address'] as String,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
tokenId: json['tokenId'] as String,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
);
}
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
}
11 changes: 11 additions & 0 deletions lib/screen/app_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import 'package:autonomy_flutter/screen/global_receive/receive_page.dart';
import 'package:autonomy_flutter/screen/home/home_bloc.dart';
import 'package:autonomy_flutter/screen/home/home_navigation_page.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/claim_empty_postcard/claim_empty_postcard_screen.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/claim_empty_postcard/pay_to_mint_postcard_screen.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/screen/interactive_postcard/design_stamp.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/hand_signature_page.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/leaderboard/postcard_leaderboard.dart';
Expand Down Expand Up @@ -197,6 +198,7 @@ class AppRouter {
static const handSignaturePage = "hand_signature_page";
static const stampPreview = "stamp_preview";
static const claimEmptyPostCard = "claim_empty_postcard";
static const payToMintPostcard = "pay_to_mint_postcard";
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
static const selectAddressScreen = "select_address_screen";
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
static const receivePostcardPage = 'receive_postcard_page';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
static const receivePostcardSelectAccountPage =
Expand Down Expand Up @@ -1062,6 +1064,15 @@ class AppRouter {
child: ClaimEmptyPostCardScreen(claimRequest: claimRequest),
);

case payToMintPostcard:
final claimRequest = settings.arguments as PayToMintRequest;
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
return CupertinoPageRoute(
settings: settings,
builder: (context) {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
return PayToMintPostcardScreen(claimRequest: claimRequest);
},
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
);

case selectAddressScreen:
final arguments = settings.arguments as Map;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
final arguments = settings.arguments as Map;
final arguments = settings.arguments! as Map;

final blockchain = arguments['blockchain'] as String;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
import 'dart:convert';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

import 'package:autonomy_flutter/common/environment.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/common/injector.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import "package:autonomy_flutter/model/postcard_claim.dart";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
import "package:autonomy_flutter/model/postcard_claim.dart";
import 'package:autonomy_flutter/model/postcard_claim.dart';

import 'package:autonomy_flutter/model/postcard_metadata.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/screen/app_router.dart';
import 'package:autonomy_flutter/service/account_service.dart';
import 'package:autonomy_flutter/service/configuration_service.dart';
import 'package:autonomy_flutter/service/metric_client_service.dart';
import 'package:autonomy_flutter/service/navigation_service.dart';
import 'package:autonomy_flutter/service/postcard_service.dart';
import 'package:autonomy_flutter/util/log.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/util/wallet_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:nft_collection/models/models.dart';
import "package:nft_collection/nft_collection.dart";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
import "package:nft_collection/nft_collection.dart";
import 'package:nft_collection/nft_collection.dart';

import 'package:nft_collection/services/tokens_service.dart';

import 'claim_empty_postcard_state.dart';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
import 'claim_empty_postcard_state.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/claim_empty_postcard/claim_empty_postcard_state.dart';


Expand All @@ -18,36 +26,89 @@ class ClaimEmptyPostCardBloc
final configService = injector<ConfigurationService>();
final accountService = injector<AccountService>();
final navigationService = injector.get<NavigationService>();
final _tokensService = injector.get<TokensService>();

ClaimEmptyPostCardBloc() : super(ClaimEmptyPostCardState()) {
on<GetTokenEvent>((event, emit) async {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
final token = AssetToken(
asset: Asset.init(
artistName: 'MoMa',
maxEdition: 0,
mimeType: 'image/png',
title: event.claimRequest.name,
medium: 'software',
previewURL: event.claimRequest.previewURL,
),
blockchain: "tezos",
fungible: true,
contractType: 'fa2',
tokenId: '1',
contractAddress: '',
edition: 0,
editionName: "",
id: "tez-",
balance: 0,
owner: 'owner',
lastActivityTime: DateTime.now(),
lastRefreshedTime: DateTime(1),
pending: true,
originTokenInfo: [],
provenance: [],
owners: {},
final postcardMetadata = PostcardMetadata(
locationInformation: [],
);
emit(state.copyWith(assetToken: token));
if (event.claimRequest is PayToMintRequest) {
final payToMintRequest = event.claimRequest as PayToMintRequest;
final indexId = payToMintRequest.tokenId;
final tokenId = 'tez-${Environment.postcardContractAddress}-$indexId';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
log.info('[Pay to mint] tokenId: $tokenId');
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
final token = AssetToken(
asset: Asset.init(
indexID: tokenId,
artistName: 'MoMa',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
maxEdition: 1,
mimeType: 'image/png',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
title: event.claimRequest.name,
medium: 'software',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of single quotes

phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
previewURL: event.claimRequest.previewURL,
artworkMetadata: event.createMetadata
? jsonEncode(postcardMetadata.toJson())
: null,
),
blockchain: "tezos",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
blockchain: "tezos",
blockchain: 'tezos',

fungible: true,
contractType: 'fa2',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of single quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
contractType: 'fa2',
contractType: "fa2",

tokenId: indexId,
contractAddress: Environment.postcardContractAddress,
edition: 0,
editionName: "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
editionName: "",
editionName: '',

id: tokenId,
balance: 1,
owner: payToMintRequest.address,
lastActivityTime: DateTime.now(),
lastRefreshedTime: DateTime(1),
pending: true,
originTokenInfo: [],
provenance: [],
owners: {
payToMintRequest.address: 1,
},
);
await _tokensService.setCustomTokens([token]);
_tokensService.reindexAddresses([payToMintRequest.address]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Missing an 'await' for the 'Future' computed by this expression

injector.get<ConfigurationService>().setListPostcardMint([tokenId]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Missing an 'await' for the 'Future' computed by this expression

Comment on lines +74 to +75
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
_tokensService.reindexAddresses([payToMintRequest.address]);
injector.get<ConfigurationService>().setListPostcardMint([tokenId]);
await _tokensService.reindexAddresses([payToMintRequest.address]);
await injector.get<ConfigurationService>().setListPostcardMint([tokenId]);

NftCollectionBloc.eventController.add(
GetTokensByOwnerEvent(pageKey: PageKey.init()),
);
emit(state.copyWith(assetToken: token));
} else {
final token = AssetToken(
asset: Asset.init(
artistName: 'MoMa',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of single quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
artistName: 'MoMa',
artistName: "MoMa",

maxEdition: 1,
mimeType: 'image/png',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
title: event.claimRequest.name,
medium: 'software',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
previewURL: event.claimRequest.previewURL,
artworkMetadata: event.createMetadata
? jsonEncode(postcardMetadata.toJson())
: null,
),
blockchain: "tezos",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
blockchain: "tezos",
blockchain: 'tezos',

fungible: true,
contractType: 'fa2',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
tokenId: '1',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
contractAddress: Environment.postcardContractAddress,
edition: 0,
editionName: "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

id: "tez-",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Comment on lines +99 to +100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
editionName: "",
id: "tez-",
editionName: '',
id: 'tez-',

balance: 1,
owner: 'owner',
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
lastActivityTime: DateTime.now(),
lastRefreshedTime: DateTime(1),
pending: true,
originTokenInfo: [],
provenance: [],
owners: {},
);
emit(state.copyWith(assetToken: token));
}
});

on<AcceptGiftEvent>((event, emit) async {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:autonomy_flutter/model/postcard_claim.dart';
import 'package:autonomy_flutter/screen/app_router.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/design_stamp.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/postcard_explain.dart';
import 'package:autonomy_flutter/util/constants.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/view/postcard_button.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -61,7 +62,7 @@ class _ClaimEmptyPostCardScreenState extends State<ClaimEmptyPostCardScreen> {
onTap: () {
bloc.add(AcceptGiftEvent(widget.claimRequest));
},
color: const Color.fromRGBO(79, 174, 79, 1),
color: POSTCARD_GREEN_BUTTON_COLOR,
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ class ClaimEmptyPostCardState {

class GetTokenEvent extends ClaimEmptyPostCardEvent {
final RequestPostcardResponse claimRequest;
final bool createMetadata;

// constructor
GetTokenEvent(this.claimRequest);
GetTokenEvent(this.claimRequest, {this.createMetadata = false});
}

class AcceptGiftEvent extends ClaimEmptyPostCardEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'package:autonomy_flutter/common/injector.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/model/postcard_claim.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/screen/app_router.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/screen/interactive_postcard/design_stamp.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/screen/interactive_postcard/postcard_explain.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/util/asset_token_ext.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/util/constants.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:autonomy_flutter/view/postcard_button.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:easy_localization/easy_localization.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:flutter/material.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'package:flutter_bloc/flutter_bloc.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

import 'claim_empty_postcard_bloc.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
import 'claim_empty_postcard_state.dart';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +13 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
import 'claim_empty_postcard_bloc.dart';
import 'claim_empty_postcard_state.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/claim_empty_postcard/claim_empty_postcard_bloc.dart';
import 'package:autonomy_flutter/screen/interactive_postcard/claim_empty_postcard/claim_empty_postcard_state.dart';


class PayToMintPostcardScreen extends StatefulWidget {
final PayToMintRequest claimRequest;
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

const PayToMintPostcardScreen({super.key, required this.claimRequest});
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

@override
State<PayToMintPostcardScreen> createState() =>
_PayToMintPostcardScreenState();
}
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

class _PayToMintPostcardScreenState extends State<PayToMintPostcardScreen> {
final bloc = injector.get<ClaimEmptyPostCardBloc>();
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved

@override
void initState() {
super.initState();
bloc.add(GetTokenEvent(widget.claimRequest, createMetadata: true));
}

@override
Widget build(BuildContext context) {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
return BlocConsumer<ClaimEmptyPostCardBloc, ClaimEmptyPostCardState>(
listener: (context, state) {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
if (state.error != null && state.error!.isNotEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.error!),
),
);
}
},
bloc: bloc,
builder: (context, state) {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
final artwork = state.assetToken;
if (artwork == null) return Container();
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
return PostcardExplain(
payload: PostcardExplainPayload(
artwork,
PostcardButton(
text: "continue".tr(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
text: "continue".tr(),
text: 'continue'.tr(),

fontSize: 18,
enabled: state.isClaiming != true,
isProcessing: state.isClaiming == true,
onTap: () {
Navigator.of(context).popAndPushNamed(AppRouter.designStamp,
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
arguments: DesignStampPayload(state.assetToken!.copyWith(
owner: widget.claimRequest.address,
tokenId: widget.claimRequest.tokenId)));
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
},
color: POSTCARD_GREEN_BUTTON_COLOR,
),
isPayToMint: true,
),
);
});
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
}

}
7 changes: 1 addition & 6 deletions lib/screen/interactive_postcard/hand_signature_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'package:autonomy_flutter/util/moma_style_color.dart';
import 'package:autonomy_flutter/view/back_appbar.dart';
import 'package:autonomy_flutter/view/postcard_button.dart';
import 'package:autonomy_theme/style/colors.dart';
import 'package:collection/collection.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -235,14 +234,10 @@ class _HandSignaturePageState extends State<HandSignaturePage> {
if (geoLocation == null) return;
final metadataFilename =
'$contractAddress-$tokenId-$counter-metadata.json';
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
final claimLocation =
asset.postcardMetadata.locationInformation.lastOrNull ??
moMAGeoLocation.position;
final claimAddress = await claimLocation.getAddress();
final stampAddress = await geoLocation.position.getAddress();
final Map<String, dynamic> metadata = {
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
"address": stampAddress, // stamp address
"claimAddress": claimAddress,
"claimAddress": stampAddress,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 reported by reviewdog 🐶
Unnecessary use of double quotes

"stampedAt": DateTime.now().toIso8601String()
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
phuocbitmark marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines 239 to 241
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[dart fix] reported by reviewdog 🐶

Suggested change
"address": stampAddress, // stamp address
"claimAddress": claimAddress,
"claimAddress": stampAddress,
"stampedAt": DateTime.now().toIso8601String()
'address': stampAddress, // stamp address
'claimAddress': stampAddress,
'stampedAt': DateTime.now().toIso8601String()

};
final metadataFile = await _writeMetadata(
Expand Down
Loading
Loading