Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add synchronization with gPodder Nextcloud server app #5243

Merged
merged 111 commits into from Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
f2b668d
create sub preference screen for both synchronization services
thrillfall Jun 24, 2021
bfcd855
add nextcloud gpodder sync client
thrillfall Jun 25, 2021
3dcf455
only call sync service if they have authenticated with their respecti…
thrillfall Jun 25, 2021
a22d529
add possibility to disconnect from nextcloud app in preferences
thrillfall Jun 26, 2021
a652c45
extract redundant response mapper methods
thrillfall Jun 26, 2021
17c8ad0
extract string resource
thrillfall Jun 28, 2021
cc78b50
remove unused
thrillfall Jun 28, 2021
201908b
extract string resource
thrillfall Jun 28, 2021
fd5bb8b
use gpodder logo for preferences
thrillfall Jun 28, 2021
626f997
move string resources to core module
thrillfall Jun 28, 2021
cdf2bfc
remove 'GPodder' references in class names and ui. Use 'Nextcloud' only
thrillfall Jun 29, 2021
a12dd73
remove dead code
thrillfall Jun 29, 2021
76f90b3
ask user first time for syncronization service to be used
thrillfall Jul 1, 2021
f4eb35a
enqueue subscription changes and episode actions only when user has s…
thrillfall Jul 3, 2021
3f6f1bc
move image to resolution specific directory
thrillfall Jul 5, 2021
a63487e
fix checkstyle violations
thrillfall Jul 6, 2021
0dbae66
move nextcloud image to core package
thrillfall Jul 6, 2021
78ab190
fix checkstyle issue
thrillfall Jul 6, 2021
c85eb7b
fix checkstyle issue
thrillfall Jul 6, 2021
15a7f95
always ask user for sync provider if none is connected
thrillfall Jul 10, 2021
a7b1db2
show correct gpodder.net icon
thrillfall Jul 10, 2021
6681210
display icon and summary of available sync provider in choice dialog
thrillfall Jul 11, 2021
af759fe
update preference screen when user has logged in to nextcloud
thrillfall Jul 11, 2021
3ea0384
fix xml style issues
thrillfall Jul 11, 2021
d6b6570
remove unused string resources
thrillfall Jul 11, 2021
83e6d54
remove unused imports
thrillfall Jul 11, 2021
b11b0bb
remove unused imports
thrillfall Jul 11, 2021
0f52b1c
fix xml style issues
thrillfall Jul 11, 2021
6fea1ed
break up too long lines
thrillfall Jul 11, 2021
a1ea557
fix xml style issues
thrillfall Jul 11, 2021
9bb0f04
remove unused string resources
thrillfall Jul 12, 2021
a7cce77
add user-agent in request headers for nextcloud sync provider
thrillfall Jul 12, 2021
688a107
remove obsolete comments
thrillfall Jul 13, 2021
cce0a85
reuse gpodder.net request building. now we send array instead of string
thrillfall Jul 13, 2021
3dd31d4
do use Result state of sync
thrillfall Jul 21, 2021
da7a4f0
hide/show elements on preference fragment creation
thrillfall Jul 21, 2021
6194424
stick to material design: use multiples of 8 for sizes
thrillfall Jul 21, 2021
4200ee4
do not enforce Android O for getting the current time in seconds
thrillfall Jul 21, 2021
5d37bdd
display cloud icon if no sync provider was chosen
thrillfall Jul 27, 2021
c11e093
extract logic to determine sync provider to separate class
thrillfall Jul 28, 2021
373e317
extract logic to determine sync provider icon to separate class
thrillfall Jul 28, 2021
d89ff7f
align method order
thrillfall Jul 28, 2021
646b0f7
extract resolving of username to separate class
thrillfall Jul 28, 2021
8c5319c
align text in choice dialog and header summary
thrillfall Jul 28, 2021
6ec7dec
remove wrong image format hint in icon name
thrillfall Aug 6, 2021
d05ecdd
increase padding around text
thrillfall Aug 6, 2021
c9e94cb
Added padding to sync provider chooser
ByteHamster Aug 8, 2021
6a03a22
Make it possible to read sync error message
ByteHamster Aug 8, 2021
89b0d50
extract sync provider resolve logic
thrillfall Aug 9, 2021
bdd91b2
remove empty line
thrillfall Aug 9, 2021
dc80dc9
do full sync on successful gpoddersync app connection
thrillfall Aug 9, 2021
baf7b16
reduce vertical space usage
thrillfall Aug 9, 2021
5c1162a
remove empty line
thrillfall Aug 9, 2021
6c50efa
reduce vertical space usage
thrillfall Aug 9, 2021
2274f34
replace static import
thrillfall Aug 9, 2021
154bc94
update ActionBar for all services
thrillfall Aug 9, 2021
c770077
create package for synchronization
thrillfall Aug 9, 2021
d0fbd14
add tests for synchronization view data provider
thrillfall Aug 10, 2021
98e26ec
store synchronization provider summary and icon in Enum
thrillfall Aug 10, 2021
e0b56ad
reuse SynchronizationProviderViewData Enum for choice dialog
thrillfall Aug 10, 2021
061d15e
do not switch twice for chosen synchronization service
thrillfall Aug 10, 2021
bdb84bc
throw exception when uploading subscription or episode changes fails
thrillfall Aug 10, 2021
bdcafdc
replace custom stream to string conversion with IOUtils
thrillfall Aug 10, 2021
edc3e88
instantiate only selected synchronization provider
thrillfall Aug 10, 2021
a63e594
make user aware of possbile heavy data load that a force-sync may pro…
thrillfall Aug 11, 2021
b2b7691
move shared preferences write access to SyncService
thrillfall Aug 11, 2021
5c893cb
do not require context as argument to access synchronization service …
thrillfall Aug 11, 2021
3a3a6a5
early exit if synchronization was triggered with no active provider set
thrillfall Aug 11, 2021
67e706d
set synchronization provider connected status after successful gpodde…
thrillfall Aug 11, 2021
2ce036c
do not try to sync with a faulty 'null' guid
thrillfall Aug 29, 2021
fc6aa9c
remove unused method
thrillfall Aug 30, 2021
b06e298
show split AndroidX dependencies and between different types (testing…
thrillfall Sep 12, 2021
13c23fb
save vertical space
thrillfall Sep 14, 2021
f502c04
align preference view title with breadcrumb for preference search
thrillfall Sep 14, 2021
ba3bc57
avoid typos by reusing constants
thrillfall Sep 15, 2021
30a78cf
reorder public and private methods
thrillfall Sep 15, 2021
ae0e361
null activity subtitle on logout
thrillfall Sep 15, 2021
f9fb82b
do not sync status change when logged out
thrillfall Sep 15, 2021
faa81eb
string resources are used for any provider
thrillfall Sep 15, 2021
2ae973b
drop provider from available synchronization providers
thrillfall Sep 16, 2021
40953e0
group shared preference key constants in separate class
thrillfall Sep 16, 2021
2aa44cc
align synchronization provider description
thrillfall Sep 17, 2021
88e5661
drop redundant string resource
thrillfall Sep 18, 2021
0b28259
align string resource naming and grouping
thrillfall Sep 18, 2021
6cb6ec0
extract synchronization queue handling to separate class
thrillfall Sep 18, 2021
8858f6b
wrap all shared preferences usage concerning synchronization in separ…
thrillfall Sep 18, 2021
17aa7fa
Reverted strings changes that are not needed
ByteHamster Sep 18, 2021
ab641ef
queue related code should go into the right class
thrillfall Sep 18, 2021
074b942
merge strings that were always combined anyways
thrillfall Sep 18, 2021
e8fc10e
only have single point of definition for synchronization providers
thrillfall Sep 18, 2021
7d6d828
get rid of ClientConfig dependency
thrillfall Sep 19, 2021
e4b8bfc
this ain't for human interface
thrillfall Sep 19, 2021
d39486a
group queue handling
thrillfall Sep 19, 2021
ea6f7f3
extract locking queue writing logic
thrillfall Sep 20, 2021
08fdadc
Synchronization queue should not know/care about synchronization prov…
thrillfall Sep 20, 2021
e475fbe
reduce constants reuse
thrillfall Sep 24, 2021
9748675
move exception handling closer to source
thrillfall Sep 24, 2021
3f4b39c
make sure write access to synchronization queue is using lock
thrillfall Sep 26, 2021
da2cea7
make conditional queueing explicit
thrillfall Sep 26, 2021
f47f2c3
Small cleanup
ByteHamster Sep 27, 2021
28572ef
Do not crash when feed item is later changed to be text-only
ByteHamster Sep 27, 2021
d0200fe
Another small round of cleanup
ByteHamster Sep 27, 2021
2e4f30a
Use a single class for storing sync credentials
ByteHamster Sep 28, 2021
c30c0c9
Do not differentiate between provider connected and provider active
ByteHamster Sep 28, 2021
cd10f97
Move hostname parsing to its own class
ByteHamster Sep 28, 2021
a22f3e6
Use Browser-based login
ByteHamster Oct 1, 2021
e97fc6e
Checkstyle fixes
ByteHamster Oct 2, 2021
85e725c
Use provider display item to login
ByteHamster Oct 2, 2021
e0140a8
Send same payload to nextcloud that we already send to gpodder
ByteHamster Oct 5, 2021
f0747b7
Reduce log spam
ByteHamster Oct 6, 2021
41f76db
Removed leftover from SSO library
ByteHamster Oct 6, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -6,6 +6,7 @@
import android.provider.Settings;
import android.view.Menu;
import android.view.MenuItem;

import android.view.View;
import android.view.inputmethod.InputMethodManager;

Expand All @@ -21,13 +22,13 @@
import de.danoeh.antennapod.core.preferences.UserPreferences;
import de.danoeh.antennapod.databinding.SettingsActivityBinding;
import de.danoeh.antennapod.fragment.preferences.AutoDownloadPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.GpodderPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.ImportExportPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.MainPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.NetworkPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.NotificationPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.PlaybackPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.StoragePreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.synchronization.SynchronizationPreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.SwipePreferencesFragment;
import de.danoeh.antennapod.fragment.preferences.UserInterfacePreferencesFragment;

Expand Down Expand Up @@ -76,8 +77,8 @@ private PreferenceFragmentCompat getPreferenceScreen(int screen) {
prefFragment = new ImportExportPreferencesFragment();
} else if (screen == R.xml.preferences_autodownload) {
prefFragment = new AutoDownloadPreferencesFragment();
} else if (screen == R.xml.preferences_gpodder) {
prefFragment = new GpodderPreferencesFragment();
} else if (screen == R.xml.preferences_synchronization) {
prefFragment = new SynchronizationPreferencesFragment();
} else if (screen == R.xml.preferences_playback) {
prefFragment = new PlaybackPreferencesFragment();
} else if (screen == R.xml.preferences_notifications) {
Expand All @@ -101,8 +102,8 @@ public static int getTitleOfPage(int preferences) {
return R.string.import_export_pref;
} else if (preferences == R.xml.preferences_user_interface) {
return R.string.user_interface_label;
} else if (preferences == R.xml.preferences_gpodder) {
return R.string.gpodnet_main_label;
} else if (preferences == R.xml.preferences_synchronization) {
return R.string.synchronization_pref;
} else if (preferences == R.xml.preferences_notifications) {
return R.string.notification_pref_fragment;
} else if (preferences == R.xml.feed_settings) {
Expand Down
@@ -1,6 +1,6 @@
package de.danoeh.antennapod.discovery;

import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetServiceException;
Expand All @@ -18,8 +18,8 @@ public Single<List<PodcastSearchResult>> search(String query) {
return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) subscriber -> {
try {
GpodnetService service = new GpodnetService(AntennapodHttpClient.getHttpClient(),
GpodnetPreferences.getHosturl(), GpodnetPreferences.getDeviceID(),
GpodnetPreferences.getUsername(), GpodnetPreferences.getPassword());
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceID(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
List<GpodnetPodcast> gpodnetPodcasts = service.searchPodcasts(query, 0);
List<PodcastSearchResult> results = new ArrayList<>();
for (GpodnetPodcast podcast : gpodnetPodcasts) {
Expand Down
Expand Up @@ -15,7 +15,7 @@
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.adapter.gpodnet.PodcastListAdapter;
import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetServiceException;
Expand Down Expand Up @@ -76,8 +76,8 @@ final void loadData() {
disposable = Observable.fromCallable(
() -> {
GpodnetService service = new GpodnetService(AntennapodHttpClient.getHttpClient(),
GpodnetPreferences.getHosturl(), GpodnetPreferences.getDeviceID(),
GpodnetPreferences.getUsername(), GpodnetPreferences.getPassword());
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceID(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
return loadPodcastData(service);
})
.subscribeOn(Schedulers.io())
Expand Down
Expand Up @@ -8,7 +8,7 @@
import androidx.fragment.app.ListFragment;
import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.adapter.gpodnet.TagListAdapter;
import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService;
import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetTag;
Expand Down Expand Up @@ -51,8 +51,8 @@ private void startLoadTask() {
disposable = Observable.fromCallable(
() -> {
GpodnetService service = new GpodnetService(AntennapodHttpClient.getHttpClient(),
GpodnetPreferences.getHosturl(), GpodnetPreferences.getDeviceID(),
GpodnetPreferences.getUsername(), GpodnetPreferences.getPassword());
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceID(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
return service.getTopTags(COUNT);
})
.subscribeOn(Schedulers.io())
Expand Down

This file was deleted.

Expand Up @@ -17,12 +17,11 @@
import de.danoeh.antennapod.fragment.preferences.about.AboutFragment;

public class MainPreferencesFragment extends PreferenceFragmentCompat {
private static final String TAG = "MainPreferencesFragment";

private static final String PREF_SCREEN_USER_INTERFACE = "prefScreenInterface";
private static final String PREF_SCREEN_PLAYBACK = "prefScreenPlayback";
private static final String PREF_SCREEN_NETWORK = "prefScreenNetwork";
private static final String PREF_SCREEN_GPODDER = "prefScreenGpodder";
private static final String PREF_SCREEN_SYNCHRONIZATION = "prefScreenSynchronization";
private static final String PREF_SCREEN_STORAGE = "prefScreenStorage";
private static final String PREF_DOCUMENTATION = "prefDocumentation";
private static final String PREF_VIEW_FORUM = "prefViewForum";
Expand Down Expand Up @@ -74,8 +73,8 @@ private void setupMainScreen() {
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_network);
return true;
});
findPreference(PREF_SCREEN_GPODDER).setOnPreferenceClickListener(preference -> {
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_gpodder);
findPreference(PREF_SCREEN_SYNCHRONIZATION).setOnPreferenceClickListener(preference -> {
((PreferenceActivity) getActivity()).openScreen(R.xml.preferences_synchronization);
return true;
});
findPreference(PREF_SCREEN_STORAGE).setOnPreferenceClickListener(preference -> {
Expand Down Expand Up @@ -142,8 +141,8 @@ private void setupSearch() {
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_network))
.addBreadcrumb(R.string.automation)
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_autodownload));
config.index(R.xml.preferences_gpodder)
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_gpodder));
config.index(R.xml.preferences_synchronization)
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_synchronization));
config.index(R.xml.preferences_notifications)
.addBreadcrumb(PreferenceActivity.getTitleOfPage(R.xml.preferences_notifications));
config.index(R.xml.feed_settings)
Expand Down
Expand Up @@ -4,11 +4,10 @@
import androidx.preference.PreferenceFragmentCompat;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.PreferenceActivity;
import de.danoeh.antennapod.core.preferences.GpodnetPreferences;
import de.danoeh.antennapod.core.sync.SynchronizationSettings;

public class NotificationPreferencesFragment extends PreferenceFragmentCompat {

private static final String TAG = "NotificationPrefFragment";
private static final String PREF_GPODNET_NOTIFICATIONS = "pref_gpodnet_notifications";

@Override
Expand All @@ -24,7 +23,6 @@ public void onStart() {
}

private void setUpScreen() {
final boolean loggedIn = GpodnetPreferences.loggedIn();
findPreference(PREF_GPODNET_NOTIFICATIONS).setEnabled(loggedIn);
findPreference(PREF_GPODNET_NOTIFICATIONS).setEnabled(SynchronizationSettings.isProviderConnected());
}
}