Loading README.md +9 −9 Original line number Diff line number Diff line # eDrive eDrive is a persitent application provided by default with /e/OS. eDrive is a [persistent][doc-persistence] application provided by default with /e/OS. It synchronizes user's data files to /e/Cloud or a self-hosted cloud. ## Install Loading @@ -22,8 +22,8 @@ and finally `adb reboot`. | /storage/emulated/0/Ringtones | /Ringtones | Ringtones | | /storage/emulated/0/Documents | /Documents | Documents | | /storage/emulated/0/Podcasts | /Podcasts | Podcasts | | /data/system/users/0/ | /Devices/\<id\>/rom_settings/ | Rom settings | | /data/data/foundation.e.drive/files/ | /Devices/\<id\>/rom_settings/app_list/ | Rom settings | | /data/system/users/0/ | /Devices/\<id\>/rom_settings/ | ROM settings | | /data/data/foundation.e.drive/files/ | /Devices/\<id\>/rom_settings/app_list/ | ROM settings | All remote directories are created by eDrive if needed. Loading @@ -31,7 +31,7 @@ All remote directories are created by eDrive if needed. ### How it works When you register an /e/account the synchronization is enabled by default. When you register an /e/account, the synchronization is enabled by default. The synchronization is done on `ACTION_SCREEN_OFF` intent if the last sync is greater than 15 min. Otherwise a sync is scheduled each 30 min. Loading @@ -39,14 +39,14 @@ sync is greater than 15 min. Otherwise a sync is scheduled each 30 min. To enable/disable the synchronisation, go into your account settings: * Application settings (Rom settings) * Application settings (ROM settings) * Pictures and videos (Images, Movies, Music, Ringtones, Documents and Podcasts) # Interrobility # Interoperability eDrive can also receive some broadcast intent for different purprose: eDrive can also receive some broadcast intent for different purpose: **Force the synchronization.** **Force the synchronization** ```bash adb shell am broadcast -a foundation.e.drive.action.FORCE_SCAN --receiver-include-background Loading app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ plugins { def versionMajor = 1 def versionMinor = 5 def versionPatch = 0 def versionPatch = 1 def getTestProp(String propName) { def result = "" Loading Loading @@ -93,7 +93,7 @@ android { } dependencies { implementation 'com.github.nextcloud:android-library:2.13.0' implementation 'foundation.e:Nextcloud-Android-Library:1.0.6-release' implementation "commons-httpclient:commons-httpclient:3.1@jar" implementation fileTree(include: ['*.jar'], dir: 'libs') api 'androidx.annotation:annotation:1.7.0' Loading app/src/main/java/foundation/e/drive/account/AccountUserInfoWorker.java +18 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import static foundation.e.drive.utils.AppConstants.ACCOUNT_USER_ID_KEY; import android.accounts.Account; import android.accounts.AccountManager; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.SharedPreferences; Loading Loading @@ -55,6 +56,8 @@ public class AccountUserInfoWorker extends Worker { private final AccountManager accountManager; private final GetUserInfoRemoteOperation GetUserInfoRemoteOperation = new GetUserInfoRemoteOperation(); private static final int QUOTA_NOTIFICATION_ID = 11; private final Context mContext; private Account account; Loading Loading @@ -85,6 +88,7 @@ public class AccountUserInfoWorker extends Worker { .diskCacheStrategy(DiskCacheStrategy.ALL) .preload(); ViewUtils.updateWidgetView(mContext); DavClientProvider.getInstance().saveAccounts(mContext); return Result.success(); } else { return Result.retry(); Loading Loading @@ -157,7 +161,11 @@ public class AccountUserInfoWorker extends Worker { } else if (relativeQuota >= 80.0 && needToNotify) { addNotification(manager, context.getString(R.string.notif_quota_80plus_title), context.getString(R.string.notif_quota_80Plus_text), false); } else { manager.cancelAll(); try { manager.cancel(QUOTA_NOTIFICATION_ID); } catch (Exception e) { Timber.e(e, "Failed to cancel quota notification"); } } } Loading Loading @@ -192,6 +200,11 @@ public class AccountUserInfoWorker extends Worker { * - else with different notification. File conflict for example. **/ private void addNotification(NotificationManager manager, String title, String text, boolean isOnGoing) { NotificationChannel channel = manager.getNotificationChannel(AppConstants.notificationChannelID); if (channel == null) { CommonUtils.createNotificationChannel(getApplicationContext()); } final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), AppConstants.notificationChannelID) .setSmallIcon(android.R.drawable.stat_sys_warning) Loading @@ -200,7 +213,7 @@ public class AccountUserInfoWorker extends Worker { .setOngoing(isOnGoing) .setStyle(new NotificationCompat.BigTextStyle().bigText(text)); // Add as notification manager.notify(0, builder.build()); manager.notify(QUOTA_NOTIFICATION_ID, builder.build()); } private boolean fetchAliases() { Loading @@ -223,6 +236,9 @@ public class AccountUserInfoWorker extends Worker { } accountManager.setUserData(account, ACCOUNT_DATA_ALIAS_KEY, aliases); Timber.d("fetchAliases(): success"); DavClientProvider.getInstance().saveAccounts(mContext); return true; } } app/src/main/java/foundation/e/drive/account/receivers/AccountAddedReceiver.kt +1 −3 Original line number Diff line number Diff line Loading @@ -12,8 +12,6 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.SharedPreferences import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import foundation.e.drive.R import foundation.e.drive.account.AccountUtils import foundation.e.drive.models.SyncedFolder Loading Loading @@ -69,7 +67,7 @@ class AccountAddedReceiver() : BroadcastReceiver() { prefs: SharedPreferences, context: Context ): Boolean { if (isSetupAlreadyDone(prefs)) { if (AccountUtils.isSetupAlreadyDone(prefs)) { return false } Loading app/src/main/java/foundation/e/drive/account/receivers/AccountRemoveCallbackReceiver.java +6 −14 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ import static foundation.e.drive.utils.AppConstants.SETUP_COMPLETED; import android.accounts.AccountManager; import android.annotation.SuppressLint; import android.app.Application; import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -25,12 +26,10 @@ import androidx.work.WorkManager; import java.io.File; import foundation.e.drive.EdriveApplication; import foundation.e.drive.R; import foundation.e.drive.database.DbHelper; import foundation.e.drive.database.FailedSyncPrefsManager; import foundation.e.drive.synchronization.SyncProgressNotifier; import foundation.e.drive.synchronization.SyncWorker; import foundation.e.drive.synchronization.SyncProxy; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.DavClientProvider; import foundation.e.drive.utils.ViewUtils; Loading @@ -52,11 +51,12 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { } cancelWorkers(applicationContext); stopRecursiveFileObserver(applicationContext); SyncProxy.INSTANCE.moveToIdle((Application) applicationContext); deleteDatabase(applicationContext); cleanSharedPreferences(applicationContext, preferences); removeCachedFiles(applicationContext); deleteNotificationChannels(applicationContext); DavClientProvider.getInstance().cleanUp(); ViewUtils.updateWidgetView(applicationContext); Loading @@ -73,12 +73,6 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { Timber.d("Remove Database: %s", result); } private void stopRecursiveFileObserver(@NonNull Context applicationContext) { if (applicationContext instanceof EdriveApplication) { ((EdriveApplication) applicationContext).stopRecursiveFileObserver(); } } private boolean shouldProceedWithRemoval(@NonNull Intent intent, @NonNull SharedPreferences preferences, @NonNull Context context) { if (isInvalidAction(intent) || intent.getExtras() == null) { Timber.w("Invalid account removal request"); Loading Loading @@ -151,12 +145,10 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { private void deleteNotificationChannels(Context context) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancelAll(); try { notificationManager.deleteNotificationChannel(AppConstants.notificationChannelID); notificationManager.deleteNotificationChannel(SyncProgressNotifier.NOTIF_CHANNEL_ID); notificationManager.cancelAll(); } catch (Exception exception) { Timber.e(exception, "Cannot delete notification Channel"); Timber.e(exception, "Cannot cancel all notifications"); } } } Loading
README.md +9 −9 Original line number Diff line number Diff line # eDrive eDrive is a persitent application provided by default with /e/OS. eDrive is a [persistent][doc-persistence] application provided by default with /e/OS. It synchronizes user's data files to /e/Cloud or a self-hosted cloud. ## Install Loading @@ -22,8 +22,8 @@ and finally `adb reboot`. | /storage/emulated/0/Ringtones | /Ringtones | Ringtones | | /storage/emulated/0/Documents | /Documents | Documents | | /storage/emulated/0/Podcasts | /Podcasts | Podcasts | | /data/system/users/0/ | /Devices/\<id\>/rom_settings/ | Rom settings | | /data/data/foundation.e.drive/files/ | /Devices/\<id\>/rom_settings/app_list/ | Rom settings | | /data/system/users/0/ | /Devices/\<id\>/rom_settings/ | ROM settings | | /data/data/foundation.e.drive/files/ | /Devices/\<id\>/rom_settings/app_list/ | ROM settings | All remote directories are created by eDrive if needed. Loading @@ -31,7 +31,7 @@ All remote directories are created by eDrive if needed. ### How it works When you register an /e/account the synchronization is enabled by default. When you register an /e/account, the synchronization is enabled by default. The synchronization is done on `ACTION_SCREEN_OFF` intent if the last sync is greater than 15 min. Otherwise a sync is scheduled each 30 min. Loading @@ -39,14 +39,14 @@ sync is greater than 15 min. Otherwise a sync is scheduled each 30 min. To enable/disable the synchronisation, go into your account settings: * Application settings (Rom settings) * Application settings (ROM settings) * Pictures and videos (Images, Movies, Music, Ringtones, Documents and Podcasts) # Interrobility # Interoperability eDrive can also receive some broadcast intent for different purprose: eDrive can also receive some broadcast intent for different purpose: **Force the synchronization.** **Force the synchronization** ```bash adb shell am broadcast -a foundation.e.drive.action.FORCE_SCAN --receiver-include-background Loading
app/build.gradle +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ plugins { def versionMajor = 1 def versionMinor = 5 def versionPatch = 0 def versionPatch = 1 def getTestProp(String propName) { def result = "" Loading Loading @@ -93,7 +93,7 @@ android { } dependencies { implementation 'com.github.nextcloud:android-library:2.13.0' implementation 'foundation.e:Nextcloud-Android-Library:1.0.6-release' implementation "commons-httpclient:commons-httpclient:3.1@jar" implementation fileTree(include: ['*.jar'], dir: 'libs') api 'androidx.annotation:annotation:1.7.0' Loading
app/src/main/java/foundation/e/drive/account/AccountUserInfoWorker.java +18 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ import static foundation.e.drive.utils.AppConstants.ACCOUNT_USER_ID_KEY; import android.accounts.Account; import android.accounts.AccountManager; import android.app.NotificationChannel; import android.app.NotificationManager; import android.content.Context; import android.content.SharedPreferences; Loading Loading @@ -55,6 +56,8 @@ public class AccountUserInfoWorker extends Worker { private final AccountManager accountManager; private final GetUserInfoRemoteOperation GetUserInfoRemoteOperation = new GetUserInfoRemoteOperation(); private static final int QUOTA_NOTIFICATION_ID = 11; private final Context mContext; private Account account; Loading Loading @@ -85,6 +88,7 @@ public class AccountUserInfoWorker extends Worker { .diskCacheStrategy(DiskCacheStrategy.ALL) .preload(); ViewUtils.updateWidgetView(mContext); DavClientProvider.getInstance().saveAccounts(mContext); return Result.success(); } else { return Result.retry(); Loading Loading @@ -157,7 +161,11 @@ public class AccountUserInfoWorker extends Worker { } else if (relativeQuota >= 80.0 && needToNotify) { addNotification(manager, context.getString(R.string.notif_quota_80plus_title), context.getString(R.string.notif_quota_80Plus_text), false); } else { manager.cancelAll(); try { manager.cancel(QUOTA_NOTIFICATION_ID); } catch (Exception e) { Timber.e(e, "Failed to cancel quota notification"); } } } Loading Loading @@ -192,6 +200,11 @@ public class AccountUserInfoWorker extends Worker { * - else with different notification. File conflict for example. **/ private void addNotification(NotificationManager manager, String title, String text, boolean isOnGoing) { NotificationChannel channel = manager.getNotificationChannel(AppConstants.notificationChannelID); if (channel == null) { CommonUtils.createNotificationChannel(getApplicationContext()); } final NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext(), AppConstants.notificationChannelID) .setSmallIcon(android.R.drawable.stat_sys_warning) Loading @@ -200,7 +213,7 @@ public class AccountUserInfoWorker extends Worker { .setOngoing(isOnGoing) .setStyle(new NotificationCompat.BigTextStyle().bigText(text)); // Add as notification manager.notify(0, builder.build()); manager.notify(QUOTA_NOTIFICATION_ID, builder.build()); } private boolean fetchAliases() { Loading @@ -223,6 +236,9 @@ public class AccountUserInfoWorker extends Worker { } accountManager.setUserData(account, ACCOUNT_DATA_ALIAS_KEY, aliases); Timber.d("fetchAliases(): success"); DavClientProvider.getInstance().saveAccounts(mContext); return true; } }
app/src/main/java/foundation/e/drive/account/receivers/AccountAddedReceiver.kt +1 −3 Original line number Diff line number Diff line Loading @@ -12,8 +12,6 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.SharedPreferences import androidx.work.OneTimeWorkRequest import androidx.work.WorkManager import foundation.e.drive.R import foundation.e.drive.account.AccountUtils import foundation.e.drive.models.SyncedFolder Loading Loading @@ -69,7 +67,7 @@ class AccountAddedReceiver() : BroadcastReceiver() { prefs: SharedPreferences, context: Context ): Boolean { if (isSetupAlreadyDone(prefs)) { if (AccountUtils.isSetupAlreadyDone(prefs)) { return false } Loading
app/src/main/java/foundation/e/drive/account/receivers/AccountRemoveCallbackReceiver.java +6 −14 Original line number Diff line number Diff line Loading @@ -13,6 +13,7 @@ import static foundation.e.drive.utils.AppConstants.SETUP_COMPLETED; import android.accounts.AccountManager; import android.annotation.SuppressLint; import android.app.Application; import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; Loading @@ -25,12 +26,10 @@ import androidx.work.WorkManager; import java.io.File; import foundation.e.drive.EdriveApplication; import foundation.e.drive.R; import foundation.e.drive.database.DbHelper; import foundation.e.drive.database.FailedSyncPrefsManager; import foundation.e.drive.synchronization.SyncProgressNotifier; import foundation.e.drive.synchronization.SyncWorker; import foundation.e.drive.synchronization.SyncProxy; import foundation.e.drive.utils.AppConstants; import foundation.e.drive.utils.DavClientProvider; import foundation.e.drive.utils.ViewUtils; Loading @@ -52,11 +51,12 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { } cancelWorkers(applicationContext); stopRecursiveFileObserver(applicationContext); SyncProxy.INSTANCE.moveToIdle((Application) applicationContext); deleteDatabase(applicationContext); cleanSharedPreferences(applicationContext, preferences); removeCachedFiles(applicationContext); deleteNotificationChannels(applicationContext); DavClientProvider.getInstance().cleanUp(); ViewUtils.updateWidgetView(applicationContext); Loading @@ -73,12 +73,6 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { Timber.d("Remove Database: %s", result); } private void stopRecursiveFileObserver(@NonNull Context applicationContext) { if (applicationContext instanceof EdriveApplication) { ((EdriveApplication) applicationContext).stopRecursiveFileObserver(); } } private boolean shouldProceedWithRemoval(@NonNull Intent intent, @NonNull SharedPreferences preferences, @NonNull Context context) { if (isInvalidAction(intent) || intent.getExtras() == null) { Timber.w("Invalid account removal request"); Loading Loading @@ -151,12 +145,10 @@ public class AccountRemoveCallbackReceiver extends BroadcastReceiver { private void deleteNotificationChannels(Context context) { NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.cancelAll(); try { notificationManager.deleteNotificationChannel(AppConstants.notificationChannelID); notificationManager.deleteNotificationChannel(SyncProgressNotifier.NOTIF_CHANNEL_ID); notificationManager.cancelAll(); } catch (Exception exception) { Timber.e(exception, "Cannot delete notification Channel"); Timber.e(exception, "Cannot cancel all notifications"); } } }