Skip to content

Commit

Permalink
Removed unnecessary context from factories and providers
Browse files Browse the repository at this point in the history
  • Loading branch information
HectorNarvaez committed May 17, 2023
1 parent c0551aa commit 215ea6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package com.omh.android.storage.api.drive.nongms

import android.content.Context
import com.omh.android.auth.api.OmhAuthClient
import com.omh.android.storage.api.OmhStorageClient
import com.omh.android.storage.api.OmhStorageFactory

class OmhStorageFactoryImpl : OmhStorageFactory {

override fun getStorageClient(
context: Context,
authClient: OmhAuthClient
): OmhStorageClient = OmhStorageClientImpl.Builder().build(context, authClient)
): OmhStorageClient = OmhStorageClientImpl.Builder().build(authClient)
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.omh.android.storage.api

import android.content.Context
import com.omh.android.auth.api.OmhAuthClient

interface OmhStorageFactory {

fun getStorageClient(context: Context, authClient: OmhAuthClient): OmhStorageClient
fun getStorageClient(authClient: OmhAuthClient): OmhStorageClient
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.omh.android.storage.api

import android.content.Context
import com.omh.android.auth.api.OmhAuthClient
import kotlin.reflect.KClass

Expand All @@ -9,9 +8,9 @@ object OmhStorageProvider {
private const val NGMS_ADDRESS = "com.omh.android.storage.api.drive.nongms.OmhStorageFactoryImpl"

@SuppressWarnings("SwallowedException")
fun provideStorageClient(context: Context, authClient: OmhAuthClient): OmhStorageClient {
fun provideStorageClient(authClient: OmhAuthClient): OmhStorageClient {
val clazz: KClass<out Any> = Class.forName(NGMS_ADDRESS).kotlin
val omhStorageFactory = clazz.objectInstance as OmhStorageFactory
return omhStorageFactory.getStorageClient(context, authClient)
return omhStorageFactory.getStorageClient(authClient)
}
}

0 comments on commit 215ea6d

Please sign in to comment.