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

Techdebt/refactor brevents syncmarkers #254

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,4 @@ app/src/litewalletDebug/google-services.json
/app/release/google-services.json
/app/debug/google-services.json
/.idea/dictionaries/grunt.xml
androidTestResultsUserPreferences.xml
66 changes: 0 additions & 66 deletions .idea/androidTestResultsUserPreferences.xml

This file was deleted.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ android {
applicationId = 'com.loafwallet'
minSdkVersion 31
targetSdkVersion 34
versionCode 20241007
versionName "v2.11.1"
versionCode 20241023
versionName "v2.12.0"
multiDexEnabled true
archivesBaseName = "${versionName}(${versionCode})"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import android.widget.*
import androidx.fragment.app.Fragment
import com.breadwallet.R
import com.breadwallet.tools.animation.BRAnimator
import com.breadwallet.tools.manager.AnalyticsManager
import com.breadwallet.tools.manager.TxManager
import com.breadwallet.tools.security.BRKeyStore
import com.breadwallet.tools.util.BRConstants
import timber.log.Timber
import java.util.*

class FragmentBalanceSeedReminder : Fragment() {
Expand Down Expand Up @@ -66,14 +70,21 @@ class FragmentBalanceSeedReminder : Fragment() {
setListeners()
fetchSeedPhrase()
}

private fun registerAnalyticsError(errorString: String) {
Timber.d("Fragment Balance Seed: RegisterError : %s", errorString)
val params = Bundle()
params.putString("lwa_error_message", errorString);
AnalyticsManager.logCustomEventWithParams(BRConstants._20200112_ERR, params)
}
fun fetchSeedPhrase() {
try {
seedPhraseTextView.text = String(BRKeyStore.getPhrase(context, 0))
} catch (_: UserNotAuthenticatedException) {
seedPhraseTextView.text = "NO_PHRASE"
if (this.activity == null) {
registerAnalyticsError("null_in_fragment_balance_fetch_seed")
}
else {
seedPhraseTextView.text = String(BRKeyStore.getPhrase(this.activity, 0)) ?: "NO_PHRASE"
}
}

private fun animateClose() {
BRAnimator.animateBackgroundDim(backgroundLayout, true)
BRAnimator.animateSignalSlide(signalLayout, true) { close() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public void setCompletion(BRAuthCompletion completion) {
public void onError() {
String authError = "auth_prompt_failed";
Bundle params = new Bundle();
params.putString("error_message",authError);
params.putString("lwa_error_message",authError);
AnalyticsManager.logCustomEventWithParams(BRConstants._20200112_ERR, params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ import android.view.ViewGroup
import com.breadwallet.databinding.FragmentHistoryBinding
import com.breadwallet.presenter.activities.BreadActivity
import com.breadwallet.presenter.base.BaseFragment
import com.breadwallet.tools.manager.AnalyticsManager
import com.breadwallet.tools.manager.BRSharedPrefs
import com.breadwallet.tools.manager.BRSharedPrefs.OnIsoChangedListener
import com.breadwallet.tools.manager.TxManager
import com.breadwallet.tools.sqlite.TransactionDataSource.OnTxAddedListener
import com.breadwallet.tools.threads.BRExecutor
import com.breadwallet.tools.util.BRConstants
import com.breadwallet.wallet.BRPeerManager
import com.breadwallet.wallet.BRPeerManager.OnTxStatusUpdate
import com.breadwallet.wallet.BRWalletManager
import com.breadwallet.wallet.BRWalletManager.OnBalanceChanged
import timber.log.Timber

/** Litewallet
* Created by Mohamed Barry on 6/1/20
Expand Down Expand Up @@ -56,11 +59,22 @@ class HistoryFragment :
BRPeerManager.getInstance().removeListener(this)
BRSharedPrefs.removeListener(this)
}

private fun registerAnalyticsError(errorString: String) {
val params = Bundle()
params.putString("lwa_error_message", errorString);
AnalyticsManager.logCustomEventWithParams(BRConstants._20200112_ERR, params)
Timber.d("History Fragment: RegisterError : %s", errorString)
}
override fun onResume() {
super.onResume()
addObservers()
TxManager.getInstance().onResume(requireActivity() as BreadActivity)

if (this.activity == null) {
registerAnalyticsError("null_in_history_fragment_on_resume")
}
else {
TxManager.getInstance().onResume(this.activity)
}
}

override fun onPause() {
Expand All @@ -74,7 +88,12 @@ class HistoryFragment :

override fun onStatusUpdate() {
BRExecutor.getInstance().forBackgroundTasks().execute {
TxManager.getInstance().updateTxList(requireActivity() as BreadActivity)
if (this.activity == null) {
registerAnalyticsError("null_in_history_fragment_on_status_update")
}
else {
TxManager.getInstance().updateTxList(this.activity)
}
}
}

Expand All @@ -84,14 +103,23 @@ class HistoryFragment :

override fun onTxAdded() {
BRExecutor.getInstance().forBackgroundTasks().execute {
TxManager.getInstance().updateTxList(requireActivity() as BreadActivity)
if (this.activity == null) {
registerAnalyticsError("null_in_history_fragment_on_tx_added")
}
else {
TxManager.getInstance().updateTxList(this.activity)
}
}
}

private fun updateUI() {
BRExecutor.getInstance().forLightWeightBackgroundTasks().execute {
Thread.currentThread().name = Thread.currentThread().name + "HistoryFragment:updateUI"
TxManager.getInstance().updateTxList(requireActivity() as BreadActivity)
if (this.activity == null) {
registerAnalyticsError("null_in_history_fragment_update_ui")
}
else {
Thread.currentThread().name = Thread.currentThread().name + "HistoryFragment:updateUI"
TxManager.getInstance().updateTxList(this.activity)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import android.app.Activity;
import android.app.FragmentManager;
import android.app.FragmentTransaction;

import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand All @@ -29,7 +29,6 @@
import com.breadwallet.R;
import com.breadwallet.presenter.activities.BreadActivity;
import com.breadwallet.presenter.activities.LoginActivity;
import com.breadwallet.presenter.activities.camera.CameraActivity;
import com.breadwallet.presenter.activities.camera.ScanQRActivity;
import com.breadwallet.presenter.customviews.BRDialogView;
import com.breadwallet.presenter.entities.TxItem;
Expand All @@ -43,6 +42,7 @@
import com.breadwallet.presenter.fragments.FragmentSend;
import com.breadwallet.presenter.fragments.FragmentSignal;
import com.breadwallet.presenter.fragments.FragmentTransactionDetails;

import com.breadwallet.presenter.interfaces.BROnSignalCompletion;
import com.breadwallet.tools.threads.BRExecutor;
import com.breadwallet.tools.util.BRConstants;
Expand Down Expand Up @@ -325,6 +325,7 @@ public void run() {
}

public static void killAllFragments(Activity app) {
//DEV: Needs refactor
if (app != null && !app.isDestroyed())
app.getFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
Expand Down
116 changes: 0 additions & 116 deletions app/src/main/java/com/breadwallet/tools/manager/BREventManager.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ public static void putGeoPermissionsRequested(Context activity, boolean requeste

public static int getStartHeight(Context context) {
SharedPreferences settingsToGet = context.getSharedPreferences(BRConstants.PREFS_NAME, 0);
return settingsToGet.getInt(BRConstants.START_HEIGHT, 0);
return settingsToGet.getInt(BRConstants.START_HEIGHT, 0);
}

public static void putStartHeight(Context context, int startHeight) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public static void addConnectionListener(ConnectionReceiverListener listener) {
if (!connectionReceiverListeners.contains(listener))
connectionReceiverListeners.add(listener);
}

@Override
public void onReceive(final Context context, final Intent intent) {
boolean connected = false;
Expand All @@ -48,7 +47,6 @@ public void onReceive(final Context context, final Intent intent) {
connected = false;
}

BREventManager.getInstance().pushEvent(connected ? "reachability.isReachble" : "reachability.isNotReachable");
for (ConnectionReceiverListener listener : connectionReceiverListeners) {
listener.onConnectionChanged(connected);
}
Expand Down
Loading