Skip to content

Commit

Permalink
Improved the message of Warning dialog to show user where they can ve…
Browse files Browse the repository at this point in the history
…rify the ZIM chunks are copied/moved properly.
  • Loading branch information
MohitMaliDeveloper committed Jan 9, 2025
1 parent cc65465 commit a3f8793
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import androidx.appcompat.widget.Toolbar
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.content.FileProvider
import androidx.core.net.toUri
import androidx.core.view.MenuHost
import androidx.core.view.MenuProvider
Expand Down Expand Up @@ -709,28 +708,6 @@ class LocalLibraryFragment : BaseFragment(), CopyMoveFileHandler.FileCopyMoveCal
}

private fun showWarningDialogForSplittedZimFile() {
dialogShower.show(
KiwixDialog.ShowWarningAboutSplittedZimFile,
::openCopiedMovedDirectory
)
}

private fun openCopiedMovedDirectory() {
val downloadedDirectoryPath = FileProvider.getUriForFile(
requireActivity(),
requireActivity().applicationContext.packageName + ".fileprovider",
File(sharedPreferenceUtil.prefStorage)
)
val intent = Intent(Intent.ACTION_VIEW).apply {
setDataAndType(downloadedDirectoryPath, "*/*")
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
try {
requireActivity().startActivity(intent)
} catch (ignore: Exception) {
// TODO change the message
activity.toast(org.kiwix.kiwixmobile.core.R.string.no_reader_application_installed)
}
dialogShower.show(KiwixDialog.ShowWarningAboutSplittedZimFile)
}

Check warning on line 712 in app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt

View check run for this annotation

Codecov / codecov/patch

app/src/main/java/org/kiwix/kiwixmobile/nav/destination/library/LocalLibraryFragment.kt#L711-L712

Added lines #L711 - L712 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ sealed class KiwixDialog(
data object ShowWarningAboutSplittedZimFile : KiwixDialog(
R.string.verify_zim_chunk_dialog_title,
R.string.verify_zim_chunks_dialog_message,
R.string.view,
android.R.string.ok,
null,
cancelable = false

Check warning on line 126 in core/src/main/java/org/kiwix/kiwixmobile/core/utils/dialog/KiwixDialog.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/utils/dialog/KiwixDialog.kt#L121-L126

Added lines #L121 - L126 were not covered by tests
)

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@
<string name="copy_move_files_dialog_description">Kiwix requires the ZIM file to be in its own data directory. Do you want to copy or move it there?</string>
<string name="copy_file_error_message">Error in copying the ZIM file: %s.</string>
<string name="verify_zim_chunk_dialog_title">Be cautious: Ensure all ZIM chunks have been properly moved/copied!</string>
<string name="verify_zim_chunks_dialog_message">You can verify them by clicking the “View” button. Once done, refresh the library screen by swiping down. The split ZIM file will then appear in your library.</string>
<string name="view">View</string>
<string name="verify_zim_chunks_dialog_message">You can verify them inside “Android/media/org.kiwix…/” folder.\nOnce done, refresh the library screen by swiping down. The split ZIM file will then appear in your library.</string>
<string name="why_copy_move_files_to_app_directory">Why copy/move files to app public directory?</string>
<string name="copy_move_files_to_app_directory_description">Due to Google Play policies on Android 11 and above, our app can no longer directly access files stored elsewhere on your device. To let you view your selected files, we need to move or copy them into a special folder within our application directory. This allows us to access and open the files.</string>
<string name="choose_storage_to_copy_move_zim_file">Choose storage to copy/move ZIM file</string>
Expand Down

0 comments on commit a3f8793

Please sign in to comment.