-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
aveek
committed
Jun 19, 2022
1 parent
18db010
commit a20e9d9
Showing
58 changed files
with
412 additions
and
27 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
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
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/moneybox/minimb/data/di/MainModule.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,10 @@ | ||
package com.moneybox.minimb.data.di | ||
|
||
import dagger.Module | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ActivityRetainedComponent | ||
|
||
@InstallIn(ActivityRetainedComponent::class) | ||
@Module | ||
object MainModule { | ||
} |
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab
Binary file not shown.
Binary file modified
BIN
+234 Bytes
(180%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/inputs/source-to-output.tab.values.at
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab
Binary file not shown.
Binary file modified
BIN
+9 Bytes
(120%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-attributes.tab.values.at
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab
Binary file not shown.
Binary file modified
BIN
+144 Bytes
(170%)
...rc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab
Binary file not shown.
Binary file modified
BIN
+144 Bytes
(170%)
...rc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab
Binary file not shown.
Binary file modified
BIN
+6.46 KB
(200%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/proto.tab.values.at
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab
Binary file not shown.
Binary file modified
BIN
+38 Bytes
(140%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/counters.tab
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
1 | ||
0 | ||
2 | ||
1 |
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab
Binary file not shown.
Binary file modified
BIN
+6 Bytes
(110%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/file-to-id.tab.values.at
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.keystream.len
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.len
Binary file not shown.
Binary file modified
BIN
+48 Bytes
(150%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab.values.at
Binary file not shown.
Binary file added
BIN
+32 KB
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i
Binary file not shown.
Binary file added
BIN
+8 Bytes
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/id-to-file.tab_i.len
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab
Binary file not shown.
Binary file modified
BIN
+590 Bytes
(250%)
buildSrc/build/kotlin/compileKotlin/caches-jvm/lookups/lookups.tab.values.at
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,28 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'kotlin-kapt' | ||
id 'dagger.hilt.android.plugin' | ||
} | ||
|
||
android { | ||
|
||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
buildFeatures { | ||
dataBinding true | ||
} | ||
kapt { | ||
correctErrorTypes = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation project(':network') | ||
implementation project(':libraries:uiComponents') | ||
|
||
implementation Deps.androidx_hilt | ||
implementation Deps.androidx_hilt_navigation | ||
kapt Deps.androidx_hilt_kapt | ||
} |
12 changes: 12 additions & 0 deletions
12
feature/login/src/main/java/com/moneybox/minimb/feature/login/api/LoginDataService.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,12 @@ | ||
package com.moneybox.minimb.feature.login.api | ||
|
||
import com.moneybox.minimb.feature.login.models.LoginResponse | ||
import retrofit2.Response | ||
import retrofit2.http.Body | ||
import retrofit2.http.POST | ||
|
||
interface LoginDataService { | ||
|
||
@POST("users/login") | ||
suspend fun loginRequest(@Body user : Map<String , String>) : Response<LoginResponse> | ||
} |
36 changes: 36 additions & 0 deletions
36
feature/login/src/main/java/com/moneybox/minimb/feature/login/data/LoginDataSource.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,36 @@ | ||
package com.moneybox.minimb.feature.login.data | ||
|
||
import com.google.gson.Gson | ||
import com.moneybox.minimb.feature.login.api.LoginDataService | ||
import com.moneybox.minimb.feature.login.models.LoginResponse | ||
import com.moneybox.minimb.network.ApiResponseResult | ||
import com.moneybox.minimb.network.ErrorResponseRemote | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flow | ||
import javax.inject.Inject | ||
|
||
class LoginDataSource @Inject constructor(private val service : LoginDataService) { | ||
suspend fun login(userMap: HashMap<String, String>): Flow<ApiResponseResult<LoginResponse>> { | ||
return flow { | ||
emit(ApiResponseResult.loading()) | ||
val result = service.loginRequest(userMap) | ||
if (result.isSuccessful) { | ||
emit(ApiResponseResult.success(data = result.body())) | ||
} else { | ||
val errorResponseRemote: ErrorResponseRemote = | ||
Gson().fromJson( | ||
result.errorBody()?.charStream(), | ||
ErrorResponseRemote::class.java | ||
) | ||
errorResponseRemote?.let { | ||
it.message?.let { msg -> | ||
emit(ApiResponseResult.error(msg, result.code().toString())) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
fun logout(){ | ||
|
||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
feature/login/src/main/java/com/moneybox/minimb/feature/login/data/LoginRepository.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 |
---|---|---|
@@ -1,6 +1,16 @@ | ||
package com.moneybox.minimb.feature.login.data | ||
|
||
import com.moneybox.minimb.feature.login.models.LoginResponse | ||
import com.moneybox.minimb.network.ApiResponseResult | ||
import kotlinx.coroutines.flow.Flow | ||
import javax.inject.Inject | ||
|
||
class LoginRepository @Inject constructor() { | ||
class LoginRepository @Inject constructor(private val loginDataSource: LoginDataSource) { | ||
suspend fun login(userMap : HashMap<String, String>): Flow<ApiResponseResult<LoginResponse>> { | ||
return loginDataSource.login(userMap) | ||
} | ||
fun logout() { | ||
// user = null | ||
loginDataSource.logout() | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
feature/login/src/main/java/com/moneybox/minimb/feature/login/di/LoginModule.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,20 @@ | ||
package com.moneybox.minimb.feature.login.di | ||
|
||
import com.moneybox.minimb.feature.login.api.LoginDataService | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ActivityRetainedComponent | ||
import dagger.hilt.android.scopes.ActivityRetainedScoped | ||
import retrofit2.Retrofit | ||
|
||
@InstallIn(ActivityRetainedComponent::class) | ||
@Module | ||
object LoginModule { | ||
|
||
@Provides | ||
@ActivityRetainedScoped | ||
fun appServiceProvider(retrofit: Retrofit) : LoginDataService{ | ||
return retrofit.create(LoginDataService::class.java) | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
feature/login/src/main/java/com/moneybox/minimb/feature/login/di/LoginRepositoryModule.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,31 @@ | ||
package com.moneybox.minimb.feature.login.di | ||
|
||
import com.moneybox.minimb.feature.login.api.LoginDataService | ||
import com.moneybox.minimb.feature.login.data.LoginDataSource | ||
import com.moneybox.minimb.feature.login.data.LoginRepository | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.ViewModelComponent | ||
import dagger.hilt.android.scopes.ViewModelScoped | ||
|
||
@InstallIn(ViewModelComponent::class) | ||
@Module | ||
class LoginRepositoryModule { | ||
|
||
@Provides | ||
@ViewModelScoped | ||
fun provideLoginDataSource( | ||
service: LoginDataService | ||
): LoginDataSource { | ||
return LoginDataSource(service) | ||
} | ||
|
||
@Provides | ||
@ViewModelScoped | ||
fun provideLoginDataRepository( | ||
dataSource: LoginDataSource | ||
): LoginRepository { | ||
return LoginRepository(dataSource) | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
feature/login/src/main/java/com/moneybox/minimb/feature/login/models/LoginRequest.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,16 @@ | ||
package com.moneybox.minimb.feature.login.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class LoginRequest( | ||
@SerializedName("Idfa") | ||
val idfa: String = "", | ||
@SerializedName("DeviceIdentifier") | ||
val deviceIdentifier: String = "", | ||
@SerializedName("UniqueDeviceIdentifier") | ||
val uniqueDeviceId: String = "", | ||
@SerializedName("Email") | ||
val email: String, | ||
@SerializedName("Password") | ||
val password: String, | ||
) |
10 changes: 10 additions & 0 deletions
10
feature/login/src/main/java/com/moneybox/minimb/feature/login/models/LoginResponse.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,10 @@ | ||
package com.moneybox.minimb.feature.login.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class LoginResponse( | ||
@SerializedName("Session") | ||
val session: SessionDataResponse, | ||
@SerializedName("User") | ||
val user: UserResponse | ||
) |
8 changes: 8 additions & 0 deletions
8
feature/login/src/main/java/com/moneybox/minimb/feature/login/models/SessionDataResponse.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,8 @@ | ||
package com.moneybox.minimb.feature.login.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class SessionDataResponse( | ||
@SerializedName("BearerToken") | ||
val bearerToken: String | ||
) |
14 changes: 14 additions & 0 deletions
14
feature/login/src/main/java/com/moneybox/minimb/feature/login/models/UserResponse.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 com.moneybox.minimb.feature.login.models | ||
|
||
import com.google.gson.annotations.SerializedName | ||
|
||
data class UserResponse( | ||
@SerializedName("UserId") | ||
val userId: String, | ||
@SerializedName("FirstName") | ||
val firstName: String, | ||
@SerializedName("LastName") | ||
val lastName: String, | ||
@SerializedName("Email") | ||
val email: String | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id 'com.android.library' | ||
id 'org.jetbrains.kotlin.android' | ||
id 'kotlin-kapt' | ||
id 'dagger.hilt.android.plugin' | ||
} | ||
|
||
android { | ||
buildFeatures { | ||
dataBinding true | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
buildFeatures { | ||
dataBinding true | ||
} | ||
kapt { | ||
correctErrorTypes = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation project(':libraries:uiComponents') | ||
implementation project(':network') | ||
implementation project(':libraries:uiComponents') | ||
|
||
implementation Deps.androidx_hilt | ||
implementation Deps.androidx_hilt_navigation | ||
kapt Deps.androidx_hilt_kapt | ||
} |
Oops, something went wrong.