Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f246266
WIP: Adding structure to the settings screen
kcw-grunt Mar 4, 2025
a54b7ad
chore: wip setting compose compat with xml
andhikayuana Mar 5, 2025
84fe06a
WIP: Layouting items
kcw-grunt Mar 6, 2025
e9f32f9
WIP: Set more of the Settings theme
kcw-grunt Mar 6, 2025
a2c16a3
Add settings title localizations
kcw-grunt Mar 7, 2025
11b5864
Added symbols to the Currency in settings
kcw-grunt Mar 7, 2025
9386f2a
WIP; Adding more function
kcw-grunt Mar 8, 2025
bffe3e0
chore: adjust wide NavigationView
andhikayuana Mar 11, 2025
b2c47b7
chore: fix after rebase with develop
andhikayuana Mar 12, 2025
1451134
chore: centering transaction_details_item.xml
andhikayuana Mar 12, 2025
37bcdc5
chore: inject settingRepository to HomeSettingDrawerComposeView
andhikayuana Mar 12, 2025
90bff01
chore: refactor HomeSettingDrawerSheet
andhikayuana Mar 14, 2025
37086df
chore: refactor HomeSettingDrawerSheet
andhikayuana Mar 14, 2025
c649d6d
Updated Games section
kcw-grunt Mar 16, 2025
7709c17
Added more security section titles
kcw-grunt Mar 18, 2025
df4100f
Layout complete
kcw-grunt Mar 18, 2025
bc9195e
chore: remove unused code
andhikayuana Mar 19, 2025
52c093a
feat: implement update pin
andhikayuana Mar 19, 2025
4bfd2b9
feat: implement show seed phrase
andhikayuana Mar 19, 2025
1f05854
feat: implement share analytics data toggle
andhikayuana Mar 19, 2025
5ce0456
feat: implement blockchain sync from setting drawer
andhikayuana Mar 19, 2025
bb1ee18
Merge pull request #42 from gruntsoftware/release/v4.3.1
kcw-grunt Mar 19, 2025
13aa961
feat: implement link open
andhikayuana Mar 19, 2025
12ab42e
Merge branch 'develop' into feat/add-settings-view-issue-93
kcw-grunt Mar 19, 2025
6369d2c
Merge pull request #45 from gruntsoftware/feat/add-settings-view-issu…
kcw-grunt Mar 19, 2025
d3d63a0
code / version bump
kcw-grunt Mar 20, 2025
19e28a6
Hacked in the WebView with Moonpay
kcw-grunt Mar 21, 2025
b509172
removed the unused images
kcw-grunt Mar 22, 2025
4fcfe8e
Merge pull request #46 from gruntsoftware/feat/add-moonpay-webview-is…
kcw-grunt Mar 22, 2025
bb77683
code bump
kcw-grunt Mar 22, 2025
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
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId = "ltd.grunt.brainwallet"
minSdk = 29
targetSdk = 34
versionCode = 202503031
versionName = "v4.3.1"
versionCode = 202503221
versionName = "v4.4.0"

