settings: add UI options to import/export subscriptions#12344
settings: add UI options to import/export subscriptions#12344AndrianaBilali wants to merge 1 commit intoTeamNewPipe:devfrom
Conversation
|
Stypox
left a comment
There was a problem hiding this comment.
Thank you, this is a very nice addition to avoid user confusion!
There was a problem hiding this comment.
The code you added in this class should be deduplicated with respect to the code in SubscriptionFragment.kt. You could create a few utils functions in a new file SubscriptionsImportExportHelper.kt under app/src/main/java/org/schabi/newpipe/local/subscription/services, and call them both from here and from SubscriptionFragment.kt. Obviously the ActivityResultLauncher cannot be deduplicated, but the rest of the code should be.
| private final ActivityResultLauncher<Intent> requestExportSubsLauncher = | ||
| registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), | ||
| this::requestExportSubsResult); | ||
|
|
| android:title="Export subscriptions" | ||
| android:summary="Export your subscriptions to a .json file" |
There was a problem hiding this comment.
Add new strings under strings.xml for these, otherwise they can't be translated
| android:title="Import subscriptions" | ||
| android:summary="Import subscriptions from a previous .json export" |
| requireContext(), SubscriptionsExportService.class); | ||
| intent.putExtra(SubscriptionsExportService.KEY_FILE_PATH, fileUri); | ||
| requireContext().startService(intent); | ||
| Toast.makeText(requireContext(), R.string.exporting, Toast.LENGTH_SHORT).show(); |
There was a problem hiding this comment.
Instead of showing a Toast I would do the same as in SubscriptionFragment and show an ImportConfirmationDialog. This will come naturally after deduplicating the code.
| ); | ||
| intent.putExtra(SubscriptionsImportService.KEY_VALUE, fileUri); | ||
| requireContext().startService(intent); | ||
| Toast.makeText(requireContext(), R.string.importing, Toast.LENGTH_SHORT).show(); |
There was a problem hiding this comment.
This Toast is redundant with showToast(R.string.export_ongoing); in SubscriptionsExportService line 112, and should be removed
|
Closing in favor of #13245 |



What is it?
Description of the changes in your PR
Adds two new options to the Backup & Restore settings screen:
Reuses existing import/export logic via SubscriptionsImportService and SubscriptionsExportService. These are 2 .json files created for testing the feature:
Before/After Screenshots/Screen Record
Fixes the following issue(s)
Due diligence