diff --git a/android/app/build.gradle b/android/app/build.gradle index e6b9eb2f8..5e27aeb9e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -37,7 +37,7 @@ if (appPropertiesFile.exists()) { } android { - compileSdkVersion 33 + compileSdkVersion 34 lintOptions { disable 'InvalidPackage' diff --git a/android/app/src/main/AndroidManifestBase.xml b/android/app/src/main/AndroidManifestBase.xml index f32482e22..2dceca577 100644 --- a/android/app/src/main/AndroidManifestBase.xml +++ b/android/app/src/main/AndroidManifestBase.xml @@ -71,8 +71,8 @@ android:name="flutterEmbedding" android:value="2" /> - bitcoinAmountToString(amount: confirmed - unconfirmed.abs() - frozen); + String get formattedAvailableBalance => bitcoinAmountToString(amount: confirmed - frozen); @override - String get formattedAdditionalBalance => - bitcoinAmountToString(amount: unconfirmed); + String get formattedAdditionalBalance => bitcoinAmountToString(amount: unconfirmed); @override String get formattedUnAvailableBalance { @@ -41,6 +35,6 @@ class ElectrumBalance extends Balance { return frozenFormatted == '0.0' ? '' : frozenFormatted; } - String toJSON() => json.encode( - {'confirmed': confirmed, 'unconfirmed': unconfirmed, 'frozen': frozen}); + String toJSON() => + json.encode({'confirmed': confirmed, 'unconfirmed': unconfirmed, 'frozen': frozen}); } diff --git a/lib/entities/fiat_currency.dart b/lib/entities/fiat_currency.dart index 8310eb18f..a8e2829d8 100644 --- a/lib/entities/fiat_currency.dart +++ b/lib/entities/fiat_currency.dart @@ -10,7 +10,7 @@ class FiatCurrency extends EnumerableItem with Serializable impl static List get all => _all.values.toList(); static List get currenciesAvailableToBuyWith => - [aud, bgn, brl, cad, chf, clp, cop, czk, dkk, egp, eur, gbp, gtq, hkd, hrk, huf, idr, ils, inr, isk, jpy, krw, mad, mxn, myr, ngn, nok, nzd, php, pkr, pln, ron, sek, sgd, thb, twd, usd, vnd, zar]; + [aud, bgn, brl, cad, chf, clp, cop, czk, dkk, egp, eur, gbp, gtq, hkd, hrk, huf, idr, ils, inr, isk, jpy, krw, mad, mxn, myr, ngn, nok, nzd, php, pkr, pln, ron, sek, sgd, thb, twd, usd, vnd, zar, tur]; static const ars = FiatCurrency(symbol: 'ARS', countryCode: "arg", fullName: "Argentine Peso"); static const aud = FiatCurrency(symbol: 'AUD', countryCode: "aus", fullName: "Australian Dollar"); @@ -60,6 +60,7 @@ class FiatCurrency extends EnumerableItem with Serializable impl static const vef = FiatCurrency(symbol: 'VEF', countryCode: "ven", fullName: "Venezuelan Bolivar Bolívar"); static const vnd = FiatCurrency(symbol: 'VND', countryCode: "vnm", fullName: "Vietnamese Dong đồng"); static const zar = FiatCurrency(symbol: 'ZAR', countryCode: "saf", fullName: "South African Rand"); + static const tur = FiatCurrency(symbol: 'TRY', countryCode: "tur", fullName: "Turkish Lira"); static final _all = { FiatCurrency.ars.raw: FiatCurrency.ars, @@ -109,7 +110,8 @@ class FiatCurrency extends EnumerableItem with Serializable impl FiatCurrency.usd.raw: FiatCurrency.usd, FiatCurrency.vef.raw: FiatCurrency.vef, FiatCurrency.vnd.raw: FiatCurrency.vnd, - FiatCurrency.zar.raw: FiatCurrency.zar + FiatCurrency.zar.raw: FiatCurrency.zar, + FiatCurrency.tur.raw: FiatCurrency.tur, }; static FiatCurrency deserialize({required String raw}) => _all[raw]!; diff --git a/lib/src/screens/buy/buy_webview_page.dart b/lib/src/screens/buy/buy_webview_page.dart index 6f7a39322..829bff3d9 100644 --- a/lib/src/screens/buy/buy_webview_page.dart +++ b/lib/src/screens/buy/buy_webview_page.dart @@ -1,10 +1,7 @@ import 'dart:async'; -import 'dart:io'; -import 'package:cake_wallet/buy/buy_provider.dart'; import 'package:cake_wallet/buy/moonpay/moonpay_provider.dart'; import 'package:cake_wallet/buy/wyre/wyre_buy_provider.dart'; import 'package:cake_wallet/generated/i18n.dart'; -import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/store/dashboard/orders_store.dart'; import 'package:cake_wallet/view_model/buy/buy_view_model.dart'; @@ -72,10 +69,10 @@ class BuyWebViewPageBodyState extends State { Widget build(BuildContext context) { return InAppWebView( key: _webViewkey, - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions(transparentBackground: true), + initialSettings: InAppWebViewSettings( + transparentBackground: true, ), - initialUrlRequest: URLRequest(url: Uri.tryParse(widget.url ?? '')), + initialUrlRequest: URLRequest(url: WebUri(widget.url ?? '')), onWebViewCreated: (InAppWebViewController controller) => setState(() => _webViewController = controller)); } diff --git a/lib/src/screens/buy/webview_page.dart b/lib/src/screens/buy/webview_page.dart index 205b87c47..97387c29a 100644 --- a/lib/src/screens/buy/webview_page.dart +++ b/lib/src/screens/buy/webview_page.dart @@ -1,5 +1,3 @@ -import 'package:cake_wallet/buy/onramper/onramper_buy_provider.dart'; -import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; @@ -35,21 +33,21 @@ class WebViewPageBodyState extends State { @override Widget build(BuildContext context) { return InAppWebView( - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions(transparentBackground: true), + initialSettings: InAppWebViewSettings( + transparentBackground: true, ), - initialUrlRequest: URLRequest(url: widget.uri), - androidOnPermissionRequest: (_, __, resources) async { + initialUrlRequest: URLRequest(url: WebUri.uri(widget.uri)), + onPermissionRequest: (controller, request) async { bool permissionGranted = await Permission.camera.status == PermissionStatus.granted; if (!permissionGranted) { permissionGranted = await Permission.camera.request().isGranted; } - return PermissionRequestResponse( - resources: resources, + return PermissionResponse( + resources: request.resources, action: permissionGranted - ? PermissionRequestResponseAction.GRANT - : PermissionRequestResponseAction.DENY, + ? PermissionResponseAction.GRANT + : PermissionResponseAction.DENY, ); }, ); diff --git a/lib/src/screens/dashboard/pages/transactions_page.dart b/lib/src/screens/dashboard/pages/transactions_page.dart index 1be8a2a65..c983b1c37 100644 --- a/lib/src/screens/dashboard/pages/transactions_page.dart +++ b/lib/src/screens/dashboard/pages/transactions_page.dart @@ -49,7 +49,7 @@ class TransactionsPage extends StatelessWidget { onTap: () => Navigator.of(context).pushNamed(Routes.webViewPage, arguments: [ '', Uri.parse( - 'https://guides.cakewallet.com/docs/bugs-service-status/why_are_my_funds_not_appearing/') + 'https://guides.cakewallet.com/docs/FAQ/why_are_my_funds_not_appearing/') ]), title: S.of(context).syncing_wallet_alert_title, subTitle: S.of(context).syncing_wallet_alert_content, diff --git a/lib/src/screens/support_chat/widgets/chatwoot_widget.dart b/lib/src/screens/support_chat/widgets/chatwoot_widget.dart index 73403d667..2557761a7 100644 --- a/lib/src/screens/support_chat/widgets/chatwoot_widget.dart +++ b/lib/src/screens/support_chat/widgets/chatwoot_widget.dart @@ -22,17 +22,17 @@ class ChatwootWidgetState extends State { @override Widget build(BuildContext context) => InAppWebView( key: _webViewkey, - initialOptions: InAppWebViewGroupOptions( - crossPlatform: InAppWebViewOptions(transparentBackground: true), - ), - initialUrlRequest: URLRequest(url: Uri.tryParse(widget.supportUrl)), + initialSettings: InAppWebViewSettings( + transparentBackground: true, + ), + initialUrlRequest: URLRequest(url: WebUri(widget.supportUrl)), onWebViewCreated: (InAppWebViewController controller) { controller.addWebMessageListener( WebMessageListener( jsObjectName: 'ReactNativeWebView', - onPostMessage: (String? message, Uri? sourceOrigin, bool isMainFrame, - JavaScriptReplyProxy replyProxy) { - final shortenedMessage = message?.substring(16); + onPostMessage: (WebMessage? message, WebUri? sourceOrigin, bool isMainFrame, + PlatformJavaScriptReplyProxy replyProxy) { + final shortenedMessage = message?.data.toString().substring(16); if (shortenedMessage != null && isJsonString(shortenedMessage)) { final parsedMessage = jsonDecode(shortenedMessage); final eventType = parsedMessage["event"]; diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 68d03b5f8..05996a674 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -9,6 +9,7 @@ import connectivity_plus_macos import cw_monero import device_info_plus import devicelocale +import flutter_inappwebview_macos import flutter_secure_storage_macos import in_app_review import package_info @@ -24,6 +25,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { CwMoneroPlugin.register(with: registry.registrar(forPlugin: "CwMoneroPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin")) + InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin")) FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) InAppReviewPlugin.register(with: registry.registrar(forPlugin: "InAppReviewPlugin")) FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin")) diff --git a/pubspec_base.yaml b/pubspec_base.yaml index b85171ed0..45f675043 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -43,7 +43,7 @@ dependencies: auto_size_text: ^3.0.0 dotted_border: ^2.0.0+2 smooth_page_indicator: ^1.0.0+2 - flutter_inappwebview: ^5.7.2+3 + flutter_inappwebview: ^6.0.0 flutter_spinkit: ^5.1.0 uni_links: ^0.5.1 lottie: ^1.3.0