Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Commit

Permalink
v0.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pinpong committed Dec 11, 2017
1 parent 3f4006e commit 36a1d67
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

def versionMajor = 0
def versionMinor = 9
def versionPatch = 1
def versionPatch = 2
def magicNumber = 9 * 1000 + 1 * 100 // last number before apply automatic logic

//TODO edit the changelog as well
Expand Down Expand Up @@ -94,7 +94,7 @@ dependencies {
implementation 'org.knowm.xchange:xchange-okcoin:4.3.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'org.iota:jota:0.9.10'
implementation 'com.github.iotaledger:iota~lib~java:6c2df37'
}

static def getGitCommitCount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@

package org.iota.wallet.api.handler;

import android.app.Activity;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Bundle;

import org.iota.wallet.R;
import org.iota.wallet.api.requests.ApiRequest;
Expand All @@ -32,6 +34,7 @@
import org.iota.wallet.helper.Constants;
import org.iota.wallet.helper.NotificationHelper;
import org.iota.wallet.helper.Utils;
import org.iota.wallet.ui.dialog.KeyReuseDetectedDialog;

import java.util.Arrays;

Expand Down Expand Up @@ -72,30 +75,45 @@ public ApiResponse handle(ApiRequest request) {
null,
//remainder address
null,
false));
false,
true));
} catch (ArgumentException | IllegalAccessError e) {
NetworkError error = new NetworkError();

NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(notificationId);

if (((SendTransferRequest) request).getValue().equals("0")
&& ((SendTransferRequest) request).getTag().equals(Constants.NEW_ADDRESS_TAG)) {
NotificationHelper.responseNotification(context, R.drawable.ic_address, context.getString(R.string.notification_attaching_new_address_response_failed_title), notificationId);
if (mNotificationManager != null) {
mNotificationManager.cancel(notificationId);
}

} else {
NotificationHelper.responseNotification(context, R.drawable.ic_fab_send, context.getString(R.string.notification_send_transfer_response_failed_title), notificationId);
if (e instanceof ArgumentException) {
if (e.getMessage().contains("Sending to a used address.") || e.getMessage().contains("Private key reuse detect!")) {
final Activity activity = (Activity) context;
Bundle bundle = new Bundle();
bundle.putString("error", e.getMessage());
KeyReuseDetectedDialog dialog = new KeyReuseDetectedDialog();
dialog.setArguments(bundle);
dialog.show(activity.getFragmentManager(), null);
error.setErrorType(NetworkErrorType.KEY_REUSE_ERROR);
}
}

if (e instanceof IllegalAccessError) {
error.setErrorType(NetworkErrorType.ACCESS_ERROR);
mNotificationManager.cancel(notificationId);
if (((SendTransferRequest) request).getTag().equals(Constants.NEW_ADDRESS_TAG))
NotificationHelper.responseNotification(context, R.drawable.ic_error, context.getString(R.string.notification_address_attach_to_tangle_blocked_title), notificationId);
else
NotificationHelper.responseNotification(context, R.drawable.ic_error, context.getString(R.string.notification_transfer_attach_to_tangle_blocked_title), notificationId);
} else
error.setErrorType(NetworkErrorType.NETWORK_ERROR);
} else {
if (error.getErrorType() != NetworkErrorType.KEY_REUSE_ERROR) {
error.setErrorType(NetworkErrorType.NETWORK_ERROR);
}
if (((SendTransferRequest) request).getValue().equals("0") && ((SendTransferRequest) request).getTag().equals(Constants.NEW_ADDRESS_TAG)) {
NotificationHelper.responseNotification(context, R.drawable.ic_address, context.getString(R.string.notification_attaching_new_address_response_failed_title), notificationId);

} else {
NotificationHelper.responseNotification(context, R.drawable.ic_fab_send, context.getString(R.string.notification_send_transfer_response_failed_title), notificationId);
}
}

response = error;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ public enum NetworkErrorType {
NETWORK_ERROR,
IOTA_COOL_NETWORK_ERROR,
ACCESS_ERROR,
INVALID_HASH_ERROR
INVALID_HASH_ERROR,
KEY_REUSE_ERROR
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2017 IOTA Foundation
*
* Authors: pinpong, adrianziser, saschan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package org.iota.wallet.ui.dialog;

import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;

import org.iota.wallet.R;

public class KeyReuseDetectedDialog extends DialogFragment implements DialogInterface.OnClickListener {

public KeyReuseDetectedDialog() {
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

Bundle bundle = getArguments();
String error = bundle.getString("error");
String message = "";
String title = "";

if (error != null) {
if (error.contains("Sending to a used address.")) {
title = getString(R.string.title_spend_to_used_address);
message = getResources().getString(R.string.message_spend_to_used_address);

} else if (error.contains("Private key reuse detect!")) {
title = getResources().getString(R.string.title_key_reuse_detect);
message = getResources().getString(R.string.message_key_reuse_detect);
}
}

return new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle)
.setTitle(title)
.setMessage(message)
.setCancelable(false)
.setPositiveButton(R.string.buttons_ok, null)
.create();
}

@Override
public void onClick(DialogInterface dialogInterface, int which) {
switch (which) {
case AlertDialog.BUTTON_NEGATIVE:
getDialog().dismiss();
break;
}
}

}
8 changes: 8 additions & 0 deletions app/src/main/res/raw/changelog.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<changelog bulletedList="true">

<changelogversion
changeDate="December 11, 2017"
versionName="0.9.2">
<changelogtext>Updated dependencies</changelogtext>
<changelogtext>Bug fixes</changelogtext>
<changelogtext>Improved stability</changelogtext>
</changelogversion>

<changelogversion
changeDate="November 11, 2017"
versionName="0.9.1">
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
<string name="copy_hash">Hash kopieren</string>
<string name="open_tangle_explorer">Im Tangle Explorer öffnen</string>
<string name="receive_to_address">Anfordern an diese Adresse</string>
<string name="replay_bundle">Transfer wiederholen</string>
<string name="replay_bundle">Transfer erneut anhängen</string>
<string name="title_current_seed">Aktueller Seed:</string>
<string name="title_enter_password">Passwort eingeben</string>
<string name="message_enter_password">Lege dein Passwort fest</string>
Expand All @@ -205,6 +205,10 @@
<string name="message_forgot_password">Es gibt keine Möglichkeit der Wiederherstellung. Mit neuem Seed anmelden? Das wird den alten löschen.</string>
<string name="title_root_detected">Gerät möglicherweise gerootet!</string>
<string name="message_root_detected">Es ist anzunhemen das dieses Gerät gerootet ist. Weiter auf eigene Gefahr?</string>
<string name="title_spend_to_used_address">Senden an eine schon benutzte Adresse!</string>
<string name="message_spend_to_used_address">Sie versuchen eine Transaktion an eine Adresse zu senden, die bereits verwendet wurde (d. h. Token wurden bereits von dieser Adresse gesendet). Bitte fragen Sie den Empfänger nach einer neuen Adresse, die noch nicht für ausgehende Transaktionen benutzt wurde.</string>
<string name="title_key_reuse_detect">Wiederverwendung des privaten Schlüssels erkannt!</string>
<string name="message_key_reuse_detect">Sie versuchen eine Transaktion mit einer bereits verwendeten Adresse zu signieren. IOTA verwendet das Winternitz-Einmalsignatur-Schema für einmalige Unterschrift (W-OTS). Aufgrund seiner Einmaligkeit sinkt die Sicherheit von Geldmitteln in einer Adresse schnell, wenn Sie neue Transaktionen mit demselben Schlüssel neu signieren. Bitte warten Sie, bis die vorherige Transaktion bestätigt wurde bevor eine weitere Transaktion gesendet wird. Durch erneutes anhängen der Transaktion bekommen Sie diese betätigt.</string>

<!-- Confirm transfer dialog -->
<string name="message_confirm_transfer">Bist du sicher das die Überweisung senden willst?</string>
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
<string name="copy_hash">Copy hash</string>
<string name="open_tangle_explorer">Open in tangle explorer</string>
<string name="receive_to_address">Request to this address</string>
<string name="replay_bundle">Replay bundle</string>
<string name="replay_bundle">Reattach transfer</string>
<string name="title_current_seed">Current Seed:</string>
<string name="title_enter_password">Enter password</string>
<string name="message_enter_password">Set your login password</string>
Expand All @@ -207,6 +207,10 @@
<string name="message_forgot_password">There is no recover option. Login with other seed? This will delete the old one.</string>
<string name="title_root_detected">Device probably rooted!</string>
<string name="message_root_detected">It can be assumed that this device is rooted. Continue at your own risk?</string>
<string name="title_spend_to_used_address">Sending to a used address!</string>
<string name="message_spend_to_used_address">You are attempting to send a transaction to an address that has already been used (i.e. tokens have already been spent from this address). Please ask recipient for a new address, that hasn\'t been spent from yet.</string>
<string name="title_key_reuse_detect">Private Key Reuse Detected!</string>
<string name="message_key_reuse_detect">You are attempting to sign a transaction with input that have an already been used. IOTA uses Winternitz one-time signature (W-OTS) scheme, due to it\'s one-time nature, the security of funds in an address decreases rapidly if you re-sign new transactions using the same key. Please wait for previous transaction to confirm, e.g. by reattaching, before sending another transaction.</string>

<!-- Confirm transfer dialog -->
<string name="message_confirm_transfer">Are you sure you want to send the transfer?</string>
Expand Down

0 comments on commit 36a1d67

Please sign in to comment.