Fix UTF-8 accent support

This commit is contained in:
poka 2021-11-22 03:54:22 +01:00
parent fbff8a6a91
commit 7eceac3f66
4 changed files with 380 additions and 373 deletions

File diff suppressed because it is too large Load Diff

View File

@ -330,12 +330,19 @@ class GenerateWalletsProvider with ChangeNotifier {
bool isBipWord(String word) {
notifyListeners();
// Needed for bad encoding of UTF-8
word = word.replaceAll('é', '');
word = word.replaceAll('è', '');
return bip39Words.contains(word);
}
bool isBipWordsList(List words) {
bool isValid = true;
for (String word in words) {
// Needed for bad encoding of UTF-8
word = word.replaceAll('é', '');
word = word.replaceAll('è', '');
if (!bip39Words.contains(word)) {
isValid = false;
}
@ -383,16 +390,14 @@ class GenerateWalletsProvider with ChangeNotifier {
Future<bool> isSentenceValid() async {
String inputMnemonic =
'${cellController0.text} ${cellController1.text} ${cellController2.text} ${cellController3.text} ${cellController4.text} ${cellController5.text} ${cellController6.text} ${cellController7.text} ${cellController8.text} ${cellController9.text} ${cellController10.text} ${cellController11.text}';
//TODO: Fix bad accent management
// inputMnemonic = inputMnemonic.replaceAll('é', 'eM-LM-^A');
// inputMnemonic = inputMnemonic.replaceAll('è', 'eM-LM-^@');
// Needed for bad encoding of UTF-8
inputMnemonic = inputMnemonic.replaceAll('é', '');
inputMnemonic = inputMnemonic.replaceAll('è', '');
NewWallet generatedWallet =
await generateWallet(inputMnemonic, isImport: true);
log.d(inputMnemonic);
if (generatedWallet == null) {
return false;
} else {

View File

@ -18,6 +18,8 @@ class RestoreChest extends StatelessWidget {
GenerateWalletsProvider generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context, listen: false);
generateWalletProvider.actualWallet = null;
return WillPopScope(
onWillPop: () {
generateWalletProvider.resetImportView();
@ -124,7 +126,7 @@ class RestoreChest extends StatelessWidget {
key: const Key('importText'),
textAlign: TextAlign.justify,
style: const TextStyle(
color: Colors.black, fontSize: 21, fontWeight: FontWeight.w400),
color: Colors.black, fontSize: 19, fontWeight: FontWeight.w400),
),
);
}

View File

@ -5,7 +5,7 @@ description: Pay with G1.
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.3+2
version: 0.0.3+3
environment:
sdk: ">=2.7.0 <3.0.0"