├── .github └── FUNDING.yml ├── ClientApp ├── .gitignore ├── ConnectorLib │ ├── ConnectorLib-release.aar │ └── build.gradle ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── litekite │ │ │ └── client │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── litekite │ │ │ │ └── client │ │ │ │ ├── app │ │ │ │ └── ClientApp.kt │ │ │ │ ├── base │ │ │ │ └── BaseActivity.kt │ │ │ │ ├── di │ │ │ │ └── AppComponents.kt │ │ │ │ ├── home │ │ │ │ ├── HomeActivity.kt │ │ │ │ └── HomeVM.kt │ │ │ │ ├── login │ │ │ │ ├── LoginActivity.kt │ │ │ │ └── LoginVM.kt │ │ │ │ ├── preference │ │ │ │ └── PreferenceController.kt │ │ │ │ └── signup │ │ │ │ ├── SignupActivity.kt │ │ │ │ └── SignupVM.kt │ │ └── res │ │ │ ├── anim │ │ │ ├── slide_in_left.xml │ │ │ ├── slide_in_right.xml │ │ │ ├── slide_out_left.xml │ │ │ └── slide_out_right.xml │ │ │ ├── drawable-v21 │ │ │ └── bg_ripple_round_34.xml │ │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── drawable │ │ │ ├── ic_arrow_back.xml │ │ │ └── ic_launcher_background.xml │ │ │ ├── layout │ │ │ ├── activity_home.xml │ │ │ ├── activity_login.xml │ │ │ ├── activity_signup.xml │ │ │ └── widget_toolbar.xml │ │ │ ├── menu │ │ │ └── home_menu.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-v21 │ │ │ └── styles.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── litekite │ │ └── client │ │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── spotless │ └── copyright.kt ├── ConnectorLib ├── .gitignore ├── ConnectorLib │ ├── .gitignore │ ├── build.gradle │ ├── consumer-rules.pro │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── litekite │ │ │ └── connector │ │ │ └── ExampleInstrumentedTest.kt │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── aidl │ │ │ └── com │ │ │ │ └── litekite │ │ │ │ └── connector │ │ │ │ ├── controller │ │ │ │ ├── IBankService.aidl │ │ │ │ └── IBankServiceCallback.aidl │ │ │ │ └── entity │ │ │ │ ├── AuthResponse.aidl │ │ │ │ ├── FailureResponse.aidl │ │ │ │ ├── LoginRequest.aidl │ │ │ │ ├── SignupRequest.aidl │ │ │ │ └── UserDetails.aidl │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── litekite │ │ │ │ └── connector │ │ │ │ ├── base │ │ │ │ └── CallbackProvider.kt │ │ │ │ ├── controller │ │ │ │ ├── BankServiceConnector.kt │ │ │ │ └── BankServiceController.kt │ │ │ │ └── entity │ │ │ │ ├── AuthResponse.kt │ │ │ │ ├── FailureResponse.kt │ │ │ │ ├── LoginRequest.kt │ │ │ │ ├── RequestCode.kt │ │ │ │ ├── ResponseCode.kt │ │ │ │ ├── SignupRequest.kt │ │ │ │ └── UserDetails.kt │ │ └── res │ │ │ └── values │ │ │ └── configs.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── litekite │ │ └── connector │ │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── spotless │ └── copyright.kt ├── LICENSE ├── README.md └── ServerApp ├── .gitignore ├── ConnectorLib ├── ConnectorLib-release.aar └── build.gradle ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── litekite │ │ └── server │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── kotlin │ │ └── com │ │ │ └── litekite │ │ │ └── server │ │ │ ├── room │ │ │ ├── dao │ │ │ │ └── BankDao.kt │ │ │ ├── db │ │ │ │ └── BankDatabase.kt │ │ │ └── entity │ │ │ │ └── UserAccount.kt │ │ │ └── service │ │ │ └── BankService.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── configs.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── litekite │ └── server │ └── ExampleUnitTest.kt ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── spotless └── copyright.kt /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # [svignesh93] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | custom: https://www.paypal.me/svignesh93 -------------------------------------------------------------------------------- /ClientApp/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | 57 | # Android Studio Configurations 58 | .DS_Store 59 | /local.properties 60 | /keystore.properties 61 | /.idea 62 | /build 63 | /captures 64 | -------------------------------------------------------------------------------- /ClientApp/ConnectorLib/ConnectorLib-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/ConnectorLib/ConnectorLib-release.aar -------------------------------------------------------------------------------- /ClientApp/ConnectorLib/build.gradle: -------------------------------------------------------------------------------- 1 | configurations.maybeCreate("default") 2 | artifacts.add("default", file('ConnectorLib-release.aar')) 3 | -------------------------------------------------------------------------------- /ClientApp/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | /schemas 4 | -------------------------------------------------------------------------------- /ClientApp/app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | apply plugin: 'kotlin-android' 19 | apply plugin: 'kotlin-kapt' 20 | apply plugin: 'kotlin-parcelize' 21 | apply plugin: 'dagger.hilt.android.plugin' 22 | 23 | android { 24 | compileSdkVersion 28 25 | defaultConfig { 26 | applicationId "com.litekite.client" 27 | minSdkVersion 16 28 | //noinspection ExpiredTargetSdkVersion 29 | targetSdkVersion 28 30 | versionCode 1 31 | versionName "1.0" 32 | vectorDrawables.useSupportLibrary = true 33 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 34 | } 35 | sourceSets { 36 | main.java.srcDirs += "src/main/kotlin" 37 | } 38 | buildFeatures { 39 | viewBinding = true 40 | dataBinding = true 41 | } 42 | lintOptions { 43 | baseline file("lint-baseline.xml") 44 | warningsAsErrors true 45 | enable "Interoperability" 46 | } 47 | compileOptions { 48 | sourceCompatibility = JavaVersion.VERSION_1_8 49 | targetCompatibility = JavaVersion.VERSION_1_8 50 | } 51 | kotlinOptions { 52 | jvmTarget = JavaVersion.VERSION_1_8 53 | } 54 | buildTypes { 55 | release { 56 | minifyEnabled true 57 | shrinkResources true 58 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 59 | } 60 | } 61 | } 62 | 63 | kapt { 64 | correctErrorTypes true 65 | } 66 | 67 | dependencies { 68 | implementation fileTree(dir: 'libs', include: ['*.jar']) 69 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 70 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3' 71 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' 72 | implementation 'androidx.core:core-ktx:1.5.0' 73 | implementation 'androidx.appcompat:appcompat:1.3.0' 74 | implementation "androidx.datastore:datastore-preferences:1.0.0-beta01" 75 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 76 | implementation 'com.google.android.material:material:1.3.0' 77 | implementation project(path: ':ConnectorLib') 78 | 79 | // Activity & Fragments KTX 80 | implementation "androidx.activity:activity-ktx:1.2.3" 81 | implementation "androidx.fragment:fragment-ktx:1.3.4" 82 | 83 | // Lifecycle KTX 84 | implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" 85 | implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" 86 | kapt "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" 87 | 88 | // Hilt 89 | implementation "com.google.dagger:hilt-android:$hilt_version" 90 | kapt "com.google.dagger:hilt-compiler:$hilt_version" 91 | 92 | // Test helpers for Core library 93 | androidTestImplementation 'androidx.test:core-ktx:1.3.0' 94 | 95 | // Hilt - Instrumentation test helpers 96 | androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_version" 97 | kaptAndroidTest "com.google.dagger:hilt-compiler:$hilt_version" 98 | 99 | // Hilt - Local unit test helpers 100 | testImplementation "com.google.dagger:hilt-android-testing:$hilt_version" 101 | kaptTest "com.google.dagger:hilt-compiler:$hilt_version" 102 | 103 | // JUnit 104 | testImplementation 'junit:junit:4.13.2' 105 | 106 | // AndroidJUnitRunner and JUnit Rules 107 | androidTestImplementation 'androidx.test:runner:1.3.0' 108 | androidTestImplementation 'androidx.test:rules:1.3.0' 109 | 110 | // Assertions 111 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 112 | androidTestImplementation 'androidx.test.ext:truth:1.3.0' 113 | 114 | // Espresso dependencies 115 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 116 | } 117 | -------------------------------------------------------------------------------- /ClientApp/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /ClientApp/app/src/androidTest/java/com/litekite/client/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client 17 | 18 | import androidx.test.ext.junit.runners.AndroidJUnit4 19 | import androidx.test.platform.app.InstrumentationRegistry 20 | import org.junit.Assert.assertEquals 21 | import org.junit.Test 22 | import org.junit.runner.RunWith 23 | 24 | /** 25 | * Instrumented test, which will execute on an Android device. 26 | * 27 | * See [testing documentation](http://d.android.com/tools/testing). 28 | * 29 | * @author Vignesh S 30 | * @version 1.0, 22/01/2020 31 | * @since 1.0 32 | */ 33 | @RunWith(AndroidJUnit4::class) 34 | class ExampleInstrumentedTest { 35 | 36 | @Test 37 | fun useAppContext() { 38 | // Context of the app under test. 39 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 40 | assertEquals("com.litekite.serverapp", appContext.packageName) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/app/ClientApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.app 17 | 18 | import android.app.Application 19 | import android.content.Context 20 | import android.util.Log 21 | import android.widget.Toast 22 | import androidx.annotation.StringRes 23 | import dagger.hilt.android.HiltAndroidApp 24 | 25 | /** 26 | * @author Vignesh S 27 | * @version 1.0, 01/06/2020 28 | * @since 1.0 29 | */ 30 | @HiltAndroidApp 31 | class ClientApp : Application() { 32 | 33 | companion object { 34 | 35 | val TAG: String = ClientApp::class.java.simpleName 36 | 37 | /** 38 | * @param context An Activity or Application Context. 39 | * @param stringRes A string resource that to be displayed inside a Toast. 40 | */ 41 | fun showToast(context: Context, @StringRes stringRes: Int) { 42 | Toast.makeText(context, stringRes, Toast.LENGTH_LONG).show() 43 | } 44 | 45 | /** 46 | * Logs messages for Debugging Purposes. 47 | * 48 | * @param tag TAG is a class name in which the log come from. 49 | * @param message Type of a Log Message. 50 | */ 51 | fun printLog(tag: String, message: String) { 52 | Log.d(tag, message) 53 | } 54 | } 55 | 56 | override fun onCreate() { 57 | super.onCreate() 58 | printLog(TAG, "onCreate: ") 59 | } 60 | 61 | override fun onLowMemory() { 62 | super.onLowMemory() 63 | printLog(TAG, "onLowMemory: ") 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/base/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.base 17 | 18 | import android.content.Context 19 | import android.view.Menu 20 | import android.view.View 21 | import android.widget.TextView 22 | import androidx.annotation.StringRes 23 | import androidx.appcompat.app.AppCompatActivity 24 | import androidx.appcompat.widget.Toolbar 25 | import com.google.android.material.snackbar.Snackbar 26 | import com.litekite.client.R 27 | 28 | /** 29 | * BaseActivity, Provides common features and functionality available for all activities. 30 | * 31 | * @author Vignesh S 32 | * @version 1.0, 03/06/2020 33 | * @since 1.0 34 | */ 35 | @Suppress("REGISTERED") 36 | open class BaseActivity : AppCompatActivity() { 37 | 38 | companion object { 39 | 40 | /** 41 | * Starts Activity animation. 42 | * 43 | * @param context An activity context. 44 | */ 45 | fun startActivityAnimation(context: Context) { 46 | if (context is AppCompatActivity) { 47 | context.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left) 48 | } 49 | } 50 | } 51 | 52 | /** 53 | * Sets Toolbar, Toolbar Title and Back Navigation Button. 54 | * 55 | * @param toolbar Toolbar widget. 56 | * @param backBtnVisible A boolean value whether to display Toolbar back navigation button or 57 | * not. 58 | * @param toolbarTitle The title of a Toolbar. 59 | * @param tvToolbarTitle A TextView in which the title of a Toolbar is displayed. 60 | */ 61 | protected fun setToolbar( 62 | toolbar: Toolbar, 63 | backBtnVisible: Boolean, 64 | toolbarTitle: String, 65 | tvToolbarTitle: TextView 66 | ) { 67 | toolbar.title = "" 68 | if (backBtnVisible) { 69 | toolbar.setNavigationIcon(R.drawable.ic_arrow_back) 70 | } 71 | toolbar.setContentInsetsAbsolute(0, 0) 72 | tvToolbarTitle.text = toolbarTitle 73 | setSupportActionBar(toolbar) 74 | if (backBtnVisible) { 75 | toolbar.setNavigationOnClickListener { onBackPressed() } 76 | } 77 | } 78 | 79 | /** 80 | * @param v A View in which the SnackBar should be displayed at the bottom of the 81 | * screen. 82 | * @param stringResID A message that to be displayed inside a SnackBar. 83 | */ 84 | fun showSnackBar(v: View, @StringRes stringResID: Int) { 85 | Snackbar.make(v, stringResID, Snackbar.LENGTH_LONG).show() 86 | } 87 | 88 | override fun onBackPressed() { 89 | super.onBackPressed() 90 | overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right) 91 | } 92 | 93 | override fun onCreateOptionsMenu(menu: Menu?): Boolean { 94 | return if (getToolbarMenuResource() == 0) { 95 | super.onCreateOptionsMenu(menu) 96 | } else { 97 | menuInflater.inflate(getToolbarMenuResource(), menu) 98 | true 99 | } 100 | } 101 | 102 | open fun getToolbarMenuResource(): Int = 0 103 | } 104 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/di/AppComponents.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.di 17 | 18 | import android.content.Context 19 | import com.litekite.client.preference.PreferenceController 20 | import com.litekite.connector.controller.BankServiceController 21 | import dagger.Module 22 | import dagger.Provides 23 | import dagger.hilt.InstallIn 24 | import dagger.hilt.android.qualifiers.ApplicationContext 25 | import dagger.hilt.components.SingletonComponent 26 | import javax.inject.Singleton 27 | 28 | /** 29 | * @author Vignesh S 30 | * @version 1.0, 04/06/2020 31 | * @since 1.0 32 | */ 33 | @Module 34 | @InstallIn(SingletonComponent::class) 35 | object AppComponents { 36 | 37 | @Provides 38 | @Singleton 39 | fun provideBankServiceController(@ApplicationContext context: Context) = 40 | BankServiceController(context) 41 | 42 | @Provides 43 | @Singleton 44 | fun providePreferenceController(@ApplicationContext context: Context) = 45 | PreferenceController(context) 46 | } 47 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/home/HomeActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.home 17 | 18 | import android.content.Context 19 | import android.content.Intent 20 | import android.os.Bundle 21 | import android.view.MenuItem 22 | import androidx.activity.viewModels 23 | import androidx.appcompat.app.AppCompatActivity 24 | import androidx.databinding.DataBindingUtil 25 | import com.litekite.client.R 26 | import com.litekite.client.base.BaseActivity 27 | import com.litekite.client.databinding.ActivityHomeBinding 28 | import dagger.hilt.android.AndroidEntryPoint 29 | 30 | /** 31 | * @author Vignesh S 32 | * @version 1.0, 21/01/2021 33 | * @since 1.0 34 | */ 35 | @AndroidEntryPoint 36 | class HomeActivity : BaseActivity() { 37 | 38 | companion object { 39 | 40 | /** 41 | * Launches HomeActivity. 42 | * 43 | * @param context An Activity Context. 44 | */ 45 | fun start(context: Context) { 46 | if (context is AppCompatActivity) { 47 | val intent = Intent(context, HomeActivity::class.java) 48 | context.startActivity(intent) 49 | startActivityAnimation(context) 50 | } 51 | } 52 | } 53 | 54 | private lateinit var homeBinding: ActivityHomeBinding 55 | private val homeVM: HomeVM by viewModels() 56 | 57 | override fun onCreate(savedInstanceState: Bundle?) { 58 | super.onCreate(savedInstanceState) 59 | homeBinding = DataBindingUtil.setContentView(this, R.layout.activity_home) 60 | init() 61 | } 62 | 63 | private fun init() { 64 | setToolbar( 65 | homeBinding.tbWidget.toolbar, 66 | false, 67 | getString(R.string.home), 68 | homeBinding.tbWidget.tvToolbarTitle 69 | ) 70 | homeBinding.presenter = homeVM 71 | lifecycle.addObserver(homeVM) 72 | } 73 | 74 | override fun getToolbarMenuResource() = R.menu.home_menu 75 | 76 | override fun onOptionsItemSelected(item: MenuItem?): Boolean { 77 | return homeVM.onOptionsItemSelected(this, item) 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/home/HomeVM.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.home 17 | 18 | import android.app.Application 19 | import android.text.TextUtils 20 | import android.view.MenuItem 21 | import android.view.View 22 | import androidx.databinding.ObservableField 23 | import androidx.lifecycle.AndroidViewModel 24 | import androidx.lifecycle.Lifecycle 25 | import androidx.lifecycle.LifecycleObserver 26 | import androidx.lifecycle.OnLifecycleEvent 27 | import androidx.lifecycle.viewModelScope 28 | import com.litekite.client.R 29 | import com.litekite.client.app.ClientApp 30 | import com.litekite.client.base.BaseActivity 31 | import com.litekite.client.login.LoginActivity 32 | import com.litekite.client.preference.PreferenceController 33 | import com.litekite.connector.controller.BankServiceConnector 34 | import com.litekite.connector.controller.BankServiceController 35 | import com.litekite.connector.entity.FailureResponse 36 | import com.litekite.connector.entity.RequestCode 37 | import com.litekite.connector.entity.ResponseCode 38 | import com.litekite.connector.entity.UserDetails 39 | import dagger.hilt.android.lifecycle.HiltViewModel 40 | import kotlinx.coroutines.flow.collectLatest 41 | import kotlinx.coroutines.launch 42 | import javax.inject.Inject 43 | 44 | /** 45 | * @author Vignesh S 46 | * @version 1.0, 22/01/2020 47 | * @since 1.0 48 | */ 49 | @HiltViewModel 50 | class HomeVM @Inject constructor( 51 | application: Application, 52 | private val bankServiceController: BankServiceController, 53 | private val preferenceController: PreferenceController 54 | ) : AndroidViewModel(application), LifecycleObserver, BankServiceConnector.Callback { 55 | 56 | companion object { 57 | val TAG: String = HomeVM::class.java.simpleName 58 | } 59 | 60 | val balance: ObservableField = ObservableField() 61 | val amount: ObservableField = ObservableField() 62 | val welcomeNote: ObservableField = ObservableField() 63 | 64 | private var backAccUserId: Long = 0L 65 | private val applicationContext = getApplication() as ClientApp 66 | 67 | init { 68 | viewModelScope.launch { 69 | preferenceController.getLong(PreferenceController.PREFERENCE_LOGGED_IN_USER_ID) 70 | .collectLatest { 71 | backAccUserId = it 72 | if (bankServiceController.isServiceConnected()) { 73 | bankServiceController.userDetailsRequest(backAccUserId) 74 | } 75 | } 76 | } 77 | } 78 | 79 | fun onClick(v: View) { 80 | when (v.id) { 81 | R.id.b_deposit -> { 82 | if (TextUtils.isEmpty(amount.get())) { 83 | (v.context as BaseActivity).showSnackBar( 84 | v.rootView, 85 | R.string.err_amount_empty 86 | ) 87 | return 88 | } 89 | bankServiceController.depositRequest( 90 | backAccUserId, 91 | "${amount.get()}".toDouble() 92 | ) 93 | } 94 | R.id.b_withdraw -> { 95 | if (TextUtils.isEmpty(amount.get())) { 96 | (v.context as BaseActivity).showSnackBar( 97 | v.rootView, 98 | R.string.err_amount_empty 99 | ) 100 | return 101 | } 102 | bankServiceController.withdrawRequest( 103 | backAccUserId, 104 | "${amount.get()}".toDouble() 105 | ) 106 | } 107 | } 108 | } 109 | 110 | private fun resetLoginCompleted() = 111 | preferenceController.store(PreferenceController.PREFERENCE_LOGIN_COMPLETE_STATE, false) 112 | 113 | private fun updateCurrentBalance(currentBalance: Double) = 114 | balance.set(String.format("%.2f", currentBalance)) 115 | 116 | private fun clearAmount() = amount.set("") 117 | 118 | override fun onBankServiceConnected() { 119 | ClientApp.printLog(TAG, "onBankServiceConnected:") 120 | bankServiceController.userDetailsRequest(backAccUserId) 121 | } 122 | 123 | override fun onUserDetailsResponse(userDetails: UserDetails) { 124 | ClientApp.printLog(TAG, "onUserDetailsResponse:") 125 | updateCurrentBalance(userDetails.balance) 126 | welcomeNote.set(applicationContext.getString(R.string.welcome_note, userDetails.username)) 127 | } 128 | 129 | override fun onCurrentBalanceChanged(currentBalance: Double) { 130 | ClientApp.printLog(TAG, "onCurrentBalanceChanged:") 131 | clearAmount() 132 | updateCurrentBalance(currentBalance) 133 | } 134 | 135 | override fun onFailureResponse(failureResponse: FailureResponse) { 136 | ClientApp.printLog(TAG, "failureResponse: ${failureResponse.responseCode}") 137 | clearAmount() 138 | if (failureResponse.requestCode == RequestCode.WITHDRAWAL || 139 | failureResponse.requestCode == RequestCode.DEPOSIT 140 | ) { 141 | when (failureResponse.responseCode) { 142 | ResponseCode.ERROR_USER_NOT_FOUND -> { 143 | ClientApp.showToast(applicationContext, R.string.err_user_not_found) 144 | } 145 | ResponseCode.ERROR_WITHDRAWAL_CURRENT_BALANCE_IS_ZERO -> { 146 | ClientApp.showToast(applicationContext, R.string.err_withdrawal_balance_is_zero) 147 | } 148 | ResponseCode.ERROR_WITHDRAWAL_AMOUNT_EXCEEDS_CURRENT_BALANCE -> { 149 | ClientApp.showToast(applicationContext, R.string.err_withdrawal_amount_exceeds) 150 | } 151 | } 152 | } 153 | } 154 | 155 | @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) 156 | fun onCreate() { 157 | bankServiceController.addCallback(this) 158 | } 159 | 160 | @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) 161 | fun onDestroy() { 162 | bankServiceController.removeCallback(this) 163 | } 164 | 165 | fun onOptionsItemSelected(activity: BaseActivity, item: MenuItem?): Boolean { 166 | return when (item?.itemId) { 167 | R.id.logout -> { 168 | resetLoginCompleted() 169 | LoginActivity.start(activity) 170 | activity.finish() 171 | true 172 | } 173 | else -> activity.onOptionsItemSelected(item) 174 | } 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/login/LoginActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.login 17 | 18 | import android.content.Context 19 | import android.content.Intent 20 | import android.os.Bundle 21 | import androidx.activity.viewModels 22 | import androidx.appcompat.app.AppCompatActivity 23 | import androidx.databinding.DataBindingUtil 24 | import androidx.lifecycle.lifecycleScope 25 | import com.litekite.client.R 26 | import com.litekite.client.app.ClientApp 27 | import com.litekite.client.base.BaseActivity 28 | import com.litekite.client.databinding.ActivityLoginBinding 29 | import com.litekite.client.home.HomeActivity 30 | import dagger.hilt.android.AndroidEntryPoint 31 | import kotlinx.coroutines.Job 32 | import kotlinx.coroutines.flow.collectLatest 33 | import kotlinx.coroutines.launch 34 | 35 | /** 36 | * @author Vignesh S 37 | * @version 1.0, 05/01/2021 38 | * @since 1.0 39 | */ 40 | @AndroidEntryPoint 41 | class LoginActivity : BaseActivity() { 42 | 43 | companion object { 44 | 45 | val TAG: String = LoginActivity::class.java.simpleName 46 | 47 | /** 48 | * Launches LoginActivity. 49 | * 50 | * @param context An Activity Context. 51 | */ 52 | fun start(context: Context) { 53 | if (context is AppCompatActivity) { 54 | val intent = Intent(context, LoginActivity::class.java) 55 | context.startActivity(intent) 56 | startActivityAnimation(context) 57 | } 58 | } 59 | } 60 | 61 | private var loginWork: Job? = null 62 | private lateinit var loginBinding: ActivityLoginBinding 63 | private val loginVM: LoginVM by viewModels() 64 | 65 | override fun onCreate(savedInstanceState: Bundle?) { 66 | super.onCreate(savedInstanceState) 67 | checkLoginState { isCompleted -> 68 | if (isCompleted == null) { 69 | return@checkLoginState 70 | } 71 | if (isCompleted) { 72 | ClientApp.printLog(TAG, "checkLoginState: logged in. Going to Home!") 73 | ClientApp.showToast(applicationContext, R.string.login_success) 74 | startHomeActivity() 75 | finish() 76 | } else { 77 | init() 78 | } 79 | } 80 | } 81 | 82 | private fun checkLoginState(block: (Boolean?) -> (Unit)) { 83 | loginWork = lifecycleScope.launch { 84 | loginVM.loginCompleted.collectLatest { 85 | block.invoke(it) 86 | } 87 | } 88 | } 89 | 90 | private fun init() { 91 | loginBinding = DataBindingUtil.setContentView( 92 | this@LoginActivity, 93 | R.layout.activity_login 94 | ) 95 | loginBinding.presenter = loginVM 96 | lifecycle.addObserver(loginVM) 97 | } 98 | 99 | private fun startHomeActivity() { 100 | HomeActivity.start(this) 101 | } 102 | 103 | override fun onDestroy() { 104 | loginWork?.cancel() 105 | super.onDestroy() 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/login/LoginVM.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.login 17 | 18 | import android.app.Application 19 | import android.text.TextUtils 20 | import android.view.View 21 | import androidx.databinding.ObservableField 22 | import androidx.lifecycle.AndroidViewModel 23 | import androidx.lifecycle.Lifecycle 24 | import androidx.lifecycle.LifecycleObserver 25 | import androidx.lifecycle.OnLifecycleEvent 26 | import androidx.lifecycle.viewModelScope 27 | import com.litekite.client.R 28 | import com.litekite.client.app.ClientApp 29 | import com.litekite.client.base.BaseActivity 30 | import com.litekite.client.preference.PreferenceController 31 | import com.litekite.client.signup.SignupActivity 32 | import com.litekite.connector.controller.BankServiceConnector 33 | import com.litekite.connector.controller.BankServiceController 34 | import com.litekite.connector.entity.AuthResponse 35 | import com.litekite.connector.entity.FailureResponse 36 | import com.litekite.connector.entity.RequestCode 37 | import com.litekite.connector.entity.ResponseCode 38 | import dagger.hilt.android.lifecycle.HiltViewModel 39 | import kotlinx.coroutines.flow.MutableStateFlow 40 | import kotlinx.coroutines.flow.StateFlow 41 | import kotlinx.coroutines.flow.collectLatest 42 | import kotlinx.coroutines.launch 43 | import javax.inject.Inject 44 | 45 | /** 46 | * @author Vignesh S 47 | * @version 1.0, 19/01/2020 48 | * @since 1.0 49 | */ 50 | @HiltViewModel 51 | class LoginVM @Inject constructor( 52 | application: Application, 53 | private val bankServiceController: BankServiceController, 54 | private val preferenceController: PreferenceController 55 | ) : AndroidViewModel(application), LifecycleObserver, BankServiceConnector.Callback { 56 | 57 | companion object { 58 | val TAG: String = LoginVM::class.java.simpleName 59 | } 60 | 61 | val username: ObservableField = ObservableField() 62 | val password: ObservableField = ObservableField() 63 | 64 | private val applicationContext = getApplication() as ClientApp 65 | private val _loginCompleted: MutableStateFlow = MutableStateFlow(null) 66 | val loginCompleted: StateFlow = _loginCompleted 67 | 68 | init { 69 | viewModelScope.launch { 70 | preferenceController.getBoolean(PreferenceController.PREFERENCE_LOGIN_COMPLETE_STATE) 71 | .collectLatest { isLoginCompleted -> 72 | _loginCompleted.value = isLoginCompleted 73 | } 74 | } 75 | } 76 | 77 | private fun storeLoginCompleted() = 78 | preferenceController.store(PreferenceController.PREFERENCE_LOGIN_COMPLETE_STATE, true) 79 | 80 | private fun storeLoggedInUserId(userId: Long) = 81 | preferenceController.store(PreferenceController.PREFERENCE_LOGGED_IN_USER_ID, userId) 82 | 83 | fun onClick(v: View) { 84 | when (v.id) { 85 | R.id.b_login -> { 86 | if (TextUtils.isEmpty(username.get()) || TextUtils.isEmpty(password.get())) { 87 | (v.context as BaseActivity).showSnackBar( 88 | v.rootView, 89 | R.string.err_all_fields_are_empty 90 | ) 91 | return 92 | } 93 | bankServiceController.login("${username.get()}", "${password.get()}") 94 | } 95 | R.id.tv_signup -> { 96 | SignupActivity.start(v.context) 97 | } 98 | } 99 | } 100 | 101 | override fun onLoginResponse(authResponse: AuthResponse) { 102 | super.onLoginResponse(authResponse) 103 | ClientApp.printLog(TAG, "onLoginResponse:") 104 | if (authResponse.responseCode == ResponseCode.OK) { 105 | storeLoggedInUserId(authResponse.userId) 106 | storeLoginCompleted() 107 | _loginCompleted.value = true 108 | } 109 | } 110 | 111 | override fun onFailureResponse(failureResponse: FailureResponse) { 112 | ClientApp.printLog(TAG, "onFailureResponse: ${failureResponse.responseCode}") 113 | if (failureResponse.requestCode == RequestCode.LOGIN) { 114 | when (failureResponse.responseCode) { 115 | ResponseCode.ERROR_LOG_IN_INCORRECT_USER_NAME_OR_PASSWORD -> { 116 | ClientApp.showToast( 117 | applicationContext, 118 | R.string.err_incorrect_username_or_password 119 | ) 120 | } 121 | ResponseCode.ERROR_LOG_IN_USER_NOT_EXISTS -> { 122 | ClientApp.showToast(applicationContext, R.string.err_login_user_not_exists) 123 | } 124 | } 125 | } 126 | } 127 | 128 | @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) 129 | fun onCreate() { 130 | bankServiceController.addCallback(this) 131 | } 132 | 133 | @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) 134 | fun onDestroy() { 135 | bankServiceController.removeCallback(this) 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/preference/PreferenceController.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020-2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.preference 17 | 18 | import android.content.Context 19 | import androidx.datastore.core.DataStore 20 | import androidx.datastore.preferences.core.Preferences 21 | import androidx.datastore.preferences.core.booleanPreferencesKey 22 | import androidx.datastore.preferences.core.edit 23 | import androidx.datastore.preferences.core.floatPreferencesKey 24 | import androidx.datastore.preferences.core.intPreferencesKey 25 | import androidx.datastore.preferences.core.longPreferencesKey 26 | import androidx.datastore.preferences.core.stringPreferencesKey 27 | import androidx.datastore.preferences.preferencesDataStore 28 | import kotlinx.coroutines.CoroutineScope 29 | import kotlinx.coroutines.Dispatchers 30 | import kotlinx.coroutines.flow.Flow 31 | import kotlinx.coroutines.flow.catch 32 | import kotlinx.coroutines.flow.flowOn 33 | import kotlinx.coroutines.flow.map 34 | import kotlinx.coroutines.launch 35 | import javax.inject.Inject 36 | import javax.inject.Singleton 37 | 38 | /** 39 | * A Preference DataStore Controller that uses Credential Protected Storage and it can be only 40 | * accessed after credentials for lock-screen being entered and unlocked. 41 | * 42 | * These preferences are stored in /data/user[release-version] or in /data/user-de[debug-version] 43 | * 44 | * @author Vignesh S 45 | * @version 1.0, 09/04/2020 46 | * @since 1.0 47 | */ 48 | @Suppress("UNUSED") 49 | @Singleton 50 | class PreferenceController @Inject constructor(private val context: Context) { 51 | 52 | companion object { 53 | 54 | const val PREFERENCES_CLIENT_APP = "preferences_client_app" 55 | 56 | const val PREFERENCE_LOGIN_COMPLETE_STATE = "preference_login_complete_state" 57 | 58 | const val PREFERENCE_LOGGED_IN_USER_ID = "preference_logged_in_user_id" 59 | } 60 | 61 | private val Context.dataStore: DataStore by preferencesDataStore( 62 | PREFERENCES_CLIENT_APP 63 | ) 64 | 65 | private val scope = CoroutineScope(Dispatchers.IO) 66 | 67 | fun getBoolean(key: String): Flow = context.dataStore.data.map { pref -> 68 | pref[booleanPreferencesKey(key)] ?: false 69 | }.flowOn( 70 | Dispatchers.IO 71 | ).catch { 72 | it.printStackTrace() 73 | } 74 | 75 | fun getInt(key: String): Flow = context.dataStore.data.map { pref -> 76 | pref[intPreferencesKey(key)] ?: 0 77 | }.flowOn( 78 | Dispatchers.IO 79 | ).catch { 80 | it.printStackTrace() 81 | } 82 | 83 | fun getLong(key: String): Flow = context.dataStore.data.map { pref -> 84 | pref[longPreferencesKey(key)] ?: 0L 85 | }.flowOn( 86 | Dispatchers.IO 87 | ).catch { 88 | it.printStackTrace() 89 | } 90 | 91 | fun getFloat(key: String): Flow = context.dataStore.data.map { pref -> 92 | pref[floatPreferencesKey(key)] ?: 0F 93 | }.flowOn( 94 | Dispatchers.IO 95 | ).catch { 96 | it.printStackTrace() 97 | } 98 | 99 | fun getDouble(key: String): Flow = context.dataStore.data.map { pref -> 100 | java.lang.Double.longBitsToDouble(pref[longPreferencesKey(key)] ?: 0) 101 | }.flowOn( 102 | Dispatchers.IO 103 | ).catch { 104 | it.printStackTrace() 105 | } 106 | 107 | fun getString(key: String): Flow = context.dataStore.data.map { pref -> 108 | pref[stringPreferencesKey(key)] ?: "" 109 | }.flowOn( 110 | Dispatchers.IO 111 | ).catch { 112 | it.printStackTrace() 113 | } 114 | 115 | fun store(key: String, value: Boolean) = set(booleanPreferencesKey(key), value) 116 | 117 | fun store(key: String, value: Int) = set(intPreferencesKey(key), value) 118 | 119 | fun store(key: String, value: Long) = set(longPreferencesKey(key), value) 120 | 121 | fun store(key: String, value: Float) = set(floatPreferencesKey(key), value) 122 | 123 | fun store(key: String, value: Double) = set( 124 | longPreferencesKey(key), 125 | java.lang.Double.doubleToRawLongBits((value)) 126 | ) 127 | 128 | fun store(key: String, value: String) = set(stringPreferencesKey(key), value) 129 | 130 | private fun set(prefKey: Preferences.Key, value: T) = scope.launch { 131 | context.dataStore.edit { pref -> pref[prefKey] = value } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/signup/SignupActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.signup 17 | 18 | import android.content.Context 19 | import android.content.Intent 20 | import android.os.Bundle 21 | import androidx.activity.viewModels 22 | import androidx.appcompat.app.AppCompatActivity 23 | import androidx.databinding.DataBindingUtil 24 | import androidx.lifecycle.lifecycleScope 25 | import com.litekite.client.R 26 | import com.litekite.client.app.ClientApp 27 | import com.litekite.client.base.BaseActivity 28 | import com.litekite.client.databinding.ActivitySignupBinding 29 | import dagger.hilt.android.AndroidEntryPoint 30 | import kotlinx.coroutines.Job 31 | import kotlinx.coroutines.flow.collect 32 | import kotlinx.coroutines.launch 33 | 34 | /** 35 | * @author Vignesh S 36 | * @version 1.0, 20/01/2020 37 | * @since 1.0 38 | */ 39 | @AndroidEntryPoint 40 | class SignupActivity : BaseActivity() { 41 | 42 | companion object { 43 | 44 | /** 45 | * Launches SignupActivity. 46 | * 47 | * @param context An Activity Context. 48 | */ 49 | fun start(context: Context) { 50 | if (context is AppCompatActivity) { 51 | val intent = Intent(context, SignupActivity::class.java) 52 | context.startActivity(intent) 53 | startActivityAnimation(context) 54 | } 55 | } 56 | } 57 | 58 | private lateinit var signupBinding: ActivitySignupBinding 59 | private var signUpWork: Job? = null 60 | private val signupVM: SignupVM by viewModels() 61 | 62 | override fun onCreate(savedInstanceState: Bundle?) { 63 | super.onCreate(savedInstanceState) 64 | signupBinding = DataBindingUtil.setContentView(this, R.layout.activity_signup) 65 | init() 66 | } 67 | 68 | private fun init() { 69 | setToolbar( 70 | signupBinding.tbWidget.toolbar, 71 | true, 72 | getString(R.string.sign_up), 73 | signupBinding.tbWidget.tvToolbarTitle 74 | ) 75 | signupBinding.presenter = signupVM 76 | lifecycle.addObserver(signupVM) 77 | } 78 | 79 | override fun onStart() { 80 | super.onStart() 81 | signUpWork = lifecycleScope.launch { 82 | signupVM.signupCompleted.collect { isCompleted -> 83 | if (isCompleted) { 84 | ClientApp.showToast(applicationContext, R.string.sign_up_success) 85 | onBackPressed() 86 | } 87 | } 88 | } 89 | } 90 | 91 | override fun onStop() { 92 | signUpWork?.cancel() 93 | super.onStop() 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/kotlin/com/litekite/client/signup/SignupVM.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client.signup 17 | 18 | import android.app.Application 19 | import android.text.TextUtils 20 | import android.view.View 21 | import androidx.databinding.ObservableField 22 | import androidx.lifecycle.AndroidViewModel 23 | import androidx.lifecycle.Lifecycle 24 | import androidx.lifecycle.LifecycleObserver 25 | import androidx.lifecycle.OnLifecycleEvent 26 | import com.litekite.client.R 27 | import com.litekite.client.app.ClientApp 28 | import com.litekite.client.base.BaseActivity 29 | import com.litekite.connector.controller.BankServiceConnector 30 | import com.litekite.connector.controller.BankServiceController 31 | import com.litekite.connector.entity.AuthResponse 32 | import com.litekite.connector.entity.FailureResponse 33 | import com.litekite.connector.entity.RequestCode 34 | import com.litekite.connector.entity.ResponseCode 35 | import dagger.hilt.android.lifecycle.HiltViewModel 36 | import kotlinx.coroutines.flow.MutableStateFlow 37 | import kotlinx.coroutines.flow.StateFlow 38 | import javax.inject.Inject 39 | 40 | /** 41 | * @author Vignesh S 42 | * @version 1.0, 19/01/2020 43 | * @since 1.0 44 | */ 45 | @HiltViewModel 46 | class SignupVM @Inject constructor( 47 | application: Application, 48 | private val bankServiceController: BankServiceController 49 | ) : AndroidViewModel(application), LifecycleObserver, BankServiceConnector.Callback { 50 | 51 | companion object { 52 | val TAG: String = SignupVM::class.java.simpleName 53 | } 54 | 55 | val username: ObservableField = ObservableField() 56 | val password: ObservableField = ObservableField() 57 | val confirmPassword: ObservableField = ObservableField() 58 | 59 | private val applicationContext = getApplication() as ClientApp 60 | private val _signupCompleted: MutableStateFlow = MutableStateFlow(false) 61 | val signupCompleted: StateFlow = _signupCompleted 62 | 63 | fun onClick(v: View) { 64 | when (v.id) { 65 | R.id.b_signup -> { 66 | if (TextUtils.isEmpty(username.get()) || 67 | TextUtils.isEmpty(password.get()) || 68 | TextUtils.isEmpty(confirmPassword.get()) 69 | ) { 70 | (v.context as BaseActivity).showSnackBar( 71 | v.rootView, 72 | R.string.err_all_fields_are_empty 73 | ) 74 | return 75 | } 76 | if (password.get() != confirmPassword.get()) { 77 | (v.context as BaseActivity).showSnackBar( 78 | v.rootView, 79 | R.string.err_incorrect_confirm_password 80 | ) 81 | return 82 | } 83 | bankServiceController.signup("${username.get()}", "${password.get()}") 84 | } 85 | } 86 | } 87 | 88 | override fun onFailureResponse(failureResponse: FailureResponse) { 89 | ClientApp.printLog(TAG, "onFailureResponse: ${failureResponse.responseCode}") 90 | if (failureResponse.requestCode == RequestCode.SIGNUP) { 91 | if (failureResponse.responseCode == ResponseCode.ERROR_SIGN_UP_USER_EXISTS) { 92 | ClientApp.showToast(applicationContext, R.string.err_user_already_exists) 93 | } 94 | } 95 | } 96 | 97 | override fun onSignupResponse(authResponse: AuthResponse) { 98 | super.onSignupResponse(authResponse) 99 | ClientApp.printLog(TAG, "onSignupResponse:") 100 | if (authResponse.responseCode == ResponseCode.OK) { 101 | _signupCompleted.value = true 102 | } 103 | } 104 | 105 | @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) 106 | fun onCreate() { 107 | bankServiceController.addCallback(this) 108 | } 109 | 110 | @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY) 111 | fun onDestroy() { 112 | bankServiceController.removeCallback(this) 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/anim/slide_in_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/anim/slide_in_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/anim/slide_out_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/anim/slide_out_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 22 | 23 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/drawable-v21/bg_ripple_round_34.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 28 | 29 | 35 | 38 | 41 | 42 | 43 | 44 | 50 | 51 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/drawable/ic_arrow_back.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 175 | 180 | 185 | 186 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/layout/activity_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 33 | 34 | 37 | 38 | 53 | 54 | 71 | 72 | 85 | 86 | 101 | 102 | 117 | 118 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/layout/activity_login.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 34 | 35 | 47 | 48 | 61 | 62 | 76 | 77 | 84 | 85 | 98 | 99 | 106 | 107 | 124 | 125 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/layout/activity_signup.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | 33 | 34 | 37 | 38 | 52 | 53 | 67 | 68 | 81 | 82 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/layout/widget_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 24 | 25 | 31 | 32 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/menu/home_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 23 | 24 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 29 | 30 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | #008577 20 | #00574B 21 | #0c3d37 22 | @color/white 23 | #FFFFFF 24 | #000000 25 | 26 | 27 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 24dp 21 | 24dp 22 | 5dp 23 | 24 | 25 | 20dp 26 | 1dp 27 | 30dp 28 | 29 | 30 | 64dp 31 | 32 | 33 | 64dp 34 | 35 | 36 | 18sp 37 | 20sp 38 | 24sp 39 | 32sp 40 | 41 | 42 | 48dp 43 | 44 | 45 | 40dp 46 | 10dp 47 | 20dp 48 | 10dp 49 | 50 | 51 | 20dp 52 | 53 | 54 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | ClientApp 20 | 21 | 22 | Username 23 | Password 24 | Login 25 | Or 26 | Sign up 27 | Login was successful! 28 | Please fill all the fields 29 | Incorrect username or password 30 | User does not exists. Please sign up to create a new 31 | user! 32 | 33 | 34 | Confirm Password 35 | Your password and confirm 36 | password are mismatching! 37 | User already exists. Please choose a 38 | different username or try login 39 | Sign up was successfully completed! 40 | 41 | 42 | i-Bank 43 | Current Bal. 44 | Enter an amount 45 | Deposit 46 | Withdraw 47 | Please enter an amount! 48 | Welcome %s! Have a nice banking experience with AIDL 49 | Failure!, User does not found!. 50 | Withdrawal Failed!, Current Balance is 51 | zero. 52 | Withdrawal Failed!, Withdrawal Amount 53 | exceeds Current Balance limit. 54 | 55 | 56 | Logout 57 | 58 | 59 | -------------------------------------------------------------------------------- /ClientApp/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 28 | 29 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ClientApp/app/src/test/java/com/litekite/client/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.client 17 | 18 | import org.junit.Assert.assertEquals 19 | import org.junit.Test 20 | 21 | /** 22 | * Example local unit test, which will execute on the development machine (host). 23 | * 24 | * See [testing documentation](http://d.android.com/tools/testing). 25 | * 26 | * @author Vignesh S 27 | * @version 1.0, 22/01/2020 28 | * @since 1.0 29 | */ 30 | class ExampleUnitTest { 31 | 32 | @Test 33 | fun addition_isCorrect() { 34 | assertEquals(4, 2 + 2) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ClientApp/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | 19 | buildscript { 20 | ext.kotlin_version = "1.5.10" 21 | ext.hilt_version = "2.36" 22 | ext.lifecycle_version = "2.3.1" 23 | repositories { 24 | google() 25 | mavenCentral() 26 | } 27 | dependencies { 28 | classpath 'com.android.tools.build:gradle:4.2.1' 29 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 30 | classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" 31 | // NOTE: Do not place your application dependencies here; they belong 32 | // in the individual module build.gradle files 33 | } 34 | } 35 | 36 | plugins { 37 | id "com.diffplug.spotless" version "5.11.1" 38 | } 39 | 40 | allprojects { 41 | repositories { 42 | google() 43 | mavenCentral() 44 | } 45 | } 46 | 47 | spotless { 48 | ratchetFrom 'origin/main' 49 | format 'misc', { 50 | target '**/*.gradle', '**/*.md', '**/.gitignore' 51 | trimTrailingWhitespace() 52 | indentWithSpaces() 53 | endWithNewline() 54 | } 55 | format 'xml', { 56 | target '**/*.xml' 57 | trimTrailingWhitespace() 58 | indentWithSpaces() 59 | endWithNewline() 60 | } 61 | kotlin { 62 | target '**/src/**/*.kt' 63 | ktlint("0.41.0") 64 | licenseHeaderFile rootProject.file('spotless/copyright.kt') 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /ClientApp/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | android.useAndroidX=true 17 | android.enableJetifier=true 18 | -------------------------------------------------------------------------------- /ClientApp/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ClientApp/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ClientApp/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 23 20:54:19 IST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /ClientApp/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /ClientApp/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /ClientApp/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':ConnectorLib' 2 | include ':app' 3 | rootProject.name='ClientApp' 4 | -------------------------------------------------------------------------------- /ClientApp/spotless/copyright.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright $YEAR LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /ConnectorLib/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | 57 | # Android Studio Configurations 58 | .DS_Store 59 | /local.properties 60 | /keystore.properties 61 | /.idea 62 | /build 63 | /captures 64 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | /schemas 4 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.library' 18 | apply plugin: 'kotlin-android' 19 | apply plugin: 'kotlin-kapt' 20 | apply plugin: 'kotlin-parcelize' 21 | 22 | android { 23 | compileSdkVersion 28 24 | defaultConfig { 25 | minSdkVersion 16 26 | //noinspection ExpiredTargetSdkVersion 27 | targetSdkVersion 28 28 | versionCode 1 29 | versionName "1.0" 30 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 31 | consumerProguardFiles 'consumer-rules.pro' 32 | } 33 | sourceSets { 34 | main.java.srcDirs += "src/main/kotlin" 35 | androidTest.assets.srcDirs += files("$projectDir/schemas".toString()) 36 | } 37 | buildFeatures { 38 | viewBinding = true 39 | dataBinding = true 40 | } 41 | compileOptions { 42 | sourceCompatibility = JavaVersion.VERSION_1_8 43 | targetCompatibility = JavaVersion.VERSION_1_8 44 | } 45 | kotlinOptions { 46 | jvmTarget = JavaVersion.VERSION_1_8 47 | } 48 | buildTypes { 49 | release { 50 | minifyEnabled false 51 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 52 | } 53 | } 54 | } 55 | 56 | kapt { 57 | correctErrorTypes true 58 | } 59 | 60 | dependencies { 61 | implementation fileTree(dir: "libs", include: ["*.jar"]) 62 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 63 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3' 64 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' 65 | implementation 'androidx.core:core-ktx:1.5.0' 66 | implementation 'androidx.appcompat:appcompat:1.3.0' 67 | implementation 'com.google.android.material:material:1.3.0' 68 | testImplementation 'junit:junit:4.13.2' 69 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 70 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 71 | } 72 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/consumer-rules.pro: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ConnectorLib/ConnectorLib/consumer-rules.pro -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/androidTest/java/com/litekite/connector/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector 17 | 18 | import androidx.test.ext.junit.runners.AndroidJUnit4 19 | import androidx.test.platform.app.InstrumentationRegistry 20 | import org.junit.Assert.assertEquals 21 | import org.junit.Test 22 | import org.junit.runner.RunWith 23 | 24 | /** 25 | * Instrumented test, which will execute on an Android device. 26 | * 27 | * See [testing documentation](http://d.android.com/tools/testing). 28 | */ 29 | @RunWith(AndroidJUnit4::class) 30 | class ExampleInstrumentedTest { 31 | 32 | @Test 33 | fun useAppContext() { 34 | // Context of the app under test. 35 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 36 | assertEquals("com.litekite.connectorlib", appContext.packageName) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/controller/IBankService.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // IBankService.aidl 18 | package com.litekite.connector.controller; 19 | 20 | // Declare any non-default types here with import statements 21 | import com.litekite.connector.controller.IBankServiceCallback; 22 | import com.litekite.connector.entity.LoginRequest; 23 | import com.litekite.connector.entity.SignupRequest; 24 | 25 | /** 26 | * Example of defining an interface for calling on to a remote service 27 | * (running in another process). 28 | * 29 | * @author Vignesh S 30 | * @version 1.0, 11/01/2021 31 | * @since 1.0 32 | */ 33 | interface IBankService { 34 | 35 | /** 36 | * Often you want to allow a service to call back to its clients. 37 | * This shows how to do so, by registering a callback interface with 38 | * the service. 39 | */ 40 | void registerCallback(IBankServiceCallback cb); 41 | 42 | /** 43 | * Remove a previously registered callback interface. 44 | */ 45 | void unregisterCallback(IBankServiceCallback cb); 46 | 47 | /** 48 | * Called upon the signup request process. 49 | */ 50 | void signupRequest(in SignupRequest signupRequest); 51 | 52 | /** 53 | * Called upon the signup request process. 54 | */ 55 | void loginRequest(in LoginRequest loginRequest); 56 | 57 | /** 58 | * Called upon the user details request process. 59 | */ 60 | void userDetailsRequest(long userId); 61 | 62 | /** 63 | * Called upon the user deposit request process. 64 | */ 65 | void depositRequest(long userId, double amount); 66 | 67 | /** 68 | * Called upon the user withdrawal request process. 69 | */ 70 | void withdrawRequest(long userId, double amount); 71 | 72 | } 73 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/controller/IBankServiceCallback.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // IBankServiceCallback.aidl 18 | package com.litekite.connector.controller; 19 | 20 | // Declare any non-default types here with import statements 21 | import com.litekite.connector.entity.AuthResponse; 22 | import com.litekite.connector.entity.UserDetails; 23 | import com.litekite.connector.entity.FailureResponse; 24 | 25 | /** 26 | * Example of a callback interface used by IBankService to send 27 | * synchronous notifications back to its clients. Note that this is a 28 | * one-way interface so the server does not block waiting for the client. 29 | * 30 | * @author Vignesh S 31 | * @version 1.0, 11/01/2021 32 | * @since 1.0 33 | */ 34 | interface IBankServiceCallback { 35 | 36 | /** 37 | * Called upon the signup request process. 38 | */ 39 | void onSignupResponse(in AuthResponse authResponse); 40 | 41 | /** 42 | * Called upon the login request process. 43 | */ 44 | void onLoginResponse(in AuthResponse authResponse); 45 | 46 | /** 47 | * Called upon the signup request process. 48 | */ 49 | void onUserDetailsResponse(in UserDetails userDetails); 50 | 51 | /** 52 | * Called upon the signup request process. 53 | */ 54 | void onCurrentBalanceChanged(double currentBalance); 55 | 56 | /** 57 | * Called upon any failure occurs with request process. 58 | */ 59 | void onFailureResponse(in FailureResponse failureResponse); 60 | 61 | } 62 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/entity/AuthResponse.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // AuthResponse.aidl 18 | package com.litekite.connector.entity; 19 | 20 | // Declare any non-default types here with import statements 21 | 22 | /** 23 | * An aidl of AuthResponse parcelable declaration 24 | * 25 | * @author Vignesh S 26 | * @version 1.0, 20/01/2021 27 | * @since 1.0 28 | */ 29 | parcelable AuthResponse; 30 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/entity/FailureResponse.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // FailureResponse.aidl 18 | package com.litekite.connector.entity; 19 | 20 | // Declare any non-default types here with import statements 21 | 22 | /** 23 | * An aidl of FailureResponse parcelable declaration 24 | * 25 | * @author Vignesh S 26 | * @version 1.0, 21/01/2021 27 | * @since 1.0 28 | */ 29 | parcelable FailureResponse; 30 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/entity/LoginRequest.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // LoginRequest.aidl 18 | package com.litekite.connector.entity; 19 | 20 | // Declare any non-default types here with import statements 21 | 22 | /** 23 | * An aidl of LoginRequest parcelable declaration 24 | * 25 | * @author Vignesh S 26 | * @version 1.0, 17/01/2021 27 | * @since 1.0 28 | */ 29 | parcelable LoginRequest; 30 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/entity/SignupRequest.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // SignupRequest.aidl 18 | package com.litekite.connector.entity; 19 | 20 | // Declare any non-default types here with import statements 21 | 22 | /** 23 | * An aidl of SignupRequest parcelable declaration 24 | * 25 | * @author Vignesh S 26 | * @version 1.0, 17/01/2021 27 | * @since 1.0 28 | */ 29 | parcelable SignupRequest; 30 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/aidl/com/litekite/connector/entity/UserDetails.aidl: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // UserDetails.aidl 18 | package com.litekite.connector.entity; 19 | 20 | // Declare any non-default types here with import statements 21 | 22 | /** 23 | * An aidl of UserDetails parcelable declaration 24 | * 25 | * @author Vignesh S 26 | * @version 1.0, 25/01/2021 27 | * @since 1.0 28 | */ 29 | parcelable UserDetails; 30 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/base/CallbackProvider.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.base 17 | 18 | /** 19 | * @author Vignesh S 20 | * @version 1.0, 31/08/2020 21 | * @since 1.0 22 | */ 23 | @Suppress("UNUSED") 24 | interface CallbackProvider { 25 | 26 | val callbacks: ArrayList 27 | 28 | fun addCallback(cb: T) { 29 | callbacks.add(cb) 30 | } 31 | 32 | fun removeCallback(cb: T) { 33 | callbacks.remove(cb) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/controller/BankServiceController.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.controller 17 | 18 | import android.content.Context 19 | import com.litekite.connector.base.CallbackProvider 20 | import com.litekite.connector.entity.AuthResponse 21 | import com.litekite.connector.entity.FailureResponse 22 | import com.litekite.connector.entity.LoginRequest 23 | import com.litekite.connector.entity.SignupRequest 24 | import com.litekite.connector.entity.UserDetails 25 | import kotlinx.coroutines.CoroutineScope 26 | import kotlinx.coroutines.Dispatchers 27 | import kotlinx.coroutines.launch 28 | 29 | /** 30 | * @author Vignesh S 31 | * @version 1.0, 17/01/2021 32 | * @since 1.0 33 | */ 34 | @Suppress("UNUSED") 35 | class BankServiceController(context: Context) : 36 | BankServiceConnector.Callback, 37 | CallbackProvider { 38 | 39 | private val coroutineScope = CoroutineScope(Dispatchers.Main) 40 | 41 | private val serviceProvider = BankServiceConnector.Builder(context) 42 | .setCallback(this) 43 | .build() 44 | 45 | override val callbacks: ArrayList = ArrayList() 46 | 47 | override fun addCallback(cb: BankServiceConnector.Callback) { 48 | super.addCallback(cb) 49 | if (callbacks.size > 0) { 50 | connect() 51 | } 52 | } 53 | 54 | override fun removeCallback(cb: BankServiceConnector.Callback) { 55 | super.removeCallback(cb) 56 | if (callbacks.size == 0) { 57 | disconnect() 58 | } 59 | } 60 | 61 | private fun connect() { 62 | serviceProvider.connectService() 63 | } 64 | 65 | fun isServiceConnected() = serviceProvider.serviceConnected 66 | 67 | private fun disconnect() { 68 | serviceProvider.disconnectService() 69 | } 70 | 71 | fun signup(username: String, password: String) { 72 | val signupRequest = SignupRequest(username, password) 73 | serviceProvider.signupRequest(signupRequest) 74 | } 75 | 76 | fun login(username: String, password: String) { 77 | val loginRequest = LoginRequest(username, password) 78 | serviceProvider.loginRequest(loginRequest) 79 | } 80 | 81 | fun depositRequest(userId: Long, amount: Double) { 82 | serviceProvider.depositRequest(userId, amount) 83 | } 84 | 85 | fun withdrawRequest(userId: Long, amount: Double) { 86 | serviceProvider.withdrawRequest(userId, amount) 87 | } 88 | 89 | fun userDetailsRequest(userId: Long) { 90 | serviceProvider.userDetailsRequest(userId) 91 | } 92 | 93 | override fun onBankServiceConnected() { 94 | coroutineScope.launch { 95 | callbacks.forEach { it.onBankServiceConnected() } 96 | } 97 | } 98 | 99 | override fun onSignupResponse(authResponse: AuthResponse) { 100 | coroutineScope.launch { 101 | callbacks.forEach { it.onSignupResponse(authResponse) } 102 | } 103 | } 104 | 105 | override fun onLoginResponse(authResponse: AuthResponse) { 106 | coroutineScope.launch { 107 | callbacks.forEach { it.onLoginResponse(authResponse) } 108 | } 109 | } 110 | 111 | override fun onUserDetailsResponse(userDetails: UserDetails) { 112 | coroutineScope.launch { 113 | callbacks.forEach { it.onUserDetailsResponse(userDetails) } 114 | } 115 | } 116 | 117 | override fun onCurrentBalanceChanged(currentBalance: Double) { 118 | coroutineScope.launch { 119 | callbacks.forEach { it.onCurrentBalanceChanged(currentBalance) } 120 | } 121 | } 122 | 123 | override fun onFailureResponse(failureResponse: FailureResponse) { 124 | coroutineScope.launch { 125 | callbacks.forEach { it.onFailureResponse(failureResponse) } 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/AuthResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | /** 22 | * @author Vignesh S 23 | * @version 1.0, 20/01/2021 24 | * @since 1.0 25 | */ 26 | @Parcelize 27 | data class AuthResponse( 28 | @ResponseCode val responseCode: Int, 29 | val userId: Long, 30 | val username: String 31 | ) : Parcelable 32 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/FailureResponse.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | /** 22 | * @author Vignesh S 23 | * @version 1.0, 21/01/2021 24 | * @since 1.0 25 | */ 26 | @Parcelize 27 | data class FailureResponse( 28 | @RequestCode val requestCode: Int, 29 | @ResponseCode val responseCode: Int 30 | ) : Parcelable 31 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/LoginRequest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | /** 22 | * @author Vignesh S 23 | * @version 1.0, 17/01/2021 24 | * @since 1.0 25 | */ 26 | @Parcelize 27 | data class LoginRequest(val username: String, val password: String) : Parcelable 28 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/RequestCode.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | /** 19 | * @author Vignesh S 20 | * @version 1.0, 21/01/2021 21 | * @since 1.0 22 | */ 23 | @Suppress("UNUSED") 24 | @Retention(AnnotationRetention.SOURCE) 25 | annotation class RequestCode { 26 | 27 | companion object { 28 | const val LOGIN = 0 29 | const val SIGNUP = 1 30 | const val USER_DETAILS_REQ = 2 31 | const val DEPOSIT = 3 32 | const val WITHDRAWAL = 4 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/ResponseCode.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | /** 19 | * @author Vignesh S 20 | * @version 1.0, 20/01/2021 21 | * @since 1.0 22 | */ 23 | @Suppress("UNUSED") 24 | @Retention(AnnotationRetention.SOURCE) 25 | annotation class ResponseCode { 26 | 27 | companion object { 28 | const val ERROR_SIGN_UP_USER_EXISTS = -6 29 | const val ERROR_LOG_IN_USER_NOT_EXISTS = -5 30 | const val ERROR_LOG_IN_INCORRECT_USER_NAME_OR_PASSWORD = -4 31 | const val ERROR_USER_NOT_FOUND = -3 32 | const val ERROR_WITHDRAWAL_CURRENT_BALANCE_IS_ZERO = -2 33 | const val ERROR_WITHDRAWAL_AMOUNT_EXCEEDS_CURRENT_BALANCE = -1 34 | const val OK = 0 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/SignupRequest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | /** 22 | * @author Vignesh S 23 | * @version 1.0, 17/01/2021 24 | * @since 1.0 25 | */ 26 | @Parcelize 27 | data class SignupRequest(val username: String, val password: String) : Parcelable 28 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/kotlin/com/litekite/connector/entity/UserDetails.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector.entity 17 | 18 | import android.os.Parcelable 19 | import kotlinx.parcelize.Parcelize 20 | 21 | /** 22 | * @author Vignesh S 23 | * @version 1.0, 25/01/2021 24 | * @since 1.0 25 | */ 26 | @Parcelize 27 | data class UserDetails(val username: String, val balance: Double = 0.0) : Parcelable 28 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/main/res/values/configs.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | com.litekite.server.intent.action.BIND_BANK_SERVICE 21 | com.litekite.server/.service.BankService 22 | 23 | 24 | -------------------------------------------------------------------------------- /ConnectorLib/ConnectorLib/src/test/java/com/litekite/connector/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.connector 17 | 18 | import org.junit.Assert.assertEquals 19 | import org.junit.Test 20 | 21 | /** 22 | * Example local unit test, which will execute on the development machine (host). 23 | * 24 | * See [testing documentation](http://d.android.com/tools/testing). 25 | */ 26 | class ExampleUnitTest { 27 | 28 | @Test 29 | fun addition_isCorrect() { 30 | assertEquals(4, 2 + 2) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ConnectorLib/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | buildscript { 19 | ext.kotlin_version = "1.5.10" 20 | repositories { 21 | google() 22 | mavenCentral() 23 | } 24 | dependencies { 25 | classpath "com.android.tools.build:gradle:4.2.1" 26 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 27 | 28 | // NOTE: Do not place your application dependencies here; they belong 29 | // in the individual module build.gradle files 30 | } 31 | } 32 | 33 | plugins { 34 | id "com.diffplug.spotless" version "5.11.1" 35 | } 36 | 37 | allprojects { 38 | repositories { 39 | google() 40 | mavenCentral() 41 | } 42 | } 43 | 44 | spotless { 45 | ratchetFrom 'origin/main' 46 | format 'misc', { 47 | target '**/*.gradle', '**/*.md', '**/.gitignore' 48 | trimTrailingWhitespace() 49 | indentWithSpaces() 50 | endWithNewline() 51 | } 52 | format 'xml', { 53 | target '**/*.xml' 54 | trimTrailingWhitespace() 55 | indentWithSpaces() 56 | endWithNewline() 57 | } 58 | kotlin { 59 | target '**/src/**/*.kt' 60 | ktlint("0.41.0") 61 | licenseHeaderFile rootProject.file('spotless/copyright.kt') 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /ConnectorLib/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | android.useAndroidX=true 17 | android.enableJetifier=true 18 | -------------------------------------------------------------------------------- /ConnectorLib/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ConnectorLib/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ConnectorLib/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 23 20:54:19 IST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip 7 | -------------------------------------------------------------------------------- /ConnectorLib/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /ConnectorLib/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /ConnectorLib/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':ConnectorLib' 2 | rootProject.name = "ConnectorLib" 3 | -------------------------------------------------------------------------------- /ConnectorLib/spotless/copyright.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright $YEAR LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android-AIDL 2 | 3 | Making Inter Process Communication (IPC) via Android Interface Definition Language (AIDL) that helps to communicate between two or more different apps that are running on different processes. 4 | 5 | The other ways of communicating with other apps are using android intents, broadcasts and content providers based on the scenarios. 6 | 7 | ## Getting Started 8 | 9 | 1) Install Server and Client app apks on the device. 10 | 11 | 2) Launch client app and perform login, sign-up, deposit and withdrawal operations. These operations are handled with AIDL Binders that are shared with client applications by server application. 12 | 13 | 3) Server app runs a BankService, a service that shares AIDL binders with the client applications which are all bound with the service. 14 | 15 | 4) Server app stores and maintains user credentials in a Database. 16 | 17 | 5) Connector library has AIDL interfaces that are commonly shared with server and client app. 18 | 19 | 6) Client app binds with the BankService with the help of BankServiceController and BankServiceConnector from Connector library that handles service connections, requests and responses with the BankService. 20 | 21 | ## 22 | 23 |
24 | 25 |

