AuthProvider: Inject it via hilt where needed
- Merge validation function in it as well instead of using it as an extension - Use dedicated preference to check if we are anonymous or not instead of authData Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
package com.aurora.extensions
|
||||
|
||||
import android.content.Context
|
||||
import com.aurora.gplayapi.data.models.AuthData
|
||||
import com.aurora.gplayapi.helpers.AuthValidator
|
||||
import com.aurora.store.data.network.HttpClient
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
suspend fun AuthData.isValid(context: Context): Boolean {
|
||||
return withContext(Dispatchers.IO) {
|
||||
try {
|
||||
AuthValidator(this@isValid)
|
||||
.using(HttpClient.getPreferredClient(context))
|
||||
.isValid()
|
||||
} catch (e: Exception) {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user