Skip to content

Commit

Permalink
Identity api module (#275)
Browse files Browse the repository at this point in the history
* Add identity-api module

* Allow only api dependencies

* Add missing bindings
  • Loading branch information
jraska authored Aug 26, 2020
1 parent b64db15 commit 9732ef2
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 10 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ dependencies {
implementation project(':navigation')
implementation project(':lib:navigation-deeplink')
implementation project(':lib:identity')
implementation project(':lib:identity-api')
implementation project(':lib:network-status')
implementation project(':feature:push')
implementation project(':feature:users')
Expand Down Expand Up @@ -140,9 +141,8 @@ dependencies {
apply plugin: 'com.jraska.module.graph.assertion'

moduleGraphAssert {
maxHeight = 3
moduleLayers = [":feature\\S*", ":lib\\S*", ":core\\S*"]
moduleLayersExclude = [":core -> :core-\\S*"]
maxHeight = 2
moduleLayers = [":feature\\S*", "\\S*-api"]
restricted = [":feature:\\S* -X> :not-wanted-module"]
}

Expand Down
2 changes: 1 addition & 1 deletion feature/about/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies {
implementation project(':core-api')
implementation project(':core-android-api')
implementation project(':navigation')
implementation project(':lib:identity')
implementation project(':lib:identity-api')

kapt rootProject.ext.daggerAnnotationProcessor
implementation rootProject.ext.dagger
Expand Down
2 changes: 1 addition & 1 deletion feature/push/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
dependencies {
implementation project(':core-api')
implementation project(':core-android-api')
implementation project(':lib:identity')
implementation project(':lib:identity-api')

api 'com.google.firebase:firebase-messaging:20.1.2'
api 'com.google.firebase:firebase-database:19.2.1'
Expand Down
5 changes: 5 additions & 0 deletions lib/identity-api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'

dependencies {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.jraska.github.client.identity

interface IdentityProvider {
fun session(): Session
}
1 change: 1 addition & 0 deletions lib/identity/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apply plugin: 'kotlin-kapt'

dependencies {
implementation project(':core-api')
implementation project(':lib:identity-api')

kapt rootProject.ext.daggerAnnotationProcessor
implementation rootProject.ext.dagger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ object IdentityModule {

@Provides
@Singleton
internal fun identityProvider(anonymousIdentity: AnonymousIdentity): IdentityProvider {
return IdentityProvider(anonymousIdentity)
internal fun identityProviderImpl(anonymousIdentity: AnonymousIdentity): IdentityProviderImpl {
return IdentityProviderImpl(anonymousIdentity)
}

@Provides
internal fun identityProvider(implementation: IdentityProviderImpl): IdentityProvider = implementation
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.jraska.github.client.identity

import com.jraska.github.client.identity.internal.AnonymousIdentity

class IdentityProvider internal constructor(
class IdentityProviderImpl internal constructor(
private val anonymousIdentity: AnonymousIdentity
) {
) : IdentityProvider {

fun session(): Session {
override fun session(): Session {
return everythingAnonymousNow()
}

Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include ':app',
':navigation',

':lib:identity',
':lib:identity-api',
':lib:network-status',
':lib:navigation-deeplink',

Expand Down

0 comments on commit 9732ef2

Please sign in to comment.