26 | AIDL Login Screen 27 | AIDL Sign Up 28 | AIDL Home 29 |

30 | 31 | ## 32 | 33 | #### please note that, due to background restrictions on Android running API level 30 and above, third-party application can no longer start or bind with the service that belongs to another process or app. 34 | 35 | #### You may need to start or bind a service as a foreground service for Android API level 29. 36 | 37 | #### It is recommended to start or bind with the service that are present in the same application. 38 | 39 | #### If you are developing system level android apps for a custom android system, there will be no restrictions applied. 40 | 41 | #### A Messenger Object can also be used as a Binder instead of AIDL Binder. 42 | 43 | ## Libraries Used 44 | 45 | `Data Binding Library` -> for updating, handling views from layouts with ViewModels.
46 | 47 | `Lifecycle Components` -> LiveData for observing changes and ViewModel for MVVM Architecture.
48 | 49 | `Room Persistence Storage` -> An ORM for SQLite Database.
50 | 51 | `Hilt DI` -> Dependency Injection Library for Android.
52 | 53 | `Kotlin Coroutines Library` -> A light-weight concurrency thread handles async and blocking works.
54 | 55 | ## Support 56 | 57 | If you've found an error in this sample, please file an issue: 58 | https://github.com/LiteKite/Android-AIDL/issues 59 | 60 | Patches are encouraged, and may be submitted by forking this project and 61 | submitting a pull request through GitHub. 62 | 63 | ## 64 | 65 |

