Skip to content

Commit

Permalink
feat: Support qr to add enterprise account #2433
Browse files Browse the repository at this point in the history
  • Loading branch information
bibash28 committed Feb 23, 2024
1 parent b7f79e8 commit 81ea925
Show file tree
Hide file tree
Showing 16 changed files with 582 additions and 60 deletions.
2 changes: 1 addition & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
1 change: 0 additions & 1 deletion lib/app/shared/constants/constants.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export 'accentuations.dart';
export 'altme_strings.dart';
export 'constants_json.dart';
export 'enterprise.dart';
export 'icon_strings.dart';
export 'image_strings.dart';
export 'parameters.dart';
Expand Down
3 changes: 0 additions & 3 deletions lib/app/shared/constants/enterprise.dart

This file was deleted.

4 changes: 3 additions & 1 deletion lib/app/shared/constants/secure_storage_keys.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ class SecureStorageKeys {
static const String customProfileSettings = 'customProfileSettings';
static const String enterpriseProfileSetting = 'enterpriseProfileSetting';

static const String walletProviderType = 'walletProviderType';
static const String enterpriseEmail = 'enterpriseEmail';
static const String enterprisePassword = 'enterprisePassword';
static const String enterpriseWalletProvider = 'enterpriseWalletProvider';
}
16 changes: 8 additions & 8 deletions lib/app/shared/constants/urls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,14 @@ class Urls {
static String ethPrice(String symbol) =>
'$cryptoCompareBaseUrl/data/price?fsym=$symbol&tsyms=USD';

// TZKT
/// TZKT
static const tzktMainnetUrl = 'https://api.tzkt.io';
static const tzktGhostnetUrl = 'https://api.ghostnet.tzkt.io';

//Moralis
/// Moralis
static const moralisBaseUrl = 'https://deep-index.moralis.io/api/v2';

//Infura
/// Infura
static const infuraBaseUrl = 'https://mainnet.infura.io/v3/';

static const objktUrl = 'https://objkt.com/';
Expand All @@ -170,24 +170,24 @@ class Urls {
static const over65AIValidationUrl = 'https://issuer.talao.co/ai/over65';
static const ageRangeAIValidationUrl = 'https://issuer.talao.co/ai/agerange';

//Matrix home server
/// Matrix home server
static const matrixHomeServer = 'https://matrix.talao.co';
static const getNonce = 'https://talao.co/matrix/nonce';
static const registerToMatrix = 'https://talao.co/matrix/register';

//deeplink
/// deeplink
static const appDeepLink = 'https://app.altme.io/app/download';

//ID360
/// ID360
static const getCodeForId360 = 'https://talao.co/id360/get_code';
static const authenticateForId360 = 'https://talao.co/id360/authenticate';

//Discover
/// Discover
static const discoverCoinsWebView = 'https://discover-coins-part.webflow.io/';
static const discoverNftsWebView =
'https://discover-coins-part.webflow.io/prod-nota-available/nft-noir';

// wallet provider
/// wallet provider
static const walletProvider = 'https://wallet-provider.talao.co';
static const walletTestProvider = 'https://preprod.wallet-provider.talao.co';
}
10 changes: 10 additions & 0 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:altme/connection_bridge/connection_bridge.dart';
import 'package:altme/credentials/credentials.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/deep_link/deep_link.dart';
import 'package:altme/enterprise/enterprise.dart';
import 'package:altme/flavor/cubit/flavor_cubit.dart';
import 'package:altme/kyc_verification/cubit/kyc_verification_cubit.dart';
import 'package:altme/l10n/l10n.dart';
Expand Down Expand Up @@ -142,6 +143,14 @@ class App extends StatelessWidget {
walletCubit: context.read<WalletCubit>(),
),
),
BlocProvider<EnterpriseCubit>(
create: (context) => EnterpriseCubit(
client: DioClient('', Dio()),
jwtDecode: JWTDecode(),
profileCubit: context.read<ProfileCubit>(),
walletCubit: context.read<WalletCubit>(),
),
),
BlocProvider<ScanCubit>(
create: (context) => ScanCubit(
client: DioClient(Urls.checkIssuerTalaoUrl, Dio()),
Expand Down Expand Up @@ -170,6 +179,7 @@ class App extends StatelessWidget {
didKitProvider: DIDKitProvider(),
oidc4vc: OIDC4VC(),
walletCubit: context.read<WalletCubit>(),
enterpriseCubit: context.read<EnterpriseCubit>(),
),
),
BlocProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:altme/credentials/credentials.dart';
import 'package:altme/dashboard/dashboard.dart';
import 'package:altme/dashboard/home/tab_bar/credentials/present/pick/credential_manifest/helpers/apply_submission_requirements.dart';
import 'package:altme/deep_link/deep_link.dart';
import 'package:altme/enterprise/enterprise.dart';
import 'package:altme/oidc4vc/oidc4vc.dart';
import 'package:altme/polygon_id/polygon_id.dart';
import 'package:altme/query_by_example/query_by_example.dart';
Expand Down Expand Up @@ -44,6 +45,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
required this.didKitProvider,
required this.oidc4vc,
required this.walletCubit,
required this.enterpriseCubit,
}) : super(const QRCodeScanState());

final DioClient client;
Expand All @@ -61,6 +63,7 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
final DIDKitProvider didKitProvider;
final OIDC4VC oidc4vc;
final WalletCubit walletCubit;
final EnterpriseCubit enterpriseCubit;

final log = getLogger('QRCodeScanCubit');

Expand Down Expand Up @@ -108,6 +111,10 @@ class QRCodeScanCubit extends Cubit<QRCodeScanState> {
scannedResponse.substring('${Urls.appDeepLink}?uri='.length),
);
await verify(uri: Uri.parse(url));
} else if (scannedResponse.startsWith('configuration://?')) {
/// enterprise
emit(state.copyWith(qrScanStatus: QrScanStatus.goBack));
await enterpriseCubit.requestTheConfiguration(scannedResponse);
} else {
final uri = Uri.parse(scannedResponse);
await verify(uri: uri);
Expand Down
Loading

0 comments on commit 81ea925

Please sign in to comment.