Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ebsi nft #1861

Merged
merged 7 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/app/shared/constants/altme_strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ class AltMeStrings {
//Don't send address
static const List<String> contractDontSendAddress = [
'KT1VuCBGQW4WakHj1PXhFC1G848dKyNy34kB',
'KT1Wv4dPiswWYj2H9UrSrVNmcMd9w5NtzczG'
'KT1Wv4dPiswWYj2H9UrSrVNmcMd9w5NtzczG',
];
}
8 changes: 4 additions & 4 deletions lib/app/shared/dio_client/dio_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import 'package:dio/dio.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
part 'logging.dart';

const _defaultConnectTimeout = Duration.millisecondsPerMinute;
const _defaultReceiveTimeout = Duration.millisecondsPerMinute;
const _defaultConnectTimeout = Duration(minutes: 1);
const _defaultReceiveTimeout = Duration(minutes: 1);

class DioClient {
DioClient(this.baseUrl, this.dio) {
Expand Down Expand Up @@ -68,7 +68,7 @@ class DioClient {
ResponseString.RESPONSE_STRING_UNABLE_TO_PROCESS_THE_DATA,
);
} catch (e) {
if (e is DioError) {
if (e is DioException) {
throw NetworkException.getDioException(error: e);
} else {
rethrow;
Expand Down Expand Up @@ -135,7 +135,7 @@ class DioClient {
ResponseString.RESPONSE_STRING_UNABLE_TO_PROCESS_THE_DATA,
);
} catch (e) {
if (e is DioError) {
if (e is DioException) {
throw NetworkException.getDioException(error: e);
} else {
rethrow;
Expand Down
2 changes: 1 addition & 1 deletion lib/app/shared/dio_client/logging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Logging extends Interceptor {
}

@override
void onError(DioError err, ErrorInterceptorHandler handler) {
void onError(DioException err, ErrorInterceptorHandler handler) {
log.e(
'ERROR[${err.response?.statusCode}] TYPE[${err.type}],=> PATH:'
' ${err.requestOptions.path} data: ${err.response?.data}',
Expand Down
31 changes: 18 additions & 13 deletions lib/app/shared/message_handler/network_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class NetworkException with MessageHandler {
final NetworkError message;
final dynamic data;

static NetworkException handleResponse(int? statusCode, DioError? error) {
static NetworkException handleResponse(int? statusCode, DioException? error) {
switch (statusCode) {
// case 200: //No Error
// case 201: //No Error
Expand Down Expand Up @@ -87,43 +87,48 @@ class NetworkException with MessageHandler {
}) {
if (error is Exception) {
NetworkException networkException;
if (error is DioError) {
if (error is DioException) {
switch (error.type) {
case DioErrorType.cancel:
case DioExceptionType.cancel:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_REQUEST_CANCELLED,
data: error.response?.data,
);

case DioErrorType.connectTimeout:
case DioExceptionType.connectionTimeout:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_REQUEST_TIMEOUT,
data: error.response?.data,
);

case DioErrorType.other:
case DioExceptionType.unknown:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_NO_INTERNET_CONNECTION,
data: error.response?.data,
);

case DioErrorType.receiveTimeout:
case DioExceptionType.receiveTimeout:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_SEND_TIMEOUT,
data: error.response?.data,
);

case DioErrorType.response:
case DioExceptionType.badResponse:
networkException = handleResponse(
error.response?.statusCode,
error,
);

case DioErrorType.sendTimeout:
case DioExceptionType.sendTimeout:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_SEND_TIMEOUT,
data: error.response?.data,
);
case DioExceptionType.badCertificate:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_UNEXPECTED_ERROR,
data: error.response?.data,
);
case DioExceptionType.connectionError:
networkException = NetworkException(
message: NetworkError.NETWORK_ERROR_UNEXPECTED_ERROR,
data: error.response?.data,
);
}
} else if (error is SocketException) {
networkException = NetworkException(
Expand Down
1 change: 0 additions & 1 deletion lib/app/shared/widget/base/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class _BasePageState extends State<BasePage> with WidgetsBindingObserver {
case AppLifecycleState.hidden:
case AppLifecycleState.detached:
break;
// TODO(all): Handle this case.
}
}

Expand Down
27 changes: 23 additions & 4 deletions lib/chat_room/matrix_chat/matrix_chat_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ class MatrixChatImpl extends MatrixChatInterface {
@override
Message mapEventToMessage(Event event) {
late final Message message;
num size = 0;
if (event.content['info'] != null) {
final info = event.content['info']! as Map;
if (info['size'] != null) {
size = info['size'] as num;
}
}

if (event.messageType == 'm.text') {
message = TextMessage(
id: event.unsigned?['transaction_id'] as String? ?? const Uuid().v4(),
Expand All @@ -183,7 +191,7 @@ class MatrixChatImpl extends MatrixChatInterface {
id: const Uuid().v4(),
remoteId: event.eventId,
name: event.plaintextBody,
size: event.content['info']['size'] as num? ?? 0,
size: size,
uri: getUrlFromUri(uri: event.content['url'] as String? ?? ''),
status: mapEventStatusToMessageStatus(event.status),
createdAt: event.originServerTs.millisecondsSinceEpoch,
Expand All @@ -196,7 +204,7 @@ class MatrixChatImpl extends MatrixChatInterface {
id: const Uuid().v4(),
remoteId: event.eventId,
name: event.plaintextBody,
size: event.content['info']['size'] as num? ?? 0,
size: size,
uri: getUrlFromUri(uri: event.content['url'] as String? ?? ''),
status: mapEventStatusToMessageStatus(event.status),
createdAt: event.originServerTs.millisecondsSinceEpoch,
Expand All @@ -205,14 +213,25 @@ class MatrixChatImpl extends MatrixChatInterface {
),
);
} else if (event.messageType == 'm.audio') {
var duration = 0;
var size = 0;
if (event.content['info'] != null) {
final info = event.content['info']! as Map;
if (info['duration'] != null) {
duration = info['duration'] as int;
}
if (info['size'] != null) {
size = info['size'] as int;
}
}
message = AudioMessage(
id: const Uuid().v4(),
remoteId: event.eventId,
duration: Duration(
milliseconds: event.content['info']['duration'] as int? ?? 0,
milliseconds: duration,
),
name: event.plaintextBody,
size: event.content['info']['size'] as num? ?? 0,
size: size,
uri: getUrlFromUri(uri: event.content['url'] as String? ?? ''),
status: mapEventStatusToMessageStatus(event.status),
createdAt: event.originServerTs.millisecondsSinceEpoch,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CredentialManifestPickCubit extends Cubit<CredentialManifestPickState> {
id: '${currentFirst.id},${descriptorsWithSameGroup.map((e) => e.id).join(",")}', // ignore: lines_longer_than_80_chars
name: [
currentFirst.name,
...descriptorsWithSameGroup.map((e) => e.name)
...descriptorsWithSameGroup.map((e) => e.name),
].where((e) => e != null).join(','),
constraints: Constraints([
...?currentFirst.constraints?.fields,
Expand All @@ -61,7 +61,7 @@ class CredentialManifestPickCubit extends Cubit<CredentialManifestPickState> {
group: currentFirst.group,
purpose: [
currentFirst.purpose,
...descriptorsWithSameGroup.map((e) => e.purpose)
...descriptorsWithSameGroup.map((e) => e.purpose),
].where((e) => e != null).join(','),
);
newInputDescriptor.add(mergedDescriptor);
Expand Down Expand Up @@ -108,7 +108,7 @@ class CredentialManifestPickCubit extends Cubit<CredentialManifestPickState> {
/// selecting the credential
selected = [
...state.selected,
...[index]
...[index],
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ class ProofOfTwitterStatsWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
// final proofOfTwitterStatsModel = credentialModel
// .credentialPreview.credentialSubjectModel as ProofOfTwitterStatsModel;

return CredentialBaseWidget(
cardBackgroundImagePath: ImageStrings.twitterStatsCard,
issuerName: credentialModel
Expand Down
2 changes: 1 addition & 1 deletion lib/dashboard/src/view/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class _DashboardViewState extends State<DashboardView> {
isSelected: state.selectedIndex == 3,
);
},
)
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion packages/credential_manifest/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: ">=2.16.0 <3.0.0"

dependencies:
dio: ^4.0.0 #tezart from git depends on dio ^4.0.0
dio: ^5.3.2
flutter:
sdk: flutter
json_annotation: ^4.8.1
Expand Down
2 changes: 1 addition & 1 deletion packages/key_generator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
tezart:
git:
url: https://github.com/autonomy-system/tezart.git
ref: 0cd68a902c8d2554227738594c62046571e57b4c
ref: e53e4ab9eaabea53cbf70e814efd2245b4659f48

dependency_overrides:
pinenacl: ^0.5.1 # tezart from git depends on pinenacl ^0.3.3
Expand Down
6 changes: 3 additions & 3 deletions packages/oidc4vc/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ dependencies:
dart_bip32_bip44: ^0.2.0
dart_jsonwebtoken: ^2.8.0
dart_web3: ^0.0.3
dio: ^4.0.0 #tezart from git depends on dio ^4.0.0
dio: ^5.3.2
fast_base58: ^0.2.1
flutter:
sdk: flutter
hex: ^0.2.0
http_mock_adapter: ^0.3.3 #http_mock_adapter 0.4.4 depends on dio ^5.0.0
http_mock_adapter: ^0.6.0
jose: ^0.3.3
json_path: ^0.4.4 #latest version creates test issue
secp256k1: ^0.3.0
tezart:
git:
url: https://github.com/autonomy-system/tezart.git
ref: 0cd68a902c8d2554227738594c62046571e57b4c
ref: e53e4ab9eaabea53cbf70e814efd2245b4659f48
uuid: ^3.0.7

dependency_overrides:
Expand Down
4 changes: 2 additions & 2 deletions packages/oidc4vc/test/src/oidc4vc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
// tokenUrl,
// (request) => request.throws(
// 401,
// DioError(requestOptions: RequestOptions(path: tokenUrl)),
// DioException(requestOptions: RequestOptions(path: tokenUrl)),
// ),
// );
// final oidc4vc = OIDC4VC(client);
Expand Down Expand Up @@ -656,7 +656,7 @@
// url,
// (request) => request.throws(
// 401,
// DioError(requestOptions: RequestOptions(path: tokenUrl)),
// DioException(requestOptions: RequestOptions(path: tokenUrl)),
// ),
// );
// final oidc4vc = OIDC4VC(client);
Expand Down
Loading
Loading