mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-16 02:48:08 -04:00
#2112 removed unused side effect
This commit is contained in:
parent
1baf0a7d4a
commit
ca8266ddda
@ -55,7 +55,6 @@ import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.Mu
|
|||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestDeleteMultiSelection
|
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestDeleteMultiSelection
|
||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestMultiSelection
|
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestMultiSelection
|
||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestNavigateTo
|
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestNavigateTo
|
||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestOpen
|
|
||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestSelect
|
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestSelect
|
||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestShareMultiSelection
|
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RequestShareMultiSelection
|
||||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RestartActionMode
|
import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.RestartActionMode
|
||||||
@ -64,7 +63,6 @@ import org.kiwix.kiwixmobile.zim_manager.fileselect_view.FileSelectListState
|
|||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.DeleteFiles
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.DeleteFiles
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.NavigateToDownloads
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.NavigateToDownloads
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.None
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.None
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.OpenFile
|
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.OpenFileWithNavigation
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.OpenFileWithNavigation
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.ShareFiles
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.ShareFiles
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.StartMultiSelection
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.StartMultiSelection
|
||||||
@ -92,7 +90,6 @@ class ZimManageViewModel @Inject constructor(
|
|||||||
private val dataSource: DataSource
|
private val dataSource: DataSource
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
sealed class FileSelectActions {
|
sealed class FileSelectActions {
|
||||||
data class RequestOpen(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
|
||||||
data class RequestNavigateTo(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
data class RequestNavigateTo(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
||||||
data class RequestSelect(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
data class RequestSelect(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
||||||
data class RequestMultiSelection(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
data class RequestMultiSelection(val bookOnDisk: BookOnDisk) : FileSelectActions()
|
||||||
@ -153,7 +150,6 @@ class ZimManageViewModel @Inject constructor(
|
|||||||
sideEffects.offer(
|
sideEffects.offer(
|
||||||
when (it) {
|
when (it) {
|
||||||
is RequestNavigateTo -> OpenFileWithNavigation(it.bookOnDisk)
|
is RequestNavigateTo -> OpenFileWithNavigation(it.bookOnDisk)
|
||||||
is RequestOpen -> OpenFile(it.bookOnDisk)
|
|
||||||
is RequestMultiSelection -> startMultiSelectionAndSelectBook(it.bookOnDisk)
|
is RequestMultiSelection -> startMultiSelectionAndSelectBook(it.bookOnDisk)
|
||||||
RequestDeleteMultiSelection -> DeleteFiles(selectionsFromState())
|
RequestDeleteMultiSelection -> DeleteFiles(selectionsFromState())
|
||||||
RequestShareMultiSelection -> ShareFiles(selectionsFromState())
|
RequestShareMultiSelection -> ShareFiles(selectionsFromState())
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Kiwix Android
|
|
||||||
* Copyright (c) 2019 Kiwix <android.kiwix.org>
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects
|
|
||||||
|
|
||||||
import android.content.Intent
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.net.toUri
|
|
||||||
import org.kiwix.kiwixmobile.core.R
|
|
||||||
import org.kiwix.kiwixmobile.core.base.SideEffect
|
|
||||||
import org.kiwix.kiwixmobile.core.extensions.ActivityExtensions.start
|
|
||||||
import org.kiwix.kiwixmobile.core.extensions.toast
|
|
||||||
import org.kiwix.kiwixmobile.core.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
|
||||||
import org.kiwix.kiwixmobile.main.KiwixMainActivity
|
|
||||||
|
|
||||||
data class OpenFile(private val bookOnDisk: BookOnDisk) :
|
|
||||||
SideEffect<Unit> {
|
|
||||||
|
|
||||||
override fun invokeWith(activity: AppCompatActivity) {
|
|
||||||
val file = bookOnDisk.file
|
|
||||||
if (!file.canRead()) {
|
|
||||||
activity.toast(R.string.error_file_not_found)
|
|
||||||
} else {
|
|
||||||
activity.finish()
|
|
||||||
activity.start<KiwixMainActivity> {
|
|
||||||
data = file.toUri()
|
|
||||||
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -63,7 +63,6 @@ import org.kiwix.kiwixmobile.zim_manager.ZimManageViewModel.FileSelectActions.Re
|
|||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.FileSelectListState
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.FileSelectListState
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.DeleteFiles
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.DeleteFiles
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.None
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.None
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.OpenFile
|
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.ShareFiles
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.ShareFiles
|
||||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.StartMultiSelection
|
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.effects.StartMultiSelection
|
||||||
import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem
|
import org.kiwix.kiwixmobile.zim_manager.library_view.adapter.LibraryListItem
|
||||||
|
Loading…
x
Reference in New Issue
Block a user