Skip to content

Commit

Permalink
feat: Show only one crypto card in card list and discover #2580
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Apr 10, 2024
1 parent 3ab0134 commit e517201
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
6 changes: 4 additions & 2 deletions lib/credentials/cubit/credentials_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/dashboard/home/tab_bar/credentials/models/activity/activity.dart';
import 'package:altme/dashboard/profile/models/display_external_issuer.dart';
import 'package:altme/wallet/model/model.dart';
import 'package:altme/wallet/wallet.dart';
import 'package:bloc/bloc.dart';
import 'package:credential_manifest/credential_manifest.dart';
Expand Down Expand Up @@ -926,7 +925,10 @@ class CredentialsCubit extends Cubit<CredentialsState> {
.contains(currentWalletAddress.toString());

if (!isBlockChainCardAvailable && isCurrentBlockchainAccount) {
requiredDummySubjects.add(subjectType);
/// if already added do not add
if (!requiredDummySubjects.contains(subjectType)) {
requiredDummySubjects.add(subjectType);
}
}

//get current wallet address
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:altme/app/app.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/wallet/wallet.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:oidc4vc/oidc4vc.dart';
Expand All @@ -26,6 +27,7 @@ class HomeCredentialCategoryList extends StatelessWidget {
.selfSovereignIdentityOptions
.customOidc4vcProfile
.vcFormatType;

return RefreshIndicator(
onRefresh: onRefresh,
child: Padding(
Expand Down Expand Up @@ -54,11 +56,26 @@ class HomeCredentialCategoryList extends StatelessWidget {
return true;
}

// /// crypto credential account to be shown always
// if (element.credentialPreview.credentialSubjectModel
// .credentialSubjectType.isBlockchainAccount ) {
// return true;
// }
/// crypto credential account to be shown always
if (element.credentialPreview.credentialSubjectModel
.credentialSubjectType.isBlockchainAccount) {
/// only show crypto card with matches current account
/// wallet address
final String? currentWalletAddress = context
.read<WalletCubit>()
.state
.currentAccount
?.walletAddress;

final String? walletAddress = getWalletAddress(
element.credentialPreview.credentialSubjectModel,
);

if (currentWalletAddress.toString() !=
walletAddress.toString()) {
return false;
}
}

/// do not load the credential if vc format is different
if (vcFormatType.value != element.getFormat) {
Expand Down

0 comments on commit e517201

Please sign in to comment.