mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-24 06:48:38 +02:00
Cw 553 update inappwebview (#1252)
* Update inapp webview and update it's deprecated code * Add Turkish Lira Fix android in-app webview * Change FAQ url [skip ci] * Fix available balance display issue
This commit is contained in:
@@ -10,7 +10,7 @@ class FiatCurrency extends EnumerableItem<String> with Serializable<String> impl
|
||||
static List<FiatCurrency> get all => _all.values.toList();
|
||||
|
||||
static List<FiatCurrency> 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<String> with Serializable<String> 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<String> with Serializable<String> 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]!;
|
||||
|
||||
@@ -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<BuyWebViewPageBody> {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -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<WebViewPageBody> {
|
||||
@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,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -22,17 +22,17 @@ class ChatwootWidgetState extends State<ChatwootWidget> {
|
||||
@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"];
|
||||
|
||||
Reference in New Issue
Block a user