mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
resetTwoWaySyncTimestamps at first run
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
26d7a0111a
commit
a0f14bc778
3 changed files with 19 additions and 0 deletions
|
@ -55,4 +55,7 @@ interface FileDao {
|
|||
"ORDER BY internal_two_way_sync_timestamp DESC"
|
||||
)
|
||||
fun getInternalTwoWaySyncFolders(fileOwner: String): List<FileEntity>
|
||||
|
||||
@Query("UPDATE filelist SET internal_two_way_sync_timestamp = -1 WHERE internal_two_way_sync_timestamp IS NULL OR internal_two_way_sync_timestamp >= 0")
|
||||
fun setInternalTwoWaySyncTimestampToMinusOne()
|
||||
}
|
||||
|
|
|
@ -394,4 +394,7 @@ public interface AppPreferences {
|
|||
|
||||
void setTwoWayInternalSyncStatus(boolean value);
|
||||
boolean getTwoWayInternalSyncStatus();
|
||||
|
||||
void setTwoWaySyncTimestampDefault(boolean value);
|
||||
boolean isTwoWaySyncTimestampDefault();
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ import com.nextcloud.client.account.User;
|
|||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.appinfo.AppInfo;
|
||||
import com.nextcloud.client.core.Clock;
|
||||
import com.nextcloud.client.database.NextcloudDatabase;
|
||||
import com.nextcloud.client.database.dao.FileDao;
|
||||
import com.nextcloud.client.device.PowerManagementService;
|
||||
import com.nextcloud.client.di.ActivityInjector;
|
||||
import com.nextcloud.client.di.AppComponent;
|
||||
|
@ -382,6 +384,17 @@ public class MainApp extends Application implements HasAndroidInjector, NetworkC
|
|||
registerGlobalPassCodeProtection();
|
||||
networkChangeReceiver = new NetworkChangeReceiver(this, connectivityService);
|
||||
registerNetworkChangeReceiver();
|
||||
resetTwoWaySyncTimestamps();
|
||||
}
|
||||
|
||||
private void resetTwoWaySyncTimestamps() {
|
||||
if (preferences.isTwoWaySyncTimestampDefault()) {
|
||||
return;
|
||||
}
|
||||
|
||||
FileDao fileDao = NextcloudDatabase.getInstance(this).fileDao();
|
||||
fileDao.setInternalTwoWaySyncTimestampToMinusOne();
|
||||
preferences.setTwoWaySyncTimestampDefault(true);
|
||||
}
|
||||
|
||||
private final LifecycleEventObserver lifecycleEventObserver = ((lifecycleOwner, event) -> {
|
||||
|
|
Loading…
Reference in a new issue