Skip to content

Commit

Permalink
update mobile and desktop layout for all backup pages and fix dismiss…
Browse files Browse the repository at this point in the history
… backup
  • Loading branch information
JustinBeBoy committed Dec 22, 2023
1 parent 0a3850c commit 15b65ae
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 318 deletions.
13 changes: 7 additions & 6 deletions ui/page/root/single_wallet_main_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,16 @@ func (swmp *SingleWalletMasterPage) OnNavigatedTo() {
swmp.checkBox.CheckBox.Value = false

needBackup := swmp.selectedWallet.GetEncryptedSeed() != ""
if needBackup && !backupLater {
swmp.showBackupInfo()
}

if swmp.CurrentPage() == nil {
swmp.Display(info.NewInfoPage(swmp.Load, swmp.selectedWallet)) // TODO: Should pagestack have a start page? YES!
} else {
swmp.CurrentPage().OnNavigatedTo()
}

if needBackup && !backupLater {
swmp.showBackupInfo()
}
// set active tab value
swmp.activeTab[swmp.pageNavigationTab.SelectedSegment()] = swmp.CurrentPageID()

Expand Down Expand Up @@ -780,10 +781,10 @@ func (swmp *SingleWalletMasterPage) showBackupInfo() {
}).
PositiveButtonStyle(swmp.Load.Theme.Color.Primary, swmp.Load.Theme.Color.InvText).
SetPositiveButtonText(values.String(values.StrBackupNow)).
SetPositiveButtonCallback(func(_ bool, _ *modal.InfoModal) bool {
swmp.selectedWallet.SaveUserConfigValue(sharedW.SeedBackupNotificationConfigKey, true)
SetPositiveButtonCallback(func(_ bool, m *modal.InfoModal) bool {
swmp.ParentNavigator().Display(seedbackup.NewBackupInstructionsPage(swmp.Load, swmp.selectedWallet, func(load *load.Load, navigator app.WindowNavigator) {
navigator.ClosePagesAfter(swmp.ParentWindow().CurrentPageID())
swmp.selectedWallet.SaveUserConfigValue(sharedW.SeedBackupNotificationConfigKey, true)
swmp.ParentNavigator().CloseCurrentPage()
}))
return true
})
Expand Down
19 changes: 8 additions & 11 deletions ui/page/seedbackup/backup_instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewBackupInstructionsPage(l *load.Load, wallet sharedW.Asset, redirect Redi
}

for i := range bi.checkBoxes {
bi.checkBoxes[i].TextSize = values.TextSize16
bi.checkBoxes[i].TextSize = values.TextSizeTransform(l.IsMobileView(), values.TextSize16)
}

bi.infoList = &layout.List{Axis: layout.Vertical}
Expand All @@ -78,8 +78,7 @@ func NewBackupInstructionsPage(l *load.Load, wallet sharedW.Asset, redirect Redi
// may be used to initialize page features that are only relevant when
// the page is displayed.
// Part of the load.Page interface.
func (pg *BackupInstructionsPage) OnNavigatedTo() {
}
func (pg *BackupInstructionsPage) OnNavigatedTo() {}

// HandleUserInteractions is called just before Layout() to determine
// if any user interaction recently occurred on the page and may be
Expand Down Expand Up @@ -120,7 +119,7 @@ func (pg *BackupInstructionsPage) OnNavigatedFrom() {}
// Layout draws the page UI components into the provided layout context
// to be eventually drawn on screen.
// Part of the load.Page interface.
func (pg *BackupInstructionsPage) Layout(gtx layout.Context) layout.Dimensions {
func (pg *BackupInstructionsPage) Layout(gtx C) D {
sp := components.SubPage{
Load: pg.Load,
Title: values.String(values.StrKeepInMind),
Expand Down Expand Up @@ -156,10 +155,10 @@ func (pg *BackupInstructionsPage) verifyCheckBoxes() bool {
func container(gtx C, isMobile bool, theme cryptomaterial.Theme, body layout.Widget, infoText string, actionBtn cryptomaterial.Button, showActionBtn bool) D {
bodyLayout := func(gtx C) D {
return layout.Stack{}.Layout(gtx,
layout.Expanded(func(gtx layout.Context) layout.Dimensions {
layout.Expanded(func(gtx C) D {
return body(gtx)
}),
layout.Stacked(func(gtx layout.Context) layout.Dimensions {
layout.Stacked(func(gtx C) D {
if !showActionBtn {
return D{}
}
Expand Down Expand Up @@ -187,12 +186,10 @@ func container(gtx C, isMobile bool, theme cryptomaterial.Theme, body layout.Wid
layout.Rigid(func(gtx C) D {
gtx.Constraints.Min.X = gtx.Constraints.Max.X
return actionBtn.Layout(gtx)
}))
}),
)
}),
)
}
if isMobile {
return components.UniformMobile(gtx, false, false, bodyLayout)
}
return cryptomaterial.UniformPadding(gtx, bodyLayout)
return cryptomaterial.UniformPadding(gtx, bodyLayout, isMobile)
}
4 changes: 2 additions & 2 deletions ui/page/seedbackup/backup_success.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ func (pg *BackupSuccessPage) Layout(gtx C) D {
return successIcon.Layout(gtx, values.MarginPadding64)
}),
layout.Rigid(func(gtx C) D {
label := pg.Theme.Label(values.TextSize24, values.String(values.StrSeedPhraseVerified))
label := pg.Theme.Label(values.TextSizeTransform(pg.IsMobileView(), values.TextSize24), values.String(values.StrSeedPhraseVerified))
label.Color = pg.Theme.Color.DeepBlue

return layout.Inset{Top: values.MarginPadding24}.Layout(gtx, label.Layout)
}),
layout.Rigid(func(gtx C) D {
label := pg.Theme.Label(values.TextSize16, values.String(values.StrSureToSafeStoreSeed))
label := pg.Theme.Label(values.TextSizeTransform(pg.IsMobileView(), values.TextSize16), values.String(values.StrSureToSafeStoreSeed))
label.Color = pg.Theme.Color.GrayText1

return layout.Inset{Top: values.MarginPadding16}.Layout(gtx, label.Layout)
Expand Down
Loading

0 comments on commit 15b65ae

Please sign in to comment.