Skip to content

Conversation

@andhikayuana
Copy link
Contributor

@andhikayuana andhikayuana commented Feb 25, 2025

Overview

Implement user preferences for dark mode, language and fiat currency

Internal Issue

Self Test

userpref

@andhikayuana andhikayuana self-assigned this Feb 25, 2025
@kcw-grunt
Copy link
Collaborator

👀

@kcw-grunt
Copy link
Collaborator

Thanks @andhikayuana .

@kcw-grunt kcw-grunt self-requested a review February 25, 2025 14:36
@andhikayuana andhikayuana changed the title WIP: new user preferences e.g. dark mode, language, currency new user preferences e.g. dark mode, language, currency Feb 25, 2025
@andhikayuana andhikayuana requested a review from josikie February 25, 2025 17:28
@andhikayuana andhikayuana marked this pull request as ready for review February 25, 2025 17:28

if (BuildConfig.DEBUG) Timber.plant(DebugTree())

// DEV: uncomment for debugging
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

kcw-grunt
kcw-grunt previously approved these changes Feb 25, 2025
Copy link
Collaborator

@kcw-grunt kcw-grunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

fun find(code: String?): Language = entries.find { it.code == code } ?: ENGLISH
}

fun toLocale(): Locale {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice and neat @andhikayuana . Does this work for all cases? Does it work for xhants and Ru? We had issues in the past

import com.brainwallet.data.model.Language
import java.util.Locale

@Deprecated(message = "migrate using SettingRepository for persistence the user preference")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add and FirebaseAnalytics metrics test point to track when we can remove completely @andhikayuana ?

        pseudo  public static final String _20250225_DULUP = "did_use_legacy_user_preference";
        Bundle params = new Bundle();
        params.putDouble("sync_time_elapsed", minutesValue);
        params.putLong("sync_start_timestamp", startSync);
        params.putLong("sync_last_timestamp", lastSync);
        AnalyticsManager.logCustomEventWithParams(BRConstants._20250225_DULUP, params);


setContent {
val appSetting by BrainwalletApp.module.settingRepository.settings.collectAsState(
val appSetting by BrainwalletApp.module!!.settingRepository.settings.collectAsState(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧑‍🎓 ✋ : What does this operator do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import com.brainwallet.ui.theme.BrainwalletTheme

/**
* describe [FiatSelectorBottomSheet] for CurrencySelector
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👨‍🎓 ✋ : Is there a shortcut to add the document comment @andhikayuana ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the content is manual, but for the comment related you can do

  • Comment/uncomment with line comment: Command+/
  • Comment/uncomment with block comment: Command+Shift+/

more: https://developer.android.com/studio/intro/keyboard-shortcuts

import com.brainwallet.ui.theme.BrainwalletTheme

@Composable
fun LanguageSelectorBottomSheet(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this up for launch!
Hope to add something like this @andhikayuana
https://medium.com/@nbtk123/create-your-own-horizontal-vertical-slider-picker-android-94b6ee32b3ff
But in vertical...like this:

Ideal Picker
Screenshot 2025-02-25 at 18 33 41

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay, noted!

@kcw-grunt kcw-grunt self-requested a review February 25, 2025 19:41
@kcw-grunt kcw-grunt dismissed their stale review February 25, 2025 19:43

Running the PR and there is an issue in one of these commits:

This commit is working 69e60e99

@kcw-grunt
Copy link
Collaborator

@andhikayuana here is the logcat:

Crash
crash-ss

@andhikayuana
Copy link
Contributor Author

@andhikayuana here is the logcat:

Crash
crash-ss

fixed at b774c16

Copy link
Collaborator

@kcw-grunt kcw-grunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kcw-grunt kcw-grunt merged commit 5b731b0 into develop Feb 26, 2025
@kcw-grunt kcw-grunt deleted the feat/issue-69 branch February 26, 2025 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants