diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostChromeClients.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostChromeClients.kt index ae659eaf5..b881874a1 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostChromeClients.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostChromeClients.kt @@ -21,9 +21,9 @@ import android.webkit.ConsoleMessage import android.webkit.WebChromeClient import android.webkit.WebView import com.google.common.flogger.FluentLogger -import com.pitchedapps.frost.web.FrostWebStore -import com.pitchedapps.frost.web.UpdateProgressAction -import com.pitchedapps.frost.web.UpdateTitleAction +import com.pitchedapps.frost.web.state.FrostWebStore +import com.pitchedapps.frost.web.state.UpdateProgressAction +import com.pitchedapps.frost.web.state.UpdateTitleAction import javax.inject.Inject /** The default chrome client */ diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebCompose.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebCompose.kt index f77c0caa1..95fc0cbd0 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebCompose.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebCompose.kt @@ -30,9 +30,9 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.viewinterop.AndroidView import androidx.core.view.children -import com.pitchedapps.frost.web.FrostWebState -import com.pitchedapps.frost.web.FrostWebStore -import com.pitchedapps.frost.web.ResponseAction +import com.pitchedapps.frost.web.state.FrostWebState +import com.pitchedapps.frost.web.state.FrostWebStore +import com.pitchedapps.frost.web.state.ResponseAction import com.pitchedapps.frost.webview.FrostWebScoped import javax.inject.Inject import kotlinx.coroutines.flow.Flow diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebViewClients.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebViewClients.kt index 92006d3a3..71d5bbd9f 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebViewClients.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/compose/webview/FrostWebViewClients.kt @@ -26,10 +26,10 @@ import com.pitchedapps.frost.facebook.FACEBOOK_BASE_COM import com.pitchedapps.frost.facebook.WWW_FACEBOOK_COM import com.pitchedapps.frost.facebook.isExplicitIntent import com.pitchedapps.frost.web.FrostWebHelper -import com.pitchedapps.frost.web.FrostWebStore -import com.pitchedapps.frost.web.UpdateNavigationAction -import com.pitchedapps.frost.web.UpdateProgressAction -import com.pitchedapps.frost.web.UpdateTitleAction +import com.pitchedapps.frost.web.state.FrostWebStore +import com.pitchedapps.frost.web.state.UpdateNavigationAction +import com.pitchedapps.frost.web.state.UpdateProgressAction +import com.pitchedapps.frost.web.state.UpdateTitleAction import java.io.ByteArrayInputStream import javax.inject.Inject diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostMiddleware.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostMiddleware.kt similarity index 84% rename from app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostMiddleware.kt rename to app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostMiddleware.kt index 372a84fdd..80c07a021 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostMiddleware.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostMiddleware.kt @@ -14,17 +14,17 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.pitchedapps.frost.web +package com.pitchedapps.frost.web.state import com.google.common.flogger.FluentLogger import mozilla.components.lib.state.Middleware import mozilla.components.lib.state.MiddlewareContext -class FrostLoggerMiddleware(private val tag: String) : Middleware { +class FrostLoggerMiddleware(private val tag: String) : Middleware { override fun invoke( - context: MiddlewareContext, - next: (FrostAction) -> Unit, - action: FrostAction + context: MiddlewareContext, + next: (FrostWebAction) -> Unit, + action: FrostWebAction ) { logger.atInfo().log("FrostWebAction-%s: %s - %s", tag, action::class.simpleName, action) next(action) diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebAction.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebAction.kt similarity index 67% rename from app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebAction.kt rename to app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebAction.kt index eae78d6d4..1d828f8ae 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebAction.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebAction.kt @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.pitchedapps.frost.web +package com.pitchedapps.frost.web.state import mozilla.components.lib.state.Action @@ -24,27 +24,29 @@ import mozilla.components.lib.state.Action * * For firefox example */ -sealed interface FrostAction : Action +sealed interface FrostWebAction : Action /** - * [FrostAction] dispatched to indicate that the store is initialized and ready to use. This action - * is dispatched automatically before any other action is processed. Its main purpose is to trigger - * initialization logic in middlewares. The action itself has no effect on the [FrostWebState]. + * [FrostWebAction] dispatched to indicate that the store is initialized and ready to use. This + * action is dispatched automatically before any other action is processed. Its main purpose is to + * trigger initialization logic in middlewares. The action itself has no effect on the + * [FrostWebState]. */ -object InitAction : FrostAction +object InitAction : FrostWebAction /** Action indicating current url state. */ -data class UpdateUrlAction(val url: String) : FrostAction +data class UpdateUrlAction(val url: String) : FrostWebAction /** Action indicating current title state. */ -data class UpdateTitleAction(val title: String?) : FrostAction +data class UpdateTitleAction(val title: String?) : FrostWebAction -data class UpdateNavigationAction(val canGoBack: Boolean, val canGoForward: Boolean) : FrostAction +data class UpdateNavigationAction(val canGoBack: Boolean, val canGoForward: Boolean) : + FrostWebAction -data class UpdateProgressAction(val progress: Int) : FrostAction +data class UpdateProgressAction(val progress: Int) : FrostWebAction /** Action triggered by user, leading to transient state changes. */ -sealed interface UserAction : FrostAction { +sealed interface UserAction : FrostWebAction { /** Action to load new url. */ data class LoadUrlAction(val url: String) : UserAction @@ -55,7 +57,7 @@ sealed interface UserAction : FrostAction { } /** Response triggered by webview, indicating [UserAction] fulfillment. */ -sealed interface ResponseAction : FrostAction { +sealed interface ResponseAction : FrostWebAction { data class LoadUrlResponseAction(val url: String) : ResponseAction diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebReducer.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebReducer.kt similarity index 95% rename from app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebReducer.kt rename to app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebReducer.kt index 3944a0f20..2ab8789e3 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebReducer.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebReducer.kt @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.pitchedapps.frost.web +package com.pitchedapps.frost.web.state /** * See @@ -23,7 +23,7 @@ package com.pitchedapps.frost.web * For firefox example */ internal object FrostWebReducer { - fun reduce(state: FrostWebState, action: FrostAction): FrostWebState { + fun reduce(state: FrostWebState, action: FrostWebAction): FrostWebState { return when (action) { is InitAction -> state is UpdateUrlAction -> state.copy(url = action.url) diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebState.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebState.kt similarity index 97% rename from app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebState.kt rename to app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebState.kt index 479370ae9..329b6ec9f 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebState.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebState.kt @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.pitchedapps.frost.web +package com.pitchedapps.frost.web.state import mozilla.components.lib.state.State diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebStore.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebStore.kt similarity index 89% rename from app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebStore.kt rename to app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebStore.kt index 87129a862..35a4c73b0 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/web/FrostWebStore.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/web/state/FrostWebStore.kt @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package com.pitchedapps.frost.web +package com.pitchedapps.frost.web.state import com.pitchedapps.frost.facebook.FB_URL_BASE import mozilla.components.lib.state.Middleware @@ -29,9 +29,9 @@ import mozilla.components.lib.state.Store class FrostWebStore( tag: String, initialState: FrostWebState = FrostWebState(), - middleware: List> = emptyList(), + middleware: List> = emptyList(), ) : - Store( + Store( initialState, FrostWebReducer::reduce, middleware, diff --git a/app-compose/src/main/kotlin/com/pitchedapps/frost/webview/FrostWeb.kt b/app-compose/src/main/kotlin/com/pitchedapps/frost/webview/FrostWeb.kt index 1ed54297d..ddb88a6a6 100644 --- a/app-compose/src/main/kotlin/com/pitchedapps/frost/webview/FrostWeb.kt +++ b/app-compose/src/main/kotlin/com/pitchedapps/frost/webview/FrostWeb.kt @@ -17,8 +17,8 @@ package com.pitchedapps.frost.webview import com.pitchedapps.frost.compose.webview.FrostWebCompose -import com.pitchedapps.frost.web.FrostLoggerMiddleware -import com.pitchedapps.frost.web.FrostWebStore +import com.pitchedapps.frost.web.state.FrostLoggerMiddleware +import com.pitchedapps.frost.web.state.FrostWebStore import dagger.BindsInstance import dagger.Module import dagger.Provides