Skip to content

Commit

Permalink
chore: update comic issue model
Browse files Browse the repository at this point in the history
update connect wallet endpoint
use search as a query param key instead of title and name substring
publishing
  • Loading branch information
d-reader-luka committed Dec 3, 2024
1 parent 332dfda commit 1c308b6
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 46 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="www.dreader.app" />
<data android:scheme="https" android:host="dev-devnet.dreader.app" />
<data android:scheme="https" android:host="www.dev-devnet.dreader.app" />
<data android:path="/" />
<data android:pathPattern="/mint/.*" />
<data android:pathPattern="/comic-issue/.*" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ class AuthRemoteDataSource implements AuthDataSource {
required String encoding,
}) async {
try {
await networkService.patch('/auth/wallet/connect/$address/$encoding');
await networkService.patch('/auth/wallet/connect', data: {
'address': address,
'encoding': encoding,
'signedDataType': 'Message'
});
return const Right(true);
} catch (exception) {
return Left(
Expand Down
21 changes: 8 additions & 13 deletions lib/features/comic_issue/domain/models/comic_issue.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import 'package:d_reader_flutter/features/creator/domain/models/creator.dart';
import 'package:d_reader_flutter/shared/domain/models/collaborator.dart';
import 'package:d_reader_flutter/features/discover/genre/domain/models/genre.dart';
import 'package:d_reader_flutter/shared/domain/models/collectible_info.dart';
import 'package:d_reader_flutter/shared/domain/models/stateful_cover.dart';
import 'package:d_reader_flutter/shared/domain/models/stateless_cover.dart';

class ComicIssueModel {
final int id, number;
final String cover, description, slug, title, comicSlug, creatorAddress;
final bool isPopular, isFreeToRead, isFullyUploaded, isSecondarySaleActive;
final String? activeCandyMachineAddress;
final double sellerFee;
final String cover, description, slug, title, comicSlug;
final bool isPopular, isFreeToRead, isFullyUploaded;
final DateTime releaseDate;
final ComicIssueStats? stats;
final ComicIssueMyStats? myStats;
final ComicType? comic;
final CreatorModel creator;
final CollectibleInfoModel? collectibleInfo;
final List<Collaborator>? collaborators;
final List<StatelessCover>? statelessCovers;
final List<StatefulCover>? statefulCovers;
Expand All @@ -31,19 +31,16 @@ class ComicIssueModel {
this.myStats,
required this.comic,
required this.creator,
this.collectibleInfo,
required this.isPopular,
required this.releaseDate,
required this.isFreeToRead,
required this.isFullyUploaded,
required this.sellerFee,
required this.genres,
this.activeCandyMachineAddress,
this.collaborators,
this.statelessCovers,
this.statefulCovers,
required this.comicSlug,
required this.creatorAddress,
required this.isSecondarySaleActive,
});

factory ComicIssueModel.fromJson(dynamic json) {
Expand All @@ -62,15 +59,15 @@ class ComicIssueModel {
: null,
comic: json['comic'] != null ? ComicType.fromJson(json['comic']) : null,
creator: CreatorModel.fromJson(json['creator']),
collectibleInfo: json['collectibleInfo'] != null
? CollectibleInfoModel.fromJson(json['collectibleInfo'])
: null,
isPopular: json['isPopular'],
releaseDate: DateTime.parse(
json['releaseDate'],
),
isFreeToRead: json['isFreeToRead'],
isFullyUploaded: json['isFullyUploaded'],
activeCandyMachineAddress: json['activeCandyMachineAddress'],
sellerFee:
json['sellerFee'] is int ? json['sellerFee'] + .0 : json['sellerFee'],
collaborators: json['collaborators'] != null
? List<Collaborator>.from(
json['collaborators'].map(
Expand Down Expand Up @@ -108,8 +105,6 @@ class ComicIssueModel {
)
: [],
comicSlug: json['comicSlug'],
creatorAddress: json['creatorAddress'],
isSecondarySaleActive: json['isSecondarySaleActive'] ?? false,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ class _ComicIssueDetailsState extends ConsumerState<ComicIssueDetails>
final textTheme = Theme.of(context).textTheme;
return provider.when(
data: (issue) {
final collectibleInfo = issue.collectibleInfo;
return DefaultTabController(
length: 2,
initialIndex: issue.isSecondarySaleActive &&
issue.activeCandyMachineAddress == null
initialIndex: collectibleInfo != null &&
collectibleInfo.isSecondarySaleActive &&
collectibleInfo.activeCandyMachineAddress == null
? ref.read(lastSelectedTabIndex)
: 0,
child: Scaffold(
Expand Down Expand Up @@ -374,8 +376,11 @@ class _ComicIssueDetailsState extends ConsumerState<ComicIssueDetails>
),
),
),
issue.isSecondarySaleActive &&
issue.activeCandyMachineAddress == null
collectibleInfo != null &&
collectibleInfo.isSecondarySaleActive &&
collectibleInfo
.activeCandyMachineAddress ==
null
? TabBar(
onTap: (value) {
ref
Expand Down Expand Up @@ -403,7 +408,8 @@ class _ComicIssueDetailsState extends ConsumerState<ComicIssueDetails>
horizontal: 16,
vertical: 16,
),
child: issue.isSecondarySaleActive
child: collectibleInfo != null &&
collectibleInfo.isSecondarySaleActive
? TabBarView(
children: [
IssueAbout(issue: issue),
Expand Down Expand Up @@ -436,6 +442,7 @@ class _BottomNavigation extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final collectibleInfo = issue.collectibleInfo;
return SafeArea(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -445,13 +452,14 @@ class _BottomNavigation extends ConsumerWidget {
issue: issue,
),
),
issue.activeCandyMachineAddress != null
collectibleInfo?.activeCandyMachineAddress != null
? Expanded(
child: MintButton(
activeCandyMachineAddress: issue.activeCandyMachineAddress!,
activeCandyMachineAddress:
issue.collectibleInfo!.activeCandyMachineAddress!,
),
)
: issue.isSecondarySaleActive
: collectibleInfo != null && collectibleInfo.isSecondarySaleActive
? const Expanded(
child: BuyButton(),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class IssueAbout extends ConsumerWidget {
shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 8),
children: [
if (issue.activeCandyMachineAddress != null) ...[
if (issue.collectibleInfo?.activeCandyMachineAddress != null) ...[
FutureBuilder(
future: ref.read(
candyMachineProvider(
query:
'candyMachineAddress=${issue.activeCandyMachineAddress}${walletAddress != null && walletAddress.isNotEmpty ? '&walletAddress=$walletAddress' : ''}')
'candyMachineAddress=${issue.collectibleInfo!.activeCandyMachineAddress}${walletAddress != null && walletAddress.isNotEmpty ? '&walletAddress=$walletAddress' : ''}')
.future,
),
builder: (context, snapshot) {
Expand All @@ -43,7 +43,7 @@ class IssueAbout extends ConsumerWidget {

if (currentCandyMachine != null &&
currentCandyMachine.address ==
issue.activeCandyMachineAddress) {
issue.collectibleInfo!.activeCandyMachineAddress) {
return MintInfoContainer(
candyMachineCoupons: currentCandyMachine.coupons,
totalSupply: currentCandyMachine.supply,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ListingStats extends ConsumerWidget {
),
StatsInfo(
title: 'SUPPLY',
stats: issue.isSecondarySaleActive
stats: issue.collectibleInfo != null &&
issue.collectibleInfo!.isSecondarySaleActive
? '${collectionStats?.supply}'
: '--',
),
Expand Down
6 changes: 3 additions & 3 deletions lib/features/creator/domain/models/creator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class CreatorModel {
banner,
description,
instagram,
lynkfire,
linktree,
name,
slug,
twitter,
Expand All @@ -20,7 +20,7 @@ class CreatorModel {
required this.description,
required this.instagram,
required this.isVerified,
required this.lynkfire,
required this.linktree,
required this.name,
required this.slug,
required this.twitter,
Expand All @@ -39,7 +39,7 @@ class CreatorModel {
description: json['description'] ?? '',
instagram: json['instagram'] ?? '',
isVerified: json['isVerified'],
lynkfire: json['lynkfire'] ?? '',
linktree: json['linktree'] ?? '',
twitter: json['twitter'] ?? '',
website: json['website'] ?? '',
stats:
Expand Down
4 changes: 2 additions & 2 deletions lib/features/creator/presentation/widgets/social_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class SocialRow extends StatelessWidget {
Widget build(BuildContext context) {
return Row(
children: [
creator.lynkfire.isNotEmpty
creator.linktree.isNotEmpty
? GestureDetector(
onTap: () {
openUrl(creator.lynkfire);
openUrl(creator.linktree);
},
child: Container(
padding: const EdgeInsets.all(6),
Expand Down
8 changes: 3 additions & 5 deletions lib/features/discover/root/presentation/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import 'package:d_reader_flutter/shared/utils/utils.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

const String _genreSlugsKey = 'genreSlugs[]';
const String _nameSubstringKey = 'nameSubstring';
const String _sortOrderKey = 'sortOrder';
const String _sortTagKey = 'sortTag';
const String _filterTagKey = 'filterTag';
const String _titleSubstringKey = 'titleSubstring';
const String _searchKey = 'search';

String _prependQueryWithKey({required String key, required String value}) =>
value.isNotEmpty ? '$key=$value' : '';
Expand Down Expand Up @@ -64,9 +63,8 @@ String getFilterQueryString(WidgetRef ref, ScrollListType scrollListType) {
final String sortDirection = getSortDirection(selectedSortDirection);
final String common =
'$_sortOrderKey=$sortDirection&${_adjustQueryString(genreTags)}${_adjustQueryString(sortByFilter)}${_adjustQueryString(filterBy)}';
final String query = scrollListType == ScrollListType.creatorList
? '$common${'$_nameSubstringKey=$search'}'
: '$common${'$_titleSubstringKey=$search'}';
final String query =
'$common${search.isNotEmpty ? '$_searchKey=$search' : ''}';
return query;
}

Expand Down
17 changes: 17 additions & 0 deletions lib/shared/domain/models/collectible_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class CollectibleInfoModel {
final bool isSecondarySaleActive;
final String? activeCandyMachineAddress;

CollectibleInfoModel({
required this.isSecondarySaleActive,
this.activeCandyMachineAddress,
});

factory CollectibleInfoModel.fromJson(dynamic json) {
print(json);
return CollectibleInfoModel(
isSecondarySaleActive: json['isSecondarySaleActive'],
activeCandyMachineAddress: json['activeCandyMachineAddress'],
);
}
}
4 changes: 2 additions & 2 deletions publishing/.asset-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"./dReader.apk": {
"path": "./dReader.apk",
"sha256": "7bLOX0TDap1EkdjctrMmDnEz7ehgGc1615bTmBH19+0=",
"uri": "https://s3.us-east-1.amazonaws.com/d-reader-main-mainnet/jYdtFyEBrJtfgWjGjISY"
"sha256": "i4zrNVTTnu9d2SN3VCt/YDg83ijXSZKdM5ilkNJQnPs=",
"uri": "https://s3.us-east-1.amazonaws.com/d-reader-main-mainnet/GUTohDHfXLGLSbocfrO0"
},
"./screenshots/1.png": {
"path": "./screenshots/1.png",
Expand Down
12 changes: 6 additions & 6 deletions publishing/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ app:
- purpose: icon
uri: ./512x512_rounded.png
release:
address: AdSaX7WDM9DdA29BFzcRiFDGy2ywudSoHWLD7Pb5mFyd
address: 7Yksoshaa7rPKgLdvQ7Egp99QkwHKvdr3CoXc2x52EBp
media:
- purpose: icon
uri: ./512x512_rounded.png
Expand All @@ -41,14 +41,14 @@ release:
name: dReader
short_description: Digital comic book store
long_description: Platform for discovering, trading, collecting, and reading digital graphic novels
new_in_version: Improve mint ui
new_in_version: Update comic issue model, connect wallet endpoint and search query param
saga_features: Exclusive early access, free/discounted collectible comics
solana_mobile_dapp_publisher_portal:
google_store_package: io.app.dreader
testing_instructions: Run the app
lastSubmittedVersionOnChain:
address: AdSaX7WDM9DdA29BFzcRiFDGy2ywudSoHWLD7Pb5mFyd
version_code: 2053
apk_hash: 7bLOX0TDap1EkdjctrMmDnEz7ehgGc1615bTmBH19+0=
address: 7Yksoshaa7rPKgLdvQ7Egp99QkwHKvdr3CoXc2x52EBp
version_code: 2054
apk_hash: i4zrNVTTnu9d2SN3VCt/YDg83ijXSZKdM5ilkNJQnPs=
lastUpdatedVersionOnStore:
address: AdSaX7WDM9DdA29BFzcRiFDGy2ywudSoHWLD7Pb5mFyd
address: 7Yksoshaa7rPKgLdvQ7Egp99QkwHKvdr3CoXc2x52EBp
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: dReader Flutter app.

publish_to: 'none'

version: 1.4.5+85 # # dappStore: 1.4.3+53 (next release: 1.4.4+54) google play: 1.4.5+85 (next release: 1.4.6+86)
version: 1.4.4+54 # # dappStore: 1.4.4+54 (next release: 1.4.5+55) google play: 1.4.6+86 (next release: 1.4.7+87)

environment:
sdk: '>=3.0.0 <4.0.0'
Expand Down

0 comments on commit 1c308b6

Please sign in to comment.