Set default seven days to sync for user folders

Sync of user folders is disabled by default
pull/30/head
M66B 6 years ago
parent f7f3e01b55
commit b0d8bc9c10

@ -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,

@ -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;

@ -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