Skip to content

Commit

Permalink
Merge pull request #5 from wisemen-digital/Actions-formatter
Browse files Browse the repository at this point in the history
Update formatter to use dart standard formatter
  • Loading branch information
Yani-Maassen authored Apr 12, 2024
2 parents 70e02f9 + a201610 commit c3bcce5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: flutter pub get

- name: Verify formatting
run: dart format . --line-length=200 --set-exit-if-changed
run: dart format . --set-exit-if-changed

- name: Analyze project source
run: dart analyze --fatal-infos --fatal-warnings
3 changes: 2 additions & 1 deletion lib/src/client/wiseclient_native.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ base class NativeWiseClient extends DioForNative with WiseClient {
Iterable<Interceptor>? replacementInterceptors,
}) {
options = baseOptions ?? BaseOptions();
httpClientAdapter = useNativeAdapter ? NativeAdapter() : IOHttpClientAdapter();
httpClientAdapter =
useNativeAdapter ? NativeAdapter() : IOHttpClientAdapter();
if (replacementInterceptors != null) {
interceptors.addAll(
replacementInterceptors,
Expand Down
3 changes: 2 additions & 1 deletion lib/src/error_screens/error_screens.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ final class WiseErrorHandler {
builder: (context) => codeWidget,
);
} else {
if (exception.response!.statusCode! >= 400 && exception.response!.statusCode! < 500) {
if (exception.response!.statusCode! >= 400 &&
exception.response!.statusCode! < 500) {
if (otherClientError != null) {
return MaterialPageRoute(
builder: (context) => otherClientError!,
Expand Down
24 changes: 16 additions & 8 deletions lib/src/error_screens/messages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ String getDetailedClientErrorMessage(String languageCode) {
case 'en':
errorMessage = 'A client error occurred, please try again later';
case 'nl':
errorMessage = 'Er is een fout opgetreden bij de client, probeer het later opnieuw';
errorMessage =
'Er is een fout opgetreden bij de client, probeer het later opnieuw';
case 'es':
errorMessage = 'Se produjo un error del cliente, por favor inténtelo de nuevo más tarde';
errorMessage =
'Se produjo un error del cliente, por favor inténtelo de nuevo más tarde';
case 'de':
errorMessage = 'Es ist ein Clientfehler aufgetreten, bitte versuchen Sie es später erneut';
errorMessage =
'Es ist ein Clientfehler aufgetreten, bitte versuchen Sie es später erneut';
case 'fr':
errorMessage = "Une erreur client s'est produite, veuillez réessayer plus tard";
errorMessage =
"Une erreur client s'est produite, veuillez réessayer plus tard";
case 'ar':
errorMessage = 'حدث خطأ في العميل، يرجى المحاولة مرة أخرى لاحقًا';
case 'ja':
Expand All @@ -80,13 +84,17 @@ String getDetailedServerErrorMesssage(String languageCode) {
case 'en':
errorMessage = 'A server error occurred, please try again later';
case 'nl':
errorMessage = 'Er is een serverfout opgetreden, probeer het later opnieuw';
errorMessage =
'Er is een serverfout opgetreden, probeer het later opnieuw';
case 'es':
errorMessage = 'Se produjo un error del servidor, por favor inténtelo de nuevo más tarde';
errorMessage =
'Se produjo un error del servidor, por favor inténtelo de nuevo más tarde';
case 'de':
errorMessage = 'Es ist ein Serverfehler aufgetreten, bitte versuchen Sie es später erneut';
errorMessage =
'Es ist ein Serverfehler aufgetreten, bitte versuchen Sie es später erneut';
case 'fr':
errorMessage = "Une erreur de serveur s'est produite, veuillez réessayer plus tard";
errorMessage =
"Une erreur de serveur s'est produite, veuillez réessayer plus tard";
case 'ar':
errorMessage = 'حدث خطأ في الخادم، يرجى المحاولة مرة أخرى لاحقًا';
case 'ja':
Expand Down
6 changes: 4 additions & 2 deletions lib/src/token_model/oauth_token.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class OAuthToken extends OAuth2Token {
accessToken: map['access_token'] as String,
tokenType: map['token_type'] != null ? map['token_type'] as String : null,
expiresIn: map['expires_in'] != null ? map['expires_in'] as int : null,
refreshToken: map['refresh_token'] != null ? map['refresh_token'] as String : null,
refreshToken:
map['refresh_token'] != null ? map['refresh_token'] as String : null,
scope: map['scope'] != null ? map['scope'] as String : null,
);
}
Expand All @@ -28,7 +29,8 @@ class OAuthToken extends OAuth2Token {
accessToken: map['accessToken'] as String,
tokenType: map['tokenType'] != null ? map['tokenType'] as String : null,
expiresIn: map['expiresIn'] != null ? map['expiresIn'] as int : null,
refreshToken: map['refreshToken'] != null ? map['refreshToken'] as String : null,
refreshToken:
map['refreshToken'] != null ? map['refreshToken'] as String : null,
scope: map['scope'] != null ? map['scope'] as String : null,
);
}
Expand Down
7 changes: 5 additions & 2 deletions lib/src/wiseclient_base.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:dio/dio.dart';
import 'package:fresh_dio/fresh_dio.dart';
import 'client/wiseclient_native.dart' if (dart.library.html) 'client/wiseclient_web.dart';
import 'client/wiseclient_native.dart'
if (dart.library.html) 'client/wiseclient_web.dart';
import 'exceptions/exceptions.dart';
import 'interceptors/interceptors.dart';
import 'options.dart';
Expand All @@ -18,7 +19,9 @@ abstract mixin class WiseClient implements Dio {
Iterable<Interceptor>? interceptors,
}) {
assert(
wiseInterceptors.contains(WiseInterceptor.fresh) ? refreshFunction != null : refreshFunction == null,
wiseInterceptors.contains(WiseInterceptor.fresh)
? refreshFunction != null
: refreshFunction == null,
'RefreshFunction is required when using fresh interceptor',
);
return createClient(
Expand Down
3 changes: 2 additions & 1 deletion lib/wiseclient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
library wiseclient;

export 'package:dio/dio.dart' show DioException, Options;
export 'package:fresh_dio/fresh_dio.dart' show AuthenticationStatus, RevokeTokenException;
export 'package:fresh_dio/fresh_dio.dart'
show AuthenticationStatus, RevokeTokenException;

export 'src/error_screens/error_screens.dart';
export 'src/exceptions/exceptions.dart';
Expand Down

0 comments on commit c3bcce5

Please sign in to comment.