Skip to content

Commit

Permalink
Can start offline and work with cache. Related to #5
Browse files Browse the repository at this point in the history
  • Loading branch information
tanghus committed Sep 10, 2019
1 parent 929eca1 commit 9b4f46d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions qml/harbour-currencyconverter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ ApplicationWindow {
workOffline = settings.value('workOffline', false)
if(!workOffline) {
waitForNetwork.start()
} else {
// NOTE: Duplicate code from onIsOnlineChanged
allCurrenciesFetcher.request({})
provider.getAvailable(toCode)
// Start timer to monitor when Currencies data is ready.
kickOff.start()
}
}

Expand All @@ -146,8 +152,7 @@ ApplicationWindow {
interval: 3000
repeat: false
onTriggered: {
if(!Env.isOnline) {
console.log('App.waitForNetwork triggered')
if(!Env.isOnline && !workOffline) {
networkIFace.openConnection()
}
}
Expand Down Expand Up @@ -316,6 +321,7 @@ ApplicationWindow {
//Currencies.available = available
}
onError: {
notifier.notify(error, message)
console.log('App.provider.onError:', error, message)
Env.setBusy(false)
}
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/FrontPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Page {
enabled: isEnabled
currentCurrencyCode: fromCode
onActivated: {
console.log('FrontPage.fromCombo.onActivated:', JSON.stringify(currency))
console.log('FrontPage.fromCombo.onActivated:')
fromCode = currency.code
fromSymbol = currency.symbol ? currency.symbol : currency.code
if(fromCode !== toCode && !Env.isBusy && Env.isReady) { app.getRate() }
Expand Down

0 comments on commit 9b4f46d

Please sign in to comment.