From 883baa9bd3f67e7907252e7a0d90281c2ab7c8b6 Mon Sep 17 00:00:00 2001 From: phuoc Date: Tue, 24 Oct 2023 14:33:13 +0700 Subject: [PATCH] use env Signed-off-by: phuoc --- .github/workflows/android-release-appcenter.yaml | 1 + .github/workflows/bmvn_build_appcenter_android.yaml | 1 + .github/workflows/bmvn_build_appcenter_ios.yaml | 1 + .github/workflows/ios-release-appstore.yaml | 1 + lib/common/environment.dart | 3 +++ lib/screen/interactive_postcard/postcard_detail_page.dart | 3 ++- lib/util/constants.dart | 2 -- 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android-release-appcenter.yaml b/.github/workflows/android-release-appcenter.yaml index 7a81750070..8f6f27c964 100644 --- a/.github/workflows/android-release-appcenter.yaml +++ b/.github/workflows/android-release-appcenter.yaml @@ -76,6 +76,7 @@ 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 echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env diff --git a/.github/workflows/bmvn_build_appcenter_android.yaml b/.github/workflows/bmvn_build_appcenter_android.yaml index ccde4ab5c2..336523ffef 100644 --- a/.github/workflows/bmvn_build_appcenter_android.yaml +++ b/.github/workflows/bmvn_build_appcenter_android.yaml @@ -95,6 +95,7 @@ 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 echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env diff --git a/.github/workflows/bmvn_build_appcenter_ios.yaml b/.github/workflows/bmvn_build_appcenter_ios.yaml index e96770e1ef..873cf55eda 100644 --- a/.github/workflows/bmvn_build_appcenter_ios.yaml +++ b/.github/workflows/bmvn_build_appcenter_ios.yaml @@ -102,6 +102,7 @@ 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 echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env diff --git a/.github/workflows/ios-release-appstore.yaml b/.github/workflows/ios-release-appstore.yaml index 95a721cf54..27089473a4 100644 --- a/.github/workflows/ios-release-appstore.yaml +++ b/.github/workflows/ios-release-appstore.yaml @@ -87,6 +87,7 @@ 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 echo FERAL_FILE_AUTHORIZATION_PREFIX=${{ secrets.FERAL_FILE_AUTHORIZATION_PREFIX }} >> .env echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env diff --git a/lib/common/environment.dart b/lib/common/environment.dart index 11708559da..93dfa57bec 100644 --- a/lib/common/environment.dart +++ b/lib/common/environment.dart @@ -157,6 +157,9 @@ class Environment { static String get postcardContractAddress => dotenv.env['POSTCARD_CONTRACT_ADDRESS'] ?? ''; + static String get merchandiseBaseUrl => + dotenv.env['AUTONOMY_MERCHANDISE_BASE_URL'] ?? ''; + static String get chatServerHmacKey => dotenv.env['CHAT_SERVER_HMAC_KEY'] ?? ''; diff --git a/lib/screen/interactive_postcard/postcard_detail_page.dart b/lib/screen/interactive_postcard/postcard_detail_page.dart index fec2ddf7c7..d0b498e084 100644 --- a/lib/screen/interactive_postcard/postcard_detail_page.dart +++ b/lib/screen/interactive_postcard/postcard_detail_page.dart @@ -10,6 +10,7 @@ import 'dart:collection'; import 'dart:convert'; import 'package:after_layout/after_layout.dart'; +import 'package:autonomy_flutter/common/environment.dart'; import 'package:autonomy_flutter/common/injector.dart'; import 'package:autonomy_flutter/model/pair.dart'; import 'package:autonomy_flutter/model/play_control_model.dart'; @@ -688,7 +689,7 @@ class ClaimedPostcardDetailPageState extends State log.info("?indexId=$indexId&hasCS=$hasCustomerSupport"); if (!context.mounted) return; final url = - "$AUTONOMY_MERCHANDISE_BASE_URL/?indexId=$indexId&hasCS=${hasCustomerSupport.toString()}&token=$jwtToken"; + "${Environment.merchandiseBaseUrl}?indexId=$indexId&hasCS=$hasCustomerSupport&token=$jwtToken"; Navigator.of(context).pushNamed(AppRouter.irlWebView, arguments: IRLWebScreenPayload(url, isPlainUI: true)); }, diff --git a/lib/util/constants.dart b/lib/util/constants.dart index a6570ae027..7d1016e576 100644 --- a/lib/util/constants.dart +++ b/lib/util/constants.dart @@ -48,8 +48,6 @@ const DEEP_LINKS = [ const FF_ARTIST_COLLECTOR = 'https://feralfile.com/docs/artist-collector-rights'; const WEB3_PRIMER_URL = 'https://autonomy.io/catalog/primer/'; -const AUTONOMY_MERCHANDISE_BASE_URL = - "http://192.168.31.162:3000"; //'https://autonomy.io/merchandise/'; const POSTCARD_RIGHTS_DOCS = "https://raw.githubusercontent.com/bitmark-inc/autonomy-apps/main/docs/postcard_collector_rights.md";