Skip to content

Commit

Permalink
Merge branch '#2714' into test_integration_TALAO
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkbee1 committed Jun 14, 2024
2 parents 953a15c + ebd822a commit 4a7ed4a
Show file tree
Hide file tree
Showing 469 changed files with 15,778 additions and 6,126 deletions.
4 changes: 0 additions & 4 deletions .fvm/fvm_config.json

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/credential_manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: credential_manifest

on: [ pull_request, push ]
on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/credential_manifest
dart_sdk: 3.3.4
dart_sdk: 3.4.1
6 changes: 3 additions & 3 deletions .github/workflows/cryptocurrency_keys.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: cryptocurrency_keys

on: [ pull_request, push ]
on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/cryptocurrency_keys
dart_sdk: 3.3.4
dart_sdk: 3.4.1
14 changes: 14 additions & 0 deletions .github/workflows/did_kit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: did_kit

on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/did_kit
dart_sdk: 3.4.1
build_runner: false
6 changes: 3 additions & 3 deletions .github/workflows/jwt_decode.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: jwt_decode

on: [ pull_request, push ]
on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/jwt_decode
dart_sdk: 3.3.4
dart_sdk: 3.4.1
build_runner: false
6 changes: 3 additions & 3 deletions .github/workflows/key_generator.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: key_generator

on: [ pull_request, push ]
on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/key_generator
dart_sdk: 3.3.4
dart_sdk: 3.4.1
build_runner: false
14 changes: 14 additions & 0 deletions .github/workflows/oidc4vc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: oidc4vc

on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/oidc4vc
dart_sdk: 3.4.1
build_runner: true
6 changes: 3 additions & 3 deletions .github/workflows/polygonid.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: polygonid

on: [ pull_request, push ]
on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.19.6
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/polygonid
dart_sdk: 3.3.4
dart_sdk: 3.4.1
build_runner: false
14 changes: 14 additions & 0 deletions .github/workflows/secure_storage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: secure_storage

on: [pull_request, push]

