Skip to content

Commit

Permalink
Merge pull request #1274 from KomodoPlatform/fix_page_switching_crash
Browse files Browse the repository at this point in the history
Fix page switching crash
  • Loading branch information
Milerius authored Sep 14, 2021
2 parents 7b52793 + 46a8511 commit c541631
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions atomic_defi_design/qml/Dashboard/NotificationsModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ DexPopup {
break
case "open_wallet_page":
api_wallet_page.ticker = notification.params.ticker
dashboard.current_page = idx_dashboard_wallet
dashboard.switchPage(idx_dashboard_wallet)
break
case "open_swaps_page":
dashboard.current_page = idx_dashboard_exchange
dashboard.switchPage(idx_dashboard_exchange)

dashboard.loader.onLoadComplete = () => {
dashboard.current_component.current_page = dashboard.isSwapDone(notification.params.new_swap_status) ? idx_exchange_history : idx_exchange_orders
Expand Down
2 changes: 1 addition & 1 deletion atomic_defi_design/qml/Portfolio/AssetsList.qml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Dex.DefaultListView
else
{
api_wallet_page.ticker = ticker
dashboard.current_page = idx_dashboard_wallet
dashboard.switchPage(idx_dashboard_wallet)
}
}
onPressAndHold:
Expand Down
2 changes: 1 addition & 1 deletion atomic_defi_design/qml/Portfolio/TableDex.qml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Item {
context_menu.popup()
else {
api_wallet_page.ticker = ticker
dashboard.current_page = idx_dashboard_wallet
dashboard.switchPage(idx_dashboard_wallet)
}
}
onPressAndHold: {
Expand Down
9 changes: 9 additions & 0 deletions atomic_defi_design/qml/Screens/Dashboard.qml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Item {
readonly property alias loader: loader
readonly property alias current_component: loader.item
property int current_page: idx_dashboard_portfolio

onCurrent_pageChanged: {
app.deepPage = current_page * 10
}
Expand All @@ -68,6 +69,14 @@ Item {
return app.current_page === idx_dashboard
}

function switchPage(page)
{
if (loader.status === Loader.Ready)
current_page = page
else
console.warn("Tried to switch to page %1 when loader is not ready yet.".arg(page))
}

property
var notifications_list: ([])

Expand Down
2 changes: 1 addition & 1 deletion atomic_defi_design/qml/Sidebar/SidebarLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Item {
else if(dashboard_index === idx_dashboard_privacy_mode) {
togglePrivacyMode()
}
else dashboard.current_page = dashboard_index
else dashboard.switchPage(dashboard_index)
}
}

Expand Down
2 changes: 1 addition & 1 deletion atomic_defi_design/qml/Wallet/Wallet.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ RowLayout
// Local
function onClickedSwap()
{
dashboard.current_page = idx_dashboard_exchange
dashboard.switchPage(idx_dashboard_exchange)
dashboard.current_ticker = api_wallet_page.ticker
API.app.trading_pg.set_pair(true, api_wallet_page.ticker)
}
Expand Down

0 comments on commit c541631

Please sign in to comment.