disable unsupported device locale on windows

This commit is contained in:
shillo 2022-12-22 17:24:12 -06:00
parent a1a11355b0
commit 5accda7355
8 changed files with 14 additions and 13 deletions

View file

@ -1297,7 +1297,7 @@ class BitcoinWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -1174,7 +1174,7 @@ class BitcoinCashWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -1064,7 +1064,7 @@ class DogecoinWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -883,7 +883,7 @@ class FiroWallet extends CoinServiceAPI {
@override
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
final currentPrice = await firoPrice;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
@ -2756,7 +2756,7 @@ class FiroWallet extends CoinServiceAPI {
var price = await firoPrice;
var builtHex = txb.build();
// return builtHex;
final locale = await Devicelocale.currentLocale;
final locale =Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
return {
"transaction": builtHex,
"txid": txId,
@ -2810,7 +2810,7 @@ class FiroWallet extends CoinServiceAPI {
final currentPrice = await firoPrice;
// Grab the most recent information on all the joinsplits
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final updatedJSplit = await getJMintTransactions(cachedElectrumXClient,
joinsplits, _prefs.currency, coin, currentPrice, locale!);
@ -3249,7 +3249,7 @@ class FiroWallet extends CoinServiceAPI {
final currentPrice = await firoPrice;
final List<Map<String, dynamic>> midSortedArray = [];
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
Logging.instance.log("refresh the txs", level: LogLevel.Info);
for (final txObject in allTransactions) {
@ -4324,7 +4324,7 @@ class FiroWallet extends CoinServiceAPI {
currency,
coin,
currentPrice,
(await Devicelocale.currentLocale)!);
(Platform.isWindows ? "en_US" : await Devicelocale.currentLocale)!);
Logging.instance.log(spendTxs, level: LogLevel.Info);
for (var element in spendTxs) {
transactionMap[element.txid] = element;
@ -4375,7 +4375,7 @@ class FiroWallet extends CoinServiceAPI {
final lelantusEntry = await _getLelantusEntry();
final anonymitySets = await fetchAnonymitySets();
final locktime = await getBlockHead(electrumXClient);
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
ReceivePort receivePort = await getIsolate({
"function": "createJoinSplit",

View file

@ -1299,7 +1299,7 @@ class LitecoinWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -1287,7 +1287,7 @@ class NamecoinWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -1200,7 +1200,7 @@ class ParticlWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
final locale = await Devicelocale.currentLocale;
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final String worthNow = Format.localizedStringAsFixed(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -1,3 +1,4 @@
import 'dart:io';
import 'package:devicelocale/devicelocale.dart';
import 'package:flutter/material.dart';
@ -7,7 +8,7 @@ class LocaleService extends ChangeNotifier {
String get locale => _locale;
Future<void> loadLocale({bool notify = true}) async {
_locale = await Devicelocale.currentLocale ?? "en_US";
_locale =Platform.isWindows ? "en_US" : await Devicelocale.currentLocale ?? "en_US";
if (notify) {
notifyListeners();
}