diff --git a/lib/core/execution_state.dart b/lib/core/execution_state.dart index d4e3faeec..18dc81030 100644 --- a/lib/core/execution_state.dart +++ b/lib/core/execution_state.dart @@ -4,7 +4,11 @@ class InitialExecutionState extends ExecutionState {} class IsExecutingState extends ExecutionState {} -class ExecutedSuccessfullyState extends ExecutionState {} +class ExecutedSuccessfullyState extends ExecutionState { + ExecutedSuccessfullyState({this.payload}); + + final dynamic payload; +} class FailureState extends ExecutionState { FailureState(this.error); diff --git a/lib/entities/node.dart b/lib/entities/node.dart index f307111d2..48f3c9d8e 100644 --- a/lib/entities/node.dart +++ b/lib/entities/node.dart @@ -14,7 +14,8 @@ class Node extends HiveObject with Keyable { {@required this.uri, @required WalletType type, this.login, - this.password}) { + this.password, + this.useSSL}) { this.type = type; } @@ -22,7 +23,8 @@ class Node extends HiveObject with Keyable { : uri = map['uri'] as String ?? '', login = map['login'] as String, password = map['password'] as String, - typeRaw = map['typeRaw'] as int; + typeRaw = map['typeRaw'] as int, + useSSL = map['useSSL'] as bool; static const boxName = 'Nodes'; @@ -38,6 +40,11 @@ class Node extends HiveObject with Keyable { @HiveField(3) int typeRaw; + @HiveField(4) + bool useSSL; + + bool get isSSL => useSSL ?? false; + @override dynamic get keyIndex { _keyIndex ??= key; diff --git a/lib/generated/i18n.dart b/lib/generated/i18n.dart index 4e43365b0..fd0c0f70e 100644 --- a/lib/generated/i18n.dart +++ b/lib/generated/i18n.dart @@ -50,6 +50,7 @@ class S implements WidgetsLocalizations { String get card_address => "Address:"; String get change => "Change"; String get change_currency => "Change Currency"; + String get change_current_node_title => "Change current node"; String get change_exchange_provider => "Change Exchange Provider"; String get change_language => "Change language"; String get change_wallet_alert_title => "Change current wallet"; @@ -108,14 +109,18 @@ class S implements WidgetsLocalizations { String get incorrect_seed => "The text entered is not valid."; String get loading_your_wallet => "Loading your wallet"; String get login => "Login"; + String get new_node_testing => "New node testing"; String get new_subaddress_create => "Create"; String get new_subaddress_label_name => "Label name"; String get new_subaddress_title => "New address"; String get new_wallet => "New Wallet"; String get node_address => "Node Address"; + String get node_connection_failed => "Connection was failed"; + String get node_connection_successful => "Connection was successful"; String get node_new => "New Node"; String get node_port => "Node port"; String get node_reset_settings_title => "Reset settings"; + String get node_test => "Test"; String get nodes => "Nodes"; String get nodes_list_reset_to_default_message => "Are you sure that you want to reset settings to default?"; String get offer_expires_in => "Offer expires in: "; @@ -298,6 +303,7 @@ class S implements WidgetsLocalizations { String get transactions => "Transactions"; String get transactions_by_date => "Transactions by date"; String get use => "Switch to "; + String get use_ssl => "Use SSL"; String get view_key_private => "View key (private)"; String get view_key_public => "View key (public)"; String get wallet_keys => "Wallet seed/keys"; @@ -498,10 +504,14 @@ class $de extends S { @override String get trade_details_pair => "Paar"; @override + String get use_ssl => "Verwenden Sie SSL"; + @override String get choose_wallet_currency => "Bitte wählen Sie die Brieftaschenwährung:"; @override String get pre_seed_description => "Auf der nächsten Seite sehen Sie eine Reihe von 25 Wörtern. Dies ist Ihr einzigartiger und privater Samen und der EINZIGE Weg, um Ihren Geldbeutel im Falle eines Verlusts oder einer Fehlfunktion wiederherzustellen. Es liegt in IHRER Verantwortung, es aufzuschreiben und an einem sicheren Ort außerhalb der Cake Wallet App aufzubewahren."; @override + String get node_connection_successful => "Die Verbindung war erfolgreich"; + @override String get confirm => "Bestätigen"; @override String get settings_display_balance_as => "Kontostand anzeigen als"; @@ -544,6 +554,8 @@ class $de extends S { @override String get contact => "Kontakt"; @override + String get change_current_node_title => "Ändern Sie den aktuellen Knoten"; + @override String get openalias_alert_title => "XMR-Empfänger erkannt"; @override String get auth_store_incorrect_password => "Falsches PIN"; @@ -576,6 +588,8 @@ class $de extends S { @override String get xmr_hidden => "Versteckt"; @override + String get node_connection_failed => "Verbindung fehlgeschlagen"; + @override String get send_xmr => "Senden XMR"; @override String get exchange => "Austausch"; @@ -652,6 +666,8 @@ class $de extends S { @override String get widgets_restore_from_blockheight => "Aus Blockhöhe wiederherstellen"; @override + String get new_node_testing => "Neuer Knotentest"; + @override String get seed_language_chinese => "Chinesisch"; @override String get new_subaddress_label_name => "Markenname"; @@ -786,6 +802,8 @@ class $de extends S { @override String get change => "Veränderung"; @override + String get node_test => "Test"; + @override String get trade_state_finished => "Fertig"; @override String get pin_is_incorrect => "PIN ist falsch"; @@ -1178,10 +1196,14 @@ class $hi extends S { @override String get trade_details_pair => "जोड़ा"; @override + String get use_ssl => "उपयोग SSL"; + @override String get choose_wallet_currency => "कृपया बटुआ मुद्रा चुनें:"; @override String get pre_seed_description => "अगले पेज पर आपको 25 शब्दों की एक श्रृंखला दिखाई देगी। यह आपका अद्वितीय और निजी बीज है और नुकसान या खराबी के मामले में अपने बटुए को पुनर्प्राप्त करने का एकमात्र तरीका है। यह आपकी जिम्मेदारी है कि इसे नीचे लिखें और इसे Cake Wallet ऐप के बाहर सुरक्षित स्थान पर संग्रहीत करें।"; @override + String get node_connection_successful => "कनेक्शन सफल रहा"; + @override String get confirm => "की पुष्टि करें"; @override String get settings_display_balance_as => "के रूप में संतुलन प्रदर्शित करें"; @@ -1224,6 +1246,8 @@ class $hi extends S { @override String get contact => "संपर्क करें"; @override + String get change_current_node_title => "वर्तमान नोड बदलें"; + @override String get openalias_alert_title => "XMR प्राप्तकर्ता का पता लगाया"; @override String get auth_store_incorrect_password => "गलत पिन"; @@ -1256,6 +1280,8 @@ class $hi extends S { @override String get xmr_hidden => "छिपा हुआ"; @override + String get node_connection_failed => "कनेक्शन विफल रहा"; + @override String get send_xmr => "संदेश XMR"; @override String get exchange => "अदला बदली"; @@ -1332,6 +1358,8 @@ class $hi extends S { @override String get widgets_restore_from_blockheight => "ब्लॉकचेन से पुनर्स्थापित करें"; @override + String get new_node_testing => "नई नोड परीक्षण"; + @override String get seed_language_chinese => "चीनी"; @override String get new_subaddress_label_name => "लेबल का नाम"; @@ -1466,6 +1494,8 @@ class $hi extends S { @override String get change => "परिवर्तन"; @override + String get node_test => "परीक्षा"; + @override String get trade_state_finished => "ख़त्म होना"; @override String get pin_is_incorrect => "पिन गलत है"; @@ -1858,10 +1888,14 @@ class $ru extends S { @override String get trade_details_pair => "Пара"; @override + String get use_ssl => "Использовать SSL"; + @override String get choose_wallet_currency => "Пожалуйста, выберите валюту кошелька:"; @override String get pre_seed_description => "На следующей странице вы увидите серию из 25 слов. Это ваша уникальная и личная мнемоническая фраза, и это ЕДИНСТВЕННЫЙ способ восстановить свой кошелек в случае потери или неисправности. ВАМ необходимо записать ее и хранить в надежном месте вне приложения Cake Wallet."; @override + String get node_connection_successful => "Подключение прошло успешно"; + @override String get confirm => "Подтвердить"; @override String get settings_display_balance_as => "Отображать баланс как"; @@ -1904,6 +1938,8 @@ class $ru extends S { @override String get contact => "Контакт"; @override + String get change_current_node_title => "Изменить текущую ноду"; + @override String get openalias_alert_title => "Получатель XMR обнаружен"; @override String get auth_store_incorrect_password => "Некорректный PIN"; @@ -1936,6 +1972,8 @@ class $ru extends S { @override String get xmr_hidden => "Скрыто"; @override + String get node_connection_failed => "Подключение не удалось"; + @override String get send_xmr => "Отправить XMR"; @override String get exchange => "Обмен"; @@ -2012,6 +2050,8 @@ class $ru extends S { @override String get widgets_restore_from_blockheight => "Восстановить на высоте блока"; @override + String get new_node_testing => "Тестирование новой ноды"; + @override String get seed_language_chinese => "Китайский"; @override String get new_subaddress_label_name => "Имя"; @@ -2146,6 +2186,8 @@ class $ru extends S { @override String get change => "Изменить"; @override + String get node_test => "Тест"; + @override String get trade_state_finished => "Завершена"; @override String get pin_is_incorrect => "Некорректный PIN"; @@ -2538,10 +2580,14 @@ class $ko extends S { @override String get trade_details_pair => "쌍"; @override + String get use_ssl => "SSL 사용"; + @override String get choose_wallet_currency => "지갑 통화를 선택하십시오:"; @override String get pre_seed_description => "다음 페이지에서 25 개의 단어를 볼 수 있습니다. 이것은 귀하의 고유하고 개인적인 시드이며 분실 또는 오작동시 지갑을 복구하는 유일한 방법입니다. 기록해두고 Cake Wallet 앱 외부의 안전한 장소에 보관하는 것은 귀하의 책임입니다."; @override + String get node_connection_successful => "성공적으로 연결되었습니다."; + @override String get confirm => "확인"; @override String get settings_display_balance_as => "잔액 표시"; @@ -2584,6 +2630,8 @@ class $ko extends S { @override String get contact => "접촉"; @override + String get change_current_node_title => "현재 노드 변경"; + @override String get openalias_alert_title => "XMR 수신자 감지"; @override String get auth_store_incorrect_password => "잘못된 PIN"; @@ -2616,6 +2664,8 @@ class $ko extends S { @override String get xmr_hidden => "숨김"; @override + String get node_connection_failed => "연결 실패"; + @override String get send_xmr => "보내다 XMR"; @override String get exchange => "교환"; @@ -2692,6 +2742,8 @@ class $ko extends S { @override String get widgets_restore_from_blockheight => "블록 높이에서 복원"; @override + String get new_node_testing => "새로운 노드 테스트"; + @override String get seed_language_chinese => "중국말"; @override String get new_subaddress_label_name => "라벨 이름"; @@ -2826,6 +2878,8 @@ class $ko extends S { @override String get change => "변화"; @override + String get node_test => "테스트"; + @override String get trade_state_finished => "끝마친"; @override String get pin_is_incorrect => "PIN이 잘못되었습니다"; @@ -3218,10 +3272,14 @@ class $pt extends S { @override String get trade_details_pair => "Par"; @override + String get use_ssl => "Use SSL"; + @override String get choose_wallet_currency => "Escolha a moeda da carteira:"; @override String get pre_seed_description => "Na próxima página, você verá uma série de 25 palavras. Esta é a sua semente única e privada e é a ÚNICA maneira de recuperar sua carteira em caso de perda ou mau funcionamento. É SUA responsabilidade anotá-lo e armazená-lo em um local seguro fora do aplicativo Cake Wallet."; @override + String get node_connection_successful => "A conexão foi bem sucedida"; + @override String get confirm => "Confirmar"; @override String get settings_display_balance_as => "Saldo a exibir"; @@ -3264,6 +3322,8 @@ class $pt extends S { @override String get contact => "Contato"; @override + String get change_current_node_title => "Mudar o nó atual"; + @override String get openalias_alert_title => "Destinatário XMR detectado"; @override String get auth_store_incorrect_password => "PIN incorreto"; @@ -3296,6 +3356,8 @@ class $pt extends S { @override String get xmr_hidden => "Esconder saldo"; @override + String get node_connection_failed => "A conexão falhou"; + @override String get send_xmr => "Enviar XMR"; @override String get exchange => "Trocar"; @@ -3372,6 +3434,8 @@ class $pt extends S { @override String get widgets_restore_from_blockheight => "Restaurar a partir de altura do bloco"; @override + String get new_node_testing => "Teste de novo nó"; + @override String get seed_language_chinese => "Chinesa"; @override String get new_subaddress_label_name => "Nome"; @@ -3506,6 +3570,8 @@ class $pt extends S { @override String get change => "Mudar"; @override + String get node_test => "Teste"; + @override String get trade_state_finished => "Finalizada"; @override String get pin_is_incorrect => "PIN incorreto"; @@ -3898,10 +3964,14 @@ class $uk extends S { @override String get trade_details_pair => "Пара"; @override + String get use_ssl => "Використати SSL"; + @override String get choose_wallet_currency => "Будь ласка, виберіть валюту гаманця:"; @override String get pre_seed_description => "На наступній сторінці ви побачите серію з 25 слів. Це ваша унікальна та приватна мнемонічна фраза, і це ЄДИНИЙ спосіб відновити ваш гаманець на випадок втрати або несправності. ВАМ необхідно записати її та зберігати в безпечному місці поза програмою Cake Wallet."; @override + String get node_connection_successful => "З'єднання було успішним"; + @override String get confirm => "Підтвердити"; @override String get settings_display_balance_as => "Відображати баланс як"; @@ -3944,6 +4014,8 @@ class $uk extends S { @override String get contact => "Контакт"; @override + String get change_current_node_title => "Змінити поточний вузол"; + @override String get openalias_alert_title => "Отримувача XMR виявлено"; @override String get auth_store_incorrect_password => "Некоректний PIN"; @@ -3976,6 +4048,8 @@ class $uk extends S { @override String get xmr_hidden => "Приховано"; @override + String get node_connection_failed => "Помилка з’єднання"; + @override String get send_xmr => "Відправити XMR"; @override String get exchange => "Обмін"; @@ -4052,6 +4126,8 @@ class $uk extends S { @override String get widgets_restore_from_blockheight => "Відновити на висоті блоку"; @override + String get new_node_testing => "Тестування нового вузла"; + @override String get seed_language_chinese => "Китайська"; @override String get new_subaddress_label_name => "Ім'я"; @@ -4186,6 +4262,8 @@ class $uk extends S { @override String get change => "Змінити"; @override + String get node_test => "Тест"; + @override String get trade_state_finished => "Завершена"; @override String get pin_is_incorrect => "Некоректний PIN"; @@ -4578,10 +4656,14 @@ class $ja extends S { @override String get trade_details_pair => "ペア"; @override + String get use_ssl => "SSLを使用する"; + @override String get choose_wallet_currency => "ウォレット通貨を選択してください:"; @override String get pre_seed_description => "次のページでは、一連の25語が表示されます。 これはあなたのユニークでプライベートなシードであり、紛失や誤動作が発生した場合にウォレットを回復する唯一の方法です。 それを書き留めて、Cake Wallet アプリの外の安全な場所に保管するのはあなたの責任です。"; @override + String get node_connection_successful => "接続に成功しました"; + @override String get confirm => "確認する"; @override String get settings_display_balance_as => "残高を表示"; @@ -4624,6 +4706,8 @@ class $ja extends S { @override String get contact => "接触"; @override + String get change_current_node_title => "現在のノードを変更する"; + @override String get openalias_alert_title => "XMR受信者が検出されました"; @override String get auth_store_incorrect_password => "間違ったPIN"; @@ -4656,6 +4740,8 @@ class $ja extends S { @override String get xmr_hidden => "非表示"; @override + String get node_connection_failed => "接続に失敗しました"; + @override String get send_xmr => "送る XMR"; @override String get exchange => "交換する"; @@ -4732,6 +4818,8 @@ class $ja extends S { @override String get widgets_restore_from_blockheight => "ブロックの高さから復元"; @override + String get new_node_testing => "新しいノードのテスト"; + @override String get seed_language_chinese => "中国語"; @override String get new_subaddress_label_name => "ラベル名"; @@ -4866,6 +4954,8 @@ class $ja extends S { @override String get change => "変化する"; @override + String get node_test => "テスト"; + @override String get trade_state_finished => "完成した"; @override String get pin_is_incorrect => "PINが間違っています"; @@ -5262,10 +5352,14 @@ class $pl extends S { @override String get trade_details_pair => "Para"; @override + String get use_ssl => "Użyj SSL"; + @override String get choose_wallet_currency => "Wybierz walutę portfela:"; @override String get pre_seed_description => "Na następnej stronie zobaczysz serię 25 słów. To jest Twoje unikalne i prywatne ziarno i jest to JEDYNY sposób na odzyskanie portfela w przypadku utraty lub awarii. Twoim obowiązkiem jest zapisanie go i przechowywanie w bezpiecznym miejscu poza aplikacją Cake Wallet."; @override + String get node_connection_successful => "Połączenie powiodło się"; + @override String get confirm => "Potwierdzać"; @override String get settings_display_balance_as => "Wyświetl saldo jako"; @@ -5308,6 +5402,8 @@ class $pl extends S { @override String get contact => "Kontakt"; @override + String get change_current_node_title => "Zmień bieżący węzeł"; + @override String get openalias_alert_title => "Wykryto odbiorcę XMR"; @override String get auth_store_incorrect_password => "Niepoprawny PIN"; @@ -5340,6 +5436,8 @@ class $pl extends S { @override String get xmr_hidden => "Ukryty"; @override + String get node_connection_failed => "Połączenie nie powiodło się"; + @override String get send_xmr => "Wysłać XMR"; @override String get exchange => "Wymieniać się"; @@ -5416,6 +5514,8 @@ class $pl extends S { @override String get widgets_restore_from_blockheight => "Przywróć z wysokości bloku"; @override + String get new_node_testing => "Testowanie nowych węzłów"; + @override String get seed_language_chinese => "Chiński"; @override String get new_subaddress_label_name => "Nazwa etykiety"; @@ -5550,6 +5650,8 @@ class $pl extends S { @override String get change => "Zmiana"; @override + String get node_test => "Test"; + @override String get trade_state_finished => "Skończone"; @override String get pin_is_incorrect => "PPIN jest niepoprawny"; @@ -5942,10 +6044,14 @@ class $es extends S { @override String get trade_details_pair => "Par"; @override + String get use_ssl => "Utilice SSL"; + @override String get choose_wallet_currency => "Por favor, elija la moneda de la billetera:"; @override String get pre_seed_description => "En la página siguiente verá una serie de 25 palabras. Esta es su semilla única y privada y es la ÚNICA forma de recuperar su billetera en caso de pérdida o mal funcionamiento. Es SU responsabilidad escribirlo y guardarlo en un lugar seguro fuera de la aplicación Cake Wallet."; @override + String get node_connection_successful => "La conexión fue exitosa"; + @override String get confirm => "Confirmar"; @override String get settings_display_balance_as => "Mostrar saldo como"; @@ -5988,6 +6094,8 @@ class $es extends S { @override String get contact => "Contacto"; @override + String get change_current_node_title => "Cambiar el nodo actual"; + @override String get openalias_alert_title => "Destinatario XMR detectado"; @override String get auth_store_incorrect_password => "Contraseña PIN"; @@ -6020,6 +6128,8 @@ class $es extends S { @override String get xmr_hidden => "Oculto"; @override + String get node_connection_failed => "La conexión falló"; + @override String get send_xmr => "Enviar XMR"; @override String get exchange => "Intercambiar"; @@ -6096,6 +6206,8 @@ class $es extends S { @override String get widgets_restore_from_blockheight => "Restaurar desde blockheight"; @override + String get new_node_testing => "Prueba de nuevos nodos"; + @override String get seed_language_chinese => "Chino"; @override String get new_subaddress_label_name => "Nombre de etiqueta"; @@ -6230,6 +6342,8 @@ class $es extends S { @override String get change => "Cambio"; @override + String get node_test => "Prueba"; + @override String get trade_state_finished => "Terminado"; @override String get pin_is_incorrect => "PIN es incorrecto"; @@ -6622,10 +6736,14 @@ class $nl extends S { @override String get trade_details_pair => "Paar"; @override + String get use_ssl => "Gebruik SSL"; + @override String get choose_wallet_currency => "Kies een portemonnee-valuta:"; @override String get pre_seed_description => "Op de volgende pagina ziet u een reeks van 25 woorden. Dit is uw unieke en persoonlijke zaadje en het is de ENIGE manier om uw portemonnee te herstellen in geval van verlies of storing. Het is JOUW verantwoordelijkheid om het op te schrijven en op een veilige plaats op te slaan buiten de Cake Wallet app."; @override + String get node_connection_successful => "Verbinding is gelukt"; + @override String get confirm => "Bevestigen"; @override String get settings_display_balance_as => "Toon saldo als"; @@ -6668,6 +6786,8 @@ class $nl extends S { @override String get contact => "Contact"; @override + String get change_current_node_title => "Wijzig het huidige knooppunt"; + @override String get openalias_alert_title => "XMR-ontvanger gedetecteerd"; @override String get auth_store_incorrect_password => "Incorrect PIN"; @@ -6700,6 +6820,8 @@ class $nl extends S { @override String get xmr_hidden => "Verborgen"; @override + String get node_connection_failed => "De verbinding is mislukt"; + @override String get send_xmr => "Sturen XMR"; @override String get exchange => "Uitwisseling"; @@ -6776,6 +6898,8 @@ class $nl extends S { @override String get widgets_restore_from_blockheight => "Herstel vanaf blockheight"; @override + String get new_node_testing => "Nieuwe knooppunttest"; + @override String get seed_language_chinese => "Chinese"; @override String get new_subaddress_label_name => "Label naam"; @@ -6910,6 +7034,8 @@ class $nl extends S { @override String get change => "Verandering"; @override + String get node_test => "Test"; + @override String get trade_state_finished => "Afgewerkt"; @override String get pin_is_incorrect => "PIN is onjuist"; @@ -7302,10 +7428,14 @@ class $zh extends S { @override String get trade_details_pair => "对"; @override + String get use_ssl => "使用SSL"; + @override String get choose_wallet_currency => "請選擇錢包貨幣:"; @override String get pre_seed_description => "在下一頁上,您將看到一系列25個單詞。 這是您獨特的私人種子,是丟失或出現故障時恢復錢包的唯一方法。 您有責任將其寫下並存儲在Cake Wallet應用程序外部的安全地方。"; @override + String get node_connection_successful => "連接成功"; + @override String get confirm => "确认"; @override String get settings_display_balance_as => "将余额显示为"; @@ -7348,6 +7478,8 @@ class $zh extends S { @override String get contact => "联系"; @override + String get change_current_node_title => "更改當前節點"; + @override String get openalias_alert_title => "檢測到XMR收件人"; @override String get auth_store_incorrect_password => "PIN码错误"; @@ -7380,6 +7512,8 @@ class $zh extends S { @override String get xmr_hidden => "隱"; @override + String get node_connection_failed => "連接失敗"; + @override String get send_xmr => "发送 XMR"; @override String get exchange => "交换"; @@ -7456,6 +7590,8 @@ class $zh extends S { @override String get widgets_restore_from_blockheight => "从块高还原"; @override + String get new_node_testing => "新節點測試"; + @override String get seed_language_chinese => "中文"; @override String get new_subaddress_label_name => "标签名称"; @@ -7590,6 +7726,8 @@ class $zh extends S { @override String get change => "更改"; @override + String get node_test => "測試"; + @override String get trade_state_finished => "已完成"; @override String get pin_is_incorrect => "PIN码不正确"; diff --git a/lib/monero/monero_wallet.dart b/lib/monero/monero_wallet.dart index 2d4878b4c..bf912a4fd 100644 --- a/lib/monero/monero_wallet.dart +++ b/lib/monero/monero_wallet.dart @@ -147,8 +147,7 @@ abstract class MoneroWalletBase extends WalletBase with Store { address: node.uri, login: node.login, password: node.password, - useSSL: false, - // FIXME: hardcoded value + useSSL: node.isSSL, isLightWallet: false); // FIXME: hardcoded value syncStatus = ConnectedSyncStatus(); } catch (e) { diff --git a/lib/src/screens/nodes/node_create_or_edit_page.dart b/lib/src/screens/nodes/node_create_or_edit_page.dart index ee13984c5..6cfa67285 100644 --- a/lib/src/screens/nodes/node_create_or_edit_page.dart +++ b/lib/src/screens/nodes/node_create_or_edit_page.dart @@ -1,3 +1,7 @@ +import 'package:cake_wallet/core/execution_state.dart'; +import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; +import 'package:cake_wallet/src/widgets/standard_checkbox.dart'; +import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; @@ -67,6 +71,39 @@ class NodeCreateOrEditPage extends BasePage { @override Widget body(BuildContext context) { + + reaction((_) => nodeCreateOrEditViewModel.connectionState, + (ExecutionState state) { + if (state is ExecutedSuccessfullyState) { + WidgetsBinding.instance.addPostFrameCallback((_) { + showPopUp( + context: context, + builder: (BuildContext context) => + AlertWithOneAction( + alertTitle: S.of(context).new_node_testing, + alertContent: state.payload as bool + ? S.of(context).node_connection_successful + : S.of(context).node_connection_failed, + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop())); + }); + } + + if (state is FailureState) { + WidgetsBinding.instance.addPostFrameCallback((_) { + showPopUp( + context: context, + builder: (BuildContext context) { + return AlertWithOneAction( + alertTitle: S.of(context).error, + alertContent: state.error, + buttonText: S.of(context).ok, + buttonAction: () => Navigator.of(context).pop()); + }); + }); + } + }); + return Container( padding: EdgeInsets.only(left: 24, right: 24), child: ScrollableWithBottomSection( @@ -122,7 +159,22 @@ class NodeCreateOrEditPage extends BasePage { ) ) ], - ) + ), + Padding( + padding: EdgeInsets.only(top: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Observer( + builder: (_) => StandardCheckbox( + value: nodeCreateOrEditViewModel.useSSL, + onChanged: (value) => + nodeCreateOrEditViewModel.useSSL = value, + caption: S.of(context).use_ssl, + )) + ], + )) ] ], )), @@ -133,9 +185,18 @@ class NodeCreateOrEditPage extends BasePage { Flexible( child: Container( padding: EdgeInsets.only(right: 8.0), - child: PrimaryButton( - onPressed: () => nodeCreateOrEditViewModel.reset(), - text: S.of(context).reset, + child: LoadingPrimaryButton( + onPressed: () async { + if (!_formKey.currentState.validate()) { + return; + } + + await nodeCreateOrEditViewModel.connect(); + }, + isLoading: nodeCreateOrEditViewModel + .connectionState is IsExecutingState, + text: S.of(context).node_test, + isDisabled: !nodeCreateOrEditViewModel.isReady, color: Colors.orange, textColor: Colors.white), )), @@ -154,7 +215,9 @@ class NodeCreateOrEditPage extends BasePage { text: S.of(context).save, color: Theme.of(context).accentTextTheme.body2.color, textColor: Colors.white, - isDisabled: !nodeCreateOrEditViewModel.isReady, + isDisabled: (!nodeCreateOrEditViewModel.isReady)|| + (nodeCreateOrEditViewModel + .connectionState is IsExecutingState), ), )), ], diff --git a/lib/src/screens/nodes/nodes_list_page.dart b/lib/src/screens/nodes/nodes_list_page.dart index 20abdae32..80697afad 100644 --- a/lib/src/screens/nodes/nodes_list_page.dart +++ b/lib/src/screens/nodes/nodes_list_page.dart @@ -99,9 +99,9 @@ class NodeListPage extends BasePage { await showPopUp( context: context, builder: (BuildContext context) { - // FIXME: Add translation. return AlertWithTwoActions( - alertTitle: 'Change current node', + alertTitle: S.of(context) + .change_current_node_title, alertContent: S .of(context) .change_current_node(node.uri), diff --git a/lib/src/widgets/standard_checkbox.dart b/lib/src/widgets/standard_checkbox.dart new file mode 100644 index 000000000..774acc9b7 --- /dev/null +++ b/lib/src/widgets/standard_checkbox.dart @@ -0,0 +1,76 @@ +import 'dart:ui'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class StandardCheckbox extends StatefulWidget { + StandardCheckbox({ + @required this.value, + this.caption = '', + @required this.onChanged}); + + final bool value; + final String caption; + final Function(bool) onChanged; + + @override + StandardCheckboxState createState() => + StandardCheckboxState(value, caption, onChanged); +} + +class StandardCheckboxState extends State { + StandardCheckboxState(this.value, this.caption, this.onChanged); + + bool value; + String caption; + Function(bool) onChanged; + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () { + value = !value; + onChanged(value); + setState(() {}); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + height: 24.0, + width: 24.0, + margin: EdgeInsets.only( + right: 10.0, + ), + decoration: BoxDecoration( + border: Border.all( + color: Theme.of(context) + .primaryTextTheme + .caption + .color, + width: 1.0), + borderRadius: BorderRadius.all( + Radius.circular(8.0)), + color: Theme.of(context).backgroundColor), + child: value + ? Icon( + Icons.check, + color: Colors.blue, + size: 20.0, + ) + : Offstage(), + ), + Text( + caption, + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context) + .primaryTextTheme + .title + .color), + ) + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/store/dashboard/trade_filter_store.dart b/lib/store/dashboard/trade_filter_store.dart index 46e1193bb..02ad383e7 100644 --- a/lib/store/dashboard/trade_filter_store.dart +++ b/lib/store/dashboard/trade_filter_store.dart @@ -3,7 +3,7 @@ import 'package:mobx/mobx.dart'; import 'package:cake_wallet/exchange/exchange_provider_description.dart'; import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart'; -part 'trade_filter_store.g.dart'; +part'trade_filter_store.g.dart'; class TradeFilterStore = TradeFilterStoreBase with _$TradeFilterStore; diff --git a/lib/view_model/node_list/node_create_or_edit_view_model.dart b/lib/view_model/node_list/node_create_or_edit_view_model.dart index fb6cd195e..0a5e07266 100644 --- a/lib/view_model/node_list/node_create_or_edit_view_model.dart +++ b/lib/view_model/node_list/node_create_or_edit_view_model.dart @@ -12,7 +12,9 @@ class NodeCreateOrEditViewModel = NodeCreateOrEditViewModelBase abstract class NodeCreateOrEditViewModelBase with Store { NodeCreateOrEditViewModelBase(this._nodeSource, this._wallet) - : state = InitialExecutionState(); + : state = InitialExecutionState(), + connectionState = InitialExecutionState(), + useSSL = false; @observable ExecutionState state; @@ -29,6 +31,12 @@ abstract class NodeCreateOrEditViewModelBase with Store { @observable String password; + @observable + ExecutionState connectionState; + + @observable + bool useSSL; + @computed bool get isReady => (address?.isNotEmpty ?? false) && (port?.isNotEmpty ?? false); @@ -54,6 +62,7 @@ abstract class NodeCreateOrEditViewModelBase with Store { port = ''; login = ''; password = ''; + useSSL = false; } @action @@ -61,11 +70,25 @@ abstract class NodeCreateOrEditViewModelBase with Store { try { state = IsExecutingState(); final node = - Node(uri: uri, type: _wallet.type, login: login, password: password); + Node(uri: uri, type: _wallet.type, login: login, password: password, + useSSL: useSSL); await _nodeSource.add(node); state = ExecutedSuccessfullyState(); } catch (e) { state = FailureState(e.toString()); } } + + @action + Future connect() async { + try { + connectionState = IsExecutingState(); + final node = + Node(uri: uri, type: _wallet.type, login: login, password: password); + final isAlive = await node.requestNode(); + connectionState = ExecutedSuccessfullyState(payload: isAlive); + } catch (e) { + connectionState = FailureState(e.toString()); + } + } } diff --git a/res/values/strings_de.arb b/res/values/strings_de.arb index bfe1ae8de..c59d74560 100644 --- a/res/values/strings_de.arb +++ b/res/values/strings_de.arb @@ -129,6 +129,11 @@ "remove" : "Löschen", "delete" : "Löschen", "add_new_node" : "Neuen Knoten hinzufügen", + "change_current_node_title" : "Ändern Sie den aktuellen Knoten", + "node_test" : "Test", + "node_connection_successful" : "Die Verbindung war erfolgreich", + "node_connection_failed" : "Verbindung fehlgeschlagen", + "new_node_testing" : "Neuer Knotentest", "use" : "Verwenden Sie ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TO-Fehler", "xmr_to_error_description" : "Ungültiger Betrag. Höchstgrenze 8 Stellen nach dem Dezimalpunkt", - "provider_error" : "${provider} Error" + "provider_error" : "${provider} Error", + + + "use_ssl" : "Verwenden Sie SSL" } \ No newline at end of file diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 368204d9e..ed39857bc 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -129,6 +129,11 @@ "remove" : "Remove", "delete" : "Delete", "add_new_node" : "Add new node", + "change_current_node_title" : "Change current node", + "node_test" : "Test", + "node_connection_successful" : "Connection was successful", + "node_connection_failed" : "Connection was failed", + "new_node_testing" : "New node testing", "use" : "Switch to ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TO error", "xmr_to_error_description" : "Invalid amount. Maximum limit 8 digits after the decimal point", - "provider_error" : "${provider} error" + "provider_error" : "${provider} error", + + + "use_ssl" : "Use SSL" } \ No newline at end of file diff --git a/res/values/strings_es.arb b/res/values/strings_es.arb index e0680e109..07e32da3c 100644 --- a/res/values/strings_es.arb +++ b/res/values/strings_es.arb @@ -129,6 +129,11 @@ "remove" : "Retirar", "delete" : "Borrar", "add_new_node" : "Agregar nuevo nodo", + "change_current_node_title" : "Cambiar el nodo actual", + "node_test" : "Prueba", + "node_connection_successful" : "La conexión fue exitosa", + "node_connection_failed" : "La conexión falló", + "new_node_testing" : "Prueba de nuevos nodos", "use" : "Utilizar a ", @@ -416,5 +421,8 @@ "xmr_to_error" : "Error de XMR.TO", "xmr_to_error_description" : "Monto invalido. Límite máximo de 8 dígitos después del punto decimal", - "provider_error" : "${provider} error" + "provider_error" : "${provider} error", + + + "use_ssl" : "Utilice SSL" } \ No newline at end of file diff --git a/res/values/strings_hi.arb b/res/values/strings_hi.arb index d49ad9161..444f9d57d 100644 --- a/res/values/strings_hi.arb +++ b/res/values/strings_hi.arb @@ -129,6 +129,11 @@ "remove" : "हटाना", "delete" : "हटाएं", "add_new_node" : "नया नोड जोड़ें", + "change_current_node_title" : "वर्तमान नोड बदलें", + "node_test" : "परीक्षा", + "node_connection_successful" : "कनेक्शन सफल रहा", + "node_connection_failed" : "कनेक्शन विफल रहा", + "new_node_testing" : "नई नोड परीक्षण", "use" : "उपयोग ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TO त्रुटि", "xmr_to_error_description" : "अवैध राशि। दशमलव बिंदु के बाद अधिकतम सीमा 8 अंक", - "provider_error" : "${provider} त्रुटि" + "provider_error" : "${provider} त्रुटि", + + + "use_ssl" : "उपयोग SSL" } \ No newline at end of file diff --git a/res/values/strings_ja.arb b/res/values/strings_ja.arb index 0a8a72478..307aa1096 100644 --- a/res/values/strings_ja.arb +++ b/res/values/strings_ja.arb @@ -129,6 +129,11 @@ "remove" : "削除する", "delete" : "削除する", "add_new_node" : "新しいノードを追加", + "change_current_node_title" : "現在のノードを変更する", + "node_test" : "テスト", + "node_connection_successful" : "接続に成功しました", + "node_connection_failed" : "接続に失敗しました", + "new_node_testing" : "新しいノードのテスト", "use" : "使用する ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TOエラー", "xmr_to_error_description" : "金額が無効です。 小数点以下8桁の上限", - "provider_error" : "${provider} エラー" + "provider_error" : "${provider} エラー", + + + "use_ssl" : "SSLを使用する" } \ No newline at end of file diff --git a/res/values/strings_ko.arb b/res/values/strings_ko.arb index e3fec3cdb..d4d07f05f 100644 --- a/res/values/strings_ko.arb +++ b/res/values/strings_ko.arb @@ -129,6 +129,11 @@ "remove" : "없애다", "delete" : "지우다", "add_new_node" : "새 노드 추가", + "change_current_node_title" : "현재 노드 변경", + "node_test" : "테스트", + "node_connection_successful" : "성공적으로 연결되었습니다.", + "node_connection_failed" : "연결 실패", + "new_node_testing" : "새로운 노드 테스트", "use" : "사용하다 ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TO 오류", "xmr_to_error_description" : "금액이 잘못되었습니다. 소수점 이하 최대 8 자리", - "provider_error" : "${provider} 오류" + "provider_error" : "${provider} 오류", + + + "use_ssl" : "SSL 사용" } \ No newline at end of file diff --git a/res/values/strings_nl.arb b/res/values/strings_nl.arb index 527ecfdb4..773ff1588 100644 --- a/res/values/strings_nl.arb +++ b/res/values/strings_nl.arb @@ -129,6 +129,11 @@ "remove" : "Verwijderen", "delete" : "Delete", "add_new_node" : "Voeg een nieuw knooppunt toe", + "change_current_node_title" : "Wijzig het huidige knooppunt", + "node_test" : "Test", + "node_connection_successful" : "Verbinding is gelukt", + "node_connection_failed" : "De verbinding is mislukt", + "new_node_testing" : "Nieuwe knooppunttest", "use" : "Gebruik ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TO-fout", "xmr_to_error_description" : "Ongeldige hoeveelheid. Maximaal 8 cijfers achter de komma", - "provider_error" : "${provider} fout" + "provider_error" : "${provider} fout", + + + "use_ssl" : "Gebruik SSL" } \ No newline at end of file diff --git a/res/values/strings_pl.arb b/res/values/strings_pl.arb index ece0e6260..2c7f627fa 100644 --- a/res/values/strings_pl.arb +++ b/res/values/strings_pl.arb @@ -129,6 +129,11 @@ "remove" : "Usunąć", "delete" : "Kasować", "add_new_node" : "Dodaj nowy węzeł", + "change_current_node_title" : "Zmień bieżący węzeł", + "node_test" : "Test", + "node_connection_successful" : "Połączenie powiodło się", + "node_connection_failed" : "Połączenie nie powiodło się", + "new_node_testing" : "Testowanie nowych węzłów", "use" : "Używać ", @@ -416,5 +421,8 @@ "xmr_to_error" : "Pomyłka XMR.TO", "xmr_to_error_description" : "Nieprawidłowa kwota. Maksymalny limit 8 cyfr po przecinku", - "provider_error" : "${provider} pomyłka" + "provider_error" : "${provider} pomyłka", + + + "use_ssl" : "Użyj SSL" } \ No newline at end of file diff --git a/res/values/strings_pt.arb b/res/values/strings_pt.arb index f3c6b6ea9..b00c0122e 100644 --- a/res/values/strings_pt.arb +++ b/res/values/strings_pt.arb @@ -129,6 +129,11 @@ "remove" : "Remover", "delete" : "Excluir", "add_new_node" : "Adicionar novo nó", + "change_current_node_title" : "Mudar o nó atual", + "node_test" : "Teste", + "node_connection_successful" : "A conexão foi bem sucedida", + "node_connection_failed" : "A conexão falhou", + "new_node_testing" : "Teste de novo nó", "use" : "Use PIN de ", @@ -416,5 +421,8 @@ "xmr_to_error" : "Erro XMR.TO", "xmr_to_error_description" : "Montante inválido. Limite máximo de 8 dígitos após o ponto decimal", - "provider_error" : "${provider} erro" + "provider_error" : "${provider} erro", + + + "use_ssl" : "Use SSL" } diff --git a/res/values/strings_ru.arb b/res/values/strings_ru.arb index 03f9c09df..3f299670e 100644 --- a/res/values/strings_ru.arb +++ b/res/values/strings_ru.arb @@ -129,6 +129,11 @@ "remove" : "Удалить", "delete" : "Удалить", "add_new_node" : "Добавить новую ноду", + "change_current_node_title" : "Изменить текущую ноду", + "node_test" : "Тест", + "node_connection_successful" : "Подключение прошло успешно", + "node_connection_failed" : "Подключение не удалось", + "new_node_testing" : "Тестирование новой ноды", "use" : "Использовать ", @@ -416,5 +421,8 @@ "xmr_to_error" : "Ошибка XMR.TO", "xmr_to_error_description" : "Недопустимая сумма. Максимум 8 цифр после десятичной точки", - "provider_error" : "${provider} ошибка" + "provider_error" : "${provider} ошибка", + + + "use_ssl" : "Использовать SSL" } \ No newline at end of file diff --git a/res/values/strings_uk.arb b/res/values/strings_uk.arb index cc7346a46..51035a4e9 100644 --- a/res/values/strings_uk.arb +++ b/res/values/strings_uk.arb @@ -129,6 +129,11 @@ "remove" : "Видалити", "delete" : "Видалити", "add_new_node" : "Додати новий вузол", + "change_current_node_title" : "Змінити поточний вузол", + "node_test" : "Тест", + "node_connection_successful" : "З'єднання було успішним", + "node_connection_failed" : "Помилка з’єднання", + "new_node_testing" : "Тестування нового вузла", "use" : "Використати ", @@ -416,5 +421,8 @@ "xmr_to_error" : "Помилка XMR.TO", "xmr_to_error_description" : "Неприпустима сума. Максимум 8 цифр після десяткової коми", - "provider_error" : "${provider} помилка" + "provider_error" : "${provider} помилка", + + + "use_ssl" : "Використати SSL" } \ No newline at end of file diff --git a/res/values/strings_zh.arb b/res/values/strings_zh.arb index 9978d9137..9c5cd6fdb 100644 --- a/res/values/strings_zh.arb +++ b/res/values/strings_zh.arb @@ -129,6 +129,11 @@ "remove" : "去掉", "delete" : "删除", "add_new_node" : "添加新節點", + "change_current_node_title" : "更改當前節點", + "node_test" : "測試", + "node_connection_successful" : "連接成功", + "node_connection_failed" : "連接失敗", + "new_node_testing" : "新節點測試", "use" : "採用 ", @@ -416,5 +421,8 @@ "xmr_to_error" : "XMR.TO錯誤", "xmr_to_error_description" : "無效的金額。 小數點後最多8位數字", - "provider_error" : "${provider} 錯誤" + "provider_error" : "${provider} 錯誤", + + + "use_ssl" : "使用SSL" } \ No newline at end of file