-
-
Notifications
You must be signed in to change notification settings - Fork 671
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ARCHITECTURE] Let's do some quality (#15)
* extract dependencies * Update test command and add lint * Move Retrofit into data module and test authentication service * Implement authorization repository * Implementation authentication usecase * Implementation presenter layer * Remove old session stuff * Java time backport * Dependency with dagger
- Loading branch information
1 parent
4789d72
commit 3219504
Showing
73 changed files
with
1,835 additions
and
342 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
19 changes: 16 additions & 3 deletions
19
app/src/main/java/io/homeassistant/companion/android/HomeAssistantApplication.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 |
---|---|---|
@@ -1,14 +1,27 @@ | ||
package io.homeassistant.companion.android | ||
|
||
import android.app.Application | ||
import io.homeassistant.companion.android.api.Session | ||
import com.jakewharton.threetenabp.AndroidThreeTen | ||
import io.homeassistant.companion.android.common.dagger.AppComponent | ||
import io.homeassistant.companion.android.common.dagger.Graph | ||
import io.homeassistant.companion.android.common.dagger.GraphComponentAccessor | ||
|
||
class HomeAssistantApplication : Application() { | ||
class HomeAssistantApplication : Application(), GraphComponentAccessor { | ||
|
||
lateinit var graph: Graph | ||
|
||
override fun onCreate() { | ||
super.onCreate() | ||
|
||
Session.init(this) | ||
AndroidThreeTen.init(this) | ||
graph = Graph(this) | ||
} | ||
|
||
override val appComponent: AppComponent | ||
get() = graph.appComponent | ||
|
||
override fun urlUpdated() { | ||
graph.urlUpdated() | ||
} | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
app/src/main/java/io/homeassistant/companion/android/PresenterComponent.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,21 @@ | ||
package io.homeassistant.companion.android | ||
|
||
import dagger.Component | ||
import io.homeassistant.companion.android.common.dagger.AppComponent | ||
import io.homeassistant.companion.android.launch.LaunchActivity | ||
import io.homeassistant.companion.android.onboarding.authentication.AuthenticationFragment | ||
import io.homeassistant.companion.android.onboarding.manual.ManualSetupFragment | ||
import io.homeassistant.companion.android.webview.WebViewActivity | ||
|
||
@Component(dependencies = [AppComponent::class], modules = [PresenterModule::class]) | ||
interface PresenterComponent { | ||
|
||
fun inject(activity: LaunchActivity) | ||
|
||
fun inject(fragment: AuthenticationFragment) | ||
|
||
fun inject(fragment: ManualSetupFragment) | ||
|
||
fun inject(activity: WebViewActivity) | ||
|
||
} |
72 changes: 72 additions & 0 deletions
72
app/src/main/java/io/homeassistant/companion/android/PresenterModule.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,72 @@ | ||
package io.homeassistant.companion.android | ||
|
||
import dagger.Binds | ||
import dagger.Module | ||
import dagger.Provides | ||
import io.homeassistant.companion.android.launch.LaunchPresenter | ||
import io.homeassistant.companion.android.launch.LaunchPresenterImpl | ||
import io.homeassistant.companion.android.launch.LaunchView | ||
import io.homeassistant.companion.android.onboarding.authentication.AuthenticationPresenter | ||
import io.homeassistant.companion.android.onboarding.authentication.AuthenticationPresenterImpl | ||
import io.homeassistant.companion.android.onboarding.authentication.AuthenticationView | ||
import io.homeassistant.companion.android.onboarding.manual.ManualSetupPresenter | ||
import io.homeassistant.companion.android.onboarding.manual.ManualSetupPresenterImpl | ||
import io.homeassistant.companion.android.onboarding.manual.ManualSetupView | ||
import io.homeassistant.companion.android.webview.WebView | ||
import io.homeassistant.companion.android.webview.WebViewPresenter | ||
import io.homeassistant.companion.android.webview.WebViewPresenterImpl | ||
|
||
@Module(includes = [PresenterModule.Declaration::class]) | ||
class PresenterModule { | ||
|
||
private lateinit var launchView: LaunchView | ||
private lateinit var authenticationView: AuthenticationView | ||
private lateinit var manualSetupView: ManualSetupView | ||
private lateinit var webView: WebView | ||
|
||
constructor(launchView: LaunchView) { | ||
this.launchView = launchView | ||
} | ||
|
||
constructor(authenticationView: AuthenticationView) { | ||
this.authenticationView = authenticationView | ||
} | ||
|
||
constructor(manualSetupView: ManualSetupView) { | ||
this.manualSetupView = manualSetupView | ||
} | ||
|
||
constructor(webView: WebView) { | ||
this.webView = webView | ||
} | ||
|
||
@Provides | ||
fun provideLaunchView() = launchView | ||
|
||
@Provides | ||
fun provideAuthenticationView() = authenticationView | ||
|
||
@Provides | ||
fun provideManualSetupView() = manualSetupView | ||
|
||
@Provides | ||
fun provideWebView() = webView | ||
|
||
@Module | ||
interface Declaration { | ||
|
||
@Binds | ||
fun bindLaunchPresenter(presenter: LaunchPresenterImpl): LaunchPresenter | ||
|
||
@Binds | ||
fun bindAuthenticationPresenterImpl(presenter: AuthenticationPresenterImpl): AuthenticationPresenter | ||
|
||
@Binds | ||
fun bindManualSetupPresenter(presenter: ManualSetupPresenterImpl): ManualSetupPresenter | ||
|
||
@Binds | ||
fun bindWebViewPresenterImpl(presenter: WebViewPresenterImpl): WebViewPresenter | ||
|
||
|
||
} | ||
} |
26 changes: 0 additions & 26 deletions
26
app/src/main/java/io/homeassistant/companion/android/api/HomeAssistantApi.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
app/src/main/java/io/homeassistant/companion/android/api/RefreshToken.kt
This file was deleted.
Oops, something went wrong.
86 changes: 0 additions & 86 deletions
86
app/src/main/java/io/homeassistant/companion/android/api/Session.kt
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
app/src/main/java/io/homeassistant/companion/android/api/Token.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.