Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix(desktop): in DesktopLocalDataSource throw exception if backpack n…
Browse files Browse the repository at this point in the history
…ot saved
  • Loading branch information
AndreaBrighi committed May 17, 2023
1 parent a2049a0 commit 0206b5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface DesktopLocalDataSource {
/**
* Get the backpack hash
*/
fun getBackpack(): String
fun getBackpack(): String?

/**
* Associate the backpack to the desktop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,12 @@ class DesktopLocalDataSourceImpl(
database.desktopDao().takeSchoolSuppliesFromBackpack(rfid)
}

override fun getBackpack(): String {
return storage.getBackpack()
}
override fun getBackpack(): String? =
if (storage.isBackpackSaved()) {
storage.getBackpack()
} else {
null
}

override fun associateBackpack(hash: String) {
storage.saveBackpack(hash)
Expand Down

0 comments on commit 0206b5f

Please sign in to comment.