From bd2e2ce258315e7e3a3f6e2e4e1796a1120eeb51 Mon Sep 17 00:00:00 2001 From: M <m@cakewallet.com> Date: Wed, 19 Jan 2022 16:25:58 +0200 Subject: [PATCH 01/11] Fixes for validation of monero seed. Add French and Italian seeds validation. --- cw_monero/lib/mnemonics/french.dart | 1630 +++++++++++++++++ cw_monero/lib/mnemonics/italian.dart | 1630 +++++++++++++++++ lib/monero/cw_monero.dart | 44 +- .../wallet_restore_from_seed_form.dart | 12 +- .../screens/restore/wallet_restore_page.dart | 62 +- lib/src/widgets/seed_widget.dart | 4 +- lib/view_model/wallet_restore_view_model.dart | 18 +- tool/configure.dart | 2 + 8 files changed, 3372 insertions(+), 30 deletions(-) create mode 100644 cw_monero/lib/mnemonics/french.dart create mode 100644 cw_monero/lib/mnemonics/italian.dart diff --git a/cw_monero/lib/mnemonics/french.dart b/cw_monero/lib/mnemonics/french.dart new file mode 100644 index 000000000..76d556f6a --- /dev/null +++ b/cw_monero/lib/mnemonics/french.dart @@ -0,0 +1,1630 @@ +class FrenchMnemonics { + static const words = [ + "abandon", + "abattre", + "aboi", + "abolir", + "aborder", + "abri", + "absence", + "absolu", + "abuser", + "acacia", + "acajou", + "accent", + "accord", + "accrocher", + "accuser", + "acerbe", + "achat", + "acheter", + "acide", + "acier", + "acquis", + "acte", + "action", + "adage", + "adepte", + "adieu", + "admettre", + "admis", + "adorer", + "adresser", + "aduler", + "affaire", + "affirmer", + "afin", + "agacer", + "agent", + "agir", + "agiter", + "agonie", + "agrafe", + "agrume", + "aider", + "aigle", + "aigre", + "aile", + "ailleurs", + "aimant", + "aimer", + "ainsi", + "aise", + "ajouter", + "alarme", + "album", + "alcool", + "alerte", + "algue", + "alibi", + "aller", + "allumer", + "alors", + "amande", + "amener", + "amie", + "amorcer", + "amour", + "ample", + "amuser", + "ananas", + "ancien", + "anglais", + "angoisse", + "animal", + "anneau", + "annoncer", + "apercevoir", + "apparence", + "appel", + "apporter", + "apprendre", + "appuyer", + "arbre", + "arcade", + "arceau", + "arche", + "ardeur", + "argent", + "argile", + "aride", + "arme", + "armure", + "arracher", + "arriver", + "article", + "asile", + "aspect", + "assaut", + "assez", + "assister", + "assurer", + "astre", + "astuce", + "atlas", + "atroce", + "attacher", + "attente", + "attirer", + "aube", + "aucun", + "audace", + "auparavant", + "auquel", + "aurore", + "aussi", + "autant", + "auteur", + "autoroute", + "autre", + "aval", + "avant", + "avec", + "avenir", + "averse", + "aveu", + "avide", + "avion", + "avis", + "avoir", + "avouer", + "avril", + "azote", + "azur", + "badge", + "bagage", + "bague", + "bain", + "baisser", + "balai", + "balcon", + "balise", + "balle", + "bambou", + "banane", + "banc", + "bandage", + "banjo", + "banlieue", + "bannir", + "banque", + "baobab", + "barbe", + "barque", + "barrer", + "bassine", + "bataille", + "bateau", + "battre", + "baver", + "bavoir", + "bazar", + "beau", + "beige", + "berger", + "besoin", + "beurre", + "biais", + "biceps", + "bidule", + "bien", + "bijou", + "bilan", + "billet", + "blanc", + "blason", + "bleu", + "bloc", + "blond", + "bocal", + "boire", + "boiserie", + "boiter", + "bonbon", + "bondir", + "bonheur", + "bordure", + "borgne", + "borner", + "bosse", + "bouche", + "bouder", + "bouger", + "boule", + "bourse", + "bout", + "boxe", + "brader", + "braise", + "branche", + "braquer", + "bras", + "brave", + "brebis", + "brevet", + "brider", + "briller", + "brin", + "brique", + "briser", + "broche", + "broder", + "bronze", + "brosser", + "brouter", + "bruit", + "brute", + "budget", + "buffet", + "bulle", + "bureau", + "buriner", + "buste", + "buter", + "butiner", + "cabas", + "cabinet", + "cabri", + "cacao", + "cacher", + "cadeau", + "cadre", + "cage", + "caisse", + "caler", + "calme", + "camarade", + "camion", + "campagne", + "canal", + "canif", + "capable", + "capot", + "carat", + "caresser", + "carie", + "carpe", + "cartel", + "casier", + "casque", + "casserole", + "cause", + "cavale", + "cave", + "ceci", + "cela", + "celui", + "cendre", + "cent", + "cependant", + "cercle", + "cerise", + "cerner", + "certes", + "cerveau", + "cesser", + "chacun", + "chair", + "chaleur", + "chamois", + "chanson", + "chaque", + "charge", + "chasse", + "chat", + "chaud", + "chef", + "chemin", + "cheveu", + "chez", + "chicane", + "chien", + "chiffre", + "chiner", + "chiot", + "chlore", + "choc", + "choix", + "chose", + "chou", + "chute", + "cibler", + "cidre", + "ciel", + "cigale", + "cinq", + "cintre", + "cirage", + "cirque", + "ciseau", + "citation", + "citer", + "citron", + "civet", + "clairon", + "clan", + "classe", + "clavier", + "clef", + "climat", + "cloche", + "cloner", + "clore", + "clos", + "clou", + "club", + "cobra", + "cocon", + "coiffer", + "coin", + "colline", + "colon", + "combat", + "comme", + "compte", + "conclure", + "conduire", + "confier", + "connu", + "conseil", + "contre", + "convenir", + "copier", + "cordial", + "cornet", + "corps", + "cosmos", + "coton", + "couche", + "coude", + "couler", + "coupure", + "cour", + "couteau", + "couvrir", + "crabe", + "crainte", + "crampe", + "cran", + "creuser", + "crever", + "crier", + "crime", + "crin", + "crise", + "crochet", + "croix", + "cruel", + "cuisine", + "cuite", + "culot", + "culte", + "cumul", + "cure", + "curieux", + "cuve", + "dame", + "danger", + "dans", + "davantage", + "debout", + "dedans", + "dehors", + "delta", + "demain", + "demeurer", + "demi", + "dense", + "dent", + "depuis", + "dernier", + "descendre", + "dessus", + "destin", + "dette", + "deuil", + "deux", + "devant", + "devenir", + "devin", + "devoir", + "dicton", + "dieu", + "difficile", + "digestion", + "digue", + "diluer", + "dimanche", + "dinde", + "diode", + "dire", + "diriger", + "discours", + "disposer", + "distance", + "divan", + "divers", + "docile", + "docteur", + "dodu", + "dogme", + "doigt", + "dominer", + "donation", + "donjon", + "donner", + "dopage", + "dorer", + "dormir", + "doseur", + "douane", + "double", + "douche", + "douleur", + "doute", + "doux", + "douzaine", + "draguer", + "drame", + "drap", + "dresser", + "droit", + "duel", + "dune", + "duper", + "durant", + "durcir", + "durer", + "eaux", + "effacer", + "effet", + "effort", + "effrayant", + "elle", + "embrasser", + "emmener", + "emparer", + "empire", + "employer", + "emporter", + "enclos", + "encore", + "endive", + "endormir", + "endroit", + "enduit", + "enfant", + "enfermer", + "enfin", + "enfler", + "enfoncer", + "enfuir", + "engager", + "engin", + "enjeu", + "enlever", + "ennemi", + "ennui", + "ensemble", + "ensuite", + "entamer", + "entendre", + "entier", + "entourer", + "entre", + "envelopper", + "envie", + "envoyer", + "erreur", + "escalier", + "espace", + "espoir", + "esprit", + "essai", + "essor", + "essuyer", + "estimer", + "exact", + "examiner", + "excuse", + "exemple", + "exiger", + "exil", + "exister", + "exode", + "expliquer", + "exposer", + "exprimer", + "extase", + "fable", + "facette", + "facile", + "fade", + "faible", + "faim", + "faire", + "fait", + "falloir", + "famille", + "faner", + "farce", + "farine", + "fatigue", + "faucon", + "faune", + "faute", + "faux", + "faveur", + "favori", + "faxer", + "feinter", + "femme", + "fendre", + "fente", + "ferme", + "festin", + "feuille", + "feutre", + "fiable", + "fibre", + "ficher", + "fier", + "figer", + "figure", + "filet", + "fille", + "filmer", + "fils", + "filtre", + "final", + "finesse", + "finir", + "fiole", + "firme", + "fixe", + "flacon", + "flair", + "flamme", + "flan", + "flaque", + "fleur", + "flocon", + "flore", + "flot", + "flou", + "fluide", + "fluor", + "flux", + "focus", + "foin", + "foire", + "foison", + "folie", + "fonction", + "fondre", + "fonte", + "force", + "forer", + "forger", + "forme", + "fort", + "fosse", + "fouet", + "fouine", + "foule", + "four", + "foyer", + "frais", + "franc", + "frapper", + "freiner", + "frimer", + "friser", + "frite", + "froid", + "froncer", + "fruit", + "fugue", + "fuir", + "fuite", + "fumer", + "fureur", + "furieux", + "fuser", + "fusil", + "futile", + "futur", + "gagner", + "gain", + "gala", + "galet", + "galop", + "gamme", + "gant", + "garage", + "garde", + "garer", + "gauche", + "gaufre", + "gaule", + "gaver", + "gazon", + "geler", + "genou", + "genre", + "gens", + "gercer", + "germer", + "geste", + "gibier", + "gicler", + "gilet", + "girafe", + "givre", + "glace", + "glisser", + "globe", + "gloire", + "gluant", + "gober", + "golf", + "gommer", + "gorge", + "gosier", + "goutte", + "grain", + "gramme", + "grand", + "gras", + "grave", + "gredin", + "griffure", + "griller", + "gris", + "gronder", + "gros", + "grotte", + "groupe", + "grue", + "guerrier", + "guetter", + "guider", + "guise", + "habiter", + "hache", + "haie", + "haine", + "halte", + "hamac", + "hanche", + "hangar", + "hanter", + "haras", + "hareng", + "harpe", + "hasard", + "hausse", + "haut", + "havre", + "herbe", + "heure", + "hibou", + "hier", + "histoire", + "hiver", + "hochet", + "homme", + "honneur", + "honte", + "horde", + "horizon", + "hormone", + "houle", + "housse", + "hublot", + "huile", + "huit", + "humain", + "humble", + "humide", + "humour", + "hurler", + "idole", + "igloo", + "ignorer", + "illusion", + "image", + "immense", + "immobile", + "imposer", + "impression", + "incapable", + "inconnu", + "index", + "indiquer", + "infime", + "injure", + "inox", + "inspirer", + "instant", + "intention", + "intime", + "inutile", + "inventer", + "inviter", + "iode", + "iris", + "issue", + "ivre", + "jade", + "jadis", + "jamais", + "jambe", + "janvier", + "jardin", + "jauge", + "jaunisse", + "jeter", + "jeton", + "jeudi", + "jeune", + "joie", + "joindre", + "joli", + "joueur", + "journal", + "judo", + "juge", + "juillet", + "juin", + "jument", + "jungle", + "jupe", + "jupon", + "jurer", + "juron", + "jury", + "jusque", + "juste", + "kayak", + "ketchup", + "kilo", + "kiwi", + "koala", + "label", + "lacet", + "lacune", + "laine", + "laisse", + "lait", + "lame", + "lancer", + "lande", + "laque", + "lard", + "largeur", + "larme", + "larve", + "lasso", + "laver", + "lendemain", + "lentement", + "lequel", + "lettre", + "leur", + "lever", + "levure", + "liane", + "libre", + "lien", + "lier", + "lieutenant", + "ligne", + "ligoter", + "liguer", + "limace", + "limer", + "limite", + "lingot", + "lion", + "lire", + "lisser", + "litre", + "livre", + "lobe", + "local", + "logis", + "loin", + "loisir", + "long", + "loque", + "lors", + "lotus", + "louer", + "loup", + "lourd", + "louve", + "loyer", + "lubie", + "lucide", + "lueur", + "luge", + "luire", + "lundi", + "lune", + "lustre", + "lutin", + "lutte", + "luxe", + "machine", + "madame", + "magie", + "magnifique", + "magot", + "maigre", + "main", + "mairie", + "maison", + "malade", + "malheur", + "malin", + "manche", + "manger", + "manier", + "manoir", + "manquer", + "marche", + "mardi", + "marge", + "mariage", + "marquer", + "mars", + "masque", + "masse", + "matin", + "mauvais", + "meilleur", + "melon", + "membre", + "menacer", + "mener", + "mensonge", + "mentir", + "menu", + "merci", + "merlu", + "mesure", + "mettre", + "meuble", + "meunier", + "meute", + "miche", + "micro", + "midi", + "miel", + "miette", + "mieux", + "milieu", + "mille", + "mimer", + "mince", + "mineur", + "ministre", + "minute", + "mirage", + "miroir", + "miser", + "mite", + "mixte", + "mobile", + "mode", + "module", + "moins", + "mois", + "moment", + "momie", + "monde", + "monsieur", + "monter", + "moquer", + "moral", + "morceau", + "mordre", + "morose", + "morse", + "mortier", + "morue", + "motif", + "motte", + "moudre", + "moule", + "mourir", + "mousse", + "mouton", + "mouvement", + "moyen", + "muer", + "muette", + "mugir", + "muguet", + "mulot", + "multiple", + "munir", + "muret", + "muse", + "musique", + "muter", + "nacre", + "nager", + "nain", + "naissance", + "narine", + "narrer", + "naseau", + "nasse", + "nation", + "nature", + "naval", + "navet", + "naviguer", + "navrer", + "neige", + "nerf", + "nerveux", + "neuf", + "neutre", + "neuve", + "neveu", + "niche", + "nier", + "niveau", + "noble", + "noce", + "nocif", + "noir", + "nomade", + "nombre", + "nommer", + "nord", + "norme", + "notaire", + "notice", + "notre", + "nouer", + "nougat", + "nourrir", + "nous", + "nouveau", + "novice", + "noyade", + "noyer", + "nuage", + "nuance", + "nuire", + "nuit", + "nulle", + "nuque", + "oasis", + "objet", + "obliger", + "obscur", + "observer", + "obtenir", + "obus", + "occasion", + "occuper", + "ocre", + "octet", + "odeur", + "odorat", + "offense", + "officier", + "offrir", + "ogive", + "oiseau", + "olive", + "ombre", + "onctueux", + "onduler", + "ongle", + "onze", + "opter", + "option", + "orageux", + "oral", + "orange", + "orbite", + "ordinaire", + "ordre", + "oreille", + "organe", + "orgie", + "orgueil", + "orient", + "origan", + "orner", + "orteil", + "ortie", + "oser", + "osselet", + "otage", + "otarie", + "ouate", + "oublier", + "ouest", + "ours", + "outil", + "outre", + "ouvert", + "ouvrir", + "ovale", + "ozone", + "pacte", + "page", + "paille", + "pain", + "paire", + "paix", + "palace", + "palissade", + "palmier", + "palpiter", + "panda", + "panneau", + "papa", + "papier", + "paquet", + "parc", + "pardi", + "parfois", + "parler", + "parmi", + "parole", + "partir", + "parvenir", + "passer", + "pastel", + "patin", + "patron", + "paume", + "pause", + "pauvre", + "paver", + "pavot", + "payer", + "pays", + "peau", + "peigne", + "peinture", + "pelage", + "pelote", + "pencher", + "pendre", + "penser", + "pente", + "percer", + "perdu", + "perle", + "permettre", + "personne", + "perte", + "peser", + "pesticide", + "petit", + "peuple", + "peur", + "phase", + "photo", + "phrase", + "piano", + "pied", + "pierre", + "pieu", + "pile", + "pilier", + "pilote", + "pilule", + "piment", + "pincer", + "pinson", + "pinte", + "pion", + "piquer", + "pirate", + "pire", + "piste", + "piton", + "pitre", + "pivot", + "pizza", + "placer", + "plage", + "plaire", + "plan", + "plaque", + "plat", + "plein", + "pleurer", + "pliage", + "plier", + "plonger", + "plot", + "pluie", + "plume", + "plus", + "pneu", + "poche", + "podium", + "poids", + "poil", + "point", + "poire", + "poison", + "poitrine", + "poivre", + "police", + "pollen", + "pomme", + "pompier", + "poncer", + "pondre", + "pont", + "portion", + "poser", + "position", + "possible", + "poste", + "potage", + "potin", + "pouce", + "poudre", + "poulet", + "poumon", + "poupe", + "pour", + "pousser", + "poutre", + "pouvoir", + "prairie", + "premier", + "prendre", + "presque", + "preuve", + "prier", + "primeur", + "prince", + "prison", + "priver", + "prix", + "prochain", + "produire", + "profond", + "proie", + "projet", + "promener", + "prononcer", + "propre", + "prose", + "prouver", + "prune", + "public", + "puce", + "pudeur", + "puiser", + "pull", + "pulpe", + "puma", + "punir", + "purge", + "putois", + "quand", + "quartier", + "quasi", + "quatre", + "quel", + "question", + "queue", + "quiche", + "quille", + "quinze", + "quitter", + "quoi", + "rabais", + "raboter", + "race", + "racheter", + "racine", + "racler", + "raconter", + "radar", + "radio", + "rafale", + "rage", + "ragot", + "raideur", + "raie", + "rail", + "raison", + "ramasser", + "ramener", + "rampe", + "rance", + "rang", + "rapace", + "rapide", + "rapport", + "rarement", + "rasage", + "raser", + "rasoir", + "rassurer", + "rater", + "ratio", + "rature", + "ravage", + "ravir", + "rayer", + "rayon", + "rebond", + "recevoir", + "recherche", + "record", + "reculer", + "redevenir", + "refuser", + "regard", + "regretter", + "rein", + "rejeter", + "rejoindre", + "relation", + "relever", + "religion", + "remarquer", + "remettre", + "remise", + "remonter", + "remplir", + "remuer", + "rencontre", + "rendre", + "renier", + "renoncer", + "rentrer", + "renverser", + "repas", + "repli", + "reposer", + "reproche", + "requin", + "respect", + "ressembler", + "reste", + "retard", + "retenir", + "retirer", + "retour", + "retrouver", + "revenir", + "revoir", + "revue", + "rhume", + "ricaner", + "riche", + "rideau", + "ridicule", + "rien", + "rigide", + "rincer", + "rire", + "risquer", + "rituel", + "rivage", + "rive", + "robe", + "robot", + "robuste", + "rocade", + "roche", + "rodeur", + "rogner", + "roman", + "rompre", + "ronce", + "rondeur", + "ronger", + "roque", + "rose", + "rosir", + "rotation", + "rotule", + "roue", + "rouge", + "rouler", + "route", + "ruban", + "rubis", + "ruche", + "rude", + "ruelle", + "ruer", + "rugby", + "rugir", + "ruine", + "rumeur", + "rural", + "ruse", + "rustre", + "sable", + "sabot", + "sabre", + "sacre", + "sage", + "saint", + "saisir", + "salade", + "salive", + "salle", + "salon", + "salto", + "salut", + "salve", + "samba", + "sandale", + "sanguin", + "sapin", + "sarcasme", + "satisfaire", + "sauce", + "sauf", + "sauge", + "saule", + "sauna", + "sauter", + "sauver", + "savoir", + "science", + "scoop", + "score", + "second", + "secret", + "secte", + "seigneur", + "sein", + "seize", + "selle", + "selon", + "semaine", + "sembler", + "semer", + "semis", + "sensuel", + "sentir", + "sept", + "serpe", + "serrer", + "sertir", + "service", + "seuil", + "seulement", + "short", + "sien", + "sigle", + "signal", + "silence", + "silo", + "simple", + "singe", + "sinon", + "sinus", + "sioux", + "sirop", + "site", + "situation", + "skier", + "snob", + "sobre", + "social", + "socle", + "sodium", + "soigner", + "soir", + "soixante", + "soja", + "solaire", + "soldat", + "soleil", + "solide", + "solo", + "solvant", + "sombre", + "somme", + "somnoler", + "sondage", + "songeur", + "sonner", + "sorte", + "sosie", + "sottise", + "souci", + "soudain", + "souffrir", + "souhaiter", + "soulever", + "soumettre", + "soupe", + "sourd", + "soustraire", + "soutenir", + "souvent", + "soyeux", + "spectacle", + "sport", + "stade", + "stagiaire", + "stand", + "star", + "statue", + "stock", + "stop", + "store", + "style", + "suave", + "subir", + "sucre", + "suer", + "suffire", + "suie", + "suite", + "suivre", + "sujet", + "sulfite", + "supposer", + "surf", + "surprendre", + "surtout", + "surveiller", + "tabac", + "table", + "tabou", + "tache", + "tacler", + "tacot", + "tact", + "taie", + "taille", + "taire", + "talon", + "talus", + "tandis", + "tango", + "tanin", + "tant", + "taper", + "tapis", + "tard", + "tarif", + "tarot", + "tarte", + "tasse", + "taureau", + "taux", + "taverne", + "taxer", + "taxi", + "tellement", + "temple", + "tendre", + "tenir", + "tenter", + "tenu", + "terme", + "ternir", + "terre", + "test", + "texte", + "thym", + "tibia", + "tiers", + "tige", + "tipi", + "tique", + "tirer", + "tissu", + "titre", + "toast", + "toge", + "toile", + "toiser", + "toiture", + "tomber", + "tome", + "tonne", + "tonte", + "toque", + "torse", + "tortue", + "totem", + "toucher", + "toujours", + "tour", + "tousser", + "tout", + "toux", + "trace", + "train", + "trame", + "tranquille", + "travail", + "trembler", + "trente", + "tribu", + "trier", + "trio", + "tripe", + "triste", + "troc", + "trois", + "tromper", + "tronc", + "trop", + "trotter", + "trouer", + "truc", + "truite", + "tuba", + "tuer", + "tuile", + "turbo", + "tutu", + "tuyau", + "type", + "union", + "unique", + "unir", + "unisson", + "untel", + "urne", + "usage", + "user", + "usiner", + "usure", + "utile", + "vache", + "vague", + "vaincre", + "valeur", + "valoir", + "valser", + "valve", + "vampire", + "vaseux", + "vaste", + "veau", + "veille", + "veine", + "velours", + "velu", + "vendre", + "venir", + "vent", + "venue", + "verbe", + "verdict", + "version", + "vertige", + "verve", + "veste", + "veto", + "vexer", + "vice", + "victime", + "vide", + "vieil", + "vieux", + "vigie", + "vigne", + "ville", + "vingt", + "violent", + "virer", + "virus", + "visage", + "viser", + "visite", + "visuel", + "vitamine", + "vitrine", + "vivant", + "vivre", + "vocal", + "vodka", + "vogue", + "voici", + "voile", + "voir", + "voisin", + "voiture", + "volaille", + "volcan", + "voler", + "volt", + "votant", + "votre", + "vouer", + "vouloir", + "vous", + "voyage", + "voyou", + "vrac", + "vrai", + "yacht", + "yeti", + "yeux", + "yoga", + "zeste", + "zinc", + "zone", + "zoom" + ]; +} \ No newline at end of file diff --git a/cw_monero/lib/mnemonics/italian.dart b/cw_monero/lib/mnemonics/italian.dart new file mode 100644 index 000000000..275f85bf4 --- /dev/null +++ b/cw_monero/lib/mnemonics/italian.dart @@ -0,0 +1,1630 @@ +class ItalianMnemonics { + static const words = [ + "abbinare", + "abbonato", + "abisso", + "abitare", + "abominio", + "accadere", + "accesso", + "acciaio", + "accordo", + "accumulo", + "acido", + "acqua", + "acrobata", + "acustico", + "adattare", + "addetto", + "addio", + "addome", + "adeguato", + "aderire", + "adorare", + "adottare", + "adozione", + "adulto", + "aereo", + "aerobica", + "affare", + "affetto", + "affidare", + "affogato", + "affronto", + "africano", + "afrodite", + "agenzia", + "aggancio", + "aggeggio", + "aggiunta", + "agio", + "agire", + "agitare", + "aglio", + "agnello", + "agosto", + "aiutare", + "albero", + "albo", + "alce", + "alchimia", + "alcool", + "alfabeto", + "algebra", + "alimento", + "allarme", + "alleanza", + "allievo", + "alloggio", + "alluce", + "alpi", + "alterare", + "altro", + "aluminio", + "amante", + "amarezza", + "ambiente", + "ambrosia", + "america", + "amico", + "ammalare", + "ammirare", + "amnesia", + "amnistia", + "amore", + "ampliare", + "amputare", + "analisi", + "anamnesi", + "ananas", + "anarchia", + "anatra", + "anca", + "ancorato", + "andare", + "androide", + "aneddoto", + "anello", + "angelo", + "angolino", + "anguilla", + "anidride", + "anima", + "annegare", + "anno", + "annuncio", + "anomalia", + "antenna", + "anticipo", + "aperto", + "apostolo", + "appalto", + "appello", + "appiglio", + "applauso", + "appoggio", + "appurare", + "aprile", + "aquila", + "arabo", + "arachidi", + "aragosta", + "arancia", + "arbitrio", + "archivio", + "arco", + "argento", + "argilla", + "aria", + "ariete", + "arma", + "armonia", + "aroma", + "arrivare", + "arrosto", + "arsenale", + "arte", + "artiglio", + "asfalto", + "asfissia", + "asino", + "asparagi", + "aspirina", + "assalire", + "assegno", + "assolto", + "assurdo", + "asta", + "astratto", + "atlante", + "atletica", + "atomo", + "atropina", + "attacco", + "attesa", + "attico", + "atto", + "attrarre", + "auguri", + "aula", + "aumento", + "aurora", + "auspicio", + "autista", + "auto", + "autunno", + "avanzare", + "avarizia", + "avere", + "aviatore", + "avido", + "avorio", + "avvenire", + "avviso", + "avvocato", + "azienda", + "azione", + "azzardo", + "azzurro", + "babbuino", + "bacio", + "badante", + "baffi", + "bagaglio", + "bagliore", + "bagno", + "balcone", + "balena", + "ballare", + "balordo", + "balsamo", + "bambola", + "bancomat", + "banda", + "barato", + "barba", + "barista", + "barriera", + "basette", + "basilico", + "bassista", + "bastare", + "battello", + "bavaglio", + "beccare", + "beduino", + "bellezza", + "bene", + "benzina", + "berretto", + "bestia", + "bevitore", + "bianco", + "bibbia", + "biberon", + "bibita", + "bici", + "bidone", + "bilancia", + "biliardo", + "binario", + "binocolo", + "biologia", + "biondina", + "biopsia", + "biossido", + "birbante", + "birra", + "biscotto", + "bisogno", + "bistecca", + "bivio", + "blindare", + "bloccare", + "bocca", + "bollire", + "bombola", + "bonifico", + "borghese", + "borsa", + "bottino", + "botulino", + "braccio", + "bradipo", + "branco", + "bravo", + "bresaola", + "bretelle", + "brevetto", + "briciola", + "brigante", + "brillare", + "brindare", + "brivido", + "broccoli", + "brontolo", + "bruciare", + "brufolo", + "bucare", + "buddista", + "budino", + "bufera", + "buffo", + "bugiardo", + "buio", + "buono", + "burrone", + "bussola", + "bustina", + "buttare", + "cabernet", + "cabina", + "cacao", + "cacciare", + "cactus", + "cadavere", + "caffe", + "calamari", + "calcio", + "caldaia", + "calmare", + "calunnia", + "calvario", + "calzone", + "cambiare", + "camera", + "camion", + "cammello", + "campana", + "canarino", + "cancello", + "candore", + "cane", + "canguro", + "cannone", + "canoa", + "cantare", + "canzone", + "caos", + "capanna", + "capello", + "capire", + "capo", + "capperi", + "capra", + "capsula", + "caraffa", + "carbone", + "carciofo", + "cardigan", + "carenza", + "caricare", + "carota", + "carrello", + "carta", + "casa", + "cascare", + "caserma", + "cashmere", + "casino", + "cassetta", + "castello", + "catalogo", + "catena", + "catorcio", + "cattivo", + "causa", + "cauzione", + "cavallo", + "caverna", + "caviglia", + "cavo", + "cazzotto", + "celibato", + "cemento", + "cenare", + "centrale", + "ceramica", + "cercare", + "ceretta", + "cerniera", + "certezza", + "cervello", + "cessione", + "cestino", + "cetriolo", + "chiave", + "chiedere", + "chilo", + "chimera", + "chiodo", + "chirurgo", + "chitarra", + "chiudere", + "ciabatta", + "ciao", + "cibo", + "ciccia", + "cicerone", + "ciclone", + "cicogna", + "cielo", + "cifra", + "cigno", + "ciliegia", + "cimitero", + "cinema", + "cinque", + "cintura", + "ciondolo", + "ciotola", + "cipolla", + "cippato", + "circuito", + "cisterna", + "citofono", + "ciuccio", + "civetta", + "civico", + "clausola", + "cliente", + "clima", + "clinica", + "cobra", + "coccole", + "cocktail", + "cocomero", + "codice", + "coesione", + "cogliere", + "cognome", + "colla", + "colomba", + "colpire", + "coltello", + "comando", + "comitato", + "commedia", + "comodino", + "compagna", + "comune", + "concerto", + "condotto", + "conforto", + "congiura", + "coniglio", + "consegna", + "conto", + "convegno", + "coperta", + "copia", + "coprire", + "corazza", + "corda", + "corleone", + "cornice", + "corona", + "corpo", + "corrente", + "corsa", + "cortesia", + "corvo", + "coso", + "costume", + "cotone", + "cottura", + "cozza", + "crampo", + "cratere", + "cravatta", + "creare", + "credere", + "crema", + "crescere", + "crimine", + "criterio", + "croce", + "crollare", + "cronaca", + "crostata", + "croupier", + "cubetto", + "cucciolo", + "cucina", + "cultura", + "cuoco", + "cuore", + "cupido", + "cupola", + "cura", + "curva", + "cuscino", + "custode", + "danzare", + "data", + "decennio", + "decidere", + "decollo", + "dedicare", + "dedurre", + "definire", + "delegare", + "delfino", + "delitto", + "demone", + "dentista", + "denuncia", + "deposito", + "derivare", + "deserto", + "designer", + "destino", + "detonare", + "dettagli", + "diagnosi", + "dialogo", + "diamante", + "diario", + "diavolo", + "dicembre", + "difesa", + "digerire", + "digitare", + "diluvio", + "dinamica", + "dipinto", + "diploma", + "diramare", + "dire", + "dirigere", + "dirupo", + "discesa", + "disdetta", + "disegno", + "disporre", + "dissenso", + "distacco", + "dito", + "ditta", + "diva", + "divenire", + "dividere", + "divorare", + "docente", + "dolcetto", + "dolore", + "domatore", + "domenica", + "dominare", + "donatore", + "donna", + "dorato", + "dormire", + "dorso", + "dosaggio", + "dottore", + "dovere", + "download", + "dragone", + "dramma", + "dubbio", + "dubitare", + "duetto", + "durata", + "ebbrezza", + "eccesso", + "eccitare", + "eclissi", + "economia", + "edera", + "edificio", + "editore", + "edizione", + "educare", + "effetto", + "egitto", + "egiziano", + "elastico", + "elefante", + "eleggere", + "elemento", + "elenco", + "elezione", + "elmetto", + "elogio", + "embrione", + "emergere", + "emettere", + "eminenza", + "emisfero", + "emozione", + "empatia", + "energia", + "enfasi", + "enigma", + "entrare", + "enzima", + "epidemia", + "epilogo", + "episodio", + "epoca", + "equivoco", + "erba", + "erede", + "eroe", + "erotico", + "errore", + "eruzione", + "esaltare", + "esame", + "esaudire", + "eseguire", + "esempio", + "esigere", + "esistere", + "esito", + "esperto", + "espresso", + "essere", + "estasi", + "esterno", + "estrarre", + "eterno", + "etica", + "euforico", + "europa", + "evacuare", + "evasione", + "evento", + "evidenza", + "evitare", + "evolvere", + "fabbrica", + "facciata", + "fagiano", + "fagotto", + "falco", + "fame", + "famiglia", + "fanale", + "fango", + "fantasia", + "farfalla", + "farmacia", + "faro", + "fase", + "fastidio", + "faticare", + "fatto", + "favola", + "febbre", + "femmina", + "femore", + "fenomeno", + "fermata", + "feromoni", + "ferrari", + "fessura", + "festa", + "fiaba", + "fiamma", + "fianco", + "fiat", + "fibbia", + "fidare", + "fieno", + "figa", + "figlio", + "figura", + "filetto", + "filmato", + "filosofo", + "filtrare", + "finanza", + "finestra", + "fingere", + "finire", + "finta", + "finzione", + "fiocco", + "fioraio", + "firewall", + "firmare", + "fisico", + "fissare", + "fittizio", + "fiume", + "flacone", + "flagello", + "flirtare", + "flusso", + "focaccia", + "foglio", + "fognario", + "follia", + "fonderia", + "fontana", + "forbici", + "forcella", + "foresta", + "forgiare", + "formare", + "fornace", + "foro", + "fortuna", + "forzare", + "fosforo", + "fotoni", + "fracasso", + "fragola", + "frantumi", + "fratello", + "frazione", + "freccia", + "freddo", + "frenare", + "fresco", + "friggere", + "frittata", + "frivolo", + "frizione", + "fronte", + "frullato", + "frumento", + "frusta", + "frutto", + "fucile", + "fuggire", + "fulmine", + "fumare", + "funzione", + "fuoco", + "furbizia", + "furgone", + "furia", + "furore", + "fusibile", + "fuso", + "futuro", + "gabbiano", + "galassia", + "gallina", + "gamba", + "gancio", + "garanzia", + "garofano", + "gasolio", + "gatto", + "gazebo", + "gazzetta", + "gelato", + "gemelli", + "generare", + "genitori", + "gennaio", + "geologia", + "germania", + "gestire", + "gettare", + "ghepardo", + "ghiaccio", + "giaccone", + "giaguaro", + "giallo", + "giappone", + "giardino", + "gigante", + "gioco", + "gioiello", + "giorno", + "giovane", + "giraffa", + "giudizio", + "giurare", + "giusto", + "globo", + "gloria", + "glucosio", + "gnocca", + "gocciola", + "godere", + "gomito", + "gomma", + "gonfiare", + "gorilla", + "governo", + "gradire", + "graffiti", + "granchio", + "grappolo", + "grasso", + "grattare", + "gridare", + "grissino", + "grondaia", + "grugnito", + "gruppo", + "guadagno", + "guaio", + "guancia", + "guardare", + "gufo", + "guidare", + "guscio", + "gusto", + "icona", + "idea", + "identico", + "idolo", + "idoneo", + "idrante", + "idrogeno", + "igiene", + "ignoto", + "imbarco", + "immagine", + "immobile", + "imparare", + "impedire", + "impianto", + "importo", + "impresa", + "impulso", + "incanto", + "incendio", + "incidere", + "incontro", + "incrocia", + "incubo", + "indagare", + "indice", + "indotto", + "infanzia", + "inferno", + "infinito", + "infranto", + "ingerire", + "inglese", + "ingoiare", + "ingresso", + "iniziare", + "innesco", + "insalata", + "inserire", + "insicuro", + "insonnia", + "insulto", + "interno", + "introiti", + "invasori", + "inverno", + "invito", + "invocare", + "ipnosi", + "ipocrita", + "ipotesi", + "ironia", + "irrigare", + "iscritto", + "isola", + "ispirare", + "isterico", + "istinto", + "istruire", + "italiano", + "jazz", + "labbra", + "labrador", + "ladro", + "lago", + "lamento", + "lampone", + "lancetta", + "lanterna", + "lapide", + "larva", + "lasagne", + "lasciare", + "lastra", + "latte", + "laurea", + "lavagna", + "lavorare", + "leccare", + "legare", + "leggere", + "lenzuolo", + "leone", + "lepre", + "letargo", + "lettera", + "levare", + "levitare", + "lezione", + "liberare", + "libidine", + "libro", + "licenza", + "lievito", + "limite", + "lince", + "lingua", + "liquore", + "lire", + "listino", + "litigare", + "litro", + "locale", + "lottare", + "lucciola", + "lucidare", + "luglio", + "luna", + "macchina", + "madama", + "madre", + "maestro", + "maggio", + "magico", + "maglione", + "magnolia", + "mago", + "maialino", + "maionese", + "malattia", + "male", + "malloppo", + "mancare", + "mandorla", + "mangiare", + "manico", + "manopola", + "mansarda", + "mantello", + "manubrio", + "manzo", + "mappa", + "mare", + "margine", + "marinaio", + "marmotta", + "marocco", + "martello", + "marzo", + "maschera", + "matrice", + "maturare", + "mazzetta", + "meandri", + "medaglia", + "medico", + "medusa", + "megafono", + "melone", + "membrana", + "menta", + "mercato", + "meritare", + "merluzzo", + "mese", + "mestiere", + "metafora", + "meteo", + "metodo", + "mettere", + "miele", + "miglio", + "miliardo", + "mimetica", + "minatore", + "minuto", + "miracolo", + "mirtillo", + "missile", + "mistero", + "misura", + "mito", + "mobile", + "moda", + "moderare", + "moglie", + "molecola", + "molle", + "momento", + "moneta", + "mongolia", + "monologo", + "montagna", + "morale", + "morbillo", + "mordere", + "mosaico", + "mosca", + "mostro", + "motivare", + "moto", + "mulino", + "mulo", + "muovere", + "muraglia", + "muscolo", + "museo", + "musica", + "mutande", + "nascere", + "nastro", + "natale", + "natura", + "nave", + "navigare", + "negare", + "negozio", + "nemico", + "nero", + "nervo", + "nessuno", + "nettare", + "neutroni", + "neve", + "nevicare", + "nicotina", + "nido", + "nipote", + "nocciola", + "noleggio", + "nome", + "nonno", + "norvegia", + "notare", + "notizia", + "nove", + "nucleo", + "nuda", + "nuotare", + "nutrire", + "obbligo", + "occhio", + "occupare", + "oceano", + "odissea", + "odore", + "offerta", + "officina", + "offrire", + "oggetto", + "oggi", + "olfatto", + "olio", + "oliva", + "ombelico", + "ombrello", + "omuncolo", + "ondata", + "onore", + "opera", + "opinione", + "opuscolo", + "opzione", + "orario", + "orbita", + "orchidea", + "ordine", + "orecchio", + "orgasmo", + "orgoglio", + "origine", + "orologio", + "oroscopo", + "orso", + "oscurare", + "ospedale", + "ospite", + "ossigeno", + "ostacolo", + "ostriche", + "ottenere", + "ottimo", + "ottobre", + "ovest", + "pacco", + "pace", + "pacifico", + "padella", + "pagare", + "pagina", + "pagnotta", + "palazzo", + "palestra", + "palpebre", + "pancetta", + "panfilo", + "panino", + "pannello", + "panorama", + "papa", + "paperino", + "paradiso", + "parcella", + "parente", + "parlare", + "parodia", + "parrucca", + "partire", + "passare", + "pasta", + "patata", + "patente", + "patogeno", + "patriota", + "pausa", + "pazienza", + "peccare", + "pecora", + "pedalare", + "pelare", + "pena", + "pendenza", + "penisola", + "pennello", + "pensare", + "pentirsi", + "percorso", + "perdono", + "perfetto", + "perizoma", + "perla", + "permesso", + "persona", + "pesare", + "pesce", + "peso", + "petardo", + "petrolio", + "pezzo", + "piacere", + "pianeta", + "piastra", + "piatto", + "piazza", + "piccolo", + "piede", + "piegare", + "pietra", + "pigiama", + "pigliare", + "pigrizia", + "pilastro", + "pilota", + "pinguino", + "pioggia", + "piombo", + "pionieri", + "piovra", + "pipa", + "pirata", + "pirolisi", + "piscina", + "pisolino", + "pista", + "pitone", + "piumino", + "pizza", + "plastica", + "platino", + "poesia", + "poiana", + "polaroid", + "polenta", + "polimero", + "pollo", + "polmone", + "polpetta", + "poltrona", + "pomodoro", + "pompa", + "popolo", + "porco", + "porta", + "porzione", + "possesso", + "postino", + "potassio", + "potere", + "poverino", + "pranzo", + "prato", + "prefisso", + "prelievo", + "premio", + "prendere", + "prestare", + "pretesa", + "prezzo", + "primario", + "privacy", + "problema", + "processo", + "prodotto", + "profeta", + "progetto", + "promessa", + "pronto", + "proposta", + "proroga", + "prossimo", + "proteina", + "prova", + "prudenza", + "pubblico", + "pudore", + "pugilato", + "pulire", + "pulsante", + "puntare", + "pupazzo", + "puzzle", + "quaderno", + "qualcuno", + "quarzo", + "quercia", + "quintale", + "rabbia", + "racconto", + "radice", + "raffica", + "ragazza", + "ragione", + "rammento", + "ramo", + "rana", + "randagio", + "rapace", + "rapinare", + "rapporto", + "rasatura", + "ravioli", + "reagire", + "realista", + "reattore", + "reazione", + "recitare", + "recluso", + "record", + "recupero", + "redigere", + "regalare", + "regina", + "regola", + "relatore", + "reliquia", + "remare", + "rendere", + "reparto", + "resina", + "resto", + "rete", + "retorica", + "rettile", + "revocare", + "riaprire", + "ribadire", + "ribelle", + "ricambio", + "ricetta", + "richiamo", + "ricordo", + "ridurre", + "riempire", + "riferire", + "riflesso", + "righello", + "rilancio", + "rilevare", + "rilievo", + "rimanere", + "rimborso", + "rinforzo", + "rinuncia", + "riparo", + "ripetere", + "riposare", + "ripulire", + "risalita", + "riscatto", + "riserva", + "riso", + "rispetto", + "ritaglio", + "ritmo", + "ritorno", + "ritratto", + "rituale", + "riunione", + "riuscire", + "riva", + "robotica", + "rondine", + "rosa", + "rospo", + "rosso", + "rotonda", + "rotta", + "roulotte", + "rubare", + "rubrica", + "ruffiano", + "rumore", + "ruota", + "ruscello", + "sabbia", + "sacco", + "saggio", + "sale", + "salire", + "salmone", + "salto", + "salutare", + "salvia", + "sangue", + "sanzioni", + "sapere", + "sapienza", + "sarcasmo", + "sardine", + "sartoria", + "sbalzo", + "sbarcare", + "sberla", + "sborsare", + "scadenza", + "scafo", + "scala", + "scambio", + "scappare", + "scarpa", + "scatola", + "scelta", + "scena", + "sceriffo", + "scheggia", + "schiuma", + "sciarpa", + "scienza", + "scimmia", + "sciopero", + "scivolo", + "sclerare", + "scolpire", + "sconto", + "scopa", + "scordare", + "scossa", + "scrivere", + "scrupolo", + "scuderia", + "scultore", + "scuola", + "scusare", + "sdraiare", + "secolo", + "sedativo", + "sedere", + "sedia", + "segare", + "segreto", + "seguire", + "semaforo", + "seme", + "senape", + "seno", + "sentiero", + "separare", + "sepolcro", + "sequenza", + "serata", + "serpente", + "servizio", + "sesso", + "seta", + "settore", + "sfamare", + "sfera", + "sfidare", + "sfiorare", + "sfogare", + "sgabello", + "sicuro", + "siepe", + "sigaro", + "silenzio", + "silicone", + "simbiosi", + "simpatia", + "simulare", + "sinapsi", + "sindrome", + "sinergia", + "sinonimo", + "sintonia", + "sirena", + "siringa", + "sistema", + "sito", + "smalto", + "smentire", + "smontare", + "soccorso", + "socio", + "soffitto", + "software", + "soggetto", + "sogliola", + "sognare", + "soldi", + "sole", + "sollievo", + "solo", + "sommario", + "sondare", + "sonno", + "sorpresa", + "sorriso", + "sospiro", + "sostegno", + "sovrano", + "spaccare", + "spada", + "spagnolo", + "spalla", + "sparire", + "spavento", + "spazio", + "specchio", + "spedire", + "spegnere", + "spendere", + "speranza", + "spessore", + "spezzare", + "spiaggia", + "spiccare", + "spiegare", + "spiffero", + "spingere", + "sponda", + "sporcare", + "spostare", + "spremuta", + "spugna", + "spumante", + "spuntare", + "squadra", + "squillo", + "staccare", + "stadio", + "stagione", + "stallone", + "stampa", + "stancare", + "starnuto", + "statura", + "stella", + "stendere", + "sterzo", + "stilista", + "stimolo", + "stinco", + "stiva", + "stoffa", + "storia", + "strada", + "stregone", + "striscia", + "studiare", + "stufa", + "stupendo", + "subire", + "successo", + "sudare", + "suono", + "superare", + "supporto", + "surfista", + "sussurro", + "svelto", + "svenire", + "sviluppo", + "svolta", + "svuotare", + "tabacco", + "tabella", + "tabu", + "tacchino", + "tacere", + "taglio", + "talento", + "tangente", + "tappeto", + "tartufo", + "tassello", + "tastiera", + "tavolo", + "tazza", + "teatro", + "tedesco", + "telaio", + "telefono", + "tema", + "temere", + "tempo", + "tendenza", + "tenebre", + "tensione", + "tentare", + "teologia", + "teorema", + "termica", + "terrazzo", + "teschio", + "tesi", + "tesoro", + "tessera", + "testa", + "thriller", + "tifoso", + "tigre", + "timbrare", + "timido", + "tinta", + "tirare", + "tisana", + "titano", + "titolo", + "toccare", + "togliere", + "topolino", + "torcia", + "torrente", + "tovaglia", + "traffico", + "tragitto", + "training", + "tramonto", + "transito", + "trapezio", + "trasloco", + "trattore", + "trazione", + "treccia", + "tregua", + "treno", + "triciclo", + "tridente", + "trilogia", + "tromba", + "troncare", + "trota", + "trovare", + "trucco", + "tubo", + "tulipano", + "tumulto", + "tunisia", + "tuono", + "turista", + "tuta", + "tutelare", + "tutore", + "ubriaco", + "uccello", + "udienza", + "udito", + "uffa", + "umanoide", + "umore", + "unghia", + "unguento", + "unicorno", + "unione", + "universo", + "uomo", + "uragano", + "uranio", + "urlare", + "uscire", + "utente", + "utilizzo", + "vacanza", + "vacca", + "vaglio", + "vagonata", + "valle", + "valore", + "valutare", + "valvola", + "vampiro", + "vaniglia", + "vanto", + "vapore", + "variante", + "vasca", + "vaselina", + "vassoio", + "vedere", + "vegetale", + "veglia", + "veicolo", + "vela", + "veleno", + "velivolo", + "velluto", + "vendere", + "venerare", + "venire", + "vento", + "veranda", + "verbo", + "verdura", + "vergine", + "verifica", + "vernice", + "vero", + "verruca", + "versare", + "vertebra", + "vescica", + "vespaio", + "vestito", + "vesuvio", + "veterano", + "vetro", + "vetta", + "viadotto", + "viaggio", + "vibrare", + "vicenda", + "vichingo", + "vietare", + "vigilare", + "vigneto", + "villa", + "vincere", + "violino", + "vipera", + "virgola", + "virtuoso", + "visita", + "vita", + "vitello", + "vittima", + "vivavoce", + "vivere", + "viziato", + "voglia", + "volare", + "volpe", + "volto", + "volume", + "vongole", + "voragine", + "vortice", + "votare", + "vulcano", + "vuotare", + "zabaione", + "zaffiro", + "zainetto", + "zampa", + "zanzara", + "zattera", + "zavorra", + "zenzero", + "zero", + "zingaro", + "zittire", + "zoccolo", + "zolfo", + "zombie", + "zucchero" + ]; +} \ No newline at end of file diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 7ca101c4a..97433773b 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -169,26 +169,30 @@ class CWMonero extends Monero { } List<String> getMoneroWordList(String language) { - switch (language.toLowerCase()) { - case 'english': - return EnglishMnemonics.words; - case 'chinese (simplified)': - return ChineseSimplifiedMnemonics.words; - case 'dutch': - return DutchMnemonics.words; - case 'german': - return GermanMnemonics.words; - case 'japanese': - return JapaneseMnemonics.words; - case 'portuguese': - return PortugueseMnemonics.words; - case 'russian': - return RussianMnemonics.words; - case 'spanish': - return SpanishMnemonics.words; - default: - return EnglishMnemonics.words; - } + switch (language.toLowerCase()) { + case 'english': + return EnglishMnemonics.words; + case 'chinese (simplified)': + return ChineseSimplifiedMnemonics.words; + case 'dutch': + return DutchMnemonics.words; + case 'german': + return GermanMnemonics.words; + case 'japanese': + return JapaneseMnemonics.words; + case 'portuguese': + return PortugueseMnemonics.words; + case 'russian': + return RussianMnemonics.words; + case 'spanish': + return SpanishMnemonics.words; + case 'french': + return FrenchMnemonics.words; + case 'italian': + return ItalianMnemonics.words; + default: + return EnglishMnemonics.words; + } } WalletCredentials createMoneroRestoreWalletFromKeysCredentials({ diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 0b327f387..bd37e672e 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -18,7 +18,9 @@ class WalletRestoreFromSeedForm extends StatefulWidget { @required this.displayBlockHeightSelector, @required this.type, this.blockHeightFocusNode, - this.onHeightOrDateEntered}) + this.onHeightOrDateEntered, + this.onSeedChange, + this.onLanguageChange}) : super(key: key); final WalletType type; @@ -26,6 +28,8 @@ class WalletRestoreFromSeedForm extends StatefulWidget { final bool displayBlockHeightSelector; final FocusNode blockHeightFocusNode; final Function(bool) onHeightOrDateEntered; + final void Function(String) onSeedChange; + final void Function(String) onLanguageChange; @override WalletRestoreFromSeedFormState createState() => @@ -62,7 +66,10 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { validator: WalletNameValidator()), Container(height: 20), SeedWidget( - key: seedWidgetStateKey, language: language, type: widget.type), + key: seedWidgetStateKey, + language: language, + type: widget.type, + onSeedChange: widget.onSeedChange), if (widget.displayLanguageSelector) GestureDetector( onTap: () async { @@ -98,6 +105,7 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { this.language = language; seedWidgetStateKey.currentState.changeSeedLanguage(language); _setLanguageLabel(language); + widget.onLanguageChange?.call(language); }); } diff --git a/lib/src/screens/restore/wallet_restore_page.dart b/lib/src/screens/restore/wallet_restore_page.dart index c6a332ad4..d1ccadaa3 100644 --- a/lib/src/screens/restore/wallet_restore_page.dart +++ b/lib/src/screens/restore/wallet_restore_page.dart @@ -18,6 +18,7 @@ import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:cake_wallet/core/validator.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; +import 'package:cake_wallet/core/seed_validator.dart'; class WalletRestorePage extends BasePage { WalletRestorePage(this.walletRestoreViewModel) @@ -39,8 +40,40 @@ class WalletRestorePage extends BasePage { type: walletRestoreViewModel.type, key: walletRestoreFromSeedFormKey, blockHeightFocusNode: _blockHeightFocusNode, - onHeightOrDateEntered: (value) => - walletRestoreViewModel.isButtonEnabled = value)); + onHeightOrDateEntered: (value) { + if (_isValidSeed()) { + walletRestoreViewModel.isButtonEnabled = value; + } + }, + onSeedChange: (String seed) { + final hasHeight = walletRestoreFromSeedFormKey + .currentState + .blockchainHeightKey + .currentState + .restoreHeightController + .text + .isNotEmpty; + if (hasHeight) { + walletRestoreViewModel.isButtonEnabled = _isValidSeed(); + } + }, + onLanguageChange: (_) { + if (walletRestoreViewModel.hasBlockchainHeightLanguageSelector) { + final hasHeight = walletRestoreFromSeedFormKey + .currentState + .blockchainHeightKey + .currentState + .restoreHeightController + .text + .isNotEmpty; + + if (hasHeight) { + walletRestoreViewModel.isButtonEnabled = _isValidSeed(); + } + } else { + walletRestoreViewModel.isButtonEnabled = _isValidSeed(); + } + })); break; case WalletRestoreMode.keys: _pages.add(WalletRestoreFromKeysFrom( @@ -169,6 +202,31 @@ class WalletRestorePage extends BasePage { ]))); } + bool _isValidSeed() { + final seedWords = walletRestoreFromSeedFormKey + .currentState + .seedWidgetStateKey + .currentState + .text + .split(' '); + + if (seedWords.length != walletRestoreViewModel.seedMnemonicLength) { + return false; + } + + final words = walletRestoreFromSeedFormKey + .currentState + .seedWidgetStateKey + .currentState + .words + .toSet(); + return seedWords + .toSet() + .difference(words) + .toSet() + .isEmpty; + } + Map<String, dynamic> _credentials() { final credentials = <String, dynamic>{}; diff --git a/lib/src/widgets/seed_widget.dart b/lib/src/widgets/seed_widget.dart index ef768c0de..6e3ef996d 100644 --- a/lib/src/widgets/seed_widget.dart +++ b/lib/src/widgets/seed_widget.dart @@ -12,10 +12,11 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:flutter/widgets.dart'; class SeedWidget extends StatefulWidget { - SeedWidget({Key key, this.language, this.type}) : super(key: key); + SeedWidget({Key key, this.language, this.type, this.onSeedChange}) : super(key: key); final String language; final WalletType type; + final void Function(String) onSeedChange; @override SeedWidgetState createState() => SeedWidgetState(language, type); @@ -52,6 +53,7 @@ class SeedWidgetState extends State<SeedWidget> { void initState() { super.initState(); _showPlaceholder = true; + controller.addListener(() => widget.onSeedChange?.call(text)); } void changeSeedLanguage(String language) { diff --git a/lib/view_model/wallet_restore_view_model.dart b/lib/view_model/wallet_restore_view_model.dart index 7b7d9e209..e1ebdbce4 100644 --- a/lib/view_model/wallet_restore_view_model.dart +++ b/lib/view_model/wallet_restore_view_model.dart @@ -1,4 +1,5 @@ import 'package:cake_wallet/bitcoin/bitcoin.dart'; +import 'package:cake_wallet/core/mnemonic_length.dart'; import 'package:flutter/foundation.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; @@ -35,17 +36,24 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { _walletCreationService.changeWalletType(type: type); } + static const moneroSeedMnemonicLength = 25; + static const electrumSeedMnemonicLength = 24; + + final List<WalletRestoreMode> availableModes; + final bool hasSeedLanguageSelector; + final bool hasBlockchainHeightLanguageSelector; + final WalletCreationService _walletCreationService; + @observable WalletRestoreMode mode; @observable bool isButtonEnabled; - final List<WalletRestoreMode> availableModes; - final bool hasSeedLanguageSelector; - final bool hasBlockchainHeightLanguageSelector; - - final WalletCreationService _walletCreationService; + int get seedMnemonicLength => + type == WalletType.monero + ? moneroSeedMnemonicLength + : electrumSeedMnemonicLength; @override WalletCredentials getCredentials(dynamic options) { diff --git a/tool/configure.dart b/tool/configure.dart index 84c1668d8..c8f2107a2 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -143,6 +143,8 @@ import 'package:cw_monero/mnemonics/japanese.dart'; import 'package:cw_monero/mnemonics/russian.dart'; import 'package:cw_monero/mnemonics/spanish.dart'; import 'package:cw_monero/mnemonics/portuguese.dart'; +import 'package:cw_monero/mnemonics/french.dart'; +import 'package:cw_monero/mnemonics/italian.dart'; """; const moneroCwPart = "part 'cw_monero.dart';"; const moneroContent = """ From bc07f9d69b9357085d3bdea505c007e1fda3525a Mon Sep 17 00:00:00 2001 From: M <m@cakewallet.com> Date: Wed, 19 Jan 2022 17:27:53 +0200 Subject: [PATCH 02/11] Fixes for validation of bitcoin seed mnemonic text. --- .../screens/restore/wallet_restore_page.dart | 33 +++++++++++++------ lib/view_model/wallet_restore_view_model.dart | 8 ++--- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/lib/src/screens/restore/wallet_restore_page.dart b/lib/src/screens/restore/wallet_restore_page.dart index d1ccadaa3..1dbb1b8b7 100644 --- a/lib/src/screens/restore/wallet_restore_page.dart +++ b/lib/src/screens/restore/wallet_restore_page.dart @@ -1,5 +1,6 @@ import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; +import 'package:cw_core/wallet_type.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:keyboard_actions/keyboard_actions.dart'; @@ -46,15 +47,19 @@ class WalletRestorePage extends BasePage { } }, onSeedChange: (String seed) { - final hasHeight = walletRestoreFromSeedFormKey - .currentState - .blockchainHeightKey - .currentState - .restoreHeightController - .text - .isNotEmpty; - if (hasHeight) { - walletRestoreViewModel.isButtonEnabled = _isValidSeed(); + if (walletRestoreViewModel.hasBlockchainHeightLanguageSelector) { + final hasHeight = walletRestoreFromSeedFormKey + .currentState + .blockchainHeightKey + .currentState + .restoreHeightController + .text + .isNotEmpty; + if (hasHeight) { + walletRestoreViewModel.isButtonEnabled = _isValidSeed(); + } + } else { + walletRestoreViewModel.isButtonEnabled = _isValidSeed(); } }, onLanguageChange: (_) { @@ -209,8 +214,16 @@ class WalletRestorePage extends BasePage { .currentState .text .split(' '); + + if (walletRestoreViewModel.type == WalletType.monero && + seedWords.length != WalletRestoreViewModelBase.moneroSeedMnemonicLength) { + return false; + } - if (seedWords.length != walletRestoreViewModel.seedMnemonicLength) { + if ((walletRestoreViewModel.type == WalletType.bitcoin || + walletRestoreViewModel.type == WalletType.litecoin) && + (seedWords.length != WalletRestoreViewModelBase.electrumSeedMnemonicLength && + seedWords.length != WalletRestoreViewModelBase.electrumShortSeedMnemonicLength)) { return false; } diff --git a/lib/view_model/wallet_restore_view_model.dart b/lib/view_model/wallet_restore_view_model.dart index e1ebdbce4..818b72eb1 100644 --- a/lib/view_model/wallet_restore_view_model.dart +++ b/lib/view_model/wallet_restore_view_model.dart @@ -38,6 +38,7 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { static const moneroSeedMnemonicLength = 25; static const electrumSeedMnemonicLength = 24; + static const electrumShortSeedMnemonicLength = 12; final List<WalletRestoreMode> availableModes; final bool hasSeedLanguageSelector; @@ -49,12 +50,7 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { @observable bool isButtonEnabled; - - int get seedMnemonicLength => - type == WalletType.monero - ? moneroSeedMnemonicLength - : electrumSeedMnemonicLength; - + @override WalletCredentials getCredentials(dynamic options) { final password = generateWalletPassword(type); From 2b7d7982530c56009588e5a4990e0e6e420bd5a3 Mon Sep 17 00:00:00 2001 From: RafiaChy <rafiachowdhury24@gmail.com> Date: Thu, 20 Jan 2022 20:55:58 +0600 Subject: [PATCH 03/11] Adding IconButton to generate names for wallet names for new_wallet and restore_wallet --- lib/entities/generate_name.dart | 1 + .../screens/new_wallet/new_wallet_page.dart | 97 +++++++++++-------- .../wallet_restore_from_seed_form.dart | 19 +++- 3 files changed, 76 insertions(+), 41 deletions(-) diff --git a/lib/entities/generate_name.dart b/lib/entities/generate_name.dart index 4aa570769..140a60b31 100644 --- a/lib/entities/generate_name.dart +++ b/lib/entities/generate_name.dart @@ -20,5 +20,6 @@ Future<String> generateName() async { final chosenNoun = nouns[randomThing.nextInt(nouns.length)]; final returnString = chosenAdjective.capitalized() + ' ' + chosenNoun.capitalized(); + return returnString; } diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index 79998e944..ad4f5560b 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/generate_name.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; @@ -24,15 +25,17 @@ class NewWalletPage extends BasePage { final walletNameImage = Image.asset('assets/images/wallet_name.png'); final walletNameLightImage = - Image.asset('assets/images/wallet_name_light.png'); + Image.asset('assets/images/wallet_name_light.png'); @override String get title => S.current.new_wallet; @override - Widget body(BuildContext context) => WalletNameForm(_walletNewVM, + Widget body(BuildContext context) => WalletNameForm( + _walletNewVM, currentTheme.type == ThemeType.dark - ? walletNameImage : walletNameLightImage); + ? walletNameImage + : walletNameLightImage); } class WalletNameForm extends StatefulWidget { @@ -55,12 +58,15 @@ class _WalletNameFormState extends State<WalletNameForm> { ReactionDisposer _stateReaction; final WalletNewVM _walletNewVM; + final TextEditingController _controller = TextEditingController(); + @override void initState() { _stateReaction ??= reaction((_) => _walletNewVM.state, (ExecutionState state) { if (state is ExecutedSuccessfullyState) { - Navigator.of(context).pushNamed(Routes.preSeed, arguments: _walletNewVM.type); + Navigator.of(context) + .pushNamed(Routes.preSeed, arguments: _walletNewVM.type); } if (state is FailureState) { @@ -92,44 +98,59 @@ class _WalletNameFormState extends State<WalletNameForm> { padding: EdgeInsets.only(left: 12, right: 12), child: AspectRatio( aspectRatio: aspectRatioImage, - child: FittedBox(child: widget.walletImage, fit: BoxFit.fill)), + child: + FittedBox(child: widget.walletImage, fit: BoxFit.fill)), ), Padding( padding: EdgeInsets.only(top: 24), child: Form( - key: _formKey, - child: TextFormField( - onChanged: (value) => _walletNewVM.name = value, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.w600, - color: - Theme.of(context).primaryTextTheme.title.color), - decoration: InputDecoration( - hintStyle: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.w500, - color: Theme.of(context) - .accentTextTheme - .display3 - .color), - hintText: S.of(context).wallet_name, - focusedBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .accentTextTheme - .display3 - .decorationColor, - width: 1.0)), - enabledBorder: UnderlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .accentTextTheme - .display3 - .decorationColor, - width: 1.0))), - validator: WalletNameValidator())), + key: _formKey, + child: TextFormField( + onChanged: (value) => _walletNewVM.name = value, + controller: _controller, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.w600, + color: Theme.of(context).primaryTextTheme.title.color), + decoration: InputDecoration( + suffixIcon: IconButton( + onPressed: () async { + final String rName = await generateName(); + + print(rName); + setState(() { + _controller.text = rName; + _walletNewVM.name = rName; + }); + }, + icon: Icon(Icons.refresh), + ), + hintStyle: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.w500, + color: + Theme.of(context).accentTextTheme.display3.color), + hintText: S.of(context).wallet_name, + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .accentTextTheme + .display3 + .decorationColor, + width: 1.0)), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context) + .accentTextTheme + .display3 + .decorationColor, + width: 1.0), + ), + ), + validator: WalletNameValidator(), + ), + ), ), if (_walletNewVM.hasLanguageSelector) ...[ Padding( diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 0b327f387..97507f49e 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/generate_name.dart'; import 'package:cw_core/wallet_type.dart'; import 'package:cake_wallet/view_model/wallet_restore_view_model.dart'; import 'package:flutter/cupertino.dart'; @@ -57,9 +58,21 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { padding: EdgeInsets.only(left: 24, right: 24), child: Column(children: [ BaseTextFormField( - controller: nameTextEditingController, - hintText: S.of(context).wallet_name, - validator: WalletNameValidator()), + controller: nameTextEditingController, + hintText: S.of(context).wallet_name, + validator: WalletNameValidator(), + suffixIcon: IconButton( + onPressed: () async { + final String rName = await generateName(); + + print(rName); + setState(() { + nameTextEditingController.text = rName; + }); + }, + icon: Icon(Icons.refresh), + ), + ), Container(height: 20), SeedWidget( key: seedWidgetStateKey, language: language, type: widget.type), From a18acd99354f5dc394cd8a7191dec3a86467c1f3 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <godilite@gmail.com> Date: Fri, 21 Jan 2022 11:06:53 +0100 Subject: [PATCH 04/11] upgrade unstoppable dependencies to include support for polygon --- android/app/build.gradle | 2 +- ios/Podfile | 2 +- ios/Podfile.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 866724032..eec79a3f2 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -90,5 +90,5 @@ dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.3.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - implementation 'com.unstoppabledomains:resolution:3.0.0' + implementation 'com.unstoppabledomains:resolution:5.0.0' } diff --git a/ios/Podfile b/ios/Podfile index d6ff9de71..b29d40484 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -36,7 +36,7 @@ target 'Runner' do # Cake Wallet (Legacy) pod 'CryptoSwift' - pod 'UnstoppableDomainsResolution', '~> 2.0.1' + pod 'UnstoppableDomainsResolution', '~> 4.0.0' end post_install do |installer| diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9de19b391..fef5810ff 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -87,7 +87,7 @@ PODS: - SwiftyGif (5.3.0) - uni_links (0.0.1): - Flutter - - UnstoppableDomainsResolution (2.0.1): + - UnstoppableDomainsResolution (4.0.0): - BigInt - CryptoSwift - url_launcher (0.0.1): @@ -112,7 +112,7 @@ DEPENDENCIES: - share (from `.symlinks/plugins/share/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`) - - UnstoppableDomainsResolution (~> 2.0.1) + - UnstoppableDomainsResolution (~> 4.0.0) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) - webview_flutter (from `.symlinks/plugins/webview_flutter/ios`) @@ -190,10 +190,10 @@ SPEC CHECKSUMS: SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699 SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40 uni_links: d97da20c7701486ba192624d99bffaaffcfc298a - UnstoppableDomainsResolution: 856ba43f08b31f3f34157c7257092bd0c6e31cf8 + UnstoppableDomainsResolution: c3c67f4d0a5e2437cb00d4bd50c2e00d6e743841 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b -PODFILE CHECKSUM: bc2591d23316907c9c90ca1cd2fce063fd866508 +PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f COCOAPODS: 1.11.2 From f2ec887b3a36d413dc1caa03e9e38e6ba6650cab Mon Sep 17 00:00:00 2001 From: RafiaChy <rafiachowdhury24@gmail.com> Date: Fri, 21 Jan 2022 17:58:09 +0600 Subject: [PATCH 05/11] Set the curson position at the end of the value in the textfield. --- lib/src/screens/new_wallet/new_wallet_page.dart | 6 +++++- lib/src/screens/restore/wallet_restore_from_seed_form.dart | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index ad4f5560b..2d65a1c45 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -122,9 +122,13 @@ class _WalletNameFormState extends State<WalletNameForm> { setState(() { _controller.text = rName; _walletNewVM.name = rName; + _controller.selection = TextSelection.fromPosition( + TextPosition(offset: _controller.text.length)); }); }, - icon: Icon(Icons.refresh), + icon: Image.asset( + 'assets/images/refresh_icon.png', + ), ), hintStyle: TextStyle( fontSize: 18.0, diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 97507f49e..8b8863961 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -68,9 +68,14 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { print(rName); setState(() { nameTextEditingController.text = rName; + nameTextEditingController.selection = + TextSelection.fromPosition(TextPosition( + offset: nameTextEditingController.text.length)); }); }, - icon: Icon(Icons.refresh), + icon: Image.asset( + 'assets/images/refresh_icon.png', + ), ), ), Container(height: 20), From f021dbf6a6b57e8ae1d674a6a0f0b25a6c66f91b Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <godilite@gmail.com> Date: Fri, 21 Jan 2022 14:02:00 +0100 Subject: [PATCH 06/11] add stay awake swift support --- ios/CakeWallet/wakeLock.swift | 20 ++++ ios/Runner.xcodeproj/project.pbxproj | 4 + ios/Runner/AppDelegate.swift | 6 ++ lib/di.dart | 98 +++++++++---------- lib/entities/wake_lock.dart | 21 ++++ .../on_wallet_sync_status_change.dart | 10 ++ 6 files changed, 107 insertions(+), 52 deletions(-) create mode 100644 ios/CakeWallet/wakeLock.swift create mode 100644 lib/entities/wake_lock.dart diff --git a/ios/CakeWallet/wakeLock.swift b/ios/CakeWallet/wakeLock.swift new file mode 100644 index 000000000..efd65fdb8 --- /dev/null +++ b/ios/CakeWallet/wakeLock.swift @@ -0,0 +1,20 @@ +// +// wakeLock.swift +// Runner +// +// Created by Godwin Asuquo on 1/21/22. +// + +import Foundation +import UIKit + +func enableWakeScreen() -> String { + UIApplication.shared.isIdleTimerDisabled = true + + return "screen wake turned ON" +} + +func disableWakeScreen() -> String{ + UIApplication.shared.isIdleTimerDisabled = false + return "screen wake turned OFF" +} diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index f66cd7099..cadcd78bb 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -12,6 +12,7 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 20ED0868E1BD7E12278C0CB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B26E3F56D69167FBB1DC160A /* Pods_Runner.framework */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 5AFFEBFD279AD49C00F906A4 /* wakeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5AFFEBFC279AD49C00F906A4 /* wakeLock.swift */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; @@ -28,6 +29,7 @@ 20F67A1B2C2FCB2A3BB048C1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; }; 501EA9286675DC8636978EA4 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; }; + 5AFFEBFC279AD49C00F906A4 /* wakeLock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = wakeLock.swift; sourceTree = "<group>"; }; 61CAA8652B54F23356F7592A /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; @@ -68,6 +70,7 @@ children = ( 0C44A7192518EF8000B570ED /* decrypt.swift */, 0C9D68C8264854B60011B691 /* secRandom.swift */, + 5AFFEBFC279AD49C00F906A4 /* wakeLock.swift */, ); path = CakeWallet; sourceTree = "<group>"; @@ -277,6 +280,7 @@ files = ( 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 5AFFEBFD279AD49C00F906A4 /* wakeLock.swift in Sources */, 0C9D68C9264854B60011B691 /* secRandom.swift in Sources */, 0C44A71A2518EF8000B570ED /* decrypt.swift in Sources */, ); diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index ebf578d09..c4d460e08 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -96,6 +96,12 @@ import UnstoppableDomainsResolution result(address) } + case "enableWakeScreen": + result(enableWakeScreen()) + + case "disableWakeScreen": + result(disableWakeScreen()) + default: result(FlutterMethodNotImplemented) } diff --git a/lib/di.dart b/lib/di.dart index 2a1430796..b117a2a96 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -1,3 +1,4 @@ +import 'package:cake_wallet/entities/wake_lock.dart'; import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart'; import 'package:cw_core/unspent_coins_info.dart'; @@ -192,8 +193,8 @@ Future setup( getIt.registerSingleton<ExchangeTemplateStore>( ExchangeTemplateStore(templateSource: _exchangeTemplates)); getIt.registerSingleton<YatStore>(YatStore( - appStore: getIt.get<AppStore>(), - secureStorage: getIt.get<FlutterSecureStorage>()) + appStore: getIt.get<AppStore>(), + secureStorage: getIt.get<FlutterSecureStorage>()) ..init()); final secretStore = @@ -237,11 +238,9 @@ Future setup( type: type, language: language); }); - getIt.registerFactory<WalletAddressListViewModel>( - () => WalletAddressListViewModel( - appStore: getIt.get<AppStore>(), - yatStore: getIt.get<YatStore>() - )); + getIt.registerFactory<WalletAddressListViewModel>(() => + WalletAddressListViewModel( + appStore: getIt.get<AppStore>(), yatStore: getIt.get<YatStore>())); getIt.registerFactory(() => BalanceViewModel( appStore: getIt.get<AppStore>(), @@ -323,8 +322,7 @@ Future setup( getIt.get<AppStore>().wallet, getIt.get<AppStore>().settingsStore, getIt.get<SendTemplateStore>(), - getIt.get<FiatConversionStore>() - )); + getIt.get<FiatConversionStore>())); getIt.registerFactory<SendViewModel>(() => SendViewModel( getIt.get<AppStore>().wallet, @@ -336,9 +334,8 @@ Future setup( getIt.registerFactory( () => SendPage(sendViewModel: getIt.get<SendViewModel>())); - getIt.registerFactory( - () => SendTemplatePage( - sendTemplateViewModel: getIt.get<SendTemplateViewModel>())); + getIt.registerFactory(() => SendTemplatePage( + sendTemplateViewModel: getIt.get<SendTemplateViewModel>())); getIt.registerFactory(() => WalletListViewModel( _walletInfoSource, @@ -471,9 +468,11 @@ Future setup( case WalletType.monero: return monero.createMoneroWalletService(_walletInfoSource); case WalletType.bitcoin: - return bitcoin.createBitcoinWalletService(_walletInfoSource, _unspentCoinsInfoSource); + return bitcoin.createBitcoinWalletService( + _walletInfoSource, _unspentCoinsInfoSource); case WalletType.litecoin: - return bitcoin.createLitecoinWalletService(_walletInfoSource, _unspentCoinsInfoSource); + return bitcoin.createLitecoinWalletService( + _walletInfoSource, _unspentCoinsInfoSource); default: return null; } @@ -507,13 +506,13 @@ Future setup( getIt .registerFactoryParam<TransactionDetailsViewModel, TransactionInfo, void>( (TransactionInfo transactionInfo, _) { - final wallet = getIt.get<AppStore>().wallet; - return TransactionDetailsViewModel( - transactionInfo: transactionInfo, - transactionDescriptionBox: _transactionDescriptionBox, - wallet: wallet, - settingsStore: getIt.get<SettingsStore>()); - }); + final wallet = getIt.get<AppStore>().wallet; + return TransactionDetailsViewModel( + transactionInfo: transactionInfo, + transactionDescriptionBox: _transactionDescriptionBox, + wallet: wallet, + settingsStore: getIt.get<SettingsStore>()); + }); getIt.registerFactoryParam<TransactionDetailsPage, TransactionInfo, void>( (TransactionInfo transactionInfo, _) => TransactionDetailsPage( @@ -574,23 +573,21 @@ Future setup( return PreOrderPage(buyViewModel: getIt.get<BuyViewModel>()); }); - getIt.registerFactoryParam<BuyWebViewPage, List, void>( - (List args, _) { - final url = args.first as String; - final buyViewModel = args[1] as BuyViewModel; + getIt.registerFactoryParam<BuyWebViewPage, List, void>((List args, _) { + final url = args.first as String; + final buyViewModel = args[1] as BuyViewModel; - return BuyWebViewPage(buyViewModel: buyViewModel, - ordersStore: getIt.get<OrdersStore>(), url: url); - }); + return BuyWebViewPage( + buyViewModel: buyViewModel, + ordersStore: getIt.get<OrdersStore>(), + url: url); + }); - getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>( - (order, _) { - final wallet = getIt.get<AppStore>().wallet; + getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) { + final wallet = getIt.get<AppStore>().wallet; - return OrderDetailsViewModel( - wallet: wallet, - orderForDetails: order); - }); + return OrderDetailsViewModel(wallet: wallet, orderForDetails: order); + }); getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) => OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order))); @@ -603,31 +600,28 @@ Future setup( final wallet = getIt.get<AppStore>().wallet; return UnspentCoinsListViewModel( - wallet: wallet, - unspentCoinsInfo: _unspentCoinsInfoSource); + wallet: wallet, unspentCoinsInfo: _unspentCoinsInfoSource); }); getIt.registerFactory(() => UnspentCoinsListPage( - unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>() - )); + unspentCoinsListViewModel: getIt.get<UnspentCoinsListViewModel>())); - getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, - UnspentCoinsItem, UnspentCoinsListViewModel>((item, model) => - UnspentCoinsDetailsViewModel( - unspentCoinsItem: item, - unspentCoinsListViewModel: model)); + getIt.registerFactoryParam<UnspentCoinsDetailsViewModel, UnspentCoinsItem, + UnspentCoinsListViewModel>( + (item, model) => UnspentCoinsDetailsViewModel( + unspentCoinsItem: item, unspentCoinsListViewModel: model)); getIt.registerFactoryParam<UnspentCoinsDetailsPage, List, void>( - (List args, _) { - final item = args.first as UnspentCoinsItem; - final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel; + (List args, _) { + final item = args.first as UnspentCoinsItem; + final unspentCoinsListViewModel = args[1] as UnspentCoinsListViewModel; - return UnspentCoinsDetailsPage( - unspentCoinsDetailsViewModel: - getIt.get<UnspentCoinsDetailsViewModel>( - param1: item, - param2: unspentCoinsListViewModel)); + return UnspentCoinsDetailsPage( + unspentCoinsDetailsViewModel: getIt.get<UnspentCoinsDetailsViewModel>( + param1: item, param2: unspentCoinsListViewModel)); }); + getIt.registerFactory(() => WakeLock()); + _isSetupFinished = true; } diff --git a/lib/entities/wake_lock.dart b/lib/entities/wake_lock.dart new file mode 100644 index 000000000..784f59c85 --- /dev/null +++ b/lib/entities/wake_lock.dart @@ -0,0 +1,21 @@ +import 'package:flutter/services.dart'; + +class WakeLock { + static const _utils = const MethodChannel('com.cake_wallet/native_utils'); + + Future<void> enableWake() async { + try { + await _utils.invokeMethod<String>('enableWakeScreen'); + } on PlatformException catch (_) { + print('Failed enabling screen wakelock'); + } + } + + Future<void> disableWake() async { + try { + await _utils.invokeMethod<String>('disableWakeScreen'); + } on PlatformException catch (_) { + print('Failed enabling screen wakelock'); + } + } +} diff --git a/lib/reactions/on_wallet_sync_status_change.dart b/lib/reactions/on_wallet_sync_status_change.dart index 8f14d7927..f2c2d07cc 100644 --- a/lib/reactions/on_wallet_sync_status_change.dart +++ b/lib/reactions/on_wallet_sync_status_change.dart @@ -1,9 +1,12 @@ +import 'package:cake_wallet/di.dart'; +import 'package:cake_wallet/entities/wake_lock.dart'; import 'package:mobx/mobx.dart'; import 'package:cw_core/transaction_history.dart'; import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/balance.dart'; import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/sync_status.dart'; +import 'package:flutter/services.dart'; ReactionDisposer _onWalletSyncStatusChangeReaction; @@ -11,11 +14,18 @@ void startWalletSyncStatusChangeReaction( WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet) { + final WakeLock _wakeLock = getIt.get<WakeLock>(); _onWalletSyncStatusChangeReaction?.reaction?.dispose(); _onWalletSyncStatusChangeReaction = reaction((_) => wallet.syncStatus, (SyncStatus status) async { if (status is ConnectedSyncStatus) { await wallet.startSync(); } + if (status is SyncingSyncStatus) { + await _wakeLock.enableWake(); + } + if (status is SyncedSyncStatus || status is FailedSyncStatus) { + await _wakeLock.disableWake(); + } }); } From e84f122956ee1f5c66a5f31897ace9aab478d558 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <godilite@gmail.com> Date: Fri, 21 Jan 2022 14:32:39 +0100 Subject: [PATCH 07/11] add wakelock for android --- .../java/com/cakewallet/cake_wallet/MainActivity.java | 9 +++++++++ .../app/src/main/java/com/monero/app/MainActivity.java | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java b/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java index 3afdc111e..d0453f571 100644 --- a/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java +++ b/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java @@ -13,6 +13,7 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Handler; import android.os.Looper; +import android.view.WindowManager; import com.unstoppabledomains.resolution.DomainResolution; import com.unstoppabledomains.resolution.Resolution; @@ -39,6 +40,14 @@ public class MainActivity extends FlutterFragmentActivity { try { switch (call.method) { + case "enableWakeScreen": + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + handler.post(() -> result.success("screen wake turned ON")); + break; + case "disableWakeScreen": + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + handler.post(() -> result.success("screen wake turned OFF")); + break; case "sec_random": int count = call.argument("count"); SecureRandom random = new SecureRandom(); diff --git a/android/app/src/main/java/com/monero/app/MainActivity.java b/android/app/src/main/java/com/monero/app/MainActivity.java index 8a46333db..0ee3d4dd5 100644 --- a/android/app/src/main/java/com/monero/app/MainActivity.java +++ b/android/app/src/main/java/com/monero/app/MainActivity.java @@ -13,6 +13,7 @@ import android.os.AsyncTask; import android.os.Build; import android.os.Handler; import android.os.Looper; +import android.view.WindowManager; import com.unstoppabledomains.resolution.DomainResolution; import com.unstoppabledomains.resolution.Resolution; @@ -39,6 +40,14 @@ public class MainActivity extends FlutterFragmentActivity { try { switch (call.method) { + case "enableWakeScreen": + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + handler.post(() -> result.success("screen wake turned ON")); + break; + case "disableWakeScreen": + getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + handler.post(() -> result.success("screen wake turned ON")); + break; case "sec_random": int count = call.argument("count"); SecureRandom random = new SecureRandom(); From 1f021b09e48d5f8916964fe6e64de0566138a5f4 Mon Sep 17 00:00:00 2001 From: RafiaChy <rafiachowdhury24@gmail.com> Date: Fri, 21 Jan 2022 20:09:25 +0600 Subject: [PATCH 08/11] Editted the IconButton according to Figma --- .../screens/new_wallet/new_wallet_page.dart | 15 +++++++++++++-- .../restore/wallet_restore_from_seed_form.dart | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index 2d65a1c45..58cc37a52 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -126,8 +126,19 @@ class _WalletNameFormState extends State<WalletNameForm> { TextPosition(offset: _controller.text.length)); }); }, - icon: Image.asset( - 'assets/images/refresh_icon.png', + icon: Container( + padding: const EdgeInsets.all(7), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Color.fromRGBO(91, 112, 146, 1), + ), + width: 27.0, + height: 27.0, + child: Image.asset( + 'assets/images/refresh_icon.png', + width: 14, + height: 13, + ), ), ), hintStyle: TextStyle( diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 8b8863961..4e83bdb5b 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -73,9 +73,21 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { offset: nameTextEditingController.text.length)); }); }, - icon: Image.asset( - 'assets/images/refresh_icon.png', - ), + icon:Container( + padding: const EdgeInsets.all(7) + , + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(6.0), + color: Color.fromRGBO(91, 112, 146, 1),), + width: 27.0, + height: 27.0, + + child: Image.asset( + 'assets/images/refresh_icon.png', + width: 14, + height: 13, + ), + ), ), ), Container(height: 20), From a89397651fbc532ec236c7993fd51f1f5eee7a8a Mon Sep 17 00:00:00 2001 From: RafiaChy <rafiachowdhury24@gmail.com> Date: Sat, 22 Jan 2022 18:55:05 +0600 Subject: [PATCH 09/11] Customised the GenerateName button according to PasteButton. Figma style is no longer applicable. --- .../screens/new_wallet/new_wallet_page.dart | 14 ++--- .../wallet_restore_from_seed_form.dart | 52 +++++++++---------- lib/src/widgets/seed_widget.dart | 6 +-- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index 58cc37a52..a73e814e8 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -127,17 +127,19 @@ class _WalletNameFormState extends State<WalletNameForm> { }); }, icon: Container( - padding: const EdgeInsets.all(7), + padding: const EdgeInsets.all(8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(6.0), - color: Color.fromRGBO(91, 112, 146, 1), + color: Theme.of(context).hintColor, ), - width: 27.0, - height: 27.0, + width: 34, + height: 34, child: Image.asset( 'assets/images/refresh_icon.png', - width: 14, - height: 13, + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor, ), ), ), diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 4e83bdb5b..9338b3eb1 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -61,33 +61,33 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { controller: nameTextEditingController, hintText: S.of(context).wallet_name, validator: WalletNameValidator(), - suffixIcon: IconButton( - onPressed: () async { - final String rName = await generateName(); + suffixIcon: Container( + width: 12, + height: 14, + margin: const EdgeInsets.only( bottom: 15, left: 13), + child: InkWell( + onTap: () async { + final String rName = await generateName(); - print(rName); - setState(() { - nameTextEditingController.text = rName; - nameTextEditingController.selection = - TextSelection.fromPosition(TextPosition( - offset: nameTextEditingController.text.length)); - }); - }, - icon:Container( - padding: const EdgeInsets.all(7) - , - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(6.0), - color: Color.fromRGBO(91, 112, 146, 1),), - width: 27.0, - height: 27.0, - - child: Image.asset( - 'assets/images/refresh_icon.png', - width: 14, - height: 13, - ), - ), + print(rName); + setState(() { + nameTextEditingController.text = rName; + nameTextEditingController.selection = + TextSelection.fromPosition(TextPosition( + offset: nameTextEditingController.text.length)); + }); + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + color: Theme.of(context).hintColor, + borderRadius: BorderRadius.all(Radius.circular(6))), + child: Image.asset('assets/images/refresh_icon.png', + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor)), + ), ), ), Container(height: 20), diff --git a/lib/src/widgets/seed_widget.dart b/lib/src/widgets/seed_widget.dart index ef768c0de..289b8076b 100644 --- a/lib/src/widgets/seed_widget.dart +++ b/lib/src/widgets/seed_widget.dart @@ -25,8 +25,7 @@ class SeedWidgetState extends State<SeedWidget> { SeedWidgetState(String language, this.type) : controller = TextEditingController(), focusNode = FocusNode(), - words = SeedValidator.getWordList( - type:type, language: language) { + words = SeedValidator.getWordList(type: type, language: language) { focusNode.addListener(() { setState(() { if (!focusNode.hasFocus && controller.text.isEmpty) { @@ -56,8 +55,7 @@ class SeedWidgetState extends State<SeedWidget> { void changeSeedLanguage(String language) { setState(() { - words = SeedValidator.getWordList( - type: type, language: language); + words = SeedValidator.getWordList(type: type, language: language); }); } From 3ed867aba3ba90dc469cefa14ea22720e7e80922 Mon Sep 17 00:00:00 2001 From: RafiaChy <rafiachowdhury24@gmail.com> Date: Mon, 24 Jan 2022 20:00:26 +0600 Subject: [PATCH 10/11] Added a generate-name button for restore-from-key page and removed empty lines, types for final variables, and print statements --- lib/entities/generate_name.dart | 1 - .../screens/new_wallet/new_wallet_page.dart | 4 +-- .../wallet_restore_from_keys_form.dart | 32 +++++++++++++++++-- .../wallet_restore_from_seed_form.dart | 6 ++-- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/lib/entities/generate_name.dart b/lib/entities/generate_name.dart index 140a60b31..4aa570769 100644 --- a/lib/entities/generate_name.dart +++ b/lib/entities/generate_name.dart @@ -20,6 +20,5 @@ Future<String> generateName() async { final chosenNoun = nouns[randomThing.nextInt(nouns.length)]; final returnString = chosenAdjective.capitalized() + ' ' + chosenNoun.capitalized(); - return returnString; } diff --git a/lib/src/screens/new_wallet/new_wallet_page.dart b/lib/src/screens/new_wallet/new_wallet_page.dart index a73e814e8..a4a0b32be 100644 --- a/lib/src/screens/new_wallet/new_wallet_page.dart +++ b/lib/src/screens/new_wallet/new_wallet_page.dart @@ -116,9 +116,7 @@ class _WalletNameFormState extends State<WalletNameForm> { decoration: InputDecoration( suffixIcon: IconButton( onPressed: () async { - final String rName = await generateName(); - - print(rName); + final rName = await generateName(); setState(() { _controller.text = rName; _walletNewVM.name = rName; diff --git a/lib/src/screens/restore/wallet_restore_from_keys_form.dart b/lib/src/screens/restore/wallet_restore_from_keys_form.dart index 4ad9c25bc..36264aa95 100644 --- a/lib/src/screens/restore/wallet_restore_from_keys_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_keys_form.dart @@ -7,12 +7,13 @@ import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/core/validator.dart'; +import 'package:cake_wallet/entities/generate_name.dart'; class WalletRestoreFromKeysFrom extends StatefulWidget { WalletRestoreFromKeysFrom({Key key, this.onHeightOrDateEntered}) : super(key: key); - final Function (bool) onHeightOrDateEntered; + final Function(bool) onHeightOrDateEntered; @override WalletRestoreFromKeysFromState createState() => @@ -56,7 +57,34 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> { BaseTextFormField( controller: nameTextEditingController, hintText: S.of(context).wallet_name, - validator: WalletNameValidator()), + validator: WalletNameValidator(), + suffixIcon: Container( + width: 12, + height: 14, + margin: const EdgeInsets.only(bottom: 15, left: 13), + child: InkWell( + onTap: () async { + final rName = await generateName(); + setState(() { + nameTextEditingController.text = rName; + nameTextEditingController.selection = + TextSelection.fromPosition(TextPosition( + offset: nameTextEditingController.text.length)); + }); + }, + child: Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + color: Theme.of(context).hintColor, + borderRadius: BorderRadius.all(Radius.circular(6))), + child: Image.asset('assets/images/refresh_icon.png', + color: Theme.of(context) + .primaryTextTheme + .display1 + .decorationColor)), + ), + ), + ), Container(height: 20), BaseTextFormField( controller: addressController, diff --git a/lib/src/screens/restore/wallet_restore_from_seed_form.dart b/lib/src/screens/restore/wallet_restore_from_seed_form.dart index 9338b3eb1..6e3ab92fe 100644 --- a/lib/src/screens/restore/wallet_restore_from_seed_form.dart +++ b/lib/src/screens/restore/wallet_restore_from_seed_form.dart @@ -64,12 +64,10 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> { suffixIcon: Container( width: 12, height: 14, - margin: const EdgeInsets.only( bottom: 15, left: 13), + margin: const EdgeInsets.only(bottom: 15, left: 13), child: InkWell( onTap: () async { - final String rName = await generateName(); - - print(rName); + final rName = await generateName(); setState(() { nameTextEditingController.text = rName; nameTextEditingController.selection = From c70ced70dd763ec2f79930ea57c5b15832ab1514 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo <godilite@gmail.com> Date: Mon, 24 Jan 2022 16:21:52 +0100 Subject: [PATCH 11/11] fix issues from PR --- .../java/com/cakewallet/cake_wallet/MainActivity.java | 4 ++-- .../app/src/main/java/com/monero/app/MainActivity.java | 4 ++-- ios/CakeWallet/wakeLock.swift | 8 ++++---- lib/reactions/on_wallet_sync_status_change.dart | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java b/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java index d0453f571..141c26944 100644 --- a/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java +++ b/android/app/src/main/java/com/cakewallet/cake_wallet/MainActivity.java @@ -42,11 +42,11 @@ public class MainActivity extends FlutterFragmentActivity { switch (call.method) { case "enableWakeScreen": getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - handler.post(() -> result.success("screen wake turned ON")); + handler.post(() -> result.success(true)); break; case "disableWakeScreen": getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - handler.post(() -> result.success("screen wake turned OFF")); + handler.post(() -> result.success(true)); break; case "sec_random": int count = call.argument("count"); diff --git a/android/app/src/main/java/com/monero/app/MainActivity.java b/android/app/src/main/java/com/monero/app/MainActivity.java index 0ee3d4dd5..385932b38 100644 --- a/android/app/src/main/java/com/monero/app/MainActivity.java +++ b/android/app/src/main/java/com/monero/app/MainActivity.java @@ -42,11 +42,11 @@ public class MainActivity extends FlutterFragmentActivity { switch (call.method) { case "enableWakeScreen": getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - handler.post(() -> result.success("screen wake turned ON")); + handler.post(() -> result.success(true)); break; case "disableWakeScreen": getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - handler.post(() -> result.success("screen wake turned ON")); + handler.post(() -> result.success(true)); break; case "sec_random": int count = call.argument("count"); diff --git a/ios/CakeWallet/wakeLock.swift b/ios/CakeWallet/wakeLock.swift index efd65fdb8..35f23eafa 100644 --- a/ios/CakeWallet/wakeLock.swift +++ b/ios/CakeWallet/wakeLock.swift @@ -8,13 +8,13 @@ import Foundation import UIKit -func enableWakeScreen() -> String { +func enableWakeScreen() -> Bool{ UIApplication.shared.isIdleTimerDisabled = true - return "screen wake turned ON" + return true } -func disableWakeScreen() -> String{ +func disableWakeScreen() -> Bool{ UIApplication.shared.isIdleTimerDisabled = false - return "screen wake turned OFF" + return true } diff --git a/lib/reactions/on_wallet_sync_status_change.dart b/lib/reactions/on_wallet_sync_status_change.dart index f2c2d07cc..bb245898c 100644 --- a/lib/reactions/on_wallet_sync_status_change.dart +++ b/lib/reactions/on_wallet_sync_status_change.dart @@ -14,7 +14,7 @@ void startWalletSyncStatusChangeReaction( WalletBase<Balance, TransactionHistoryBase<TransactionInfo>, TransactionInfo> wallet) { - final WakeLock _wakeLock = getIt.get<WakeLock>(); + final _wakeLock = getIt.get<WakeLock>(); _onWalletSyncStatusChangeReaction?.reaction?.dispose(); _onWalletSyncStatusChangeReaction = reaction((_) => wallet.syncStatus, (SyncStatus status) async {