create services module

This commit is contained in:
Rinat Nurmukhametov 2022-03-16 18:31:01 +03:00
parent d201cfb36f
commit ccb3f1c4e1
7 changed files with 52 additions and 7 deletions

1
client-services/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,35 @@
apply from: "../android-configs/lib-config.gradle"
apply plugin: 'com.huawei.agconnect'
dependencies {
implementation "androidx.core:core"
implementation "androidx.annotation:annotation"
implementation "com.google.android.gms:play-services-base"
implementation "com.huawei.hms:safetydetect"
constraints {
implementation("androidx.core:core") {
version {
require '1.0.0'
}
}
implementation("androidx.annotation:annotation") {
version {
require '1.1.0'
}
}
implementation("com.google.android.gms:play-services-base") {
version {
require '18.0.1'
}
}
implementation("com.huawei.hms:safetydetect") {
version {
require '4.0.3.300'
}
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.touchin.client_services">
</manifest>

View File

@ -0,0 +1,5 @@
package ru.touchin.client_services
enum class MobileService {
HUAWEI_SERVICE, GOOGLE_SERVICE
}

View File

@ -1,11 +1,10 @@
package ru.touchin.recaptcha
package ru.touchin.client_services
import android.content.Context
import com.google.android.gms.common.ConnectionResult
import com.google.android.gms.common.GoogleApiAvailability
import com.huawei.hms.api.HuaweiApiAvailability
//TODO: in the future move to a module with services
class ServicesUtils {
fun getCurrentService(context: Context): MobileService = when {
@ -23,7 +22,3 @@ class ServicesUtils {
.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS
}
enum class MobileService {
HUAWEI_SERVICE, GOOGLE_SERVICE
}

View File

@ -2,7 +2,8 @@ apply from: "../android-configs/lib-config.gradle"
apply plugin: 'com.huawei.agconnect'
dependencies {
implementation project(':kotlin-extensions')
implementation project(':client-services')
implementation "androidx.core:core"
implementation "androidx.annotation:annotation"
implementation "com.google.android.gms:play-services-safetynet"

View File

@ -1,6 +1,8 @@
package ru.touchin.recaptcha
import android.app.Activity
import ru.touchin.client_services.MobileService
import ru.touchin.client_services.ServicesUtils
/**
* onNewTokenReceived - callback на успешную проверку каптчи