Skip to content

Commit

Permalink
Fixed incorrect prices for some pair and statistics.
Browse files Browse the repository at this point in the history
  • Loading branch information
koloale committed Apr 26, 2018
1 parent 6fcd678 commit 89fcf18
Show file tree
Hide file tree
Showing 18 changed files with 263 additions and 91 deletions.
144 changes: 74 additions & 70 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@ android {
signingConfigs {
config {
keyAlias 'WavesWallet'
keyPassword ''
storeFile file('')
storePassword ''
}
}
compileSdkVersion 25
buildToolsVersion '26.0.2'
compileSdkVersion 26
buildToolsVersion '27.0.3'
flavorDimensions "default"
dexOptions {
javaMaxHeapSize "3g"
}
defaultConfig {
applicationId "com.wavesplatform.wallet"
targetSdkVersion 25
versionCode 335
versionName "1.1.5"
targetSdkVersion 26
versionCode 340
versionName "1.1.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
archivesBaseName = "waves-wallet-$versionName"
Expand Down Expand Up @@ -56,9 +59,6 @@ android {
signingConfig signingConfigs.config
}
dev {
// For everyday work, setting minSdkVersion to 21 bypasses MultiDex, resulting in
// much faster builds
minSdkVersion 21
}
}
compileOptions {
Expand Down Expand Up @@ -90,94 +90,98 @@ android {
}

ext {
supportVersion = '25.3.1'
googleServicesVersion = '10.0.1'
supportVersion = '26.1.0'
googleServicesVersion = '15.0.0'
rxJavaVersion = '2.0.4'
rxAndroidVersion = '2.0.1'
daggerVersion = '2.8'
retrofitVersion = '2.1.0'
retrofitVersion = '2.4.0'
okHttpVersion = '3.5.0'
}

dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:appcompat-v7:$supportVersion"
compile "com.android.support:recyclerview-v7:$supportVersion"
compile "com.android.support:cardview-v7:$supportVersion"
compile "com.android.support:design:$supportVersion"
compile "com.android.support:support-v13:$supportVersion"
compile "com.android.support:preference-v7:$supportVersion"
compile "com.android.support:preference-v14:$supportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$supportVersion"
implementation "com.android.support:recyclerview-v7:$supportVersion"
implementation "com.android.support:cardview-v7:$supportVersion"
implementation "com.android.support:design:$supportVersion"
implementation "com.android.support:support-v13:$supportVersion"
implementation "com.android.support:preference-v7:$supportVersion"
implementation "com.android.support:preference-v14:$supportVersion"

// Enable crash reporting only for release version
compile 'com.google.firebase:firebase-database:10.0.1'
releaseCompile "com.google.firebase:firebase-crash:$googleServicesVersion"
compile "com.google.firebase:firebase-messaging:$googleServicesVersion"
compile 'commons-io:commons-io:2.4'
implementation 'com.google.firebase:firebase-database:15.0.0'
releaseImplementation "com.google.firebase:firebase-crash:$googleServicesVersion"
implementation "com.google.firebase:firebase-messaging:$googleServicesVersion"
implementation 'commons-io:commons-io:2.4'

// Keep at 1.3 to match Android implementation
compile 'commons-codec:commons-codec:1.3'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.android.support:multidex:1.0.1'
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
compile 'com.neovisionaries:nv-websocket-client:1.19'
compile('com.google.zxing:core:3.3.0') { transitive = true }
compile 'com.github.mukeshsolanki:country-picker-android:1.1.6'
compile 'com.aurelhubert:ahbottomnavigation:2.0.2'
// RxJava
compile "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
compile "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
compile 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'
// Retrofit
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
compile "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
compile "com.squareup.retrofit2:adapter-rxjava2:2.3.0-SNAPSHOT"
implementation 'commons-codec:commons-codec:1.6'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'com.android.support:multidex:1.0.3'
implementation 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'
implementation 'com.neovisionaries:nv-websocket-client:1.19'
implementation('com.google.zxing:core:3.3.0') { transitive = true }
implementation 'com.github.mukeshsolanki:country-picker-android:1.1.6'
implementation 'com.aurelhubert:ahbottomnavigation:2.0.2'

compile "org.whispersystems:curve25519-java:0.3.0"
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
// RxJava
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0'

compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.22'
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-jackson:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofitVersion"
implementation 'org.whispersystems:curve25519-java:0.3.0'
implementation 'com.bignerdranch.android:recyclerview-multiselect:0.2'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.22'

// OkHttp
compile "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
compile 'com.github.ihsanbal:LoggingInterceptor:1.0.5'
compile "com.squareup.okhttp3:okhttp:$okHttpVersion"
// Dagger2
compile "com.google.dagger:dagger:$daggerVersion"

compile 'com.github.rubensousa:bottomsheetbuilder:1.6.0'

compile 'com.github.vihtarb:tooltip:0.1.9'
compile 'com.madgag.spongycastle:core:1.52.0.0'
compile 'com.google.guava:guava:20.0'
compile 'com.github.ihsanbal:LoggingInterceptor:1.0.5'
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
implementation 'com.github.ihsanbal:LoggingInterceptor:1.0.5'
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"

// Dagger2
implementation "com.google.dagger:dagger:$daggerVersion"
implementation 'com.github.rubensousa:bottomsheetbuilder:1.6.0'
implementation 'com.github.vihtarb:tooltip:0.1.9'
implementation 'com.madgag.spongycastle:core:1.52.0.0'
implementation 'com.google.guava:guava:22.0'
implementation 'com.github.ihsanbal:LoggingInterceptor:1.0.5'
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
annotationProcessor 'com.google.guava:guava:20.0'
annotationProcessor 'com.google.guava:guava:22.0'

// Fingerprint authentication
compile 'com.mtramin:rxfingerprint:2.0.1'
implementation 'com.mtramin:rxfingerprint:2.0.1'

// UI/Instrumentation Tests
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.6.3'
androidTestCompile "com.android.support:support-annotations:$supportVersion"
androidTestCompile 'com.android.support.test:rules:0.5'
androidTestCompile('com.android.support.test:runner:0.5') {
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.6.3'
androidTestImplementation "com.android.support:support-annotations:$supportVersion"
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation('com.android.support.test:runner:0.5') {
exclude module: 'support-annotations'
}
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2') {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2') {
exclude group: 'javax.inject', module: 'support-annotations'
}

// Unit Tests
testCompile 'org.json:json:20140107'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.hamcrest:hamcrest-junit:2.0.0.0'
testCompile('org.robolectric:robolectric:3.1.4') {
testImplementation 'org.json:json:20140107'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation 'org.hamcrest:hamcrest-junit:2.0.0.0'
testImplementation('org.robolectric:robolectric:3.1.4') {
exclude group: 'com.google.guava'
exclude group: 'com.google.protobuf'
}
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.appsflyer:af-android-sdk:4.8.9'
implementation 'com.android.installreferrer:installreferrer:1.0'
}

buildscript {
Expand Down
16 changes: 13 additions & 3 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
-keepclasseswithmembers class * {
@retrofit.http.* <methods>;
}
# Platform calls Class.forName on types which do not exist on Android to determine platform.
-dontnote retrofit2.Platform
# Platform used when running on Java 8 VMs. Will not be used at runtime.
-dontwarn retrofit2.Platform$Java8
# Retain declared checked exceptions for use by a Proxy instance.
-keepattributes Exceptions

-keep class com.google.gson.** { *; }
-keep class com.google.inject.** { *; }
-keep class org.apache.http.** { *; }
Expand All @@ -134,7 +141,6 @@

-keepattributes Signature
-keepattributes *Annotation*
-keepattributes Signature

# slf4j
-dontwarn org.slf4j.**
Expand All @@ -155,12 +161,16 @@
# Only necessary if you downloaded the SDK jar directly instead of from maven.
-keep class com.shaded.fasterxml.jackson.** { *; }

-keepattributes Signature
-keepattributes *Annotation*
-keepattributes EnclosingMethod
-keepattributes InnerClasses

-keep class com.wavesplatform.wallet.data.services.** {*;}
-keepclassmembers class com.wavesplatform.wallet.data.services.** {*;}
-keep class com.wavesplatform.wallet.data.access.** {*;}
-keepclassmembers class com.wavesplatform.wallet.data.access.** {*;}

-dontwarn com.android.installreferrerCopy
-dontwarn com.appsflyer.*

-keep class com.appsflyer.** { *; }
-keep class om.android.installreferrerCopy.** { *; }
7 changes: 7 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.USE_FINGERPRINT" />

<application
Expand Down Expand Up @@ -128,6 +129,12 @@
</provider>

<activity android:name=".ui.transactions.ExchangeTransactionActivity"></activity>

<receiver android:name="com.appsflyer.SingleInstallBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import android.support.v7.app.AppCompatDelegate;
import android.util.Log;

import com.appsflyer.AppsFlyerConversionListener;
import com.appsflyer.AppsFlyerLib;
import com.wavesplatform.wallet.data.access.AccessState;
import com.wavesplatform.wallet.data.access.DexAccessState;
import com.wavesplatform.wallet.data.connectivity.ConnectivityManager;
Expand All @@ -20,6 +22,8 @@
import com.wavesplatform.wallet.util.annotations.Thunk;
import com.wavesplatform.wallet.util.exceptions.LoggingExceptionHandler;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.plugins.RxJavaPlugins;
Expand Down Expand Up @@ -96,6 +100,41 @@ public void onBecameBackground() {
AccessState.getInstance().removeWavesWallet();
}
});

initAppsFlyer();
}

