Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanvians authored and ukane-philemon committed Dec 5, 2023
1 parent b03db55 commit dc5fe0b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 26 deletions.
1 change: 0 additions & 1 deletion libwallet/assets/wallet/wallet_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const (
LanguagePreferenceKey = "app_language"
DarkModeConfigKey = "dark_mode"
HideTotalBalanceConfigKey = "hideTotalUSDBalance"
DexFirstVisitKey = "dexFirstVisit"

PassphraseTypePin int32 = 0
PassphraseTypePass int32 = 1
Expand Down
12 changes: 0 additions & 12 deletions libwallet/assets_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,3 @@ func (mgr *AssetsManager) SetTotalBalanceVisibility(data bool) {
func genKey(prefix, identifier interface{}) string {
return fmt.Sprintf("%v-%v", prefix, identifier)
}

// IsDexFirstVisit checks if its the users first visit to DCRDEX page
func (mgr *AssetsManager) IsDexFirstVisit() bool {
var data bool
mgr.db.ReadWalletConfigValue(sharedW.DexFirstVisitKey, &data)
return data
}

// SetDexFirstVisit sets the first visit to DCRDEX .
func (mgr *AssetsManager) SetDexFirstVisit(data bool) {
mgr.db.SaveWalletConfigValue(sharedW.DexFirstVisitKey, data)
}
1 change: 0 additions & 1 deletion ui/load/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ const (
SpendUnmixedFundsKey = "spend_unmixed_funds"
KnownDexServersConfigKey = "known_dex_servers"
GapLimitConfigKey = "gap_limit_key"
DexFirstVisitKey = "dexFirstVisit"
)
20 changes: 10 additions & 10 deletions ui/page/dcrdex/dcrdex_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/crypto-power/cryptopower/ui/values"
)

const DCRDEXID = "DCRDEXID"
const DCRDEXPageID = "DCRDEXPageID"

type (
C = layout.Context
Expand All @@ -28,28 +28,28 @@ type DEXPage struct {

openTradeMainPage *cryptomaterial.Clickable
splashPageInfoButton cryptomaterial.IconButton
enableDEXBtn cryptomaterial.Button
navigateToSettingsBtn cryptomaterial.Button
inited bool // TODO: Set value
finalizeOnboardingBtn cryptomaterial.Button
isDexFirstVisit bool
}

func NewDEXPage(l *load.Load) *DEXPage {
dp := &DEXPage{
Load: l,
MasterPage: app.NewMasterPage(DCRDEXID),
MasterPage: app.NewMasterPage(DCRDEXPageID),
openTradeMainPage: l.Theme.NewClickable(false),
isDexFirstVisit: true,
}

dp.initSplashPageWidgets()
dp.navigateToSettingsBtn = dp.Theme.Button(values.String(values.StrStartTrading))
dp.finalizeOnboardingBtn = dp.Theme.Button(values.String(values.StrStartTrading))
return dp
}

// ID is a unique string that identifies the page and may be used to
// differentiate this page from other pages.
// Part of the load.Page interface.
func (pg *DEXPage) ID() string {
return DCRDEXID
return DCRDEXPageID
}

// OnNavigatedTo is called when the page is about to be displayed and may be
Expand All @@ -70,7 +70,7 @@ func (pg *DEXPage) OnNavigatedTo() {
// eventually drawn on screen.
// Part of the load.Page interface.
func (pg *DEXPage) Layout(gtx C) D {
if !pg.AssetsManager.IsDexFirstVisit() {
if pg.isDexFirstVisit {
return components.UniformPadding(gtx, pg.splashPage)
}
return layout.Stack{}.Layout(gtx,
Expand Down Expand Up @@ -100,8 +100,8 @@ func (pg *DEXPage) HandleUserInteractions() {
if pg.splashPageInfoButton.Button.Clicked() {
pg.showInfoModal()
}
if pg.navigateToSettingsBtn.Button.Clicked() {
pg.AssetsManager.SetDexFirstVisit(true)
if pg.finalizeOnboardingBtn.Button.Clicked() {
pg.isDexFirstVisit = false
}
}

Expand Down
3 changes: 1 addition & 2 deletions ui/page/dcrdex/dex_splash_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

func (pg *DEXPage) initSplashPageWidgets() {
_, pg.splashPageInfoButton = components.SubpageHeaderButtons(pg.Load)
pg.enableDEXBtn = pg.Theme.Button(values.String(values.StrBack))
}

func (pg *DEXPage) splashPage(gtx layout.Context) layout.Dimensions {
Expand Down Expand Up @@ -58,7 +57,7 @@ func (pg *DEXPage) splashPage(gtx layout.Context) layout.Dimensions {
return layout.Inset{
Top: values.MarginPadding24,
Right: values.MarginPadding16,
}.Layout(gtx, pg.navigateToSettingsBtn.Layout)
}.Layout(gtx, pg.finalizeOnboardingBtn.Layout)
}),
)
}
Expand Down

0 comments on commit dc5fe0b

Please sign in to comment.