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

🥳[Feature] Add bech32 to enable ltc1 addresses & false positive rate (Bloom Filter) interface #137

Merged
merged 12 commits into from
Apr 8, 2023
Merged
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ app/src/main/jni/transition/testingStuff.c
# Built application files
*.apk
*.ap_
*/release/*.aab

# Files for the Dalvik VM
*.dex
Expand Down
3 changes: 3 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ add_library( # Specifies the name of the library.
src/main/jni/loafwallet-core/BRTransaction.h
src/main/jni/loafwallet-core/BRWallet.c
src/main/jni/loafwallet-core/BRWallet.h
src/main/jni/loafwallet-core/BRChainParams.h
src/main/jni/loafwallet-core/BRBech32.c
src/main/jni/loafwallet-core/BRBech32.h

src/main/jni/transition/core.c
src/main/jni/transition/core.h
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ android {
applicationId = 'com.loafwallet'
minSdkVersion 27
targetSdkVersion 32
versionCode 725
versionName "v2.8.1"
versionCode 730
versionName "v2.8.4"
multiDexEnabled true
archivesBaseName = "${versionName}(${versionCode})"

Expand Down
Binary file removed app/loaf/release/v2.4.0(641)-loaf-release.aab
Binary file not shown.
Binary file removed app/loaf/release/v2.4.2(1)-loaf-release.aab
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/java/com/breadwallet/BreadApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void onCreate() {
}

// setup Timber
Timber.plant(BuildConfig.DEBUG ? new Timber.DebugTree() : new CrashReportingTree());
Timber.plant(new Timber.DebugTree());

FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(enableCrashlytics);
AnalyticsManager.init(this);
Expand Down Expand Up @@ -98,7 +98,7 @@ public static void onStop(final BRActivity app) {
public void run() {
if (isAppInBackground(app)) {
backgroundedTime = System.currentTimeMillis();
Timber.d("App went in background!");
Timber.d("timber: App went in background!");
// APP in background, do something
isBackgroundChecker.cancel();
fireListeners();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ protected void onCreate(Bundle savedInstanceState) {
initializeViews();
setPriceTags(BRSharedPrefs.getPreferredLTC(BreadActivity.this), false);
setListeners();

setUpBarFlipper();
checkTransactionDatabase();

primaryPrice.setTextSize(PRIMARY_TEXT_SIZE);
secondaryPrice.setTextSize(SECONDARY_TEXT_SIZE);
Expand Down Expand Up @@ -138,7 +138,7 @@ private void showInAppReviewDialogIfNeeded() {
// The flow has finished. The API does not indicate whether the user
// reviewed or not, or even whether the review dialog was shown. Thus, no
// matter the result, we continue our app flow.
Timber.i("In-app LaunchReviewFlow completed successful (%s)", task1.isSuccessful());
Timber.i("timber: In-app LaunchReviewFlow completed successful (%s)", task1.isSuccessful());
if (task1.isSuccessful()) {
BRSharedPrefs.inAppReviewDone(BreadActivity.this);
}
Expand Down Expand Up @@ -281,6 +281,10 @@ private void setPriceTags(boolean ltcPreferred, boolean animate) {
mHandler.postDelayed(() -> updateUI(), toolBarConstraintLayout.getLayoutTransition().getDuration(LayoutTransition.CHANGING));
}

private void checkTransactionDatabase() {

}

private void setUpBarFlipper() {
barFlipper.setInAnimation(AnimationUtils.loadAnimation(this, R.anim.flipper_enter));
barFlipper.setOutAnimation(AnimationUtils.loadAnimation(this, R.anim.flipper_exit));
Expand Down Expand Up @@ -435,7 +439,7 @@ public void onConnectionChanged(boolean isConnected) {
}
BRExecutor.getInstance().forLightWeightBackgroundTasks().execute(() -> {
final double progress = BRPeerManager.syncProgress(BRSharedPrefs.getStartHeight(BreadActivity.this));
Timber.d("Sync Progress: %s", progress);
Timber.d("timber: Sync Progress: %s", progress);
if (progress < 1 && progress > 0) {
SyncManager.getInstance().startSyncingProgressThread();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import com.breadwallet.BuildConfig;
import com.breadwallet.R;
import com.breadwallet.presenter.activities.camera.ScanQRActivity;
import com.breadwallet.presenter.activities.util.BRActivity;
Expand All @@ -38,6 +39,7 @@
import com.breadwallet.tools.util.BRConstants;
import com.breadwallet.tools.util.BRCurrency;
import com.breadwallet.wallet.BRWalletManager;
import com.google.android.material.snackbar.Snackbar;
import com.platform.APIClient;

import java.math.BigDecimal;
Expand Down Expand Up @@ -81,7 +83,8 @@ public static LoginActivity getApp() {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_pin);
setContentView(R.layout.activity_pin);
View parentLayout = findViewById(android.R.id.content);
String pin = BRKeyStore.getPinCode(this);
if (pin.isEmpty() || (pin.length() != 6 && pin.length() != 4)) {
Intent intent = new Intent(this, SetPinActivity.class);
Expand Down Expand Up @@ -169,6 +172,19 @@ public void onCancel() {
}, 500);

setCurrentLtcPrice();

if (BuildConfig.VERSION_NAME == "v2.8.4") {
Snackbar.make(parentLayout,
R.string.release_notes,
Snackbar.LENGTH_INDEFINITE).setAction(R.string.Webview_dismiss, new View.OnClickListener() {
@Override
public void onClick(View view) {

}
})
.setActionTextColor(getResources().getColor(android.R.color.holo_red_light ))
.show();
}
}

private void setCurrentLtcPrice() {
Expand Down Expand Up @@ -211,11 +227,11 @@ protected void onPause() {

private void handleClick(String key) {
if (!inputAllowed) {
Timber.d("handleClick: input not allowed");
Timber.d("timber: handleClick: input not allowed");
return;
}
if (key == null) {
Timber.d("handleClick: key is null! ");
Timber.d("timber: handleClick: key is null! ");
return;
}

Expand All @@ -224,7 +240,7 @@ private void handleClick(String key) {
} else if (Character.isDigit(key.charAt(0))) {
handleDigitClick(Integer.parseInt(key.substring(0, 1)));
} else {
Timber.d("handleClick: oops: %s", key);
Timber.d("timber: handleClick: oops: %s", key);
}
}

Expand Down Expand Up @@ -313,7 +329,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
// permission was granted, yay! Do the
// contacts-related task you need to do.
} else {
Timber.i("onRequestPermissionsResult: permission isn't granted for: %s", requestCode);
Timber.i("timber: onRequestPermissionsResult: permission isn't granted for: %s", requestCode);
// permission denied, boo! Disable the
// functionality that depends on this permission.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void onPause() {
private void handleClick(String key) {
if (!isPressAllowed) return;
if (key == null) {
Timber.d("handleClick: key is null! ");
Timber.d("timber: handleClick: key is null! ");
return;
}

Expand All @@ -104,7 +104,7 @@ private void handleClick(String key) {
} else if (Character.isDigit(key.charAt(0))) {
handleDigitClick(Integer.parseInt(key.substring(0, 1)));
} else {
Timber.d("handleClick: oops: %s", key);
Timber.d("timber: handleClick: oops: %s", key);
}
}

Expand Down Expand Up @@ -171,7 +171,7 @@ public void onComplete() {
}
} else {
AuthManager.getInstance().authFail(this);
Timber.d("verifyPin: FAIL: firs: %s, reEnter: %s ", firstPIN, pin);
Timber.d("timber: verifyPin: FAIL: firs: %s, reEnter: %s ", firstPIN, pin);
SpringAnimator.failShakeAnimation(this, pinLayout);
pin = new StringBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ protected void onCreate(Bundle savedInstanceState) {
keyboard = (BRKeyboard) findViewById(R.id.brkeyboard);
title = (TextView) findViewById(R.id.title);


//TODO: all views are using the layout of this button. Views should be refactored without it
// Hiding until layouts are built.
faq = (ImageButton) findViewById(R.id.faq_button);

dot1 = findViewById(R.id.dot1);
dot2 = findViewById(R.id.dot2);
dot3 = findViewById(R.id.dot3);
Expand Down Expand Up @@ -82,7 +82,7 @@ protected void onPause() {

private void handleClick(String key) {
if (key == null) {
Timber.d("handleClick: key is null! ");
Timber.d("timber: handleClick: key is null! ");
return;
}

Expand All @@ -91,7 +91,7 @@ private void handleClick(String key) {
} else if (Character.isDigit(key.charAt(0))) {
handleDigitClick(Integer.parseInt(key.substring(0, 1)));
} else {
Timber.d("handleClick: oops: %s", key);
Timber.d("timber: handleClick: oops: %s", key);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected void onPause() {

private void handleClick(String key) {
if (key == null) {
Timber.d("handleClick: key is null! ");
Timber.d("timber: handleClick: key is null! ");
return;
}

Expand All @@ -104,7 +104,7 @@ private void handleClick(String key) {
} else if (Character.isDigit(key.charAt(0))) {
handleDigitClick(Integer.parseInt(key.substring(0, 1)));
} else {
Timber.d("handleClick: oops: %s", key);
Timber.d("timber: handleClick: oops: %s", key);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ private static Size chooseOptimalSize(Size[] choices, int textureViewWidth,
} else if (notBigEnough.size() > 0) {
return Collections.max(notBigEnough, new CompareSizesByArea());
} else {
Timber.d("Couldn't find any suitable preview size");
Timber.d("timber: Couldn't find any suitable preview size");
return choices[0];
}
}
Expand Down Expand Up @@ -473,7 +473,7 @@ private void setUpCameraOutputs(int width, int height) {
}
break;
default:
Timber.d("Display rotation is invalid: %s", displayRotation);
Timber.d("timber: Display rotation is invalid: %s", displayRotation);
}

Point displaySize = new Point();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void onCreate(final Bundle savedInstanceState) {
== PackageManager.PERMISSION_GRANTED) {
initQRCodeReaderView();
} else {
Timber.d("onCreate: Permissions needed? HUH?");
Timber.d("timber: onCreate: Permissions needed? HUH?");
}

new Handler().postDelayed(new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
package com.breadwallet.presenter.activities.intro;

import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;

import com.breadwallet.BuildConfig;
import com.breadwallet.R;
Expand All @@ -26,7 +26,6 @@
import com.platform.APIClient;

import java.io.Serializable;
import java.util.Locale;

import timber.log.Timber;

Expand All @@ -38,7 +37,6 @@ public class IntroActivity extends BRActivity implements Serializable {
private static IntroActivity app;
private TextView versionText;


public static IntroActivity getApp() {
return app;
}
Expand All @@ -57,10 +55,10 @@ protected void onCreate(Bundle savedInstanceState) {
newWalletButton = (Button) findViewById(R.id.button_new_wallet);
recoverWalletButton = (Button) findViewById(R.id.button_recover_wallet);
versionText = findViewById(R.id.version_text);
View parentLayout = findViewById(android.R.id.content);

setListeners();
updateBundles();
// SyncManager.getInstance().updateAlarms(this);

if (!BuildConfig.DEBUG && BRKeyStore.AUTH_DURATION_SEC != 300) {
RuntimeException ex = new RuntimeException("onCreate: AUTH_DURATION_SEC should be 300");
Timber.e(ex);
Expand All @@ -77,12 +75,28 @@ protected void onCreate(Bundle savedInstanceState) {
byte[] masterPubKey = BRKeyStore.getMasterPublicKey(this);
boolean isFirstAddressCorrect = false;
if (masterPubKey != null && masterPubKey.length != 0) {
Timber.d("timber: masterPubkey exists");

isFirstAddressCorrect = SmartValidator.checkFirstAddress(this, masterPubKey);
}
if (!isFirstAddressCorrect) {
Timber.d("timber: Calling wipeWalletButKeyStore");
BRWalletManager.getInstance().wipeWalletButKeystore(this);
}

if (BuildConfig.VERSION_NAME == "v2.8.4") {
Snackbar.make(parentLayout,
R.string.release_notes,
Snackbar.LENGTH_INDEFINITE).setAction(R.string.Webview_dismiss, new View.OnClickListener() {
@Override
public void onClick(View view) {

}
})
.setActionTextColor(getResources().getColor(android.R.color.holo_red_light ))
.show();
}

PostAuth.getInstance().onCanaryCheck(this, false);
}

Expand All @@ -94,7 +108,7 @@ public void run() {
final long startTime = System.currentTimeMillis();
APIClient apiClient = APIClient.getInstance(IntroActivity.this);
long endTime = System.currentTimeMillis();
Timber.d("updateBundle DONE in %sms",endTime - startTime);
Timber.d("timber: updateBundle DONE in %sms",endTime - startTime);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

public class AboutActivity extends BRActivity {
private static final String TAG = AboutActivity.class.getName();
// private TextView termsText;
private TextView policyText;
private TextView infoText;
private TextView versionText;

private ImageView instagramShare;
private ImageView twitterShare;
Expand All @@ -45,13 +44,13 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);

infoText = (TextView) findViewById(R.id.info_text);
versionText = (TextView) findViewById(R.id.version_text);
policyText = (TextView) findViewById(R.id.policy_text);
instagramShare = (ImageView) findViewById(R.id.instagram_share_button);
twitterShare = (ImageView) findViewById(R.id.twitter_share_button);
blogShare = (ImageView) findViewById(R.id.blog_share_button);

infoText.setText(BRConstants.APP_VERSION_NAME_CODE);
versionText.setText(BRConstants.APP_VERSION_NAME_CODE);

instagramShare.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected void onCreate(Bundle savedInstanceState) {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Activity app = FingerprintActivity.this;
if (isChecked && !Utils.isFingerprintEnrolled(app)) {
Timber.d("onCheckedChanged: fingerprint not setup");
Timber.d("timber: onCheckedChanged: fingerprint not setup");
BRDialog.showCustomDialog(app, getString(R.string.TouchIdSettings_disabledWarning_title_android), getString(R.string.TouchIdSettings_disabledWarning_body_android), getString(R.string.Button_ok), null, new BRDialogView.BROnClickListener() {
@Override
public void onClick(BRDialogView brDialogView) {
Expand Down
Loading