Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 10th, 2020 147 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class AddingPresenterImplementation @Inject constructor(private val dataSource: DataSource): AddingPresenter {
  2.     private var addingView: AddingView? = null
  3.  
  4.     @InternalCoroutinesApi
  5.     override suspend fun add(name: String, cost: Int, currency: Int, date: Long) {
  6.         addingView?.setLoadingVisibility(true)
  7.         val purchase = Purchase(0, name, cost, currency, date)
  8.         try {
  9.             dataSource.database.purchaseDao().insert(purchase)
  10.             addingView?.addSuccess()
  11.         } catch (e: Exception) {
  12.             addingView?.addFailed()
  13.             addingView?.showError(e.localizedMessage ?: "Unresolved error")
  14.         }
  15.     }
  16.  
  17.     override fun attachView(view: AddingView) {
  18.         addingView = view
  19.     }
  20.  
  21.     override fun detachView() {
  22.         addingView = null
  23.     }
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top