Browse Source

Set default seven days to sync for user folders

Sync of user folders is disabled by default
main
M66B 6 years ago
parent
commit
b0d8bc9c10
3 changed files with 22 additions and 21 deletions
  1. +10
    -9
      app/src/main/java/eu/faircode/email/EntityFolder.java
  2. +11
    -11
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  3. +1
    -1
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 10
- 9
app/src/main/java/eu/faircode/email/EntityFolder.java View File

@ -33,10 +33,10 @@ import static android.arch.persistence.room.ForeignKey.CASCADE;
@Entity(
tableName = EntityFolder.TABLE_NAME,
foreignKeys = {
@ForeignKey(childColumns = "account" , entity = EntityAccount.class, parentColumns = "id" , onDelete = CASCADE)
@ForeignKey(childColumns = "account", entity = EntityAccount.class, parentColumns = "id", onDelete = CASCADE)
},
indices = {
@Index(value = {"account" , "name"}, unique = true),
@Index(value = {"account", "name"}, unique = true),
@Index(value = {"account"}),
@Index(value = {"name"}),
@Index(value = {"type"})
@ -55,10 +55,10 @@ public class EntityFolder {
static final String TYPE_USER = "User";
static final List<String> SYSTEM_FOLDER_ATTR = Arrays.asList(
"All" ,
"Drafts" ,
"Trash" ,
"Junk" ,
"All",
"Drafts",
"Trash",
"Junk",
"Sent"
);
static final List<String> SYSTEM_FOLDER_TYPE = Arrays.asList(
@ -67,7 +67,7 @@ public class EntityFolder {
TYPE_TRASH,
TYPE_JUNK,
TYPE_SENT
); // Must match SYSTEM_FOLDER_ATTR
); // MUST match SYSTEM_FOLDER_ATTR
static final List<String> FOLDER_SORT_ORDER = Arrays.asList(
TYPE_INBOX,
@ -80,8 +80,9 @@ public class EntityFolder {
TYPE_USER
);
static final int DEFAULT_INBOX_SYNC = 30;
static final int DEFAULT_STANDARD_SYNC = 7;
static final int DEFAULT_INBOX_SYNC = 30; // days
static final int DEFAULT_SYSTEM_SYNC = 7; // days
static final int DEFAULT_USER_SYNC = 7; // days
static final List<String> SYSTEM_FOLDER_SYNC = Arrays.asList(
TYPE_ARCHIVE,


+ 11
- 11
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -85,7 +85,7 @@ public class FragmentAccount extends FragmentEx {
// Get arguments
Bundle args = getArguments();
final long id = (args == null ? -1 : args.getLong("id" , -1));
final long id = (args == null ? -1 : args.getLong("id", -1));
// Get providers
providers = Provider.loadProfiles(getContext());
@ -140,14 +140,14 @@ public class FragmentAccount extends FragmentEx {
pbCheck.setVisibility(View.VISIBLE);
Bundle args = new Bundle();
args.putLong("id" , id);
args.putString("name" , etName.getText().toString());
args.putString("host" , etHost.getText().toString());
args.putString("port" , etPort.getText().toString());
args.putString("user" , etUser.getText().toString());
args.putString("password" , tilPassword.getEditText().getText().toString());
args.putBoolean("synchronize" , cbSynchronize.isChecked());
args.putBoolean("primary" , cbPrimary.isChecked());
args.putLong("id", id);
args.putString("name", etName.getText().toString());
args.putString("host", etHost.getText().toString());
args.putString("port", etPort.getText().toString());
args.putString("user", etUser.getText().toString());
args.putString("password", tilPassword.getEditText().getText().toString());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
getLoaderManager().restartLoader(ActivityView.LOADER_ACCOUNT_PUT, args, putLoaderCallbacks).forceLoad();
}
@ -296,12 +296,12 @@ public class FragmentAccount extends FragmentEx {
folder.name = ifolder.getFullName();
folder.type = type;
folder.synchronize = EntityFolder.SYSTEM_FOLDER_SYNC.contains(folder.type);
folder.after = EntityFolder.DEFAULT_STANDARD_SYNC;
folder.after = EntityFolder.DEFAULT_SYSTEM_SYNC;
folders.add(folder);
Log.i(Helper.TAG, account.name +
" system=" + folder.name +
" type=" + folder.type + " attr=" + TextUtils.join("," , attrs));
" type=" + folder.type + " attr=" + TextUtils.join(",", attrs));
if (EntityFolder.TYPE_DRAFTS.equals(folder.type))
drafts = true;


+ 1
- 1
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -944,7 +944,7 @@ public class ServiceSynchronize extends LifecycleService {
folder.name = ifolder.getFullName();
folder.type = EntityFolder.TYPE_USER;
folder.synchronize = false;
folder.after = 0;
folder.after = EntityFolder.DEFAULT_USER_SYNC;
dao.insertFolder(folder);
Log.i(Helper.TAG, folder.name + " added");
} else


Loading…
Cancel
Save