-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a "gravatar-noop" module and inject it in wear/automotive builds
Injecting the "gravatar-noop" we prevent the Gravatar SDK from landing in those builds.
- Loading branch information
Showing
8 changed files
with
92 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
plugins { | ||
alias(libs.plugins.android.library) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.ksp) | ||
alias(libs.plugins.hilt) | ||
} | ||
|
||
android { | ||
namespace = "au.com.shiftyjelly.pocketcasts.gravatar" | ||
buildFeatures { | ||
buildConfig = true | ||
viewBinding = false | ||
compose = false | ||
} | ||
} | ||
|
||
dependencies { | ||
ksp(libs.dagger.hilt.compiler) | ||
ksp(libs.hilt.compiler) | ||
|
||
api(libs.dagger.hilt.android) | ||
|
||
implementation(projects.modules.services.utils) | ||
} |
18 changes: 18 additions & 0 deletions
18
...s/services/gravatar-noop/src/main/kotlin/au/com/shiftyjelly/pocketcasts/GravatarModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package au.com.shiftyjelly.pocketcasts | ||
|
||
import androidx.fragment.app.Fragment | ||
import au.com.shiftyjelly.pocketcasts.utils.gravatar.GravatarService | ||
import dagger.Module | ||
import dagger.Provides | ||
import dagger.hilt.InstallIn | ||
import dagger.hilt.android.components.FragmentComponent | ||
|
||
@Module | ||
@InstallIn(FragmentComponent::class) | ||
object GravatarModule { | ||
@Provides | ||
fun provideGravatarService( | ||
fragment: Fragment, | ||
onAvatarSelected: () -> Unit, | ||
): GravatarService = NoOpGravatarSdkService(fragment, onAvatarSelected) | ||
} |
28 changes: 28 additions & 0 deletions
28
...es/gravatar-noop/src/main/kotlin/au/com/shiftyjelly/pocketcasts/NoOpGravatarSdkService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package au.com.shiftyjelly.pocketcasts | ||
|
||
import androidx.fragment.app.Fragment | ||
import au.com.shiftyjelly.pocketcasts.utils.gravatar.GravatarService | ||
import dagger.assisted.Assisted | ||
import dagger.assisted.AssistedFactory | ||
import dagger.assisted.AssistedInject | ||
|
||
class NoOpGravatarSdkService @AssistedInject constructor(@Assisted fragment: Fragment?, @Assisted onAvatarSelected: (() -> Unit)?) : | ||
GravatarService { | ||
|
||
override fun launchExternalQuickEditor(email: String) { | ||
error("Operation not supported") | ||
} | ||
|
||
override fun launchQuickEditor(isLightTheme: Boolean, email: String) { | ||
error("Operation not supported") | ||
} | ||
|
||
override suspend fun logout(email: String) { | ||
error("Operation not supported") | ||
} | ||
|
||
@AssistedFactory | ||
interface Factory : GravatarService.Factory { | ||
override fun create(fragment: Fragment?, onAvatarSelected: (() -> Unit)?): NoOpGravatarSdkService | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters