Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update OAuth logic for some library restructuring #22

Open
wants to merge 2 commits into
base: test
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,23 @@ package org.wycliffe.mypd.app.dagger

import dagger.Module
import dagger.Provides
import dagger.Reusable
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import org.ccci.gto.android.common.dagger.eager.EagerModule
import org.mpdx.android.library.oauth.listener.OAuthAppListener
import org.mpdx.android.library.oauth.OAuthConfig
import org.wycliffe.mypd.BuildConfig

@InstallIn(SingletonComponent::class)
@Module(includes = [EagerModule::class])
class AuthorizationAppModule {

@Provides
fun providesOAuthAppConstant(): OAuthAppListener {
return object : OAuthAppListener {
override fun authProvider() = BuildConfig.AUTH_PROVIDER

override fun authorizationEndPoint() = BuildConfig.AUTH_END_POINT

override fun clientId() = BuildConfig.CLIENT_ID

override fun redirectUri() = BuildConfig.REDIRECT_URI

override fun tokenEndPoint() = BuildConfig.TOKEN_END_POINT
}
}
@Reusable
fun oauthConfig() = OAuthConfig(
authorizationEndPoint = BuildConfig.AUTH_END_POINT,
tokenEndPoint = BuildConfig.TOKEN_END_POINT,
clientId = BuildConfig.CLIENT_ID,
redirectUri = BuildConfig.REDIRECT_URI,
authProvider = BuildConfig.AUTH_PROVIDER,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import org.greenrobot.eventbus.Subscribe
import org.mpdx.android.core.UserDeviceApi
import org.mpdx.android.core.model.UserDevice
import org.mpdx.android.core.services.ConnectivityService
import org.mpdx.android.library.auth.AuthenticationListener
import org.mpdx.android.library.core.AppConstantListener
import org.mpdx.android.library.core.AuthenticationListener
import timber.log.Timber
import java.io.IOException
import javax.inject.Inject
Expand Down Expand Up @@ -40,7 +40,7 @@ class FirebaseMessagingManager @Inject constructor(
}

private fun registerDevice() = launch {
if (authenticationListener.getSessionGuid() == null) return@launch
if (!authenticationListener.isAuthenticated()) return@launch

try {
FirebaseInstanceId.getInstance().instanceId.await()
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ allprojects {

configurations.all {
resolutionStrategy {
// HACK: force the correct version of lifecycle-viewmodel-ktx to address a transitive version conflict
force "androidx.lifecycle:lifecycle-viewmodel-ktx:${libs.versions.androidx.lifecycle.get()}"
force libs.okhttp3

// HACK: force an older version of Realm than what is referenced in gto-support
Expand Down
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ kotlin = "1.9.20"
kotlinCoroutines = "1.7.3"
kotlinKover = "0.7.5"
ktlint = "0.50.0"
mpdxLib = "3.0.5-SNAPSHOT"
mpdxLib = "3.1.0-SNAPSHOT"
moshi = "1.15.0"
okhttp3 = "4.12.0"
realm = "10.17.0"
Expand Down Expand Up @@ -105,8 +105,8 @@ leakcanary = "com.squareup.leakcanary:leakcanary-android:2.12"
materialComponents = "com.google.android.material:material:1.10.0"
mpdx-lib-lib = { module = "org.cru.mpdx.android:library", version.ref = "mpdxLib"}
mpdx-lib-core = { module ="org.cru.mpdx.android:core", version.ref = "mpdxLib"}
mpdx-lib-okta = { module ="org.cru.mpdx.android:okta", version.ref = "mpdxLib"}
mpdx-lib-oauth = { module ="org.cru.mpdx.android:oauth", version.ref = "mpdxLib"}
mpdx-lib-okta = { module ="org.cru.mpdx.android:auth-okta", version.ref = "mpdxLib"}
mpdx-lib-oauth = { module ="org.cru.mpdx.android:auth-oauth", version.ref = "mpdxLib"}
mockito = "org.mockito:mockito-inline:5.2.0"
mockito-kotlin = "org.mockito.kotlin:mockito-kotlin:5.2.1"
mockk = "io.mockk:mockk:1.13.8"
Expand Down
Loading