Skip to content

Commit

Permalink
feat: All Pylons tokens should instead display as USD
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanAli13503 committed Apr 29, 2024
1 parent a419c10 commit d0b6e26
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 13 deletions.
4 changes: 2 additions & 2 deletions easel/lib/utils/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ const kAgoricSymbol = 'urun';
const kJunoSymbol = 'ujunox';
const String kEthereumSymbol = "weth-wei";

const kPylonText = 'Pylon';
const kUSDText = 'USD';
const kPylonText = 'IAP';
const kUSDText = 'Stripe';
const kAtomText = 'Atom';
const kEurText = 'EEur';
const kAgoricText = 'Agoric';
Expand Down
17 changes: 15 additions & 2 deletions wallet/lib/pages/detailed_asset_view/owner_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import '../../utils/failure/failure.dart';
import 'widgets/create_trade_bottom_sheet.dart';

import 'widgets/toggle_button.dart';
import 'package:pylons_wallet/utils/constants.dart' as constants;


class OwnerView extends StatefulWidget {
final NFT nft;
Expand Down Expand Up @@ -286,6 +288,9 @@ class _CollapsedBottomMenuState extends State<_CollapsedBottomMenu> {
final viewModel = context.read<OwnerViewViewModel>();
final ibcEnumCoins = viewModel.nft.ibcCoins;

/// this change will reflect only for upylon ibcCoins
final isPylon = ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION;

return Padding(
padding: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 16.w, top: 8.w),
child: Column(
Expand Down Expand Up @@ -328,7 +333,10 @@ class _CollapsedBottomMenuState extends State<_CollapsedBottomMenu> {
children: [
if (viewModel.nft.type != NftType.TYPE_ITEM)
Text(
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
/// message change request will reflect only if [isPylon] is [true]
isPylon?
"\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}":
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
style: TextStyle(color: Colors.white, fontSize: 15.sp, fontWeight: FontWeight.bold),
)
],
Expand Down Expand Up @@ -393,6 +401,8 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
final viewModel = context.read<OwnerViewViewModel>();
final ibcEnumCoins = viewModel.nft.ibcCoins;

final isPylon = ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION;

return Stack(
key: const ValueKey(kOwnerViewBottomSheetKeyValue),
children: [
Expand Down Expand Up @@ -656,9 +666,12 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
children: [
if (viewModel.nft.type != NftType.TYPE_ITEM) ...[
Text(
/// message change request will reflect only if [isPylon] is [true]
isPylon?
"\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}":
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
style: TextStyle(color: Colors.white, fontSize: 15.sp, fontWeight: FontWeight.bold),
),
)
]
],
),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:cached_network_image/cached_network_image.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
Expand All @@ -20,6 +19,7 @@ import '../../easel_section/no_easel_art_work.dart';
import '../collection_screen.dart';
import '../collection_view_model.dart';
import '../preview_nft_grid.dart';
import 'package:pylons_wallet/utils/constants.dart' as constants;

class CreationsCollection extends StatelessWidget {
final OnNFTSelected onNFTSelected;
Expand Down Expand Up @@ -58,14 +58,20 @@ class CreationsCollection extends StatelessWidget {
childrenDelegate: SliverChildBuilderDelegate(
(context, index) {
final nft = viewModel.creations[index];

/// this change will reflect only for upylon ibcCoins
final isPylon = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION;

return ClipRRect(
child: GestureDetector(
onTap: () => onNFTSelected(nft),
child: Banner(
color: AppColors.kPriceTagColor,
location: BannerLocation.topStart,
message:
"${nft.ibcCoins.getCoinWithProperDenomination(nft.price)} ${nft.ibcCoins.getAbbrev()}",
/// message change request will reflect only if [isPylon] is [true]
message: isPylon
? "\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}"
: "${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}",
child: PreviewNFTGrid(
assetType: nft.assetType,
on3dNFT: (BuildContext context) => Container(
Expand Down Expand Up @@ -153,4 +159,4 @@ Widget _getAudioThumbnailFromUrl({required String thumbnailUrl}) {
);
}

}
}
6 changes: 6 additions & 0 deletions wallet/lib/pages/home/currency_screen/model/ibc_coins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ extension IBCCoinsDePar on IBCCoins {
return "${(double.parse(amount) / kEthIntBase).toStringAsFixed(kCurrencyDecimalLength)} ${getAbbrev()}";
}
}


String pylnToCredit(String amount) {
return( double.parse(amount)/10).toStringAsFixed(2);
}

}

SizedBox getIconFromAsset(String ibcCoinIcon) => SizedBox(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import 'package:pylons_wallet/utils/constants.dart';
import 'package:pylons_wallet/utils/image_util.dart';

import '../../../../generated/locale_keys.g.dart';
import 'package:pylons_wallet/utils/constants.dart' as constants;


class CurrencyBackgroundCard extends StatelessWidget {
final bool isDefault;
Expand Down Expand Up @@ -109,6 +111,7 @@ class CurrencyCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
List<TransactionHistory> denomSpecificTxList = [];

if (isDefault) {
denomSpecificTxList = context.read<HomeProvider>().getDenomSpecificTxList(
defaultCurrency: currencyModel.currency,
Expand Down Expand Up @@ -198,11 +201,10 @@ class CurrencyCard extends StatelessWidget {
getHelpIcon(context),
const Spacer(),
Text(
currencyModel.amount,
"\$${currencyModel.ibcCoins.pylnToCredit(currencyModel.amount)}",
style: kCurrencyStyle,
),
SizedBox(width: 10.w),
Text(currencyModel.ibcCoins.getAbbrev(), style: kCurrencyStyle),
],
),
Align(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:pylons_wallet/components/loading.dart';
import 'package:pylons_wallet/gen/assets.gen.dart';
import 'package:pylons_wallet/model/transaction.dart';
import 'package:pylons_wallet/modules/Pylonstech.pylons.pylons/module/client/pylons/recipe.pb.dart';
import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart';
import 'package:pylons_wallet/providers/account_provider.dart';
import 'package:pylons_wallet/pylons_app.dart';
import 'package:pylons_wallet/stores/wallet_store.dart';
Expand Down Expand Up @@ -72,7 +73,7 @@ class LatestTransactions extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${getPrefix(txHistory) ? "" : "+"}${defaultCurrency.convertFromU(txHistory)} ${denomAbbr[defaultCurrency]}",
"${getPrefix(txHistory) ? "" : "+"}${denomAbbr[defaultCurrency] == kPYLN_ABBREVATION?"\$":""}${denomAbbr[defaultCurrency] == kPYLN_ABBREVATION?IBCCoins.upylon.pylnToCredit(defaultCurrency.convertFromU(txHistory)):defaultCurrency.convertFromU(txHistory)} ${denomAbbr[defaultCurrency]}",
style: _headingTextStyle,
),
if (defaultCurrency != kUSD)
Expand Down
11 changes: 11 additions & 0 deletions wallet/lib/services/data_stores/remote_data_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import 'package:pylons_wallet/model/wallet_creation_model.dart';
import 'package:pylons_wallet/modules/Pylonstech.pylons.pylons/module/export.dart' as pylons;
import 'package:pylons_wallet/modules/cosmos.tx.v1beta1/module/export.dart' as cosmos_tx;
import 'package:pylons_wallet/pages/detailed_asset_view/widgets/create_trade_bottom_sheet.dart';
import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart';
import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_trace_model.dart';
import 'package:pylons_wallet/services/third_party_services/analytics_helper.dart';
import 'package:pylons_wallet/services/third_party_services/firestore_helper.dart';
Expand All @@ -48,6 +49,7 @@ import '../../model/common.dart';
import '../../model/update_recipe_model.dart';
import '../../modules/Pylonstech.pylons.pylons/module/client/pylons/tx.pb.dart';
import '../../utils/types.dart';
import 'package:pylons_wallet/utils/constants.dart' as constants;

abstract class RemoteDataStore {
/// This method is used to generate the stripe registration token
Expand Down Expand Up @@ -1199,6 +1201,7 @@ class RemoteDataStoreImp implements RemoteDataStore {

@override
Future<String> createDynamicLinkForRecipeNftShare({required String address, required NFT nft}) async {
final isPylon = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION;
final dynamicLinkParams = DynamicLinkParameters(
link: Uri.parse("$bigDipperBaseLink?recipe_id=${nft.recipeID}&cookbook_id=${nft.cookbookID}&address=$address"),
uriPrefix: kDeepLink,
Expand All @@ -1213,6 +1216,14 @@ class RemoteDataStoreImp implements RemoteDataStore {
Uri.parse("$bigDipperBaseLink?recipe_id=${nft.recipeID}&cookbook_id=${nft.cookbookID}&address=$address"),
),
navigationInfoParameters: const NavigationInfoParameters(forcedRedirectEnabled: true),
socialMetaTagParameters: SocialMetaTagParameters(
title: nft.name,
imageUrl: Uri.parse(nft.url),
description: '${nft.description} Price:${isPylon ?
"\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))}"
: "${nft.ibcCoins.getCoinWithProperDenomination(nft.price)} ${nft.ibcCoins.getAbbrev()}"}'
,
)
);

final link = await dynamicLinksGenerator.buildShortLink(
Expand Down
4 changes: 2 additions & 2 deletions wallet/lib/utils/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const String kAgoric = "Agoric";
const String kJuno = "Juno";
const String kNone = "None";
const String kEmoney = "eMoney Euro";
const String kPylons = "Pylons";
const String kPylons = "Pylons Credit";
const String kDollar = "U.S. Dollar";
const String kPoints = "Points";
const String kAtom = "ATOM";
Expand Down Expand Up @@ -217,7 +217,7 @@ List<Color> colorListForPracticeTest = [
/// Currency ABRR
const String kEmoneyAbb = "EEUR";
const String kAGoricAbb = "run";
const String kPYLN_ABBREVATION = 'PYLN';
const String kPYLN_ABBREVATION = 'credit';
const String kStripeUSD_ABR = 'USD';
const String kAgoricAbr = "RUN";
const String kAtomAbr = "ATOM";
Expand Down

0 comments on commit d0b6e26

Please sign in to comment.