From d196f0676ae81626b9a20c69e5347ee34c01f366 Mon Sep 17 00:00:00 2001 From: fajar Date: Fri, 26 Jul 2024 06:34:51 +0700 Subject: [PATCH 01/18] implement API for register but still doesnt work clearly --- .../{Application.kt => MyApplication.kt} | 16 +++- .../bankingapps/ViewModelFactory.kt | 24 +++++ common2/.gitignore | 1 + common2/build.gradle.kts | 43 +++++++++ common2/consumer-rules.pro | 0 common2/proguard-rules.pro | 21 +++++ .../jer/common2/ExampleInstrumentedTest.kt | 24 +++++ common2/src/main/AndroidManifest.xml | 4 + .../java/com/jer/common2/ExampleUnitTest.kt | 17 ++++ core/.gitignore | 1 + core/build.gradle.kts | 9 ++ core/consumer-rules.pro | 0 core/proguard-rules.pro | 21 +++++ .../com/jer/core/ExampleInstrumentedTest.kt | 24 +++++ core/src/main/AndroidManifest.xml | 4 + .../test/java/com/jer/core/ExampleUnitTest.kt | 17 ++++ .../data/local/AuthLocalSource.kt | 9 ++ .../data/local/DataStoreFactory.kt | 9 ++ .../data/local/ImplementLocalSource.kt | 4 + .../data/remote/AuthRemoteSource.kt | 4 + .../data/remote/ImplementAuthRemote.kt | 54 +++++++++++ .../feature_auth/data/remote/response/Data.kt | 19 ++++ .../data/remote/response/DataX.kt | 17 ++++ .../data/remote/response/ErrorResponse.kt | 3 + .../remote/response/LoginLoginResponse.kt | 11 +++ .../data/remote/response/LoginResponse.kt | 15 +++ .../data/remote/response/RegistResponse.kt | 11 +++ .../data/remote/response/RegisterResponse.kt | 13 +++ .../data/remote/{ => retrofit}/ApiService.kt | 0 .../data/remote/retrofit/LoginBody.kt | 3 + .../remote/{ => retrofit}/NetworkModule.kt | 4 +- .../data/remote/retrofit/RegisterBody.kt | 3 + .../repository/ImplementAuthRepository.kt | 4 + .../synrgy7team4/feature_auth/di/AuthKoin.kt | 36 +++++++ .../feature_auth/di/AuthModule.kt | 19 ---- .../synrgy7team4/feature_auth/di/Module.kt | 2 + .../feature_auth/domain/model/UserModel.kt | 3 + .../domain/repository/AuthRepository.kt | 4 + .../domain/usecase/LoginUseCase.kt | 4 + .../presentation/register/CreatePassword.kt | 94 ------------------- .../register/CreatePasswordFragment.kt | 60 ++++++++++++ .../presentation/viewmodel/LoginViewModel.kt | 4 + .../viewmodel/RegisterViewModel.kt | 4 + .../res/layout/fragment_create_password.xml | 77 ++------------- shared/.gitignore | 1 + shared/build.gradle.kts | 43 +++++++++ shared/consumer-rules.pro | 0 shared/proguard-rules.pro | 21 +++++ .../com/jer/shared/ExampleInstrumentedTest.kt | 24 +++++ shared/src/main/AndroidManifest.xml | 4 + .../jer/shared/ViewModelFactoryProvider.kt | 4 + .../java/com/jer/shared/ExampleUnitTest.kt | 17 ++++ 52 files changed, 644 insertions(+), 186 deletions(-) rename app/src/main/java/com/synrgy7team4/bankingapps/{Application.kt => MyApplication.kt} (68%) create mode 100644 app/src/main/java/com/synrgy7team4/bankingapps/ViewModelFactory.kt create mode 100644 common2/.gitignore create mode 100644 common2/build.gradle.kts create mode 100644 common2/consumer-rules.pro create mode 100644 common2/proguard-rules.pro create mode 100644 common2/src/androidTest/java/com/jer/common2/ExampleInstrumentedTest.kt create mode 100644 common2/src/main/AndroidManifest.xml create mode 100644 common2/src/test/java/com/jer/common2/ExampleUnitTest.kt create mode 100644 core/.gitignore create mode 100644 core/build.gradle.kts create mode 100644 core/consumer-rules.pro create mode 100644 core/proguard-rules.pro create mode 100644 core/src/androidTest/java/com/jer/core/ExampleInstrumentedTest.kt create mode 100644 core/src/main/AndroidManifest.xml create mode 100644 core/src/test/java/com/jer/core/ExampleUnitTest.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/AuthLocalSource.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/DataStoreFactory.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/ImplementLocalSource.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/AuthRemoteSource.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/ImplementAuthRemote.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/Data.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/DataX.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/ErrorResponse.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginLoginResponse.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginResponse.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegistResponse.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegisterResponse.kt rename feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/{ => retrofit}/ApiService.kt (100%) create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/LoginBody.kt rename feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/{ => retrofit}/NetworkModule.kt (87%) create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/RegisterBody.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/repository/ImplementAuthRepository.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthKoin.kt delete mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthModule.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/Module.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/model/UserModel.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/repository/AuthRepository.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/usecase/LoginUseCase.kt delete mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePassword.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePasswordFragment.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/LoginViewModel.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/RegisterViewModel.kt create mode 100644 shared/.gitignore create mode 100644 shared/build.gradle.kts create mode 100644 shared/consumer-rules.pro create mode 100644 shared/proguard-rules.pro create mode 100644 shared/src/androidTest/java/com/jer/shared/ExampleInstrumentedTest.kt create mode 100644 shared/src/main/AndroidManifest.xml create mode 100644 shared/src/main/java/com/jer/shared/ViewModelFactoryProvider.kt create mode 100644 shared/src/test/java/com/jer/shared/ExampleUnitTest.kt diff --git a/app/src/main/java/com/synrgy7team4/bankingapps/Application.kt b/app/src/main/java/com/synrgy7team4/bankingapps/MyApplication.kt similarity index 68% rename from app/src/main/java/com/synrgy7team4/bankingapps/Application.kt rename to app/src/main/java/com/synrgy7team4/bankingapps/MyApplication.kt index 7969b508..a5726ab5 100644 --- a/app/src/main/java/com/synrgy7team4/bankingapps/Application.kt +++ b/app/src/main/java/com/synrgy7team4/bankingapps/MyApplication.kt @@ -1,7 +1,9 @@ -package com.synrgy7team4.bankingapps +package com.jer.di import android.app.Application import com.synrgy7team4.feature_auth.di.AuthKoin +import com.synrgy7team4.feature_auth.di.Module + import com.synrgy7team4.feature_auth.presentation.viewmodel.AuthViewModelKoin import com.synrgy7team4.feature_mutasi.di.MutasiKoin import com.synrgy7team4.feature_mutasi.presentation.viewmodel.MutasiViewModelKoin @@ -9,12 +11,20 @@ import org.koin.android.ext.koin.androidContext import org.koin.android.ext.koin.androidLogger import org.koin.core.context.startKoin -class Application : Application() { +class MyApplication : Application() { + + lateinit var module: Module + lateinit var viewModelFactory: ViewModelFactory + override fun onCreate() { super.onCreate() + + module = Module(this) + viewModelFactory = ViewModelFactory(module) + startKoin { androidLogger() - androidContext(this@Application) + androidContext(this@MyApplication) modules( AuthKoin, AuthViewModelKoin, diff --git a/app/src/main/java/com/synrgy7team4/bankingapps/ViewModelFactory.kt b/app/src/main/java/com/synrgy7team4/bankingapps/ViewModelFactory.kt new file mode 100644 index 00000000..118b9fa5 --- /dev/null +++ b/app/src/main/java/com/synrgy7team4/bankingapps/ViewModelFactory.kt @@ -0,0 +1,24 @@ +package com.jer.di + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.ViewModelProvider +import com.synrgy7team4.feature_auth.di.Module +import com.synrgy7team4.feature_auth.presentation.viewmodel.LoginViewModel +import com.synrgy7team4.feature_auth.presentation.viewmodel.RegisterViewModel + +class ViewModelFactory(private val module: Module): ViewModelProvider.Factory { + + override fun create(modelClass: Class): T { + return when (modelClass) { + + RegisterViewModel::class.java-> RegisterViewModel(authRepository = module.authRepository) as T + LoginViewModel::class.java -> LoginViewModel(loginUseCase = module.loginUseCase) as T + + else -> { + throw IllegalArgumentException("Unknown ViewModel class: " + modelClass.name) + } + } + + + } +} \ No newline at end of file diff --git a/common2/.gitignore b/common2/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/common2/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/common2/build.gradle.kts b/common2/build.gradle.kts new file mode 100644 index 00000000..c0599237 --- /dev/null +++ b/common2/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.jer.common2" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("com.google.android.material:material:1.12.0") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") +} \ No newline at end of file diff --git a/common2/consumer-rules.pro b/common2/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/common2/proguard-rules.pro b/common2/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/common2/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/common2/src/androidTest/java/com/jer/common2/ExampleInstrumentedTest.kt b/common2/src/androidTest/java/com/jer/common2/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..9aedc183 --- /dev/null +++ b/common2/src/androidTest/java/com/jer/common2/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.jer.common2 + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.jer.common2.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/common2/src/main/AndroidManifest.xml b/common2/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/common2/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/common2/src/test/java/com/jer/common2/ExampleUnitTest.kt b/common2/src/test/java/com/jer/common2/ExampleUnitTest.kt new file mode 100644 index 00000000..39127583 --- /dev/null +++ b/common2/src/test/java/com/jer/common2/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.jer.common2 + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/core/.gitignore b/core/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/core/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts new file mode 100644 index 00000000..b0ca5924 --- /dev/null +++ b/core/build.gradle.kts @@ -0,0 +1,9 @@ +plugins { + id("java-library") + id("org.jetbrains.kotlin.jvm") +} + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} \ No newline at end of file diff --git a/core/consumer-rules.pro b/core/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/core/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/core/src/androidTest/java/com/jer/core/ExampleInstrumentedTest.kt b/core/src/androidTest/java/com/jer/core/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..3ff59aa8 --- /dev/null +++ b/core/src/androidTest/java/com/jer/core/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.jer.core + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.jer.core.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/core/src/main/AndroidManifest.xml b/core/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/core/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/core/src/test/java/com/jer/core/ExampleUnitTest.kt b/core/src/test/java/com/jer/core/ExampleUnitTest.kt new file mode 100644 index 00000000..c9d63bdd --- /dev/null +++ b/core/src/test/java/com/jer/core/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.jer.core + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/AuthLocalSource.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/AuthLocalSource.kt new file mode 100644 index 00000000..56d499df --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/AuthLocalSource.kt @@ -0,0 +1,9 @@ +package com.synrgy7team4.feature_auth.data.remote.local + +interface AuthLocalSource { + + suspend fun saveToken(token: String) + suspend fun loadtoken(): String? + suspend fun deleteToken() + +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/DataStoreFactory.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/DataStoreFactory.kt new file mode 100644 index 00000000..e11b846b --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/DataStoreFactory.kt @@ -0,0 +1,9 @@ +package com.synrgy7team4.feature_auth.data.remote.local + +import android.content.Context +import androidx.datastore.core.DataStore +import androidx.datastore.preferences.core.Preferences +import androidx.datastore.preferences.preferencesDataStore + + +val Context.dataStore: DataStore by preferencesDataStore(name = "dataStore") diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/ImplementLocalSource.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/ImplementLocalSource.kt new file mode 100644 index 00000000..f03b204b --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/local/ImplementLocalSource.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.data.local + +class ImplementLocalSource { +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/AuthRemoteSource.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/AuthRemoteSource.kt new file mode 100644 index 00000000..7175d620 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/AuthRemoteSource.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.data.remote + +interface AuthRemoteSource { +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/ImplementAuthRemote.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/ImplementAuthRemote.kt new file mode 100644 index 00000000..752a660b --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/ImplementAuthRemote.kt @@ -0,0 +1,54 @@ +package com.synrgy7team4.feature_auth.data.remote.retrofit + +import android.util.Log +import com.synrgy7team4.feature_auth.data.remote.AuthRemoteSource +import com.synrgy7team4.feature_auth.domain.repository.AuthRepository +import retrofit2.Call +import retrofit2.Callback +import retrofit2.Response + +class ImplementAuthRemote ( + private val apiService: ApiService +) : AuthRemoteSource { + override suspend fun register(name: String, email: String, password: String) { + + val registerRequest = RegisterBody(name, email, password) + val call = apiService.register(registerRequest) + call.enqueue(object : Callback { + override fun onResponse(p0: Call, p1: Response) { + if (p1.isSuccessful) { + p1.body() + } else { + Log.e("ImplementAuthRemote", "Failure: ${p1.message()}") + } + } + + override fun onFailure(p0: Call, p1: Throwable) { + Log.e("ImplementAuthRemote", "Failure: ${p1.message}") + } + + }) + + } + + override suspend fun login(email: String, password: String) { + val loginRequest = LoginBody(email, password) + val call = apiService.login(loginRequest) + call.enqueue(object : Callback { + override fun onResponse(p0: Call, p1: Response) { + if (p1.isSuccessful) { + p1.body() + } else { + Log.e("ImplementAuthRemote", "Failure: ${p1.message()}") + } + } + + override fun onFailure(p0: Call, p1: Throwable) { + Log.e("ImplementAuthRemote", "Failure: ${p1.message}") + } + + }) + } + + +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/Data.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/Data.kt new file mode 100644 index 00000000..bad1fa85 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/Data.kt @@ -0,0 +1,19 @@ +package com.synrgy7team4.feature_auth.data.remote.response + + +import com.google.gson.annotations.SerializedName + +data class Data( + @SerializedName("date_of_birth") + val dateOfBirth: String, + @SerializedName("email") + val email: String, + @SerializedName("id") + val id: String, + @SerializedName("name") + val name: String, + @SerializedName("no_hp") + val noHp: String, + @SerializedName("no_ktp") + val noKtp: String +) \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/DataX.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/DataX.kt new file mode 100644 index 00000000..755b075a --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/DataX.kt @@ -0,0 +1,17 @@ +package com.synrgy7team4.feature_auth.data.remote.response + + +import com.google.gson.annotations.SerializedName + +data class DataX( + @SerializedName("email") + val email: String, + @SerializedName("id") + val id: String, + @SerializedName("jwt_token") + val jwtToken: String, + @SerializedName("name") + val name: String, + @SerializedName("refresh_token") + val refreshToken: String +) \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/ErrorResponse.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/ErrorResponse.kt new file mode 100644 index 00000000..aca470c4 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/ErrorResponse.kt @@ -0,0 +1,3 @@ +package com.synrgy7team4.feature_auth.data.remote.response + +data class ErrorResponse() diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginLoginResponse.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginLoginResponse.kt new file mode 100644 index 00000000..bac39cb5 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginLoginResponse.kt @@ -0,0 +1,11 @@ +package com.synrgy7team4.feature_auth.data.remote.response + + +import com.google.gson.annotations.SerializedName + +data class LoginLoginResponse( + @SerializedName("data") + val `data`: DataX, + @SerializedName("success") + val success: Boolean +) \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginResponse.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginResponse.kt new file mode 100644 index 00000000..5ee06b28 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/LoginResponse.kt @@ -0,0 +1,15 @@ +package com.synrgy7team4.feature_auth.data.remote.retrofit + + +import com.google.gson.annotations.SerializedName + +data class LoginResponse( + @SerializedName("email") + val email: String, + @SerializedName("id") + val id: String, + @SerializedName("name") + val name: String, + @SerializedName("token") + val token: String +) \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegistResponse.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegistResponse.kt new file mode 100644 index 00000000..27a4f047 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegistResponse.kt @@ -0,0 +1,11 @@ +package com.synrgy7team4.feature_auth.data.remote.response + + +import com.google.gson.annotations.SerializedName + +data class RegistResponse( + @SerializedName("data") + val `data`: Data, + @SerializedName("success") + val success: Boolean +) \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegisterResponse.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegisterResponse.kt new file mode 100644 index 00000000..7b473554 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/response/RegisterResponse.kt @@ -0,0 +1,13 @@ +package com.synrgy7team4.feature_auth.data.remote.retrofit + + +import com.google.gson.annotations.SerializedName + +data class RegisterResponse( + @SerializedName("email") + val email: String, + @SerializedName("id") + val id: String, + @SerializedName("name") + val name: String +) \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/ApiService.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/ApiService.kt similarity index 100% rename from feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/ApiService.kt rename to feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/ApiService.kt diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/LoginBody.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/LoginBody.kt new file mode 100644 index 00000000..530a9b14 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/LoginBody.kt @@ -0,0 +1,3 @@ +package com.synrgy7team4.feature_auth.data.remote.retrofit + +data class LoginBody() diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/NetworkModule.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/NetworkModule.kt similarity index 87% rename from feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/NetworkModule.kt rename to feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/NetworkModule.kt index 80abd04f..30974f15 100644 --- a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/NetworkModule.kt +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/NetworkModule.kt @@ -1,6 +1,7 @@ package com.synrgy7team4.feature_auth.data.remote import com.synrgy7team4.common.Constants.Companion.BASE_URL +import com.synrgy7team4.common.Constants.Companion.BASE_URL_AUTH import okhttp3.OkHttpClient import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory @@ -24,7 +25,8 @@ fun provideRetrofit( gsonConverterFactory: GsonConverterFactory ): Retrofit { return Retrofit.Builder() - .baseUrl(BASE_URL) + .baseUrl(BASE_URL_AUTH) +// .baseUrl(BASE_URL) .client(okHttpClient) .addConverterFactory(gsonConverterFactory) .build() diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/RegisterBody.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/RegisterBody.kt new file mode 100644 index 00000000..c99a73bd --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/remote/retrofit/RegisterBody.kt @@ -0,0 +1,3 @@ +package com.synrgy7team4.feature_auth.data.remote.retrofit + +data class RegisterBody() diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/repository/ImplementAuthRepository.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/repository/ImplementAuthRepository.kt new file mode 100644 index 00000000..dbc71a3b --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/data/repository/ImplementAuthRepository.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.data.repository + +class ImplementAuthRepository { +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthKoin.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthKoin.kt new file mode 100644 index 00000000..bb82bdb4 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthKoin.kt @@ -0,0 +1,36 @@ +package com.synrgy7team4.feature_auth.di + +import androidx.datastore.core.DataStore +import androidx.datastore.preferences.core.Preferences +import com.synrgy7team4.feature_auth.data.Repository +import com.synrgy7team4.feature_auth.data.local.AuthLocalSource +import com.synrgy7team4.feature_auth.data.local.ImplementLocalSource +import com.synrgy7team4.feature_auth.data.local.dataStore +import com.synrgy7team4.feature_auth.data.remote.AuthRemoteSource +import com.synrgy7team4.feature_auth.data.remote.ImplementAuthRemote +import com.synrgy7team4.feature_auth.data.remote.RemoteDataSource +import com.synrgy7team4.feature_auth.data.remote.retrofit.provideConverterFactory +import com.synrgy7team4.feature_auth.data.remote.retrofit.provideHttpClient +import com.synrgy7team4.feature_auth.data.remote.retrofit.provideHttpLoggingInterceptor +import com.synrgy7team4.feature_auth.data.remote.retrofit.provideRetrofit +import com.synrgy7team4.feature_auth.data.remote.retrofit.provideService +import com.synrgy7team4.feature_auth.data.repository.ImplementAuthRepository +import com.synrgy7team4.feature_auth.domain.repository.AuthRepository +import org.koin.android.ext.koin.androidContext +import org.koin.dsl.module + +val AuthModule = module { + single { provideHttpClient() } + single { provideConverterFactory() } + single { provideRetrofit(get()) } + single { provideHttpLoggingInterceptor() } + single { provideService() } + + single {ImplementAuthRepository(authRemoteSource = get(), authLocalSource = get())} + single {ImplementAuthRemote(get())} + single { ImplementLocalSource(get()) } + single> { androidContext().dataStore } + + factory { RemoteDataSource(get()) } + factory { Repository(get()) } +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthModule.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthModule.kt deleted file mode 100644 index d57c7cc7..00000000 --- a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/AuthModule.kt +++ /dev/null @@ -1,19 +0,0 @@ -package com.synrgy7team4.feature_auth.di - -import com.synrgy7team4.feature_auth.data.Repository -import com.synrgy7team4.feature_auth.data.remote.RemoteDataSource -import com.synrgy7team4.feature_auth.data.remote.provideConverterFactory -import com.synrgy7team4.feature_auth.data.remote.provideHttpClient -import com.synrgy7team4.feature_auth.data.remote.provideRetrofit -import com.synrgy7team4.feature_auth.data.remote.provideService -import org.koin.dsl.module - -val AuthKoin = module { - single { provideHttpClient() } - single { provideConverterFactory() } - single { provideRetrofit(get(),get()) } - single { provideService(get()) } - - factory { RemoteDataSource(get()) } - factory { Repository(get()) } -} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/Module.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/Module.kt new file mode 100644 index 00000000..68c5e408 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/di/Module.kt @@ -0,0 +1,2 @@ +package com.synrgy7team4.feature_auth.di + diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/model/UserModel.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/model/UserModel.kt new file mode 100644 index 00000000..5cde24b6 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/model/UserModel.kt @@ -0,0 +1,3 @@ +package com.synrgy7team4.feature_auth.domain.model + +data class UserModel() diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/repository/AuthRepository.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/repository/AuthRepository.kt new file mode 100644 index 00000000..dfe98510 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/repository/AuthRepository.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.domain.repository + +interface AuthRepository { +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/usecase/LoginUseCase.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/usecase/LoginUseCase.kt new file mode 100644 index 00000000..f8269766 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/domain/usecase/LoginUseCase.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.domain.usecase + +class LoginUseCase { +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePassword.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePassword.kt deleted file mode 100644 index af22699a..00000000 --- a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePassword.kt +++ /dev/null @@ -1,94 +0,0 @@ -package com.synrgy7team4.feature_auth.presentation.register - -import android.os.Bundle -import android.util.Log -import androidx.fragment.app.Fragment -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import androidx.navigation.findNavController -import com.google.android.material.button.MaterialButton -import com.google.android.material.textfield.TextInputEditText -import com.synrgy7team4.feature_auth.R -import com.synrgy7team4.feature_auth.databinding.FragmentCreatePasswordBinding -import com.synrgy7team4.feature_auth.databinding.FragmentOtpVerificationBinding - -//class CreatePassword : Fragment() { -// -// private var _binding: FragmentCreatePasswordBinding? = null -// private val binding get() = _binding!! -// -// override fun onCreate(savedInstanceState: Bundle?) { -// super.onCreate(savedInstanceState) -// } -// -// override fun onCreateView( -// inflater: LayoutInflater, container: ViewGroup?, -// savedInstanceState: Bundle? -// ): View? { -// // Inflate the layout for this fragment -// //return inflater.inflate(R.layout.fragment_create_password, container, false) -// _binding = FragmentCreatePasswordBinding.inflate(inflater, container, false) -// return binding.root -// } -// -// override fun onViewCreated(view: View, savedInstanceState: Bundle?) { -// super.onViewCreated(view, savedInstanceState) -// -// binding.submitCreatedPassword.setOnClickListener { -// view.findNavController().navigate(R.id.action_createPassword_to_ktpVerificationBoardFragment) -// } -// -// view.findViewById(R.id.submitCreatedPassword).setOnClickListener { getPassword(view) } -// } -// -// private fun getPassword(view:View){ -// val password = view.findViewById(R.id.inputPassword).text -// val passwordConfirmation = view.findViewById(R.id.inputPasswordConfirmation).text -// -// Log.d("password", password.toString()) -// Log.d("passwordConfirmation", passwordConfirmation.toString()) -// } -//} - -class CreatePassword : Fragment() { - - private var _binding: FragmentCreatePasswordBinding? = null - private val binding get() = _binding!! - - override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? - ): View? { - // Inflate the layout for this fragment - // return inflater.inflate(R.layout.fragment_otp_verification, container, false) - _binding = FragmentCreatePasswordBinding.inflate(inflater, container, false) - return binding.root - } - - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { - super.onViewCreated(view, savedInstanceState) - - binding.submitCreatedPassword.setOnClickListener { - // Navigate with a delay - view.postDelayed({ - // view.findNavController().navigate(R.id.action_createPassword_to_ktpVerificationBoardFragment) - }, 2000) // Delay 2 seconds - } - - binding.submitCreatedPassword.setOnClickListener { getPassword() } - } - - private fun getPassword() { - val password = binding.inputPassword.text - val passwordConfirmation = binding.inputPasswordConfirmation.text - - Log.d("password", password.toString()) - Log.d("passwordConfirmation", passwordConfirmation.toString()) - } - - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } -} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePasswordFragment.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePasswordFragment.kt new file mode 100644 index 00000000..dd54b322 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/CreatePasswordFragment.kt @@ -0,0 +1,60 @@ +package com.synrgy7team4.feature_auth.presentation.register + +import android.os.Bundle +import androidx.fragment.app.Fragment +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import com.synrgy7team4.feature_auth.R + +// TODO: Rename parameter arguments, choose names that match +// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER +private const val ARG_PARAM1 = "param1" +private const val ARG_PARAM2 = "param2" + +/** + * A simple [Fragment] subclass. + * Use the [CreatePasswordFragment.newInstance] factory method to + * create an instance of this fragment. + */ +class CreatePasswordFragment : Fragment() { + // TODO: Rename and change types of parameters + private var param1: String? = null + private var param2: String? = null + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + arguments?.let { + param1 = it.getString(ARG_PARAM1) + param2 = it.getString(ARG_PARAM2) + } + } + + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + // Inflate the layout for this fragment + return inflater.inflate(R.layout.fragment_create_password2, container, false) + } + + companion object { + /** + * Use this factory method to create a new instance of + * this fragment using the provided parameters. + * + * @param param1 Parameter 1. + * @param param2 Parameter 2. + * @return A new instance of fragment CreatePasswordFragment. + */ + // TODO: Rename and change types and number of parameters + @JvmStatic + fun newInstance(param1: String, param2: String) = + CreatePasswordFragment().apply { + arguments = Bundle().apply { + putString(ARG_PARAM1, param1) + putString(ARG_PARAM2, param2) + } + } + } +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/LoginViewModel.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/LoginViewModel.kt new file mode 100644 index 00000000..b19e81ee --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/LoginViewModel.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.presentation.viewmodel + +class LoginViewModel { +} \ No newline at end of file diff --git a/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/RegisterViewModel.kt b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/RegisterViewModel.kt new file mode 100644 index 00000000..bf6a24a2 --- /dev/null +++ b/feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/viewmodel/RegisterViewModel.kt @@ -0,0 +1,4 @@ +package com.synrgy7team4.feature_auth.presentation.viewmodel + +class RegisterViewModel { +} \ No newline at end of file diff --git a/feature_auth/src/main/res/layout/fragment_create_password.xml b/feature_auth/src/main/res/layout/fragment_create_password.xml index 880d30b6..b86373f4 100644 --- a/feature_auth/src/main/res/layout/fragment_create_password.xml +++ b/feature_auth/src/main/res/layout/fragment_create_password.xml @@ -1,75 +1,14 @@ - + tools:context=".presentation.register.CreatePasswordFragment"> - + + - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/shared/.gitignore b/shared/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/shared/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts new file mode 100644 index 00000000..8cd12ca4 --- /dev/null +++ b/shared/build.gradle.kts @@ -0,0 +1,43 @@ +plugins { + id("com.android.library") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "com.jer.shared" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("com.google.android.material:material:1.12.0") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") +} \ No newline at end of file diff --git a/shared/consumer-rules.pro b/shared/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/shared/proguard-rules.pro b/shared/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/shared/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/shared/src/androidTest/java/com/jer/shared/ExampleInstrumentedTest.kt b/shared/src/androidTest/java/com/jer/shared/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..1751a690 --- /dev/null +++ b/shared/src/androidTest/java/com/jer/shared/ExampleInstrumentedTest.kt @@ -0,0 +1,24 @@ +package com.jer.shared + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.jer.shared.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/shared/src/main/AndroidManifest.xml b/shared/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/shared/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/shared/src/main/java/com/jer/shared/ViewModelFactoryProvider.kt b/shared/src/main/java/com/jer/shared/ViewModelFactoryProvider.kt new file mode 100644 index 00000000..ccfb30af --- /dev/null +++ b/shared/src/main/java/com/jer/shared/ViewModelFactoryProvider.kt @@ -0,0 +1,4 @@ +package com.jer.shared + +interface ViewModelFactoryProvider { +} \ No newline at end of file diff --git a/shared/src/test/java/com/jer/shared/ExampleUnitTest.kt b/shared/src/test/java/com/jer/shared/ExampleUnitTest.kt new file mode 100644 index 00000000..a9a430bc --- /dev/null +++ b/shared/src/test/java/com/jer/shared/ExampleUnitTest.kt @@ -0,0 +1,17 @@ +package com.jer.shared + +import org.junit.Test + +import org.junit.Assert.* + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file From 516d67da54d6854873129ffad0946b78b81a30cc Mon Sep 17 00:00:00 2001 From: fajar Date: Sat, 27 Jul 2024 22:07:01 +0700 Subject: [PATCH 02/18] created a successful Register Feature, and successfully sent the request except for the date of birth --- .idea/deploymentTargetSelector.xml | 3 - .idea/gradle.xml | 2 + app/build.gradle.kts | 1 + app/src/main/AndroidManifest.xml | 2 +- .../synrgy7team4/bankingapps/MyApplication.kt | 12 +- .../bankingapps/ViewModelFactory.kt | 2 +- common/build.gradle.kts | 2 + common/src/main/AndroidManifest.xml | 1 + .../java/com/synrgy7team4/common/Constants.kt | 2 + common/src/main/res/values/colors.xml | 16 +-- common2/.gitignore | 1 - common2/build.gradle.kts | 43 ------- common2/consumer-rules.pro | 0 common2/proguard-rules.pro | 21 ---- .../jer/common2/ExampleInstrumentedTest.kt | 24 ---- common2/src/main/AndroidManifest.xml | 4 - .../java/com/jer/common2/ExampleUnitTest.kt | 17 --- core/.gitignore | 1 - core/build.gradle.kts | 9 -- core/consumer-rules.pro | 0 core/proguard-rules.pro | 21 ---- .../com/jer/core/ExampleInstrumentedTest.kt | 24 ---- core/src/main/AndroidManifest.xml | 4 - .../test/java/com/jer/core/ExampleUnitTest.kt | 17 --- feature_auth/build.gradle.kts | 5 + .../data/local/AuthLocalSource.kt | 18 ++- .../data/local/DataStoreFactory.kt | 2 +- .../data/local/ImplementLocalSource.kt | 66 ++++++++++- .../data/remote/AuthRemoteSource.kt | 13 +++ .../data/remote/ImplementAuthRemote.kt | 89 +++++++------- .../data/remote/RemoteDataSource.kt | 2 + .../feature_auth/data/remote/response/Data.kt | 12 +- .../data/remote/response/ErrorResponse.kt | 4 +- .../remote/response/LoginLoginResponse.kt | 2 +- .../data/remote/response/LoginResponse.kt | 2 +- .../data/remote/response/RegistResponse.kt | 2 +- .../data/remote/response/RegisterResponse.kt | 2 +- .../data/remote/retrofit/ApiService.kt | 36 +++++- .../data/remote/retrofit/LoginBody.kt | 5 +- .../data/remote/retrofit/NetworkModule.kt | 29 +++-- .../data/remote/retrofit/RegisterBody.kt | 14 ++- .../repository/ImplementAuthRepository.kt | 53 ++++++++- .../synrgy7team4/feature_auth/di/AuthKoin.kt | 2 +- .../synrgy7team4/feature_auth/di/Module.kt | 43 +++++++ .../feature_auth/domain/model/UserModel.kt | 9 +- .../domain/repository/AuthRepository.kt | 22 ++++ .../domain/usecase/LoginUseCase.kt | 23 +++- .../presentation/register/BiodataFragment.kt | 77 ++++++++++++ .../register/CreatePasswordFragment.kt | 110 ++++++++++++------ .../register/InputEmailFragment.kt | 51 +++++++- .../register/InputPhoneNumberFragment.kt | 39 ++++++- .../presentation/register/OtpVerification.kt | 3 +- .../register/PinConfirmationFragment.kt | 73 ++++++++++++ .../presentation/register/PinFragment.kt | 23 ++++ .../register/RegistrationSuccessFragment.kt | 31 +++++ .../viewmodel/AuthViewModelKoin.kt | 4 +- .../presentation/viewmodel/LoginViewModel.kt | 50 +++++++- .../viewmodel/RegisterViewModel.kt | 62 +++++++++- .../src/main/res/layout/fragment_biodata.xml | 109 +++++++++++++++++ .../res/layout/fragment_create_password.xml | 70 ++++++++++- .../main/res/layout/fragment_input_email.xml | 26 ++--- .../layout/fragment_input_phone_number.xml | 33 +++--- .../src/main/res/layout/fragment_login.xml | 2 +- .../navigation/feature_auth_navigation.xml | 27 +++-- feature_auth/src/main/res/values/strings.xml | 1 + .../src/main/res/layout/fragment_home.xml | 14 +++ feature_mutasi/build.gradle.kts | 3 + settings.gradle.kts | 1 + .../jer/shared/ViewModelFactoryProvider.kt | 3 + 69 files changed, 1130 insertions(+), 366 deletions(-) delete mode 100644 common2/.gitignore delete mode 100644 common2/build.gradle.kts delete mode 100644 common2/consumer-rules.pro delete mode 100644 common2/proguard-rules.pro delete mode 100644 common2/src/androidTest/java/com/jer/common2/ExampleInstrumentedTest.kt delete mode 100644 common2/src/main/AndroidManifest.xml delete mode 100644 common2/src/test/java/com/jer/common2/ExampleUnitTest.kt delete mode 100644 core/.gitignore delete mode 100644 core/build.gradle.kts delete mode 100644 core/consumer-rules.pro delete mode 100644 core/proguard-rules.pro delete mode 100644 core/src/androidTest/java/com/jer/core/ExampleInstrumentedTest.kt delete mode 100644 core/src/main/AndroidManifest.xml delete mode 100644 core/src/test/java/com/jer/core/ExampleUnitTest.kt create mode 100644 feature_auth/src/main/java/com/synrgy7team4/feature_auth/presentation/register/BiodataFragment.kt create mode 100644 feature_auth/src/main/res/layout/fragment_biodata.xml diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index 3c68f2df..69effbab 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -13,9 +13,6 @@ - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index f447adc3..354c1849 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -13,7 +13,9 @@