-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mvvm_architecture' into loanAcc-detail-mvvm
- Loading branch information
Showing
29 changed files
with
1,172 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
app/src/main/java/org/mifos/mobile/repositories/ClientRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
interface ClientRepository { | ||
|
||
fun updateAuthenticationToken(password: String) | ||
} |
19 changes: 19 additions & 0 deletions
19
app/src/main/java/org/mifos/mobile/repositories/ClientRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import okhttp3.Credentials | ||
import org.mifos.mobile.api.BaseApiManager | ||
import org.mifos.mobile.api.local.PreferencesHelper | ||
import javax.inject.Inject | ||
|
||
class ClientRepositoryImp @Inject constructor(private val preferencesHelper: PreferencesHelper) : ClientRepository { | ||
|
||
override fun updateAuthenticationToken(password: String) { | ||
val authenticationToken = Credentials.basic(preferencesHelper.userName!!, password) | ||
preferencesHelper.saveToken(authenticationToken) | ||
BaseApiManager.createService( | ||
preferencesHelper.baseUrl, | ||
preferencesHelper.tenant, | ||
preferencesHelper.token, | ||
) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
app/src/main/java/org/mifos/mobile/repositories/NotificationRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.models.notification.MifosNotification | ||
|
||
interface NotificationRepository { | ||
|
||
fun loadNotifications(): Observable<List<MifosNotification?>?> | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/org/mifos/mobile/repositories/NotificationRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.notification.MifosNotification | ||
import javax.inject.Inject | ||
|
||
class NotificationRepositoryImp @Inject constructor(private val dataManager: DataManager) : NotificationRepository { | ||
|
||
override fun loadNotifications(): Observable<List<MifosNotification?>?> { | ||
return dataManager.notifications | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/org/mifos/mobile/repositories/RecentTransactionRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.models.Page | ||
import org.mifos.mobile.models.Transaction | ||
|
||
interface RecentTransactionRepository { | ||
|
||
fun recentTransactions( | ||
offset: Int?, | ||
limit: Int? | ||
): Observable<Page<Transaction?>?>? | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/org/mifos/mobile/repositories/RecentTransactionRepositoryImp.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.mifos.mobile.repositories | ||
|
||
import io.reactivex.Observable | ||
import org.mifos.mobile.api.DataManager | ||
import org.mifos.mobile.models.Page | ||
import org.mifos.mobile.models.Transaction | ||
import javax.inject.Inject | ||
|
||
class RecentTransactionRepositoryImp @Inject constructor(private val dataManager: DataManager) : | ||
RecentTransactionRepository { | ||
|
||
override fun recentTransactions(offset: Int?, limit: Int?): Observable<Page<Transaction?>?>? { | ||
return limit?.let { offset?.let { it1 -> dataManager.getRecentTransactions(it1, it) } } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.