Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/build.gradle
  • Loading branch information
edwardstock committed Apr 8, 2019
2 parents 2866d24 + 7107420 commit ec10a89
Show file tree
Hide file tree
Showing 46 changed files with 721 additions and 317 deletions.
5 changes: 5 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes

## 1.3.0
- New network api
- Fixed UI issues
- Fixed converting issues

## 1.2.8
- Showing commission for exchanging transactions
- Updated SDK
Expand Down
18 changes: 9 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ android {
applicationId "network.minter.bipwallet"
minSdkVersion minterMinSdk
targetSdkVersion minterMaxSdk
versionCode 71
versionName "1.2.8"
versionCode 75
versionName "1.3.0-dev05"
testInstrumentationRunner "network.minter.bipwallet.tests.internal.WalletTestRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
Expand Down Expand Up @@ -83,10 +83,10 @@ android {

signingConfigs {
config {
keyAlias getProperty("minter_key_alias")
keyPassword getProperty("minter_key_password")
storeFile file(getProperty("minter_key_store_file"))
storePassword getProperty("minter_key_store_password")
keyAlias localProps['minter_key_alias']
keyPassword localProps['minter_key_password']
storeFile file(localProps['minter_key_store_file'])
storePassword localProps['minter_key_store_password']
}
}

Expand Down Expand Up @@ -157,10 +157,10 @@ android {
}

ext {
minterExplorerSDK = "0.3.1"
minterExplorerSDK = "0.4.0"
minterProfileSDK = "0.2.1"
minterBlockchainSDK = "0.5.2"
minterCoreSDK = "0.2.3"
minterBlockchainSDK = "0.5.5"
minterCoreSDK = "0.2.4"
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@
import network.minter.core.bip39.MnemonicResult;
import network.minter.core.crypto.MinterAddress;
import network.minter.explorer.MinterExplorerApi;
import network.minter.explorer.models.BCExplorerResult;
import network.minter.explorer.models.CoinItem;
import network.minter.explorer.models.ExpResult;
import network.minter.explorer.models.GateResult;
import network.minter.explorer.repo.ExplorerCoinsRepository;
import network.minter.explorer.repo.GateEstimateRepository;
import network.minter.profile.models.User;
import retrofit2.Response;
import timber.log.Timber;
Expand All @@ -85,8 +86,8 @@
import static android.support.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static network.minter.bipwallet.apis.reactive.ReactiveMyMinter.rxBc;
import static network.minter.bipwallet.apis.reactive.ReactiveMyMinter.rxExp;
import static network.minter.bipwallet.apis.reactive.ReactiveBlockchain.rxBc;
import static network.minter.bipwallet.apis.reactive.ReactiveExplorer.rxExp;
import static network.minter.bipwallet.internal.helpers.MathHelper.bdHuman;
import static network.minter.bipwallet.tests.internal.MyMatchers.withInputLayoutError;
import static network.minter.bipwallet.tests.internal.MyMatchers.withInputLayoutHint;
Expand Down Expand Up @@ -215,7 +216,7 @@ public void testSpendCoin() {
}

@Test
public void testSpendCommission() {
public void testSpendCommission() throws Throwable {
ApiMockInterceptor gateMock = new ApiMockInterceptor("gate", mActivityTestRule.getActivity());
try {
MinterExplorerApi.getInstance().getGateApiService().addHttpInterceptor(gateMock);
Expand Down Expand Up @@ -270,6 +271,7 @@ public void testGetCommission() {
public void testSpendInputs() throws Throwable {

ExplorerCoinsRepository repo = TestWallet.app().explorerCoinsRepo();
GateEstimateRepository estimateRepo = TestWallet.app().estimateRepo();

final int tabPos = 0;
// spend coins
Expand Down Expand Up @@ -350,8 +352,8 @@ public void testSpendInputs() throws Throwable {
calculationSum.perform(scrollTo());


Response<BCExplorerResult<ExchangeSellValue>> estimate1 = repo.getCoinExchangeCurrencyToSell(MinterSDK.DEFAULT_COIN, new BigDecimal(amount), mExchangeCoin.getSymbol()).execute();
assertTrue(estimate1.body().isSuccess());
Response<GateResult<ExchangeSellValue>> estimate1 = estimateRepo.getCoinExchangeCurrencyToSell(MinterSDK.DEFAULT_COIN, new BigDecimal(amount), mExchangeCoin.getSymbol()).execute();
assertTrue(estimate1.body().isOk());
// amount without commission
String expectEstimate3 = bdHuman(estimate1.body().result.getAmount());
calculationSum.check(matches(withText(String.format("%s %s", expectEstimate3, mExchangeCoin.getSymbol()))));
Expand All @@ -362,8 +364,8 @@ public void testSpendInputs() throws Throwable {
actionUseMax.perform(click());
amountInput.check(matches(withText("100")));

Response<BCExplorerResult<ExchangeSellValue>> estimate2 = repo.getCoinExchangeCurrencyToSell(MinterSDK.DEFAULT_COIN, new BigDecimal("100"), mExchangeCoin.getSymbol()).execute();
assertTrue(estimate2.body().isSuccess());
Response<GateResult<ExchangeSellValue>> estimate2 = estimateRepo.getCoinExchangeCurrencyToSell(MinterSDK.DEFAULT_COIN, new BigDecimal("100"), mExchangeCoin.getSymbol()).execute();
assertTrue(estimate2.body().isOk());
// amount without commission
String expectEstimate2 = bdHuman(estimate2.body().result.getAmount());
calculationSum.check(matches(withText(String.format("%s %s", expectEstimate2, mExchangeCoin.getSymbol()))));
Expand All @@ -373,6 +375,7 @@ public void testSpendInputs() throws Throwable {
public void testGetInputs() throws Throwable {

ExplorerCoinsRepository repo = TestWallet.app().explorerCoinsRepo();
GateEstimateRepository estimateRepo = TestWallet.app().estimateRepo();

final int tabPos = 1;
// spend coins
Expand Down Expand Up @@ -456,8 +459,8 @@ public void testGetInputs() throws Throwable {
calculationSum.perform(scrollTo());


Response<BCExplorerResult<ExchangeBuyValue>> estimate1 = repo.getCoinExchangeCurrencyToBuy(MinterSDK.DEFAULT_COIN, new BigDecimal(amount), mExchangeCoin.getSymbol()).execute();
assertTrue(estimate1.body().isSuccess());
Response<GateResult<ExchangeBuyValue>> estimate1 = estimateRepo.getCoinExchangeCurrencyToBuy(MinterSDK.DEFAULT_COIN, new BigDecimal(amount), mExchangeCoin.getSymbol()).execute();
assertTrue(estimate1.body().isOk());
// amount without commission
String expectEstimate1 = bdHuman(estimate1.body().result.getAmount());
calculationSum.check(matches(withText(String.format("%s %s", expectEstimate1, MinterSDK.DEFAULT_COIN))));
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@


<service
android:name=".services.livebalance.BalanceUpdateService"
android:name=".services.livebalance.LiveBalanceService"
android:exported="false"
android:screenOrientation="portrait"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public interface GenerateView extends MvpView, ProgressTextView, ErrorView {
}

public interface MainView extends MvpView, ErrorView, ProgressTextView {
void setOnGenerate(View.OnClickListener listener);
void setMnemonicTextChangedListener(TextWatcher textWatcher);
void setOnActivateMnemonic(View.OnClickListener listener);
@StateStrategyType(OneExecutionStateStrategy.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,30 @@ public class AccountItem implements Serializable, Cloneable {
public String coin;
public MinterAddress address;
public BigDecimal balance;
public BigDecimal balanceBase;
public BigDecimal balanceUsd;
int mHashCode;

public AccountItem(final AccountItem another) {
id = another.id;
avatar = another.avatar;
coin = another.coin;
address = another.address;
balanceUsd = another.balanceUsd;
balance = another.balance;
balanceBase = another.balanceBase;
mHashCode = another.mHashCode;
}

public AccountItem(String avatar, String coin, MinterAddress address, BigDecimal balance, BigDecimal balanceUsd, BigDecimal balanceBase) {
this(coin, address, balance, balanceUsd, balanceBase);
public AccountItem(String avatar, String coin, MinterAddress address, BigDecimal balance) {
this(coin, address, balance);
this.avatar = avatar;
}

@SuppressWarnings("NullableProblems")
public AccountItem(@NonNull String coin, MinterAddress address, BigDecimal balance, BigDecimal balanceUsd, BigDecimal balanceBase) {
public AccountItem(@NonNull String coin, MinterAddress address, BigDecimal balance) {
this.id = UUID.randomUUID().toString();
this.coin = checkNotNull(coin, "Coin name required");
this.address = checkNotNull(address, "Address required");
this.balance = balance;
this.balanceUsd = balanceUsd;
this.balanceBase = balanceBase;
this.avatar = MinterProfileApi.getCoinAvatarUrl(coin);
mHashCode = Objects.hash(id, avatar, coin, address, balance, balanceUsd);
mHashCode = Objects.hash(id, avatar, coin, address, balance);
}

AccountItem() {
Expand Down Expand Up @@ -114,19 +108,14 @@ public BigDecimal getBalance() {
return balance;
}

@Deprecated
public BigDecimal getBalanceBase() {
if (balanceBase == null) {
balanceBase = new BigDecimal(0);
}

return balanceBase;
return getBalance();
}

@Deprecated
public BigDecimal getBalanceUsd() {
if (balanceUsd == null) {
balanceUsd = new BigDecimal(0);
}
return balanceUsd;
return getBalance();
}

@Override
Expand All @@ -136,8 +125,7 @@ public boolean equals(Object o) {
AccountItem that = (AccountItem) o;
return Objects.equals(coin, that.coin) &&
Objects.equals(address, that.address) &&
Objects.equals(balance, that.balance) &&
Objects.equals(balanceUsd, that.balanceUsd);
Objects.equals(balance, that.balance);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@
import network.minter.bipwallet.home.ui.HomeActivity;
import network.minter.bipwallet.internal.BaseMvpInjectActivity;
import network.minter.bipwallet.internal.dialogs.WalletInputDialog;
import network.minter.bipwallet.internal.helpers.KeyboardHelper;
import network.minter.bipwallet.internal.helpers.forms.validators.RegexValidator;
import network.minter.bipwallet.internal.system.ActivityBuilder;
import timber.log.Timber;

/**
* minter-android-wallet. 2018
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
import network.minter.bipwallet.internal.BaseMvpInjectActivity;
import network.minter.bipwallet.internal.dialogs.WalletInputDialog;
import network.minter.bipwallet.internal.dialogs.WalletProgressDialog;
import network.minter.bipwallet.internal.helpers.KeyboardHelper;
import network.minter.bipwallet.internal.system.ActivityBuilder;
import timber.log.Timber;

/**
* minter-android-wallet. 2018
Expand All @@ -65,7 +67,6 @@ public class AdvancedMainActivity extends BaseMvpInjectActivity implements Advan
public static final String EXTRA_FOR_RESULT = "EXTRA_FOR_RESULT";
public static final String EXTRA_TITLE = "EXTRA_TITLE";

@BindView(R.id.action_generate) Button actionGenerate;
@BindView(R.id.action_activate) Button actionActivate;
@BindView(R.id.input_seed) AppCompatEditText seedInput;
@BindView(R.id.toolbar) Toolbar toolbar;
Expand All @@ -74,11 +75,6 @@ public class AdvancedMainActivity extends BaseMvpInjectActivity implements Advan
@InjectPresenter AdvancedMainPresenter presenter;
private WalletProgressDialog mProgress;

@Override
public void setOnGenerate(View.OnClickListener listener) {
actionGenerate.setOnClickListener(listener);
}

@Override
public void setMnemonicTextChangedListener(TextWatcher textWatcher) {
seedInput.addTextChangedListener(textWatcher);
Expand Down Expand Up @@ -123,6 +119,7 @@ public void finishSuccess() {

@Override
public void startHome() {
KeyboardHelper.hideKeyboard(this);
startActivityClearTop(this, HomeActivity.class);
finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public void attachView(AdvancedModeModule.GenerateView view) {
// default value for basic user
mSaveOnServer = session.getRole() == AuthSession.AuthType.Basic;

mMnemonicResult = NativeBip39.encodeBytes(mRandom.generateSeed(16));
getViewState().setMnemonic(mMnemonicResult.getMnemonic());

getViewState().setEnableCopy(true);
Expand Down Expand Up @@ -120,6 +119,7 @@ public void attachView(AdvancedModeModule.GenerateView view) {
protected void onFirstViewAttach() {
super.onFirstViewAttach();
getViewState().setEnableLaunch(false);
mMnemonicResult = NativeBip39.encodeBytes(mRandom.generateSeed(16));
}

private boolean saveServerAddress(String fieldName, String value, MinterAddress address) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ public void attachView(AdvancedModeModule.MainView view) {
getViewState().startHome();
}
});

getViewState().setOnGenerate(this::onStartGenerate);
}

private void onStartGenerate(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ public boolean mapError(Throwable throwable) {
}

NetworkException e = (NetworkException) NetworkException.convertIfNetworking(throwable);
data = null;
result = null;
error = new ErrorResult();
error.statusCode = e.getStatusCode();
error.code = statusCode;
error.message = e.getUserMessage();
statusCode = e.getStatusCode();
errorMessage = e.getUserMessage();
Expand Down
Loading

0 comments on commit ec10a89

Please sign in to comment.