diff --git a/buildSrc/components.json b/buildSrc/components.json index 3484e9dd3d..a8099b3e9f 100755 --- a/buildSrc/components.json +++ b/buildSrc/components.json @@ -782,10 +782,6 @@ "dir": "lib-core-navigation", "artifact_name": "core-navigation", "third_party_dependencies": [ - { - "name": "com.google.android.play:core", - "type": "implementation" - }, { "name": "androidx.browser:browser", "type": "implementation" diff --git a/buildSrc/config.gradle b/buildSrc/config.gradle index 3507340434..3a909d7ce0 100755 --- a/buildSrc/config.gradle +++ b/buildSrc/config.gradle @@ -77,7 +77,6 @@ ext { "com.google.firebase:firebase-messaging" : "23.0.0", //http://bit.ly/2Q81pGJ "com.google.firebase:firebase-analytics" : "20.0.0", //http://bit.ly/2Q81pGJ "com.google.android.material:material" : "1.4.0", //http://bit.ly/2KAAq1y - "com.google.android.play:core" : "1.10.2", //http://bit.ly/2Hod1T1 "com.github.bumptech.glide:glide" : "4.12.0", //http://bit.ly/2Q7Fa41 "com.squareup.retrofit2:retrofit" : "2.9.0", //https://vk.cc/7UFxk3 "com.squareup.retrofit2:converter-gson" : "2.9.0", //https://vk.cc/7UFxk3 diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigator.java b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigator.java index 3a682d44c7..8aa8132352 100755 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigator.java +++ b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigator.java @@ -25,8 +25,6 @@ import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityOptionsCompat; -import com.agna.ferro.rx.ObservableOperatorFreeze; - import java.io.Serializable; import java.util.HashMap; import java.util.Map; @@ -42,21 +40,14 @@ import ru.surfstudio.android.core.ui.event.lifecycle.pause.OnPauseDelegate; import ru.surfstudio.android.core.ui.event.lifecycle.resume.OnResumeDelegate; import ru.surfstudio.android.core.ui.event.newintent.NewIntentDelegate; -import ru.surfstudio.android.core.ui.navigation.event.result.BaseActivityResultDelegate; -import ru.surfstudio.android.core.ui.navigation.event.result.CrossFeatureSupportOnActivityResultRoute; -import ru.surfstudio.android.core.ui.navigation.event.result.SupportOnActivityResultRoute; import ru.surfstudio.android.core.ui.navigation.ActivityRouteInterface; import ru.surfstudio.android.core.ui.navigation.Navigator; import ru.surfstudio.android.core.ui.navigation.ScreenResult; import ru.surfstudio.android.core.ui.navigation.activity.route.ActivityRoute; import ru.surfstudio.android.core.ui.navigation.activity.route.ActivityWithResultRoute; import ru.surfstudio.android.core.ui.navigation.activity.route.NewIntentRoute; -import ru.surfstudio.android.core.ui.navigation.feature.installer.SplitFeatureEvent; -import ru.surfstudio.android.core.ui.navigation.feature.installer.SplitFeatureInstallState; -import ru.surfstudio.android.core.ui.navigation.feature.installer.SplitFeatureInstallStatus; -import ru.surfstudio.android.core.ui.navigation.feature.installer.SplitFeatureInstaller; -import ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature.DynamicCrossFeatureRoute; -import ru.surfstudio.android.core.ui.navigation.feature.route.feature.ActivityCrossFeatureRoute; +import ru.surfstudio.android.core.ui.navigation.event.result.BaseActivityResultDelegate; +import ru.surfstudio.android.core.ui.navigation.event.result.SupportOnActivityResultRoute; import ru.surfstudio.android.core.ui.provider.ActivityProvider; /** @@ -72,15 +63,9 @@ public abstract class ActivityNavigator extends BaseActivityResultDelegate private Map newIntentSubjects = new HashMap<>(); private final ActivityProvider activityProvider; - private final SplitFeatureInstaller splitFeatureInstaller; private Disposable splitFeatureInstallDisposable = Disposables.disposed(); - private final Boolean isSplitFeatureModeOn; private final BehaviorSubject freezeSelector = BehaviorSubject.createDefault(false); - private interface OnFeatureInstallListener { - void doOnInstall(BehaviorSubject startStatusSubject); - } - /** * Base activity navigator constructor. * @@ -89,28 +74,8 @@ private interface OnFeatureInstallListener { */ public ActivityNavigator(ActivityProvider activityProvider, ScreenEventDelegateManager eventDelegateManager) { - this(activityProvider, eventDelegateManager, null, false); - } - - /** - * Activity navigator with "split-features" support constructor. - * - * @param activityProvider actual Activity provider instance - * @param eventDelegateManager screen event delegate manager instance - * @param splitFeatureInstaller "split-feature" install manager - * @param isSplitFeatureModeOn "split-feature" navigation activation flag. - * Actually, it needs to be {@code true} just for release build which - * has already been deployed to Google Play. Otherwise, cross-feature - * navigation won't work at all. - */ - public ActivityNavigator(ActivityProvider activityProvider, - ScreenEventDelegateManager eventDelegateManager, - SplitFeatureInstaller splitFeatureInstaller, - Boolean isSplitFeatureModeOn) { eventDelegateManager.registerDelegate(this); this.activityProvider = activityProvider; - this.splitFeatureInstaller = splitFeatureInstaller; - this.isSplitFeatureModeOn = isSplitFeatureModeOn; } protected abstract void startActivityForResult(Intent intent, int requestCode, @Nullable Bundle bundle); @@ -230,73 +195,6 @@ public boolean start(ActivityRoute route) { return false; } - /** - * Launch a new activity from another Feature Module. - *

- * Performs asynchronically due to type of the target Feature Module. - * This method returns stream of install state change events. You can make a subscription in - * your Presenter and handle errors or any other type of events during Dynamic Feature - * installation. - * - * @param route navigation route - * @return stream of install state change events - */ - public Observable start(ActivityCrossFeatureRoute route) { - return startCrossFeature(route, startStatusSubject -> performStart(route, startStatusSubject)); - } - - /** - * Launch a new Activity for result from another Feature Module. - *

- * Performs asynchronously due to type of the target Feature Module. - * This method returns stream of install state change events. You can make a subscription in - * your Presenter and handle errors or any other type of events during Dynamic Feature - * installation. - * - * @param route navigation route - * @return stream of install state change events - */ - public Observable startForResult(CrossFeatureSupportOnActivityResultRoute route) { - return startCrossFeature(route, startStatusSubject -> performStartForResult(route, startStatusSubject)); - } - - private Observable startCrossFeature( - ActivityRouteInterface route, - OnFeatureInstallListener onFeatureInstallListener - ) { - BehaviorSubject startStatusSubject = BehaviorSubject.create(); - if (route instanceof DynamicCrossFeatureRoute && this.isSplitFeatureModeOn) { - DynamicCrossFeatureRoute dynamicCrossFeatureRoute = (DynamicCrossFeatureRoute) route; - splitFeatureInstallDisposable.dispose(); - splitFeatureInstallDisposable = - splitFeatureInstaller.installFeature(dynamicCrossFeatureRoute.splitNames()) - .lift(new ObservableOperatorFreeze<>(freezeSelector)) - .subscribe(splitFeatureInstallState -> { - if (splitFeatureInstallState.getInstallEvent() instanceof SplitFeatureEvent.InstallationStateEvent.Installed) { - startStatusSubject.onNext(splitFeatureInstallState); - onFeatureInstallListener.doOnInstall(startStatusSubject); - } - }); - } else { - onFeatureInstallListener.doOnInstall(startStatusSubject); - } - return startStatusSubject.hide(); - } - - private void performStart(ActivityRoute route, BehaviorSubject startStatusSubject) { - boolean startupStatus = start(route); - emitFeatureInstallState(startStatusSubject, startupStatus); - } - - private void performStartForResult(SupportOnActivityResultRoute route, BehaviorSubject startStatusSubject) { - boolean startupStatus = startForResult(route); - emitFeatureInstallState(startStatusSubject, startupStatus); - } - - private void emitFeatureInstallState(BehaviorSubject splitFeatureInstallStateSubject, boolean startupStatus) { - SplitFeatureInstallStatus status = SplitFeatureInstallStatus.Companion.getByValue(startupStatus); - splitFeatureInstallStateSubject.onNext(new SplitFeatureInstallState(status)); - } /** * Launch a new activity for result. diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForActivity.java b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForActivity.java index 750c3f0978..66b8c18833 100755 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForActivity.java +++ b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForActivity.java @@ -22,7 +22,6 @@ import androidx.annotation.Nullable; import ru.surfstudio.android.core.ui.event.ScreenEventDelegateManager; -import ru.surfstudio.android.core.ui.navigation.feature.installer.SplitFeatureInstaller; import ru.surfstudio.android.core.ui.provider.ActivityProvider; /** @@ -34,14 +33,7 @@ public class ActivityNavigatorForActivity extends ActivityNavigator { public ActivityNavigatorForActivity(ActivityProvider activityProvider, ScreenEventDelegateManager eventDelegateManager) { - this(activityProvider, eventDelegateManager, null, false); - } - - public ActivityNavigatorForActivity(ActivityProvider activityProvider, - ScreenEventDelegateManager eventDelegateManager, - SplitFeatureInstaller splitFeatureInstaller, - Boolean isSplitFeatureModeOn) { - super(activityProvider, eventDelegateManager, splitFeatureInstaller, isSplitFeatureModeOn); + super(activityProvider, eventDelegateManager); this.activityProvider = activityProvider; } diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForFragment.java b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForFragment.java index daf6e9651c..ccb692ca2f 100755 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForFragment.java +++ b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/activity/navigator/ActivityNavigatorForFragment.java @@ -22,7 +22,6 @@ import androidx.annotation.Nullable; import ru.surfstudio.android.core.ui.event.ScreenEventDelegateManager; -import ru.surfstudio.android.core.ui.navigation.feature.installer.SplitFeatureInstaller; import ru.surfstudio.android.core.ui.provider.ActivityProvider; import ru.surfstudio.android.core.ui.provider.FragmentProvider; @@ -36,17 +35,9 @@ public class ActivityNavigatorForFragment extends ActivityNavigator { public ActivityNavigatorForFragment(ActivityProvider activityProvider, FragmentProvider fragmentProvider, ScreenEventDelegateManager eventDelegateManager) { - this(activityProvider, fragmentProvider, eventDelegateManager, null, false); - - } - - public ActivityNavigatorForFragment(ActivityProvider activityProvider, - FragmentProvider fragmentProvider, - ScreenEventDelegateManager eventDelegateManager, - SplitFeatureInstaller splitFeatureInstaller, - Boolean isSplitFeatureModeOn) { - super(activityProvider, eventDelegateManager, splitFeatureInstaller, isSplitFeatureModeOn); + super(activityProvider, eventDelegateManager); this.fragmentProvider = fragmentProvider; + } @Override diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureEvent.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureEvent.kt deleted file mode 100644 index d0aaf02bef..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureEvent.kt +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (c) 2018-present, SurfStudio LLC, Maxim Tuev. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package ru.surfstudio.android.core.ui.navigation.feature.installer - -/** - * All kinds of Dynamic Feature installation events. - * - * * installation startup success [StartupSuccess]; - * * installation status changing event (with subtypes) [InstallationStateEvent]; - * * installation startup failure (with subtypes) [StartupFailure]; - */ -sealed class SplitFeatureEvent { - - /** - * Installation startup success event. - */ - object StartupSuccess : SplitFeatureEvent() - - /** - * Event during installation process. - */ - sealed class InstallationStateEvent : SplitFeatureEvent() { - - /** - * The request has been accepted and the download should start soon. - */ - object Pending : InstallationStateEvent() - - /** - * The download requires user confirmation. This is most likely due to the size of the - * download being larger than 10 MB. - */ - object RequiresUserConfirmation : InstallationStateEvent() - - /** - * Download is in progress. - * - * @param totalBytes total size of the downloading feature in bytes - * @param progress current downloading progress - */ - data class Downloading(val totalBytes: Long, - val progress: Long) : InstallationStateEvent() - - /** - * The device has downloaded the module but installation has no yet begun. - */ - object Downloaded : InstallationStateEvent() - - /** - * The device is currently installing the module. - */ - object Installing : InstallationStateEvent() - - /** - * The module is installed on the device. - */ - object Installed : InstallationStateEvent() - - /** - * The request failed before the module was installed on the device. - */ - object Failed : InstallationStateEvent() - - /** - * The device is in the process of cancelling the request. - */ - object Cancelling : InstallationStateEvent() - - /** - * The request has been cancelled. - */ - object Canceled : InstallationStateEvent() - - /** - * Event from another installation session. - * - * @param sessionId installation session ID - */ - data class AlienSessionEvent(val sessionId: Int) : InstallationStateEvent() - - /** - * Unknown event. - * - * @param status current status code - */ - data class UnknownEvent(val status: Int) : InstallationStateEvent() - } - - /** - * Installation startup failure event. - */ - sealed class StartupFailure : SplitFeatureEvent() { - - /** - * The request is rejected because there is at least one existing request that is - * currently downloading. - */ - object ActiveSessionsLimitExceeded : StartupFailure() - - /** - * Google Play is unable to find the requested module based on the current installed - * version of the app, device, and user’s Google Play account. - */ - object ModuleUnavailable : StartupFailure() - - /** - * Google Play received the request, but the request is not valid. - */ - object InvalidRequest : StartupFailure() - - /** - * A session for a given session ID was not found. - */ - object SessionNotFound : StartupFailure() - - /** - * The Play Core Library is not supported on the current device. That is, the device is - * not able to download and install features on demand. - */ - object ApiNotAvailable : StartupFailure() - - /** - * The app is unable to register the request because of insufficient permissions. - */ - object AccessDenied : StartupFailure() - - /** - * The request failed because of a network error. - */ - object NetworkError : StartupFailure() - - /** - * The request contains one or more modules that have already been requested but have - * not yet been installed. - */ - object IncompatibleWithExistingSession : StartupFailure() - - /** - * The service responsible for handling the request has died. - */ - object ServiceDied : StartupFailure() - - /** - * UnknownEvent error. - */ - object UnknownReason : StartupFailure() - } - -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstallState.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstallState.kt deleted file mode 100644 index df79128900..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstallState.kt +++ /dev/null @@ -1,19 +0,0 @@ -package ru.surfstudio.android.core.ui.navigation.feature.installer - -/** - * Cross-feature startup event. - * - * @param installEvent Dynamic Feature installation event - */ -data class SplitFeatureInstallState( - var installEvent: SplitFeatureEvent? = null -) { - - constructor(installStatus: SplitFeatureInstallStatus) : this() { - this.installStatus = installStatus - } - - //cross-feature startup status - @Suppress("MemberVisibilityCanBePrivate") - var installStatus = SplitFeatureInstallStatus.getBySplitFeatureEvent(installEvent) -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstallStatus.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstallStatus.kt deleted file mode 100644 index 74362e09bb..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstallStatus.kt +++ /dev/null @@ -1,36 +0,0 @@ -package ru.surfstudio.android.core.ui.navigation.feature.installer - -/** - * Cross-feature startup status. - * - * [IN_PROGRESS] value is possible during navigation to Dynamic Feature only. - */ -enum class SplitFeatureInstallStatus { - SUCCESS, - IN_PROGRESS, - FAILURE, - UNKNOWN; - - companion object { - - fun getByValue(value: Boolean) = - if (value) { - SUCCESS - } else { - FAILURE - } - - fun getBySplitFeatureEvent(splitFeatureEvent: SplitFeatureEvent?) = - if (splitFeatureEvent == null) { - UNKNOWN - } else if (splitFeatureEvent is SplitFeatureEvent.InstallationStateEvent.Installed) { - SUCCESS - } else if (splitFeatureEvent is SplitFeatureEvent.InstallationStateEvent.Failed || - splitFeatureEvent is SplitFeatureEvent.InstallationStateEvent.Canceled || - splitFeatureEvent is SplitFeatureEvent.StartupFailure) { - FAILURE - } else { - IN_PROGRESS - } - } -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstaller.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstaller.kt deleted file mode 100644 index 8be40c9b13..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/installer/SplitFeatureInstaller.kt +++ /dev/null @@ -1,198 +0,0 @@ -package ru.surfstudio.android.core.ui.navigation.feature.installer - -import android.content.Context -import com.google.android.play.core.splitinstall.SplitInstallException -import com.google.android.play.core.splitinstall.SplitInstallManagerFactory -import com.google.android.play.core.splitinstall.SplitInstallRequest -import com.google.android.play.core.splitinstall.model.SplitInstallErrorCode -import com.google.android.play.core.splitinstall.model.SplitInstallSessionStatus -import io.reactivex.Observable -import io.reactivex.subjects.BehaviorSubject - -/** - * Dynamic Feature install manager. - */ -class SplitFeatureInstaller( - applicationContext: Context -) { - private val splitFeatureInstallSubject = BehaviorSubject.create() - - private val splitInstallManager = SplitInstallManagerFactory.create(applicationContext) - - //current installation session id - private var sessionId = 0 - - /** - * Request Dynamic Feature installation. - * - * @param splitName Dynamic Feature name - * @param splitFeatureInstallListener installation events listener - */ - @Suppress("unused") - fun installFeature(splitName: String) { - installFeature(listOf(splitName)) - } - - /** - * Request multiple Dynamic Features installation by one batch. - * - * @param splitNames multiple Dynamic Feature names - * @param splitFeatureInstallListener installation events listener - */ - fun installFeature(splitNames: List): Observable { - val requestBuilder = SplitInstallRequest.newBuilder() - for (splitName in splitNames) { - requestBuilder.addModule(splitName) - } - val request = requestBuilder.build() - - this.splitInstallManager.registerListener { state -> - if (state?.sessionId() == -1 && - state.status() == SplitInstallSessionStatus.FAILED && - state.errorCode() == SplitInstallErrorCode.SERVICE_DIED) { - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState(SplitFeatureEvent.StartupFailure.ServiceDied) - ) - } else if (state?.sessionId() == this@SplitFeatureInstaller.sessionId) { - when { - state.status() == SplitInstallSessionStatus.PENDING -> - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Pending - ) - ) - state.status() == SplitInstallSessionStatus.REQUIRES_USER_CONFIRMATION -> - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.RequiresUserConfirmation - ) - ) - state.status() == SplitInstallSessionStatus.DOWNLOADING -> - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Downloading( - state.totalBytesToDownload(), - state.bytesDownloaded() - ) - ) - ) - state.status() == SplitInstallSessionStatus.DOWNLOADED -> - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Downloaded - ) - ) - state.status() == SplitInstallSessionStatus.INSTALLING -> - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Installing - ) - ) - state.status() == SplitInstallSessionStatus.INSTALLED -> { - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Installed - ) - ) - } - state.status() == SplitInstallSessionStatus.FAILED -> { - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Failed - ) - ) - } - state.status() == SplitInstallSessionStatus.CANCELING -> - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Cancelling - ) - ) - state.status() == SplitInstallSessionStatus.CANCELED -> { - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.Canceled - ) - ) - } - else -> { - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.UnknownEvent( - state.status() - ) - ) - ) - } - } - } else { - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.InstallationStateEvent.AlienSessionEvent( - state?.sessionId() ?: -1 - ) - ) - ) - } - } - this.splitInstallManager - .startInstall(request) - .addOnSuccessListener { sessionId -> - this@SplitFeatureInstaller.sessionId = sessionId ?: -1 - splitFeatureInstallSubject.onNext( - SplitFeatureInstallState( - SplitFeatureEvent.StartupSuccess - ) - ) - } - .addOnFailureListener { exception -> - if (exception is SplitInstallException) { - splitFeatureInstallSubject.onNext( - when { - exception.errorCode == SplitInstallErrorCode.ACTIVE_SESSIONS_LIMIT_EXCEEDED -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.ActiveSessionsLimitExceeded - ) - exception.errorCode == SplitInstallErrorCode.MODULE_UNAVAILABLE -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.ModuleUnavailable - ) - exception.errorCode == SplitInstallErrorCode.INVALID_REQUEST -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.InvalidRequest - ) - exception.errorCode == SplitInstallErrorCode.SESSION_NOT_FOUND -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.SessionNotFound - ) - exception.errorCode == SplitInstallErrorCode.API_NOT_AVAILABLE -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.ApiNotAvailable - ) - exception.errorCode == SplitInstallErrorCode.ACCESS_DENIED -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.AccessDenied - ) - exception.errorCode == SplitInstallErrorCode.NETWORK_ERROR -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.NetworkError - ) - exception.errorCode == SplitInstallErrorCode.INCOMPATIBLE_WITH_EXISTING_SESSION -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.IncompatibleWithExistingSession - ) - exception.errorCode == SplitInstallErrorCode.SERVICE_DIED -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.ServiceDied - ) - else -> - SplitFeatureInstallState( - SplitFeatureEvent.StartupFailure.UnknownReason - ) - } - ) - } - } - return splitFeatureInstallSubject - } -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureRoute.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureRoute.kt deleted file mode 100644 index 01488014d6..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureRoute.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (c) 2018-present, SurfStudio LLC, Maxim Tuev. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature - -import ru.surfstudio.android.core.ui.navigation.activity.route.ActivityRoute -import ru.surfstudio.android.core.ui.navigation.feature.route.feature.ActivityCrossFeatureRoute - -/** - * Dynamic Feature navigation Activity route. - * - * Designed for navigation to Activity from separate Dynamic Feature, doesn't matter installed or - * not at the present moment. - * - * @see [ActivityRoute] - * @see [DynamicCrossFeatureRoute] - */ -abstract class ActivityDynamicCrossFeatureRoute : - ActivityCrossFeatureRoute(), - DynamicCrossFeatureRoute \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithParamsAndResultRoute.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithParamsAndResultRoute.kt deleted file mode 100644 index 9ac6f8bd79..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithParamsAndResultRoute.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2018-present, SurfStudio LLC, Maxim Tuev. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -@file:Suppress("unused") - -package ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature - -import android.content.Intent -import ru.surfstudio.android.core.ui.navigation.activity.route.ActivityRoute -import ru.surfstudio.android.core.ui.navigation.feature.route.feature.ActivityCrossFeatureWithResultRoute -import java.io.Serializable - -/** - * Dynamic Feature navigation Activity route with support of Activity result delivering and parameters. - * - * Designed for navigation to Activity from separate Dynamic Feature, doesn't matter installed or - * not at the present moment. - * - * @param T result type (should be [Serializable]) - * - * @see [ActivityRoute] - * @see [DynamicCrossFeatureRoute] - * @see [ActivityDynamicCrossFeatureRoute] - */ -abstract class ActivityDynamicCrossFeatureWithParamsAndResultRoute : - ActivityCrossFeatureWithResultRoute { - - constructor() { - //empty - } - - @Suppress("ConvertSecondaryConstructorToPrimary", "UNUSED_PARAMETER") - constructor(intent: Intent) : this() -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithParamsRoute.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithParamsRoute.kt deleted file mode 100644 index 38443b067a..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithParamsRoute.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2018-present, SurfStudio LLC, Maxim Tuev. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -@file:Suppress("unused") - -package ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature - -import android.content.Intent -import ru.surfstudio.android.core.ui.navigation.activity.route.ActivityRoute - -/** - * Dynamic Feature navigation Activity route with parameters. - * - * Designed for navigation to Activity from separate Dynamic Feature, doesn't matter installed or - * not at the present moment. - * - * @see [ActivityRoute] - * @see [DynamicCrossFeatureRoute] - * @see [ActivityDynamicCrossFeatureRoute] - */ -abstract class ActivityDynamicCrossFeatureWithParamsRoute : ActivityDynamicCrossFeatureRoute { - - constructor() { - //empty - } - - @Suppress("ConvertSecondaryConstructorToPrimary", "UNUSED_PARAMETER") - constructor(intent: Intent) : this() -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithResultRoute.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithResultRoute.kt deleted file mode 100644 index 46dc50ba88..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/ActivityDynamicCrossFeatureWithResultRoute.kt +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2018-present, SurfStudio LLC, Maxim Tuev. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -@file:Suppress("unused") - -package ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature - -import android.content.Intent -import ru.surfstudio.android.core.ui.navigation.event.result.CrossFeatureSupportOnActivityResultRoute -import ru.surfstudio.android.core.ui.navigation.event.result.SupportOnActivityResultRoute -import java.io.Serializable - -/** - * Dynamic Feature navigation Activity route with support of Activity result delivering. - * - * Designed for navigation to Activity from separate Dynamic Feature, doesn't matter installed or - * not at the present moment. - * - * @param T result type (should be [Serializable]) - * - * @see [DynamicCrossFeatureRoute] - * @see [ActivityDynamicCrossFeatureRoute] - */ -abstract class ActivityDynamicCrossFeatureWithResultRoute : - ActivityDynamicCrossFeatureRoute(), - CrossFeatureSupportOnActivityResultRoute { - - override fun prepareResultIntent(resultData: T): Intent { - val i = Intent() - i.putExtra(SupportOnActivityResultRoute.EXTRA_RESULT, resultData) - return i - } - - override fun parseResultIntent(resultIntent: Intent): T { - @Suppress("UNCHECKED_CAST") - return resultIntent.getSerializableExtra(SupportOnActivityResultRoute.EXTRA_RESULT) as T - } - - override fun getRequestCode(): Int { - return Math.abs(this.javaClass.canonicalName!!.hashCode() % MAX_REQUEST_CODE) - } - -} - -private const val MAX_REQUEST_CODE = 32768 \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/DynamicCrossFeatureRoute.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/DynamicCrossFeatureRoute.kt deleted file mode 100644 index 7a1473e448..0000000000 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/dynamic_feature/DynamicCrossFeatureRoute.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2018-present, SurfStudio LLC, Maxim Tuev. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ -package ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature - -import ru.surfstudio.android.core.ui.navigation.feature.route.feature.CrossFeatureRoute - -/** - * Interface for Dynamic Feature navigation route. - * - * Should be used for routing to Activity from the Dynamic Feature module. - * - * For using it override [targetClassPath] method and return full classpath of the target - * feature starting point (e.g. activity). Also you need to specify [splitName] which should be the - * same as the Dynamic Feature Gradle-projects' name. - * - * Read more: [https://developer.android.com/studio/projects/dynamic-delivery] - */ -interface DynamicCrossFeatureRoute : CrossFeatureRoute { - - /** - * @return name of the Dynamic Feature which the target starting point leads to plus names of - * any other Feature Modules to download and install it in the same batch if necessary - * - * IMPORTANT NOTE: `splitName` value should be the same as the feature Gradle-projects' name! - */ - fun splitNames(): List -} \ No newline at end of file diff --git a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/feature/ActivityCrossFeatureWithResultRoute.kt b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/feature/ActivityCrossFeatureWithResultRoute.kt index 0389ceb989..63f757c79c 100644 --- a/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/feature/ActivityCrossFeatureWithResultRoute.kt +++ b/core-navigation/lib-core-navigation/src/main/java/ru/surfstudio/android/core/ui/navigation/feature/route/feature/ActivityCrossFeatureWithResultRoute.kt @@ -18,7 +18,6 @@ package ru.surfstudio.android.core.ui.navigation.feature.route.feature import android.content.Intent import ru.surfstudio.android.core.ui.navigation.event.result.CrossFeatureSupportOnActivityResultRoute import ru.surfstudio.android.core.ui.navigation.event.result.SupportOnActivityResultRoute -import ru.surfstudio.android.core.ui.navigation.feature.route.dynamic_feature.ActivityDynamicCrossFeatureRoute import java.io.Serializable /** @@ -29,7 +28,6 @@ import java.io.Serializable * @param T result type (should be [Serializable]) * * @see [CrossFeatureRoute] - * @see [ActivityDynamicCrossFeatureRoute] */ abstract class ActivityCrossFeatureWithResultRoute : ActivityCrossFeatureRoute(),