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

feat: All Pylons tokens should instead display as USD #2390

Merged
merged 5 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions easel/lib/models/denom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ class Denom {
}

static List<Denom> get availableDenoms => [
Denom(name: kUSDText, symbol: kUsdSymbol, icon: PngUtils.kIconDenomUsd),
Denom(name: kPylonText, symbol: kPylonSymbol, icon: PngUtils.kIconDenomPylon),
Denom(name: kStripeText, symbol: kUsdSymbol, icon: PngUtils.kIconDenomUsd),
Denom(name: kIAPText, symbol: kPylonSymbol, icon: PngUtils.kIconDenomPylon),
];

TextInputFormatter getFormatter() {
Expand Down
2 changes: 1 addition & 1 deletion easel/lib/screens/publish_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class _OwnerBottomDrawerState extends State<OwnerBottomDrawer> {
children: [
buildRow(
title: LocaleKeys.currency.tr(),
subtitle: widget.nft.isFreeDrop == FreeDrop.yes.name ? kPylonText : getCurrency(),
subtitle: widget.nft.isFreeDrop == FreeDrop.yes.name ? kIAPText : getCurrency(),
),
SizedBox(height: 5.h),
buildRow(title: LocaleKeys.price.tr(), subtitle: getPriceSubtitle()),
Expand Down
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 kIAPText = 'IAP';
const kStripeText = 'Stripe';
const kAtomText = 'Atom';
const kEurText = 'EEur';
const kAgoricText = 'Agoric';
Expand Down
32 changes: 21 additions & 11 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,7 @@ 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 +287,11 @@ class _CollapsedBottomMenuState extends State<_CollapsedBottomMenu> {
final viewModel = context.read<OwnerViewViewModel>();
final ibcEnumCoins = viewModel.nft.ibcCoins;

/// This change will reflect only for upylon ibcCoins
final coinWithDenom =ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION
? "\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}"
: "${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}";

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 +334,9 @@ class _CollapsedBottomMenuState extends State<_CollapsedBottomMenu> {
children: [
if (viewModel.nft.type != NftType.TYPE_ITEM)
Text(
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
viewModel.nft.price == "0"
? LocaleKeys.free.tr()
: coinWithDenom,
style: TextStyle(color: Colors.white, fontSize: 15.sp, fontWeight: FontWeight.bold),
)
],
Expand Down Expand Up @@ -393,6 +401,11 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
final viewModel = context.read<OwnerViewViewModel>();
final ibcEnumCoins = viewModel.nft.ibcCoins;

// This change will reflect only for upylon ibcCoins
final coinWithDenom = ibcEnumCoins.getAbbrev() == constants.kPYLN_ABBREVATION
? "\$${ibcEnumCoins.pylnToCredit(viewModel.nft.ibcCoins.getCoinWithProperDenomination(viewModel.nft.price))} ${viewModel.nft.ibcCoins.getAbbrev()}"
: "${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}";

return Stack(
key: const ValueKey(kOwnerViewBottomSheetKeyValue),
children: [
Expand Down Expand Up @@ -459,9 +472,7 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
width: 10.w,
),
Text(
viewModel.viewsCount == 1
? "${viewModel.viewsCount} ${LocaleKeys.view.tr()}"
: "${viewModel.viewsCount} ${LocaleKeys.views.tr()}",
viewModel.viewsCount == 1 ? "${viewModel.viewsCount} ${LocaleKeys.view.tr()}" : "${viewModel.viewsCount} ${LocaleKeys.views.tr()}",
style: TextStyle(color: Colors.white, fontSize: 12.sp),
)
],
Expand Down Expand Up @@ -582,9 +593,7 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
recipeId: viewModel.nft.recipeID,
);
},
child: viewModel.isLiking
? getLikingLoader()
: getLikeIcon(likedByMe: viewModel.likedByMe),
child: viewModel.isLiking ? getLikingLoader() : getLikeIcon(likedByMe: viewModel.likedByMe),
),
),
SizedBox(
Expand Down Expand Up @@ -619,8 +628,7 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
if (viewModel.nft.assetType == AssetType.Image && Platform.isAndroid)
GestureDetector(
onTap: () {
final WallpaperScreen wallpaperScreen =
WallpaperScreen(nft: viewModel.nft.url, context: context);
final WallpaperScreen wallpaperScreen = WallpaperScreen(nft: viewModel.nft.url, context: context);
wallpaperScreen.show();
},
child: SvgPicture.asset(
Expand Down Expand Up @@ -656,9 +664,11 @@ class __ExpandedBottomMenuState extends State<_ExpandedBottomMenu> {
children: [
if (viewModel.nft.type != NftType.TYPE_ITEM) ...[
Text(
"${ibcEnumCoins.getCoinWithProperDenomination(viewModel.nft.price)} ${ibcEnumCoins.getAbbrev()}",
viewModel.nft.price == "0"
? LocaleKeys.free.tr()
: coinWithDenom,
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
/// message change request will reflect only if [isPylon] is [true]
final coinWithDenom = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION? "\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}"
: "${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))} ${nft.ibcCoins.getAbbrev()}";


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: nft.price == "0" ? LocaleKeys.free.tr() : coinWithDenom,
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 @@ -68,11 +69,15 @@ class LatestTransactions extends StatelessWidget {
Column getAmountColumn({required TransactionHistory txHistory}) {
if (txHistory.transactionTypeEnum == WalletHistoryTransactionType.NFTSELL ||
txHistory.transactionTypeEnum == WalletHistoryTransactionType.RECEIVE) {

final checkIfKPYLNAbbr = denomAbbr[defaultCurrency] == kPYLN_ABBREVATION;
final historyWithDenom = "${getPrefix(txHistory) ? "" : "+"}${checkIfKPYLNAbbr?"\$${IBCCoins.upylon.pylnToCredit(defaultCurrency.convertFromU(txHistory))}":defaultCurrency.convertFromU(txHistory)} ${denomAbbr[defaultCurrency]}";

return Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
"${getPrefix(txHistory) ? "" : "+"}${defaultCurrency.convertFromU(txHistory)} ${denomAbbr[defaultCurrency]}",
historyWithDenom,
style: _headingTextStyle,
),
if (defaultCurrency != kUSD)
Expand Down
12 changes: 12 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,10 @@ class RemoteDataStoreImp implements RemoteDataStore {

@override
Future<String> createDynamicLinkForRecipeNftShare({required String address, required NFT nft}) async {
final updateText = nft.ibcCoins.getAbbrev() == constants.kPYLN_ABBREVATION?
"\$${nft.ibcCoins.pylnToCredit(nft.ibcCoins.getCoinWithProperDenomination(nft.price))}"
: "${nft.ibcCoins.getCoinWithProperDenomination(nft.price)} ${nft.ibcCoins.getAbbrev()}";

final dynamicLinkParams = DynamicLinkParameters(
link: Uri.parse("$bigDipperBaseLink?recipe_id=${nft.recipeID}&cookbook_id=${nft.cookbookID}&address=$address"),
uriPrefix: kDeepLink,
Expand All @@ -1213,6 +1219,12 @@ 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:${nft.price == "0" ? LocaleKeys.free.tr() :updateText}'
,
)
);

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
Loading