blob: f9ef9ce4a1fabdb2c22abc1356633630e6b11258 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package it.niedermann.owncloud.notes.persistence.migration;
import android.content.Context;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import androidx.room.migration.Migration;
import androidx.sqlite.db.SupportSQLiteDatabase;
// CS304 issue link : https://github.com/stefan-niedermann/nextcloud-notes/issues/1168
public class Migration_21_22 extends Migration {
@NonNull
private final Context context;
public Migration_21_22(@NonNull Context context) {
super(21, 22);
this.context = context;
}
/**
* Enabling Set backgroundSync to every 15 minutes, and wifiOnly to true
* @param database no use just implement
*/
@Override
public void migrate(@NonNull SupportSQLiteDatabase database) {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("wifiOnly", true);
editor.putString("backgroundSync", "15_minutes");
editor.apply();
}
}
|