|
@@ -28,11 +28,13 @@ import android.content.Context;
|
|
|
import android.content.SharedPreferences;
|
|
|
import android.content.res.Configuration;
|
|
|
|
|
|
+import com.google.common.reflect.TypeToken;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.nextcloud.appReview.AppReviewShownModel;
|
|
|
import com.nextcloud.client.account.User;
|
|
|
import com.nextcloud.client.account.UserAccountManager;
|
|
|
import com.nextcloud.client.account.UserAccountManagerImpl;
|
|
|
+import com.nextcloud.client.jobs.LogEntry;
|
|
|
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
|
|
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
|
|
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
|
@@ -41,6 +43,8 @@ import com.owncloud.android.ui.activity.PassCodeActivity;
|
|
|
import com.owncloud.android.ui.activity.SettingsActivity;
|
|
|
import com.owncloud.android.utils.FileSortOrder;
|
|
|
|
|
|
+import java.lang.reflect.Type;
|
|
|
+import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.CopyOnWriteArraySet;
|
|
|
|
|
@@ -108,6 +112,8 @@ public final class AppPreferencesImpl implements AppPreferences {
|
|
|
private static final String PREF__STORAGE_PERMISSION_REQUESTED = "storage_permission_requested";
|
|
|
private static final String PREF__IN_APP_REVIEW_DATA = "in_app_review_data";
|
|
|
|
|
|
+ private static final String LOG_ENTRY = "log_entry";
|
|
|
+
|
|
|
private final Context context;
|
|
|
private final SharedPreferences preferences;
|
|
|
private final UserAccountManager userAccountManager;
|
|
@@ -499,6 +505,21 @@ public final class AppPreferencesImpl implements AppPreferences {
|
|
|
return preferences.getInt(AUTO_PREF__LAST_SEEN_VERSION_CODE, 0);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void saveLogEntry(List<LogEntry> logEntryList) {
|
|
|
+ Gson gson = new Gson();
|
|
|
+ String json = gson.toJson(logEntryList);
|
|
|
+ preferences.edit().putString(LOG_ENTRY, json).apply();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<LogEntry> readLogEntry() {
|
|
|
+ String json = preferences.getString(LOG_ENTRY, null);
|
|
|
+ Gson gson = new Gson();
|
|
|
+ Type listType = new TypeToken<List<LogEntry>>() {}.getType();
|
|
|
+ return gson.fromJson(json, listType);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void setLastSeenVersionCode(int versionCode) {
|
|
|
preferences.edit().putInt(AUTO_PREF__LAST_SEEN_VERSION_CODE, versionCode).apply();
|