Skip to content

Commit

Permalink
fix a few issues that happen due to library upgrades
Browse files Browse the repository at this point in the history
  • Loading branch information
gram-incolo committed Jul 3, 2024
1 parent 0cef1f5 commit a93f87f
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 32 deletions.
19 changes: 13 additions & 6 deletions wallet/lib/main_prod.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import 'package:pylons_wallet/components/loading.dart';
import 'package:pylons_wallet/pylons_app.dart';
import 'package:pylons_wallet/utils/base_env.dart';
import 'package:pylons_wallet/utils/constants.dart';
import 'package:pylons_wallet/utils/dependency_injection/dependency_injection.dart' as di;
import 'package:pylons_wallet/utils/dependency_injection/dependency_injection.dart'
as di;
import 'package:pylons_wallet/utils/extension.dart';
import 'package:pylons_wallet/utils/types.dart';

Expand All @@ -31,7 +32,8 @@ Future<void> main() async {
await FlutterDownloader.initialize(ignoreSsl: true);
await EasyLocalization.ensureInitialized();
await Firebase.initializeApp();
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(!kDebugMode);
await FirebaseCrashlytics.instance
.setCrashlyticsCollectionEnabled(!kDebugMode);

PlatformDispatcher.instance.onError = (error, stack) {
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
Expand All @@ -53,7 +55,8 @@ Future<void> main() async {
FirebaseAnalytics.instance.logEvent(name: event.getEventName());
},
onLogError: (exception, {bool fatal = false, StackTrace? stack}) {
FirebaseCrashlytics.instance.recordError(exception, stack, fatal: fatal);
FirebaseCrashlytics.instance
.recordError(exception, stack, fatal: fatal);
},
onLogMessage: logMessage,
);
Expand Down Expand Up @@ -86,14 +89,17 @@ Future<void> main() async {
}

Future<void> initializeAppCheck() async {
await FirebaseAppCheck.instance.activate(webRecaptchaSiteKey: 'recaptcha-v3-site-key');
await FirebaseAppCheck.instance.activate(
webProvider: ReCaptchaV3Provider('recaptcha-v3-site-key'),
);
// FirebaseAppCheck when enforced would block incoming requests from Android and iOS in debug mode.
// This kDebugMode check gets a android debug token from FirebaseAppCheck which can then be added on the Firebase console
// iOS debug token from FirebaseAppCheck automatically get without method channel when run on debug mode which can then be added on the Firebase console
// So that the application can be allowed to access to Firebase AppCheck token in debug mode.
if (kDebugMode && Platform.isAndroid) {
try {
const MethodChannel methodChannel = MethodChannel(kGetFirebaseAppCheckTokenMethodChannelKey);
const MethodChannel methodChannel =
MethodChannel(kGetFirebaseAppCheckTokenMethodChannelKey);
await methodChannel.invokeMethod(kGetFirebaseAppCheckDebugTokenKey);
} catch (e) {
e.toString().show();
Expand All @@ -105,6 +111,7 @@ class MyHttpOverrides extends HttpOverrides {
@override
HttpClient createHttpClient(SecurityContext? context) {
return super.createHttpClient(context)
..badCertificateCallback = (X509Certificate cert, String host, int port) => true;
..badCertificateCallback =
(X509Certificate cert, String host, int port) => true;
}
}
26 changes: 17 additions & 9 deletions wallet/lib/pages/stripe_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ class _StripeScreenState extends State<StripeScreen> {

Future<bool> loadLoginLink() async {
final loading = Loading()..showLoading();
final account_response = await GetIt.I.get<StripeHandler>().handleStripeAccountLink();
final account_response =
await GetIt.I.get<StripeHandler>().handleStripeAccountLink();
loading.dismiss();
account_response.fold((fail) => {fail.message.show()}, (accountlink) {
_controller.loadUrl(urlRequest: URLRequest(url: Uri.parse(accountlink)));
_controller.loadUrl(
urlRequest: URLRequest(url: WebUri.uri(Uri.parse(accountlink))));
});

return true;
Expand All @@ -73,7 +75,8 @@ class _StripeScreenState extends State<StripeScreen> {
top: 40.h,
bottom: 0,
child: InAppWebView(
initialUrlRequest: URLRequest(url: Uri.parse(widget.url)),
initialUrlRequest:
URLRequest(url: WebUri.uri(Uri.parse(widget.url))),
onWebViewCreated: (InAppWebViewController webViewController) {
_controller = webViewController;
},
Expand All @@ -88,7 +91,8 @@ class _StripeScreenState extends State<StripeScreen> {
getAccountLinkAndRedirect();
return NavigationActionPolicy.CANCEL;
}
if (urlInString.contains(baseEnv.baseStripeCallbackRefreshUrl)) {
if (urlInString
.contains(baseEnv.baseStripeCallbackRefreshUrl)) {
getAccountLinkAndRedirect();
return NavigationActionPolicy.CANCEL;
}
Expand All @@ -103,9 +107,11 @@ class _StripeScreenState extends State<StripeScreen> {
}
return NavigationActionPolicy.ALLOW;
},
androidOnPermissionRequest:
(InAppWebViewController controller, String origin, List<String> resources) async {
return PermissionRequestResponse(resources: resources, action: PermissionRequestResponseAction.GRANT);
androidOnPermissionRequest: (InAppWebViewController controller,
String origin, List<String> resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT);
},
initialOptions: InAppWebViewGroupOptions(
crossPlatform: InAppWebViewOptions(
Expand Down Expand Up @@ -148,10 +154,12 @@ class _StripeScreenState extends State<StripeScreen> {
Future getAccountLinkAndRedirect() async {
final loading = Loading()..showLoading();

final account_response = await GetIt.I.get<StripeHandler>().handleStripeAccountLink();
final account_response =
await GetIt.I.get<StripeHandler>().handleStripeAccountLink();
loading.dismiss();
account_response.fold((fail) => {fail.message.show()}, (accountlink) {
_controller.loadUrl(urlRequest: URLRequest(url: Uri.parse(accountlink)));
_controller.loadUrl(
urlRequest: URLRequest(url: WebUri.uri(Uri.parse(accountlink))));
});
}
}
34 changes: 17 additions & 17 deletions wallet/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,41 @@ dependencies:
path: pkgs/pdf_viewer-master
alan:
path: pkgs/alan
audio_video_progress_bar: ^1.0.0
audio_video_progress_bar: ^2.0.3
auto_size_text: ^3.0.0
backdrop: ^0.9.0
bottom_drawer: ^0.0.3
cached_network_image:
cloud_firestore: ^4.3.0
cloud_firestore: ^5.0.2
cupertino_icons: ^1.0.3
dartz: ^0.10.1
decimal: ^2.3.0
detectable_text_field: ^2.0.3
detectable_text_field: ^3.0.2
dotted_border: ^2.0.0+2
easy_localization: ^3.0.1
equatable: ^2.0.5
expandable: ^5.0.1
firebase_analytics:
firebase_app_check: ^0.1.1+7
firebase_core: ^2.4.0
firebase_crashlytics: ^3.0.8
firebase_dynamic_links: ^5.0.10
firebase_messaging: ^14.2.0
firebase_remote_config: ^3.0.8
firebase_app_check: ^0.3.0+2
firebase_core: ^3.1.1
firebase_crashlytics: ^4.0.2
firebase_dynamic_links: ^6.0.2
firebase_messaging: ^15.0.2
firebase_remote_config: ^5.0.2
fixnum: ^1.0.0
floor: ^1.3.0
flutter:
sdk: flutter
flutter_dotenv: ^5.0.2
flutter_downloader: ^1.9.1
flutter_inappwebview: ^5.7.2+2
flutter_local_notifications: ^13.0.0
flutter_inappwebview: ^6.0.0
flutter_local_notifications: ^17.2.1
flutter_localizations:
sdk: flutter
flutter_mobx: ^2.0.1
flutter_screenutil: ^5.5.4
flutter_secure_storage: ^8.0.0
flutter_staggered_grid_view: ^0.6.2
flutter_staggered_grid_view: ^0.7.0
flutter_sticky_header: ^0.6.0
flutter_stripe:
flutter_svg:
Expand All @@ -56,26 +56,26 @@ dependencies:
focus_detector: ^2.0.1
get_it: ^7.2.0
google_sign_in: ^6.0.2
googleapis: ^11.1.0
googleapis: ^13.2.0
grpc: ^3.0.2
home_widget: ^0.2.0+1
home_widget: ^0.6.0
http:
icloud_storage: ^2.0.0
image: ^4.0.12
image_cropper:
image_picker: ^0.8.5+3
image_picker: ^1.1.2
in_app_purchase: ^3.0.7
internet_connection_checker: ^1.0.0+1
intl:
just_audio: ^0.9.29
just_the_tooltip: 0.0.12
local_auth: ^2.1.2
mobx: ^2.0.3
modal_bottom_sheet: ^2.0.0
modal_bottom_sheet: ^3.0.0
model_viewer_plus:
path: pkgs/model_viewer_plus.dart-master
path_provider: ^2.0.11
permission_handler: ^10.0.1
permission_handler: ^11.3.1
provider: ^6.0.3
qr_flutter: ^4.0.0

Expand Down

0 comments on commit a93f87f

Please sign in to comment.