private static final String AF_DEV_KEY = "4di8SsYap4CM4XYMdh8uT6";

void initAppsFlyer() {
AppsFlyerConversionListener conversionDataListener =
new AppsFlyerConversionListener() {
@Override
public void onInstallConversionDataLoaded(Map<String, String> conversionData) {
for (String attrName : conversionData.keySet()) {
Log.d(AppsFlyerLib.LOG_TAG, "attribute: " + attrName + " = " + conversionData.get(attrName));
}
}

@Override
public void onInstallConversionFailure(String errorMessage) {
Log.d(AppsFlyerLib.LOG_TAG, "error getting conversion data: " + errorMessage);
}

@Override
public void onAppOpenAttribution(Map<String, String> attributionData) {
for (String attrName : attributionData.keySet()) {
Log.d(AppsFlyerLib.LOG_TAG, "attribute: " + attrName + " = " + attributionData.get(attrName));
}
}

@Override
public void onAttributionFailure(String errorMessage) {
Log.d(AppsFlyerLib.LOG_TAG, "error onAttributionFailure : " + errorMessage);
}
};
AppsFlyerLib.getInstance().init(AF_DEV_KEY, conversionDataListener, getApplicationContext());
AppsFlyerLib.getInstance().startTracking(this);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ private AssetBalance getAssetBallance() {
return NodeManager.get().getAssetBalance(getAmountAssetId());
}

private AssetBalance getPriceAssetBallance() {
return NodeManager.get().getAssetBalance(getPriceAssetId());
}

public long getTransactionFee(){
if (getMyOrder().orderType.equals(OrderType.buy)){
return buyMatcherFee;
Expand Down Expand Up @@ -99,7 +103,7 @@ public int getPriceDecimals() {
if (getMyOrder().assetPair.priceAsset == null) {
return 8;
}
return getAssetBallance().issueTransaction.decimals;
return getPriceAssetBallance().issueTransaction.decimals;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.support.annotation.StringRes;
import android.util.Log;

import com.appsflyer.AppsFlyerLib;
import com.google.common.base.Charsets;
import com.google.common.primitives.Ints;
import com.wavesplatform.wallet.BR;
Expand All @@ -19,6 +20,9 @@
import com.wavesplatform.wallet.ui.customviews.ToastCustom;
import com.wavesplatform.wallet.util.MoneyUtil;

import java.util.HashMap;
import java.util.Map;


@SuppressWarnings("WeakerAccess")
public class IssueViewModel extends BaseViewModel {
Expand Down Expand Up @@ -142,9 +146,17 @@ public boolean signTransaction() {
}
}

private void trackIssueAsset(IssueTransactionRequest request) {
Map<String, Object> eventValue = new HashMap<String, Object>();
eventValue.put("af_asset_name", request.name);
eventValue.put("af_asset_id", request.id);
AppsFlyerLib.getInstance().trackEvent(context, "af_issue_tx", eventValue);
}

public void submitIssue() {
NodeManager.get().broadcastIssue(request)
.compose(RxUtil.applySchedulersToObservable()).subscribe(tx -> {
trackIssueAsset(tx);
if (dataListener != null)
dataListener.onShowTransactionSuccess(request);
}, err -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void setCurrent(Environment current) {

public enum Environment {
PRODUCTION(KEY_ENV_PROD, "https://nodes.wavesplatform.com", "https://matcher.wavesplatform.com/", "https://marketdata.wavesplatform.com/api/", 'W'),
TESTNET(KEY_ENV_TESTNET, "http://52.30.47.67:6869", "http://52.30.47.67:6886/", "https://marketdata.wavesplatform.com/api/", 'T');
TESTNET(KEY_ENV_TESTNET, "http://pool.testnet.wavesnodes.com:6869", "http://pool.testnet.wavesnodes.com:6886/", "https://marketdata.wavesplatform.com/api/", 'T');

private String name;
private String nodeUrl;
Expand Down

0 comments on commit 89fcf18

Please sign in to comment.