Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀[ Release v.2.7.1] Merge into Develop #104

Merged
merged 13 commits into from
Jan 15, 2023
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

28 changes: 28 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ android {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

compileSdkVersion 31
compileSdkVersion 32

defaultConfig {
testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner'
applicationId = 'com.loafwallet'
minSdkVersion 27
targetSdkVersion 31
versionCode 690
versionName "v2.7.0"
minSdkVersion 27
targetSdkVersion 32
versionCode 705
versionName "v2.7.1"
multiDexEnabled true
archivesBaseName = "${versionName}(${versionCode})"

Expand Down Expand Up @@ -264,10 +264,10 @@ repositories {
dependencies {

androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

androidTestImplementation('androidx.test.espresso:espresso-core:3.4.0')
androidTestImplementation('androidx.test:runner:1.4.0')
androidTestImplementation('androidx.test:rules:1.4.0')
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.6.20-RC'

Expand All @@ -280,10 +280,10 @@ dependencies {

// androidx
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
// preferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
package com.breadwallet;

import android.util.Log;

import com.breadwallet.tools.security.SmartValidator;
import com.breadwallet.tools.util.BRConstants;
import com.breadwallet.tools.util.Bip39Reader;
import com.breadwallet.tools.util.Utils;
import com.breadwallet.wallet.BRWalletManager;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.junit.Test;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public class PlatformTests {
// proto is the transport protocol to use for talking to the API (either http or https)
private static final String PROTO = "https";
// host is the server(s) on which the API is hosted
// private static final String HOST = "api.breadwallet.com";
// convenience getter for the API endpoint
private static final String BASE_URL = PROTO + "://" + BreadApp.HOST;
//feePerKb url
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.breadwallet.presenter.fragments;

import static com.breadwallet.tools.util.BRConstants.LW_API_HOST;

import android.annotation.TargetApi;
import android.app.Activity;
import android.content.ClipData;
Expand Down Expand Up @@ -45,7 +47,6 @@ public class FragmentBuy extends Fragment {
private ProgressBar progress;
private WebView webView;
private String onCloseUrl;
private static final String URL_BUY_LTC = BuildConfig.DEBUG ? "https://api-stage.lite-wallet.org" : "https://api-prod.lite-wallet.org";
private static final String CURRENCY_KEY = "currency_code_key";
private static final String PARTNER_KEY = "partner_key";
private ValueCallback<Uri> uploadMessage;
Expand Down Expand Up @@ -93,6 +94,20 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
webSettings.setDomStorageEnabled(true);
webSettings.setJavaScriptEnabled(true);

// App (in Java)
WebMessageListener bitrefillListener = new WebMessageListener() {
@Override
public void onPostMessage(WebView view, WebMessageCompat message, Uri sourceOrigin,
boolean isMainFrame, JavaScriptReplyProxy replyProxy) {
// do something about view, message, sourceOrigin and isMainFrame.
replyProxy.postMessage("Got it!");
}
};

if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_MESSAGE_LISTENER)) {
WebViewCompat.addWebMessageListener(webView, "bitrefillPostObj", rules, bitrefillListener);
}

String currency = getArguments().getString(CURRENCY_KEY);
Partner partner = (Partner) getArguments().getSerializable(PARTNER_KEY);

Expand All @@ -101,20 +116,19 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
String bitrefillUrl = String.format( BRConstants.BITREFILL_AFFILIATE_LINK + "/embed/?paymentMethod=litecoin&ref=%s&utm_source=%s", bitrefillRef,utmSource);

String buyUrl = partner == Partner.BITREFILL ? bitrefillUrl : url(getContext(), partner, currency);

Timber.d("URL %s", buyUrl);
webView.loadUrl(buyUrl);

return rootView;
}


public static String url(Context context, Partner partner, String currency) {
String walletAddress = BRSharedPrefs.getReceiveAddress(context);
Long timestamp = new Date().getTime();
String uuid = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
String prefix = partner == Partner.MOONPAY ? "/moonpay/buy" : "";
return String.format(URL_BUY_LTC + prefix + "?address=%s&code=%s&idate=%s&uid=%s", walletAddress, currency, timestamp, uuid);
return String.format(LW_API_HOST + prefix + "?address=%s&code=%s&idate=%s&uid=%s", walletAddress, currency, timestamp, uuid);
}

private void closePayment() {
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/com/breadwallet/tools/manager/BRApiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.breadwallet.presenter.entities.CurrencyEntity;
import com.breadwallet.tools.sqlite.CurrencyDataSource;
import com.breadwallet.tools.threads.BRExecutor;

import com.breadwallet.tools.util.BRConstants;
import com.breadwallet.tools.util.Utils;
import com.platform.APIClient;

Expand All @@ -32,6 +34,10 @@
import okhttp3.Response;
import timber.log.Timber;

import static com.breadwallet.tools.util.BRConstants.*;
import static com.breadwallet.tools.util.BRConstants.LW_API_HOST;
import static com.breadwallet.tools.util.BRConstants.LW_BACKUP_API_HOST;

public class BRApiManager {
private static BRApiManager instance;
private Timer timer;
Expand Down Expand Up @@ -131,7 +137,7 @@ public void stopTimerTask() {
}

public static JSONArray fetchRates(Activity activity) {
String jsonString = createGETRequestURL(activity, "https://api.loshan.co.uk/api/v1/rates");
String jsonString = createGETRequestURL(activity, LW_API_HOST + "/api/v1/rates");
JSONArray jsonArray = null;
if (jsonString == null) return null;
try {
Expand All @@ -143,7 +149,9 @@ public static JSONArray fetchRates(Activity activity) {
}

public static JSONArray backupFetchRates(Activity activity) {
String jsonString = createGETRequestURL(activity, "https://api.loafwallet.org/api/v1/rates");
String jsonString = createGETRequestURL(activity, LW_BACKUP_API_HOST + "/api/v1/rates");

AnalyticsManager.logCustomEvent(_20230113_BAC);

JSONArray jsonArray = null;
if (jsonString == null) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,14 @@ public class BRConstants {
public static final String REDDIT_LINK = "https://www.reddit.com/r/Litewallet";
public static final String WEB_LINK = "https://litewalle.io";
public static final String TOS_LINK = "https://litewallet.io/privacy/policy.html";
public static String CUSTOMER_SUPPORT_LINK = "https://litecoinfoundation.zendesk.com";
public static String CUSTOMER_SUPPORT_LINK = "https://support.litewallet.io";
public static String BITREFILL_AFFILIATE_LINK = "https://www.bitrefill.com/";

/**
* API Hosts
*/
public static final String LW_API_HOST = "https://api-prod.lite-wallet.org";
public static final String LW_BACKUP_API_HOST = "https://api-dev.lite-wallet.org";

public static final String BLOCK_EXPLORER_BASE_URL = BuildConfig.LITECOIN_TESTNET ? "https://testnet.litecore.io/tx/" : "https://insight.litecore.io/tx/";

Expand Down Expand Up @@ -131,6 +136,7 @@ private BRConstants() {
public static final String _20201121_SIL = "started_IFPS_lookup";
public static final String _20201121_DRIA = "did_resolve_IPFS_address";
public static final String _20201121_FRIA = "failed_resolve_IPFS_address";
public static final String _20230113_BAC = "backup_apiserver_called";

///Dev: These events not yet used
public static final String _20200207_DTHB = "did_tap_header_balance";
Expand Down Expand Up @@ -168,6 +174,7 @@ private BRConstants() {
_20201121_SIL,
_20201121_DRIA,
_20201121_FRIA,
_20230113_BAC,
_20200207_DTHB,
_20210405_TAWDF,
_20210804_TAA2FAC,
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx4608m


# Request a long standing daemon to run so that subsequent gradle commands run faster.
org.gradle.daemon=true
Expand Down