Like this project?, Always support...

66 | 67 |

68 | 69 |

70 | 71 | ## License 72 | 73 | ~~~ 74 | 75 | Copyright 2021 LiteKite Startup 76 | 77 | Licensed under the Apache License, Version 2.0 (the "License"); 78 | you may not use this file except in compliance with the License. 79 | You may obtain a copy of the License at 80 | 81 | http://www.apache.org/licenses/LICENSE-2.0 82 | 83 | Unless required by applicable law or agreed to in writing, software 84 | distributed under the License is distributed on an "AS IS" BASIS, 85 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 86 | See the License for the specific language governing permissions and 87 | limitations under the License. 88 | 89 | ~~~ 90 | -------------------------------------------------------------------------------- /ServerApp/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | 57 | # Android Studio Configurations 58 | .DS_Store 59 | /local.properties 60 | /keystore.properties 61 | /.idea 62 | /build 63 | /captures 64 | -------------------------------------------------------------------------------- /ServerApp/ConnectorLib/ConnectorLib-release.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/ConnectorLib/ConnectorLib-release.aar -------------------------------------------------------------------------------- /ServerApp/ConnectorLib/build.gradle: -------------------------------------------------------------------------------- 1 | configurations.maybeCreate("default") 2 | artifacts.add("default", file('ConnectorLib-release.aar')) 3 | -------------------------------------------------------------------------------- /ServerApp/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /release 3 | /schemas 4 | -------------------------------------------------------------------------------- /ServerApp/app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | apply plugin: 'kotlin-android' 19 | apply plugin: 'kotlin-kapt' 20 | apply plugin: 'kotlin-parcelize' 21 | 22 | android { 23 | compileSdkVersion 28 24 | defaultConfig { 25 | applicationId "com.litekite.server" 26 | minSdkVersion 16 27 | //noinspection ExpiredTargetSdkVersion 28 | targetSdkVersion 28 29 | versionCode 1 30 | versionName "1.0" 31 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' 32 | javaCompileOptions { 33 | annotationProcessorOptions { 34 | arguments += ["room.incremental": "true"] 35 | arguments += ["room.schemaLocation": "$projectDir/schemas".toString()] 36 | } 37 | } 38 | } 39 | sourceSets { 40 | main.java.srcDirs += "src/main/kotlin" 41 | } 42 | buildFeatures { 43 | viewBinding = true 44 | dataBinding = true 45 | } 46 | lintOptions { 47 | baseline file("lint-baseline.xml") 48 | warningsAsErrors true 49 | enable "Interoperability" 50 | } 51 | compileOptions { 52 | sourceCompatibility = JavaVersion.VERSION_1_8 53 | targetCompatibility = JavaVersion.VERSION_1_8 54 | } 55 | kotlinOptions { 56 | jvmTarget = JavaVersion.VERSION_1_8 57 | } 58 | buildTypes { 59 | release { 60 | minifyEnabled true 61 | shrinkResources true 62 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 63 | } 64 | } 65 | } 66 | 67 | kapt { 68 | correctErrorTypes true 69 | } 70 | 71 | dependencies { 72 | implementation fileTree(dir: 'libs', include: ['*.jar']) 73 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 74 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3' 75 | implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2' 76 | implementation 'androidx.core:core-ktx:1.5.0' 77 | implementation 'androidx.appcompat:appcompat:1.3.0' 78 | implementation project(path: ':ConnectorLib') 79 | 80 | // Room 81 | implementation "androidx.room:room-runtime:$room_version" 82 | kapt "androidx.room:room-compiler:$room_version" 83 | 84 | // Room KTX 85 | implementation "androidx.room:room-ktx:$room_version" 86 | 87 | // Test helpers for Room 88 | testImplementation "androidx.room:room-testing:$room_version" 89 | 90 | // Test helpers for Room 91 | testImplementation "androidx.room:room-testing:$room_version" 92 | 93 | testImplementation 'junit:junit:4.13.2' 94 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 95 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 96 | } 97 | -------------------------------------------------------------------------------- /ServerApp/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /ServerApp/app/src/androidTest/java/com/litekite/server/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.server 17 | 18 | import androidx.test.ext.junit.runners.AndroidJUnit4 19 | import androidx.test.platform.app.InstrumentationRegistry 20 | import org.junit.Assert.assertEquals 21 | import org.junit.Test 22 | import org.junit.runner.RunWith 23 | 24 | /** 25 | * Instrumented test, which will execute on an Android device. 26 | * 27 | * See [testing documentation](http://d.android.com/tools/testing). 28 | * 29 | * @author Vignesh S 30 | * @version 1.0, 22/01/2020 31 | * @since 1.0 32 | */ 33 | @RunWith(AndroidJUnit4::class) 34 | class ExampleInstrumentedTest { 35 | 36 | @Test 37 | fun useAppContext() { 38 | // Context of the app under test. 39 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 40 | assertEquals("com.litekite.serverapp", appContext.packageName) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 21 | 24 | 25 | 26 | 27 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/kotlin/com/litekite/server/room/dao/BankDao.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.server.room.dao 17 | 18 | import androidx.room.Dao 19 | import androidx.room.Insert 20 | import androidx.room.OnConflictStrategy 21 | import androidx.room.Query 22 | import androidx.room.Update 23 | import com.litekite.server.room.entity.UserAccount 24 | 25 | /** 26 | * @author Vignesh S 27 | * @version 1.0, 20/01/2021 28 | * @since 1.0 29 | */ 30 | @Dao 31 | interface BankDao { 32 | 33 | @Query("select exists(select * from user_account where username = :username)") 34 | suspend fun isUserAccountExists(username: String): Boolean 35 | 36 | @Query("select * from user_account where username = :username AND password = :password") 37 | suspend fun getUserAccount(username: String, password: String): UserAccount? 38 | 39 | @Query("select * from user_account where user_id = :userId") 40 | suspend fun getUserAccount(userId: Long): UserAccount? 41 | 42 | @Update(onConflict = OnConflictStrategy.REPLACE) 43 | suspend fun updateUserAccount(userAccount: UserAccount): Int 44 | 45 | @Insert(onConflict = OnConflictStrategy.REPLACE) 46 | suspend fun saveUserAccount(userAccount: UserAccount): Long 47 | } 48 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/kotlin/com/litekite/server/room/db/BankDatabase.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.server.room.db 17 | 18 | import android.content.Context 19 | import androidx.room.Database 20 | import androidx.room.Room 21 | import androidx.room.RoomDatabase 22 | import com.litekite.server.room.dao.BankDao 23 | import com.litekite.server.room.entity.UserAccount 24 | import kotlinx.coroutines.Dispatchers 25 | import kotlinx.coroutines.withContext 26 | 27 | /** 28 | * Database Class, Creates Database, Database Instance and destroys Database instance. 29 | * 30 | * @author Vignesh S 31 | * 32 | * @see [Room Library Guide](https://developer.android.com/topic/libraries/architecture/room.html) 33 | * 34 | * @see [Reference Guide](https://developer.android.com/reference/android/arch/persistence/room/package-summary.html) 35 | * 36 | * @version 1.0, 04/03/2018 37 | * @since 1.0 38 | */ 39 | @Database(entities = [UserAccount::class], version = 1) 40 | abstract class BankDatabase : RoomDatabase() { 41 | 42 | companion object { 43 | 44 | const val ONE_ROW_UPDATED: Int = 1 45 | 46 | private const val DATABASE_NAME = "bank_database" 47 | 48 | @Volatile 49 | private var BANK_DATABASE_INSTANCE: BankDatabase? = null 50 | 51 | /** 52 | * Creates Room Database Instance if was not already initiated. 53 | * 54 | * @param context Activity or Application Context. 55 | * 56 | * @return [BANK_DATABASE_INSTANCE] 57 | */ 58 | @Synchronized 59 | fun getBankDatabase(context: Context): BankDatabase { 60 | if (BANK_DATABASE_INSTANCE == null) { 61 | BANK_DATABASE_INSTANCE = 62 | Room.databaseBuilder(context, BankDatabase::class.java, DATABASE_NAME).build() 63 | } 64 | return BANK_DATABASE_INSTANCE as BankDatabase 65 | } 66 | } 67 | 68 | suspend fun isUserExists(username: String): Boolean { 69 | return withContext(Dispatchers.IO) { 70 | bankDao.isUserAccountExists(username) 71 | } 72 | } 73 | 74 | suspend fun saveUserAccount(userAccount: UserAccount): Long { 75 | return withContext(Dispatchers.IO) { 76 | bankDao.saveUserAccount(userAccount) 77 | } 78 | } 79 | 80 | suspend fun updateUserAccount(userAccount: UserAccount): Int { 81 | return withContext(Dispatchers.IO) { 82 | bankDao.updateUserAccount(userAccount) 83 | } 84 | } 85 | 86 | suspend fun getUserAccount(username: String, password: String): UserAccount? { 87 | return withContext(Dispatchers.IO) { 88 | bankDao.getUserAccount(username, password) 89 | } 90 | } 91 | 92 | suspend fun getUserAccount(userId: Long): UserAccount? { 93 | return withContext(Dispatchers.IO) { 94 | bankDao.getUserAccount(userId) 95 | } 96 | } 97 | 98 | /** 99 | * Destroys [BANK_DATABASE_INSTANCE] 100 | */ 101 | fun destroyAppDatabase() { 102 | BANK_DATABASE_INSTANCE = null 103 | } 104 | 105 | /** 106 | * Gives BankDao Database Operations. 107 | * 108 | * @return BankDao abstract implementation. 109 | */ 110 | abstract val bankDao: BankDao 111 | } 112 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/kotlin/com/litekite/server/room/entity/UserAccount.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.server.room.entity 17 | 18 | import android.os.Parcelable 19 | import androidx.room.ColumnInfo 20 | import androidx.room.Entity 21 | import androidx.room.Index 22 | import androidx.room.PrimaryKey 23 | import kotlinx.parcelize.Parcelize 24 | 25 | /** 26 | * @author Vignesh S 27 | * @version 1.0, 20/01/2021 28 | * @since 1.0 29 | */ 30 | @Parcelize 31 | @Entity(tableName = "user_account", indices = [Index("user_id")]) 32 | data class UserAccount( 33 | 34 | @PrimaryKey(autoGenerate = true) 35 | @ColumnInfo(name = "user_id") 36 | val userId: Long = 0, 37 | 38 | @ColumnInfo(name = "username") 39 | val username: String, 40 | 41 | @ColumnInfo(name = "password") 42 | val password: String, 43 | 44 | @ColumnInfo(name = "balance") 45 | var balance: Double = 0.0 46 | 47 | ) : Parcelable 48 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 28 | 29 | 35 | 38 | 41 | 42 | 43 | 44 | 50 | 51 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 175 | 180 | 185 | 186 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | #008577 19 | #00574B 20 | #D81B60 21 | 22 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/values/configs.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | com.litektite.server.intent.action 21 | .LOCAL_BIND_BANK_SERVICE 22 | 23 | 24 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | ServerApp 19 | 20 | -------------------------------------------------------------------------------- /ServerApp/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ServerApp/app/src/test/java/com/litekite/server/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.litekite.server 17 | 18 | import org.junit.Assert.assertEquals 19 | import org.junit.Test 20 | 21 | /** 22 | * Example local unit test, which will execute on the development machine (host). 23 | * 24 | * See [testing documentation](http://d.android.com/tools/testing). 25 | * 26 | * @author Vignesh S 27 | * @version 1.0, 22/01/2020 28 | * @since 1.0 29 | */ 30 | class ExampleUnitTest { 31 | 32 | @Test 33 | fun addition_isCorrect() { 34 | assertEquals(4, 2 + 2) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /ServerApp/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | 19 | buildscript { 20 | ext.room_version = '2.3.0' 21 | ext.kotlin_version = '1.5.10' 22 | repositories { 23 | google() 24 | mavenCentral() 25 | } 26 | dependencies { 27 | classpath 'com.android.tools.build:gradle:4.2.1' 28 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 29 | // NOTE: Do not place your application dependencies here; they belong 30 | // in the individual module build.gradle files 31 | } 32 | } 33 | 34 | plugins { 35 | id "com.diffplug.spotless" version "5.11.1" 36 | } 37 | 38 | allprojects { 39 | repositories { 40 | google() 41 | mavenCentral() 42 | } 43 | } 44 | 45 | spotless { 46 | ratchetFrom 'origin/main' 47 | format 'misc', { 48 | target '**/*.gradle', '**/*.md', '**/.gitignore' 49 | trimTrailingWhitespace() 50 | indentWithSpaces() 51 | endWithNewline() 52 | } 53 | format 'xml', { 54 | target '**/*.xml' 55 | trimTrailingWhitespace() 56 | indentWithSpaces() 57 | endWithNewline() 58 | } 59 | kotlin { 60 | target '**/src/**/*.kt' 61 | ktlint("0.41.0") 62 | licenseHeaderFile rootProject.file('spotless/copyright.kt') 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /ServerApp/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # Kotlin code style for this project: "official" or "obsolete": 15 | kotlin.code.style=official 16 | android.useAndroidX=true 17 | android.enableJetifier=true 18 | -------------------------------------------------------------------------------- /ServerApp/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiteKite/Android-AIDL/6f7b20588e21030516af6533ba24b9a01808f985/ServerApp/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /ServerApp/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 23 20:54:19 IST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /ServerApp/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /ServerApp/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /ServerApp/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':ConnectorLib' 2 | include ':app' 3 | rootProject.name = 'ServerApp' 4 | -------------------------------------------------------------------------------- /ServerApp/spotless/copyright.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright $YEAR LiteKite Startup. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | --------------------------------------------------------------------------------