multiDexEnabled = true
base.archivesName.set("${defaultConfig.versionName}(${defaultConfig.versionCode})")
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/com/brainwallet/data/model/AppSetting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ data class AppSetting(
val languageCode: String = Language.ENGLISH.code,
val currency: CurrencyEntity = CurrencyEntity(
"USD",
"USD",
-1f
"US Dollar",
-1f,
"$"
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ public class CurrencyEntity implements Serializable {
public String code;
public String name;
public float rate;
public String symbol;

public CurrencyEntity(String code, String name, float rate) {
public CurrencyEntity(String code, String name, float rate, String symbol) {
this.code = code;
this.name = name;
this.rate = rate;
this.symbol = symbol;
}

public CurrencyEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ interface SettingRepository {
currencyDataSource.getCurrencyByIso(it)
?: return@let CurrencyEntity(
"USD",
"USD",
-1f
"US Dollar",
-1f,
"$"
)
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/brainwallet/di/Module.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.brainwallet.data.repository.SettingRepository
import com.brainwallet.data.source.RemoteConfigSource
import com.brainwallet.tools.manager.BRApiManager
import com.brainwallet.tools.sqlite.CurrencyDataSource
import com.brainwallet.ui.screens.home.SettingsViewModel
import com.brainwallet.ui.screens.inputwords.InputWordsViewModel
import com.brainwallet.ui.screens.setpasscode.SetPasscodeViewModel
import com.brainwallet.ui.screens.unlock.UnLockViewModel
Expand Down Expand Up @@ -36,6 +37,7 @@ val dataModule = module {

val viewModelModule = module {
viewModelOf(::WelcomeViewModel)
viewModelOf(::SettingsViewModel)
viewModel { InputWordsViewModel() }
viewModel { SetPasscodeViewModel() }
viewModel { UnLockViewModel() }
Expand Down
14 changes: 12 additions & 2 deletions app/src/main/java/com/brainwallet/navigation/LegacyNavigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent
import com.brainwallet.R
import com.brainwallet.presenter.activities.BreadActivity
import com.brainwallet.presenter.activities.LoginActivity
import com.brainwallet.ui.BrainwalletActivity
import timber.log.Timber

Expand All @@ -25,7 +24,7 @@ object LegacyNavigation {
auth: Boolean
) {
Timber.i("timber: startBreadActivity: %s", from.javaClass.name)
val intent = if (auth) BrainwalletActivity.createIntent(from, Route.UnLock)
val intent = if (auth) BrainwalletActivity.createIntent(from, Route.UnLock())
else Intent(from, BreadActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
from.startActivity(intent)
Expand All @@ -35,6 +34,17 @@ object LegacyNavigation {
}
}

@JvmStatic
fun restartBreadActivity(
context: Context
) {
Intent(context, BreadActivity::class.java).apply {
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
}.also {
context.startActivity(it)
}
}

//open compose from old activity
@JvmStatic
@JvmOverloads
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/com/brainwallet/navigation/MainNav.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ fun NavGraphBuilder.mainNavGraph(

composable<Route.SetPasscode> { navBackStackEntry ->
val route: Route.SetPasscode = navBackStackEntry.toRoute()
SetPasscodeScreen(onNavigate = onNavigate, passcode = route.passcode)
SetPasscodeScreen(
onNavigate = onNavigate,
passcode = route.passcode,
)
}
composable<Route.InputWords> { navBackStackEntry ->
val route: Route.InputWords = navBackStackEntry.toRoute()
Expand All @@ -98,16 +101,16 @@ fun NavGraphBuilder.mainNavGraph(
)
}


/**
* for now, still using old activity & fragment [com.brainwallet.presenter.activities.BreadActivity]
*/
// composable<Route.Home> {
// HomeScreen(onNavigate = onNavigate)
// }

composable<Route.UnLock> {
UnLockScreen(onNavigate = onNavigate)
composable<Route.UnLock> { navBackStackEntry ->
val route: Route.UnLock = navBackStackEntry.toRoute()
UnLockScreen(onNavigate = onNavigate, isUpdatePin = route.isUpdatePin)
}

//todo add more composable screens
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/com/brainwallet/navigation/Route.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@ sealed class Route : JavaSerializable {
@Serializable
object TopUp : Route()

@Serializable
object Settings : Route()

@Serializable
data class SetPasscode(
val passcode: List<Int> = emptyList()
val passcode: List<Int> = emptyList(),
val isUpdatePin: Boolean = false,
) : Route()

@Serializable
Expand All @@ -39,6 +43,6 @@ sealed class Route : JavaSerializable {
// object Home : Route()

@Serializable
object UnLock : Route()
data class UnLock(val isUpdatePin: Boolean = false) : Route()

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.constraintlayout.widget.ConstraintSet;
import androidx.core.app.ActivityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.transition.ChangeBounds;
import androidx.transition.Fade;
import androidx.transition.TransitionManager;
import androidx.transition.TransitionSet;

import com.brainwallet.BrainwalletApp;
import com.brainwallet.R;
import com.brainwallet.navigation.LegacyNavigation;
import com.brainwallet.navigation.Route;
import com.brainwallet.presenter.activities.settings.SettingsActivity;
import com.brainwallet.presenter.activities.settings.SyncBlockchainActivity;
import com.brainwallet.presenter.activities.util.BRActivity;
import com.brainwallet.presenter.customviews.BRNotificationBar;
import com.brainwallet.presenter.fragments.BuyTabFragment;
import com.brainwallet.presenter.fragments.FragmentMoonpay;
import com.brainwallet.presenter.history.HistoryFragment;
import com.brainwallet.tools.animation.BRAnimator;
import com.brainwallet.tools.animation.TextSizeTransition;
Expand All @@ -46,18 +51,23 @@
import com.brainwallet.tools.manager.InternetManager;
import com.brainwallet.tools.manager.SyncManager;
import com.brainwallet.tools.security.BitcoinUrlHandler;
import com.brainwallet.tools.security.PostAuth;
import com.brainwallet.tools.sqlite.TransactionDataSource;
import com.brainwallet.tools.threads.BRExecutor;
import com.brainwallet.tools.util.BRConstants;
import com.brainwallet.tools.util.BRCurrency;
import com.brainwallet.tools.util.BRExchange;
import com.brainwallet.tools.util.ExtensionKt;
import com.brainwallet.tools.util.Utils;
import com.brainwallet.ui.BrainwalletActivity;
import com.brainwallet.ui.screens.home.SettingsViewModel;
import com.brainwallet.ui.screens.home.composable.HomeSettingDrawerComposeView;
import com.brainwallet.util.PermissionUtil;
import com.brainwallet.wallet.BRPeerManager;
import com.brainwallet.wallet.BRWalletManager;
import com.google.android.gms.tasks.Task;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.navigation.NavigationView;
import com.google.android.play.core.review.ReviewInfo;
import com.google.android.play.core.review.ReviewManager;
import com.google.android.play.core.review.ReviewManagerFactory;
Expand Down Expand Up @@ -90,6 +100,9 @@ public class BreadActivity extends BRActivity implements BRWalletManager.OnBalan
private BottomNavigationView bottomNav;

private Handler mHandler = new Handler();
private NavigationView navigationDrawer;
private DrawerLayout drawerLayout;
private HomeSettingDrawerComposeView homeSettingDrawerComposeView;

public static BreadActivity getApp() {
return app;
Expand Down Expand Up @@ -220,14 +233,15 @@ private void setListeners() {
secondaryPrice.setOnClickListener(v -> swap());
menuBut.setOnClickListener(v -> {
if (BRAnimator.isClickAllowed()) {
BRAnimator.showMenuFragment(BreadActivity.this);
drawerLayout.open();
}
});
}

public boolean handleNavigationItemSelected(int menuItemId) {
if (mSelectedBottomNavItem == menuItemId) return true;
mSelectedBottomNavItem = menuItemId;

//TODO: revisit
// we are using compose, that's why commented, will remove it after fully migrated to compose
if (menuItemId == R.id.nav_history) {
Expand All @@ -242,8 +256,12 @@ public boolean handleNavigationItemSelected(int menuItemId) {
BRAnimator.showReceiveFragment(BreadActivity.this, true);
}
mSelectedBottomNavItem = 0;
} else if (menuItemId == R.id.nav_buy) {
ExtensionKt.replaceFragment(BreadActivity.this, new BuyTabFragment(), false, R.id.fragment_container);
}
else if (menuItemId == R.id.nav_buy) {
if (BRAnimator.isClickAllowed()) {
BRAnimator.showMoonpayFragment(BreadActivity.this);
}
mSelectedBottomNavItem = 0;
}
return true;
}
Expand Down Expand Up @@ -366,6 +384,33 @@ protected void onDestroy() {

private void initializeViews() {
menuBut = findViewById(R.id.menuBut);

navigationDrawer = findViewById(R.id.navigationDrawer);
drawerLayout = findViewById(R.id.drawerLayout);
homeSettingDrawerComposeView = findViewById(R.id.homeDrawerComposeView);
homeSettingDrawerComposeView.observeBus(message -> {
drawerLayout.close();
if (SettingsViewModel.LEGACY_EFFECT_ON_LOCK.equals(message.getMessage())) {
LegacyNavigation.startBreadActivity(this, true);
} else if (SettingsViewModel.LEGACY_EFFECT_ON_TOGGLE_DARK_MODE.equals(message.getMessage())) {
LegacyNavigation.restartBreadActivity(this);
} else if (SettingsViewModel.LEGACY_EFFECT_ON_SEC_UPDATE_PIN.equals(message.getMessage())) {
Intent intent = BrainwalletActivity.createIntent(this, new Route.UnLock(true));
intent.putExtra("noPin", true);
startActivity(intent);
} else if (SettingsViewModel.LEGACY_EFFECT_ON_SEED_PHRASE.equals(message.getMessage())) {
PostAuth.getInstance().onPhraseCheckAuth(this, true);
} else if (SettingsViewModel.LEGACY_EFFECT_ON_SHARE_ANALYTICS_DATA_TOGGLE.equals(message.getMessage())) {
boolean currentShareAnalyticsDataEnabled = BRSharedPrefs.getShareData(this);
BRSharedPrefs.putShareData(this, !currentShareAnalyticsDataEnabled);
} else if (SettingsViewModel.LEGACY_EFFECT_ON_SYNC.equals(message.getMessage())) {
Intent intent = new Intent(this, SyncBlockchainActivity.class);
startActivity(intent);
overridePendingTransition(R.anim.enter_from_right, R.anim.exit_to_left);
}
return null;
}); //since we are still using this BreadActivity, need to observe EventBus e.g. lock from [HomeSettingDrawerSheet]

bottomNav = findViewById(R.id.bottomNav);
bottomNav.getMenu().clear();
bottomNav.inflateMenu(isInUsa() ? R.menu.bottom_nav_menu_us : R.menu.bottom_nav_menu);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ private void populateItems() {

//toggle dark mode
boolean isDarkMode = settingRepository.isDarkMode();

items.add(new BRSettingsItem(getString(R.string.toggle_dark_mode), getString(isDarkMode ? androidx.appcompat.R.string.abc_capital_on : androidx.appcompat.R.string.abc_capital_off), v -> {
settingRepository.toggleDarkMode(!isDarkMode);
LegacyNavigation.openComposeScreen(SettingsActivity.this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public void onClick(BRDialogView brDialogView) {
BRExecutor.getInstance().forLightWeightBackgroundTasks().execute(new Runnable() {
@Override
public void run() {
///Dev: This is the structure to do full sync
BRSharedPrefs.putStartHeight(SyncBlockchainActivity.this, 0);
BRSharedPrefs.putAllowSpend(SyncBlockchainActivity.this, false);
BRPeerManager.getInstance().rescan();
Expand Down
45 changes: 0 additions & 45 deletions app/src/main/java/com/brainwallet/presenter/entities/Partner.java

This file was deleted.

Loading