Skip to content

Commit

Permalink
feat: sharable link and denom added
Browse files Browse the repository at this point in the history
  • Loading branch information
AhsanRns committed May 28, 2024
1 parent 48e1cb7 commit 7745c60
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 43 deletions.
7 changes: 4 additions & 3 deletions wallet/lib/model/event.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';
import 'package:equatable/equatable.dart';
import 'package:get_it/get_it.dart';
import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart';
import 'package:pylons_wallet/stores/wallet_store.dart';
import '../modules/Pylonstech.pylons.pylons/module/client/cosmos/base/v1beta1/coin.pb.dart';
import '../modules/Pylonstech.pylons.pylons/module/client/pylons/recipe.pb.dart';
Expand All @@ -25,7 +26,7 @@ class Events extends Equatable {
final String isFreeDrops;
final String cookbookID;
final String step;
final String denom;
final IBCCoins denom;
String ownerAddress = "";
String owner = "";

Expand All @@ -52,7 +53,7 @@ class Events extends Equatable {
this.numberOfTickets = '0',
this.price = '',
this.isFreeDrops = 'unselected',
this.denom = '',
this.denom = IBCCoins.upylon,

///* other
this.cookbookID = '',
Expand Down Expand Up @@ -104,7 +105,7 @@ class Events extends Equatable {
listOfPerks: listOfPerks,
cookbookID: map[kCookBookId]!,
recipeID: map[kRecipeId]!,
denom: denom!,
denom: denom!.toIBCCoinsEnum(),
);
}

Expand Down
9 changes: 2 additions & 7 deletions wallet/lib/pages/events/event_purchase_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
import 'package:pylons_wallet/components/space_widgets.dart';
import 'package:pylons_wallet/model/event.dart';
import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart';
import 'package:pylons_wallet/utils/constants.dart';

class EventPurchaseView extends StatefulWidget {
Expand Down Expand Up @@ -44,12 +45,6 @@ class EventPassViewContent extends StatelessWidget {

@override
Widget build(BuildContext context) {
final scanWindow = Rect.fromCenter(
center: MediaQuery.sizeOf(context).center(Offset.zero),
width: 100,
height: 100,
);

return ColoredBox(
color: AppColors.kBlack87,
child: SafeArea(
Expand Down Expand Up @@ -166,7 +161,7 @@ class EventPassViewContent extends StatelessWidget {
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
Text(
events.price == "0" ? "Free" : events.price,
events.price == "0" ? "Free" : '${events.price} ${events.denom.getName()}',
style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
],
Expand Down
3 changes: 2 additions & 1 deletion wallet/lib/pages/events/events_owner_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
import 'package:pylons_wallet/components/space_widgets.dart';
import 'package:pylons_wallet/model/event.dart';
import 'package:pylons_wallet/pages/detailed_asset_view/owner_view_view_model.dart';
import 'package:pylons_wallet/pages/home/currency_screen/model/ibc_coins.dart';
import 'package:pylons_wallet/utils/constants.dart';

class EventOwnerView extends StatefulWidget {
Expand Down Expand Up @@ -149,7 +150,7 @@ class EventPassViewContent extends StatelessWidget {
style: Theme.of(context).textTheme.displayLarge?.copyWith(fontSize: 11.sp, fontWeight: FontWeight.w400, color: AppColors.kWhite),
),
Text(
viewModel.events.price == "0" ? "Free" : viewModel.events.price,
viewModel.events.price == "0" ? "Free" : '${viewModel.events.price} ${viewModel.events.denom.getName()}',
style: Theme.of(context).textTheme.labelSmall?.copyWith(fontSize: 15.sp, fontWeight: FontWeight.w700, color: AppColors.kWhite),
),
],
Expand Down
36 changes: 4 additions & 32 deletions wallet/lib/services/data_stores/remote_data_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,10 @@ class RemoteDataStoreImp implements RemoteDataStore {

@override
Future<String> createDynamicLinkForRecipeEventShare({required String address, required Events events}) async {
final updateText = '${events.eventName} is hosted by ${events.hostName} at location ${events.location} ticket price is ${events.price}';
final updateText = events.denom.getAbbrev() == constants.kPYLN_ABBREVATION
? "\$${events.denom.pylnToCredit(events.denom.getCoinWithProperDenomination(events.price))}"
: "${events.denom.getCoinWithProperDenomination(events.price)} ${events.denom.getAbbrev()}";

final dynamicLinkParams = DynamicLinkParameters(
link: Uri.parse("$bigDipperBaseLink?recipe_id=${events.recipeID}&cookbook_id=${events.cookbookID}&address=$address"),
uriPrefix: kDeepLink,
Expand Down Expand Up @@ -1539,34 +1542,3 @@ class GoogleInAppPurchaseModel {
return base64Url.encode(utf8.encode(jsonEncode(receiptData)));
}
}

class EventlyDenom {
final String name;
final String symbol;
final String icon;

EventlyDenom({required this.name, required this.symbol, required this.icon});

factory EventlyDenom.initial() {
return EventlyDenom(icon: '', name: '', symbol: '');
}

@override
String toString() {
return '{name: $name, symbol: $symbol, icon: $icon}';
}

Map<String, String> toJson() {
final Map<String, String> map = {};
map['name'] = name;
map['symbol'] = symbol;
map['icon'] = icon;
return map;
}

factory EventlyDenom.fromJson(Map<String, String> json) => EventlyDenom(
name: json['name']!,
symbol: json['symbol']!,
icon: json['icon']!,
);
}

0 comments on commit 7745c60

Please sign in to comment.