Activity.getComponentProvider(): P { 11 | return (this as HasComponent
).component
12 | }
13 |
--------------------------------------------------------------------------------
/includedBuild/dependencies/src/main/java/net/yslibrary/monotweety/dependencies/DependenciesPlugin.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.dependencies
2 |
3 | import org.gradle.api.Plugin
4 | import org.gradle.api.Project
5 |
6 | class DependenciesPlugin : Plugin lazyWithParam(function: (P) -> T): Lazy>
10 |
11 | fun appInfo(packageName: String): Single
>
9 | get() = getLicenses.execute()
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/net/yslibrary/monotweety/logout/LogoutComponent.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.logout
2 |
3 | import dagger.Component
4 | import net.yslibrary.monotweety.UserComponent
5 | import net.yslibrary.monotweety.base.di.ServiceScope
6 |
7 | @ServiceScope
8 | @Component(
9 | dependencies = [UserComponent::class]
10 | )
11 | interface LogoutComponent {
12 | fun inject(service: LogoutService)
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/net/yslibrary/monotweety/appdata/user/local/resolver/UserSQLiteTypeMapping.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.appdata.user.local.resolver
2 |
3 | import com.pushtorefresh.storio3.sqlite.SQLiteTypeMapping
4 | import net.yslibrary.monotweety.appdata.user.User
5 |
6 | class UserSQLiteTypeMapping : SQLiteTypeMapping
> {
12 | return licenseRepository.get()
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/net/yslibrary/monotweety/status/ComposeStatusComponent.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.status
2 |
3 | import dagger.Subcomponent
4 | import net.yslibrary.monotweety.base.di.ControllerScope
5 |
6 | @ControllerScope
7 | @Subcomponent(
8 | modules = [ComposeStatusViewModule::class]
9 | )
10 | interface ComposeStatusComponent {
11 |
12 | fun inject(controller: ComposeStatusController)
13 |
14 | interface ComponentProvider {
15 | fun composeStatusComponent(module: ComposeStatusViewModule): ComposeStatusComponent
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app2/src/main/java/net/yslibrary/monotweety/ui/footereditor/FooterEditorFragmentComponent.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.ui.footereditor
2 |
3 | import dagger.Subcomponent
4 |
5 | @Subcomponent
6 | interface FooterEditorFragmentComponent {
7 | fun inject(fragment: FooterEditorFragment)
8 |
9 | @Subcomponent.Factory
10 | interface Factory {
11 | fun build(): FooterEditorFragmentComponent
12 | }
13 |
14 | interface ComponentProvider {
15 | fun footerEditorFragmentComponent(): FooterEditorFragmentComponent.Factory
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/app/src/main/java/net/yslibrary/monotweety/login/domain/IsLoggedIn.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.login.domain
2 |
3 | import io.reactivex.Single
4 | import net.yslibrary.monotweety.appdata.session.SessionRepository
5 | import javax.inject.Inject
6 | import javax.inject.Singleton
7 |
8 | @Singleton
9 | class IsLoggedIn @Inject constructor(private val sessionRepository: SessionRepository) {
10 |
11 | fun execute(): Single
> {
17 | return appInfoManager.installedApps()
18 | .flatMapObservable { Observable.fromIterable(it) }
19 | .filter { twitterApps.contains(it.packageName) }
20 | .toList()
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/data/src/main/java/net/yslibrary/monotweety/data/UserScopeDataModule.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.data
2 |
3 | import com.codingfeline.twitter4kt.core.Twitter
4 | import com.codingfeline.twitter4kt.core.model.oauth1a.AccessToken
5 | import com.codingfeline.twitter4kt.core.session.ApiClient
6 | import com.codingfeline.twitter4kt.core.startSession
7 | import dagger.Module
8 | import dagger.Provides
9 | import net.yslibrary.monotweety.data.status.StatusDataModule
10 | import net.yslibrary.monotweety.data.user.UserDataModule
11 | import net.yslibrary.monotweety.di.UserScope
12 |
13 | @Module(
14 | includes = [
15 | StatusDataModule::class,
16 | UserDataModule::class,
17 | ]
18 | )
19 | object UserScopeDataModule {
20 |
21 | @UserScope
22 | @Provides
23 | fun provideApiClient(twitter: Twitter, token: AccessToken): ApiClient {
24 | return twitter.startSession(token)
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/data/src/main/java/net/yslibrary/monotweety/data/user/remote/UserRemoteGateway.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.data.user.remote
2 |
3 | import com.codingfeline.twitter4kt.core.ApiResult
4 | import com.codingfeline.twitter4kt.v1.api.account.AccountApi
5 | import com.codingfeline.twitter4kt.v1.api.account.verifyCredentials
6 | import com.codingfeline.twitter4kt.v1.model.account.Account
7 | import javax.inject.Inject
8 |
9 | interface UserRemoteGateway {
10 | suspend fun verifyCredentials(): ApiResult
> VM.consumeStates(
21 | scope: LifecycleCoroutineScope,
22 | crossinline stateHandler: (state: S) -> Unit,
23 | ) {
24 | scope.launchWhenStarted {
25 | states.onEach { stateHandler(it) }
26 | .collect()
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/net/yslibrary/monotweety/base/RxExtensions.kt:
--------------------------------------------------------------------------------
1 | package net.yslibrary.monotweety.base
2 |
3 | import io.reactivex.Observable
4 | import io.reactivex.Single
5 | import io.reactivex.disposables.Disposable
6 | import io.reactivex.disposables.SerialDisposable
7 | import io.reactivex.functions.Consumer
8 |
9 | class SkipUntilCompletedConsumer