Skip to content

Commit

Permalink
init OMH: auth client provider
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuSanal committed Jul 3, 2024
1 parent 91a643a commit fef01d0
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.amaze.filemanager.utils.omh

import android.content.Context
import com.amaze.filemanager.BuildConfig
import com.openmobilehub.android.auth.core.OmhAuthClient
import com.openmobilehub.android.auth.core.OmhAuthProvider

class OMHClientHelper {

companion object {

@Volatile
var instance: OmhAuthClient? = null

@JvmStatic
public fun getGoogleAuthClient(context: Context): OmhAuthClient {
if (instance == null) {
synchronized(this) {
val omhAuthProvider = OmhAuthProvider.Builder()
.addNonGmsPath(
"com.openmobilehub.android.auth.plugin.google.nongms.presentation.OmhAuthFactoryImpl"
)
.addGmsPath(
"com.openmobilehub.android.auth.plugin.google.gms.OmhAuthFactoryImpl"
)
.build()

instance = omhAuthProvider
.provideAuthClient(
scopes = listOf("openid", "email", "profile"),
clientId = BuildConfig.GOOGLE_CLIENT_ID,
context = context
)

instance!!.initialize()
}
}

return instance!!
}
}
}

0 comments on commit fef01d0

Please sign in to comment.