mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-06 03:49:58 +02:00
set single-device on profile-creation, assume multi-device when we go a hint
This commit is contained in:
parent
29b1c1e493
commit
89a4eb9538
6 changed files with 20 additions and 0 deletions
|
@ -236,6 +236,19 @@ public class DcContext {
|
||||||
return getConfigInt("is_chatmail") == 1;
|
return getConfigInt("is_chatmail") == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called for new profiles on chatmail servers that are "single device" initially;
|
||||||
|
// to save server disk space, we make use of that delete all messages immediately after download.
|
||||||
|
public void assumeSingleDevice() {
|
||||||
|
setConfigInt("delete_server_after", 1 /*at once*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when we get a hint that another device may be set up.
|
||||||
|
public void assumeMultiDevice() {
|
||||||
|
if (getConfigInt("delete_server_after") == 1 /*at once*/) {
|
||||||
|
setConfigInt("delete_server_after", 0 /*never/automatic*/);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if at least one chat has location streaming enabled
|
* @return true if at least one chat has location streaming enabled
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -481,6 +481,9 @@ public class InstantOnboardingActivity extends BaseActionBarActivity implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DcHelper.getAccounts(this).stopIo();
|
DcHelper.getAccounts(this).stopIo();
|
||||||
|
if (!isDcLogin) {
|
||||||
|
dcContext.assumeSingleDevice();
|
||||||
|
}
|
||||||
dcContext.configure();
|
dcContext.configure();
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,6 +369,7 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen
|
||||||
else if (progress==1000/*done*/) {
|
else if (progress==1000/*done*/) {
|
||||||
DcHelper.getAccounts(this).startIo();
|
DcHelper.getAccounts(this).startIo();
|
||||||
progressSuccess();
|
progressSuccess();
|
||||||
|
dcContext.assumeMultiDevice();
|
||||||
notificationController.close();
|
notificationController.close();
|
||||||
cleanupTempBackupFile();
|
cleanupTempBackupFile();
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,7 @@ public abstract class ListSummaryPreferenceFragment extends CorrectedPreferenceF
|
||||||
protected void startImexInner(int accountId, int what, String imexPath, String pathAsDisplayedToUser)
|
protected void startImexInner(int accountId, int what, String imexPath, String pathAsDisplayedToUser)
|
||||||
{
|
{
|
||||||
DcContext dcContext = DcHelper.getAccounts(getActivity()).getAccount(accountId);
|
DcContext dcContext = DcHelper.getAccounts(getActivity()).getAccount(accountId);
|
||||||
|
dcContext.assumeMultiDevice();
|
||||||
this.pathAsDisplayedToUser = pathAsDisplayedToUser;
|
this.pathAsDisplayedToUser = pathAsDisplayedToUser;
|
||||||
progressWhat = what;
|
progressWhat = what;
|
||||||
dcContext.imex(progressWhat, imexPath);
|
dcContext.imex(progressWhat, imexPath);
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class BackupProviderFragment extends Fragment implements DcEventCenter.Dc
|
||||||
progressBar.setIndeterminate(true);
|
progressBar.setIndeterminate(true);
|
||||||
|
|
||||||
dcContext = DcHelper.getContext(getActivity());
|
dcContext = DcHelper.getContext(getActivity());
|
||||||
|
dcContext.assumeMultiDevice();
|
||||||
DcHelper.getEventCenter(getActivity()).addObserver(DcContext.DC_EVENT_IMEX_PROGRESS, this);
|
DcHelper.getEventCenter(getActivity()).addObserver(DcContext.DC_EVENT_IMEX_PROGRESS, this);
|
||||||
|
|
||||||
prepareThread = new Thread(() -> {
|
prepareThread = new Thread(() -> {
|
||||||
|
|
|
@ -94,6 +94,7 @@ public class BackupReceiverFragment extends Fragment implements DcEventCenter.Dc
|
||||||
} else if (permille == 1000) {
|
} else if (permille == 1000) {
|
||||||
getTransferActivity().setTransferState(BackupTransferActivity.TransferState.TRANSFER_SUCCESS);
|
getTransferActivity().setTransferState(BackupTransferActivity.TransferState.TRANSFER_SUCCESS);
|
||||||
getTransferActivity().doFinish();
|
getTransferActivity().doFinish();
|
||||||
|
dcContext.assumeMultiDevice();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue