-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement shared local logging (#682)
Co-authored-by: Ivan Magda <ivan.magda@hyperskill.org>
- Loading branch information
1 parent
c46f66b
commit 59fe8f4
Showing
56 changed files
with
487 additions
and
86 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
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
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
10 changes: 8 additions & 2 deletions
10
shared/src/commonMain/kotlin/org/hyperskill/app/auth/injection/AuthSocialComponent.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,10 +1,16 @@ | ||
package org.hyperskill.app.auth.injection | ||
|
||
import org.hyperskill.app.auth.presentation.AuthSocialFeature | ||
import org.hyperskill.app.auth.view.mapper.AuthSocialErrorMapper | ||
import ru.nobird.app.presentation.redux.feature.Feature | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature.Action as AuthSocialAction | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature.Message as AuthSocialMessage | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature.State as AuthSocialState | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.Action as AuthSocialWebViewAction | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.Message as AuthSocialWebViewMessage | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.State as AuthSocialWebViewState | ||
|
||
interface AuthSocialComponent { | ||
val authSocialFeature: Feature<AuthSocialFeature.State, AuthSocialFeature.Message, AuthSocialFeature.Action> | ||
val authSocialFeature: Feature<AuthSocialState, AuthSocialMessage, AuthSocialAction> | ||
val authSocialErrorMapper: AuthSocialErrorMapper | ||
val authSocialWebViewFeature: Feature<AuthSocialWebViewState, AuthSocialWebViewMessage, AuthSocialWebViewAction> | ||
} |
24 changes: 19 additions & 5 deletions
24
shared/src/commonMain/kotlin/org/hyperskill/app/auth/injection/AuthSocialComponentImpl.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,29 +1,43 @@ | ||
package org.hyperskill.app.auth.injection | ||
|
||
import org.hyperskill.app.analytic.injection.AnalyticComponent | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature.Action | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature.Message | ||
import org.hyperskill.app.auth.presentation.AuthSocialFeature.State | ||
import org.hyperskill.app.auth.view.mapper.AuthSocialErrorMapper | ||
import org.hyperskill.app.core.injection.CommonComponent | ||
import org.hyperskill.app.logging.inject.LoggerComponent | ||
import org.hyperskill.app.profile.injection.ProfileDataComponent | ||
import org.hyperskill.app.sentry.injection.SentryComponent | ||
import ru.nobird.app.presentation.redux.feature.Feature | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.Action as WebViewAction | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.Message as WebViewMessage | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.State as WebViewState | ||
|
||
class AuthSocialComponentImpl( | ||
private val commonComponent: CommonComponent, | ||
private val authComponent: AuthComponent, | ||
private val profileDataComponent: ProfileDataComponent, | ||
private val analyticComponent: AnalyticComponent, | ||
private var sentryComponent: SentryComponent | ||
private val sentryComponent: SentryComponent, | ||
private val loggerComponent: LoggerComponent | ||
) : AuthSocialComponent { | ||
override val authSocialFeature: Feature< | ||
AuthSocialFeature.State, AuthSocialFeature.Message, AuthSocialFeature.Action> | ||
override val authSocialFeature: Feature<State, Message, Action> | ||
get() = AuthSocialFeatureBuilder.build( | ||
authComponent.authInteractor, | ||
profileDataComponent.currentProfileStateRepository, | ||
analyticComponent.analyticInteractor, | ||
sentryComponent.sentryInteractor | ||
sentryComponent.sentryInteractor, | ||
loggerComponent.logger, | ||
commonComponent.buildKonfig.buildVariant | ||
) | ||
|
||
override val authSocialErrorMapper: AuthSocialErrorMapper | ||
get() = AuthSocialErrorMapper(commonComponent.resourceProvider) | ||
|
||
override val authSocialWebViewFeature: Feature<WebViewState, WebViewMessage, WebViewAction> | ||
get() = AuthSocialWebViewFeatureBuilder.build( | ||
logger = loggerComponent.logger, | ||
buildVariant = commonComponent.buildKonfig.buildVariant | ||
) | ||
} |
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
16 changes: 13 additions & 3 deletions
16
...rc/commonMain/kotlin/org/hyperskill/app/auth/injection/AuthSocialWebViewFeatureBuilder.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,21 +1,31 @@ | ||
package org.hyperskill.app.auth.injection | ||
|
||
import co.touchlab.kermit.Logger | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewActionDispatcher | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.Action | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.Message | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewFeature.State | ||
import org.hyperskill.app.auth.presentation.AuthSocialWebViewReducer | ||
import org.hyperskill.app.core.domain.BuildVariant | ||
import org.hyperskill.app.core.presentation.ActionDispatcherOptions | ||
import org.hyperskill.app.logging.presentation.wrapWithLogger | ||
import ru.nobird.app.presentation.redux.dispatcher.wrapWithActionDispatcher | ||
import ru.nobird.app.presentation.redux.feature.Feature | ||
import ru.nobird.app.presentation.redux.feature.ReduxFeature | ||
|
||
object AuthSocialWebViewFeatureBuilder { | ||
fun build(): Feature<State, Message, Action> { | ||
private const val LOG_TAG = "AuthSocialWebViewFeature" | ||
|
||
fun build( | ||
logger: Logger, | ||
buildVariant: BuildVariant | ||
): Feature<State, Message, Action> { | ||
val authReducer = AuthSocialWebViewReducer() | ||
val authActionDispatcher = AuthSocialWebViewActionDispatcher(ActionDispatcherOptions()) | ||
|
||
return ReduxFeature(State.Idle, authReducer) | ||
.wrapWithActionDispatcher(authActionDispatcher) | ||
return ReduxFeature( | ||
State.Idle, | ||
authReducer.wrapWithLogger(buildVariant, logger, LOG_TAG) | ||
).wrapWithActionDispatcher(authActionDispatcher) | ||
} | ||
} |
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
Oops, something went wrong.