jobs:
build:
uses: TalaoDAO/AltMe/.github/workflows/flutter_package.yaml@main
with:
flutter_channel: stable
flutter_version: 3.22.1
min_coverage: 30
working_directory: packages/secure_storage
dart_sdk: 3.4.1
build_runner: false
70 changes: 29 additions & 41 deletions lib/app/shared/dio_client/dio_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,14 @@ class DioClient {
bool isCachingEnabled = false,
}) async {
try {
final isInternetAvailable = await isConnected();
if (!isInternetAvailable) {
throw NetworkException(
message: NetworkError.NETWORK_ERROR_NO_INTERNET_CONNECTION,
);
}

final stopwatch = Stopwatch()..start();
await getSpecificHeader(uri, headers);
log.i('uri - $uri');

final cachedData = await secureStorageProvider.get(uri);
dynamic response;

if (!isCachingEnabled || cachedData == null) {
response = await dio.get<dynamic>(
uri,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onReceiveProgress: onReceiveProgress,
);
} else {
final cachedDataJson = jsonDecode(cachedData);
final expiry = int.parse(cachedDataJson['expiry'].toString());

final isExpired = DateTime.now().millisecondsSinceEpoch > expiry;

if (isExpired) {
if (isCachingEnabled) {
final cachedData = await secureStorageProvider.get(uri);
if (cachedData == null) {
response = await dio.get<dynamic>(
uri,
queryParameters: queryParameters,
Expand All @@ -92,18 +71,34 @@ class DioClient {
onReceiveProgress: onReceiveProgress,
);
} else {
/// directly return cached data
/// returned here to avoid the caching override everytime
final response = await cachedDataJson['data'];
log.i('Time - ${stopwatch.elapsed}');
return response;
final cachedDataJson = jsonDecode(cachedData);
final expiry = int.parse(cachedDataJson['expiry'].toString());

final isExpired = DateTime.now().millisecondsSinceEpoch > expiry;
if (isExpired) {
response = await dio.get<dynamic>(
uri,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onReceiveProgress: onReceiveProgress,
);
} else {
/// directly return cached data
/// returned here to avoid the caching override everytime
final response = await cachedDataJson['data'];
return response;
}
}
} else {
response = await dio.get<dynamic>(
uri,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onReceiveProgress: onReceiveProgress,
);
}
final expiry =
DateTime.now().add(const Duration(days: 2)).millisecondsSinceEpoch;

final value = {'expiry': expiry, 'data': response.data};
await secureStorageProvider.set(uri, jsonEncode(value));

log.i('Time - ${stopwatch.elapsed}');
return response.data;
Expand Down Expand Up @@ -153,13 +148,6 @@ class DioClient {
},
}) async {
try {
final isInternetAvailable = await isConnected();
if (!isInternetAvailable) {
throw NetworkException(
message: NetworkError.NETWORK_ERROR_NO_INTERNET_CONNECTION,
);
}

final stopwatch = Stopwatch()..start();
await getSpecificHeader(uri, headers);
final response = await dio.post<dynamic>(
Expand Down
4 changes: 1 addition & 3 deletions lib/app/shared/enum/credential_category.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:altme/l10n/l10n.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';

enum CredentialCategory {
advantagesCards,
Expand Down Expand Up @@ -80,8 +79,7 @@ extension CredentialCategoryX on CredentialCategory {
}
}

CredentialCategoryConfig config(BuildContext context) {
final l10n = context.l10n;
CredentialCategoryConfig config(AppLocalizations l10n) {
switch (this) {
case CredentialCategory.advantagesCards:
return CredentialCategoryConfig(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:altme/app/app.dart';
import 'package:altme/l10n/l10n.dart';
import 'package:altme/theme/theme.dart';
import 'package:flutter/material.dart';

extension CredentialStatusExtension on CredentialStatus {
Expand Down Expand Up @@ -44,15 +43,15 @@ extension CredentialStatusExtension on CredentialStatus {
Color color(BuildContext context) {
switch (this) {
case CredentialStatus.active:
return Theme.of(context).colorScheme.activeColor;
return Theme.of(context).colorScheme.onTertiary;
case CredentialStatus.invalidStatus:
case CredentialStatus.expired:
case CredentialStatus.pending:
case CredentialStatus.unknown:
case CredentialStatus.invalidSignature:
case CredentialStatus.statusListInvalidSignature:
case CredentialStatus.noStatus:
return Theme.of(context).colorScheme.inactiveColor;
return Theme.of(context).colorScheme.error;
}
}
}
1 change: 1 addition & 0 deletions lib/app/shared/enum/status/status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export 'app_status.dart';
export 'beacon_status.dart';
export 'credential_detail_tab_status.dart';
export 'credential_status.dart';
export 'credential_status_extension.dart';
export 'credentials_status.dart';
export 'home_status.dart';
export 'kyc_verification_status.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/app/shared/enum/type/message_type/message_type.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:altme/app/shared/constants/icon_strings.dart';
import 'package:altme/theme/theme.dart';
import 'package:flutter/material.dart';

part 'message_type_extension.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ extension MessageTypeX on MessageType {
Color getColor(BuildContext context) {
switch (this) {
case MessageType.error:
return Theme.of(context).colorScheme.alertErrorMessage;
return Theme.of(context).colorScheme.error;
case MessageType.warning:
return Theme.of(context).colorScheme.alertWarningMessage;
return Theme.of(context).colorScheme.onErrorContainer;
case MessageType.info:
return Theme.of(context).colorScheme.alertInfoMessage;
return Theme.of(context).colorScheme.outline;
case MessageType.success:
return Theme.of(context).colorScheme.alertSuccessMessage;
return Theme.of(context).colorScheme.onTertiary;
}
}

Expand Down
3 changes: 1 addition & 2 deletions lib/app/shared/extension/extension.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export 'bigint_extension.dart';
export 'credential_status.dart';
export 'double_extension.dart';
export 'iterable_extension.dart';
export 'string_extension.dart';
export 'unit8List_extension.dart';
export 'unit8_list_extension.dart';
Loading

0 comments on commit 4a7ed4a

Please sign in to comment.