Skip to content

Commit

Permalink
remove trade section from darwin builds
Browse files Browse the repository at this point in the history
  • Loading branch information
dreacot committed May 20, 2024
1 parent 617ca9a commit 376532f
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
5 changes: 5 additions & 0 deletions appos/os.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package appos
type AppOS struct {
isAndroid bool
isIOS bool
isDarwin bool
}

// Default AppOS value. Updated in OS-specific files for each OS.
Expand All @@ -26,3 +27,7 @@ func (os *AppOS) IsIOS() bool {
func (os *AppOS) IsMobile() bool {
return os.isAndroid || os.isIOS
}

func (os *AppOS) IsDarwin() bool {
return os.isDarwin
}
8 changes: 8 additions & 0 deletions appos/os_darwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build darwin
// +build darwin

package appos

func init() {
appCurrentOS.isDarwin = true
}
15 changes: 13 additions & 2 deletions ui/page/root/home_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,20 @@ func (hp *HomePage) initPageItems() {
values.String(values.StrOverview),
values.String(values.StrTransactions),
values.String(values.StrWallets),
values.String(values.StrTrade),
values.String(values.StrGovernance),
}

// Add trade tab only if not on macOS
if !appos.Current().IsDarwin() {
// Determine the insertion point, which is second to last position
insertionPoint := len(navigationTabTitles) - 1
if insertionPoint < 0 {
insertionPoint = 0
}
// Append at the second to last position
navigationTabTitles = append(navigationTabTitles[:insertionPoint], append([]string{values.String(values.StrTrade)}, navigationTabTitles[insertionPoint:]...)...)
}

hp.navigationTab = hp.Theme.Tab(layout.Horizontal, false, navigationTabTitles)

hp.sendReceiveNavItems = []components.NavBarItem{
Expand Down Expand Up @@ -706,7 +717,7 @@ func (hp *HomePage) initBottomNavItems() {
},
}

// Add the trade tab only if not on mobile
// Add the trade tab only if not on iOS
if !appos.Current().IsIOS() {
tradeTab := components.BottomNavigationBarHandler{
Clickable: hp.Theme.NewClickable(true),
Expand Down
3 changes: 2 additions & 1 deletion ui/page/root/overview_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ func (pg *OverviewPage) layoutMobile(gtx C) D {
pg.recentProposal,
}

if !appos.Current().IsIOS() {
// Do not show recent trades on iOS and macOS
if !appos.Current().IsIOS() || !appos.Current().IsDarwin() {
// Determine the insertion point, which is second to last position
insertionPoint := len(pageContent) - 1
if insertionPoint < 0 {
Expand Down

0 comments on commit 376532f

Please sign in to comment.