migrate more to using realm

it might crash but hey at least it builds right

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/277/head
androidacy-user 1 year ago
parent 2a45502d91
commit 21da75c3fc

@ -4,10 +4,12 @@ import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.fox2code.mmm.BuildConfig;
import com.fox2code.mmm.MainApplication;
@ -19,6 +21,7 @@ import com.fox2code.mmm.repo.RepoModule;
import com.fox2code.mmm.utils.io.Http;
import com.fox2code.mmm.utils.io.HttpException;
import com.fox2code.mmm.utils.io.PropUtils;
import com.fox2code.mmm.utils.realm.ReposList;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.topjohnwu.superuser.Shell;
@ -37,15 +40,15 @@ import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import io.realm.Realm;
import io.realm.RealmConfiguration;
import okhttp3.HttpUrl;
@SuppressWarnings("KotlinInternalInJava")
public final class AndroidacyRepoData extends RepoData {
public static String token = MainApplication.getINSTANCE().getSharedPreferences("androidacy", 0).getString("pref_androidacy_api_token", null);
public SharedPreferences cachedPreferences = MainApplication.getINSTANCE().getSharedPreferences("androidacy", 0);
private static final String TAG = "AndroidacyRepoData";
public static String token = MainApplication.getINSTANCE().getSharedPreferences("androidacy", 0).getString("pref_androidacy_api_token", null);
static {
HttpUrl.Builder OK_HTTP_URL_BUILDER = new HttpUrl.Builder().scheme("https");
@ -56,27 +59,18 @@ public final class AndroidacyRepoData extends RepoData {
@SuppressWarnings("unused")
public final String ClientID = BuildConfig.ANDROIDACY_CLIENT_ID;
private final boolean testMode;
private final String host;
public SharedPreferences cachedPreferences = MainApplication.getINSTANCE().getSharedPreferences("androidacy", 0);
public String memberLevel;
// Avoid spamming requests to Androidacy
private long androidacyBlockade = 0;
public AndroidacyRepoData(File cacheRoot, SharedPreferences cachedPreferences, boolean testMode) {
super(testMode ? RepoManager.ANDROIDACY_TEST_MAGISK_REPO_ENDPOINT : RepoManager.ANDROIDACY_MAGISK_REPO_ENDPOINT, cacheRoot, cachedPreferences);
// make sure the modules.json exists
File modulesJson = new File(cacheRoot, "modules.json");
if (!modulesJson.exists()) {
try {
if (!modulesJson.createNewFile()) {
throw new IOException("Failed to create modules.json");
}
} catch (
IOException e) {
e.printStackTrace();
}
}
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name("ModuleListCache.realm").allowWritesOnUiThread(true).allowWritesOnUiThread(true).directory(cacheRoot).build();
Realm.setDefaultConfiguration(realmConfiguration);
Realm.getInstance(realmConfiguration);
this.defaultName = "Androidacy Modules Repo";
this.defaultWebsite = RepoManager.ANDROIDACY_MAGISK_REPO_HOMEPAGE;
this.defaultSupport = "https://t.me/androidacy_discussions";
@ -86,6 +80,7 @@ public final class AndroidacyRepoData extends RepoData {
this.testMode = testMode;
}
@RequiresApi(api = Build.VERSION_CODES.N)
public static AndroidacyRepoData getInstance() {
return RepoManager.getINSTANCE().getAndroidacyRepoData();
}
@ -187,6 +182,23 @@ public final class AndroidacyRepoData extends RepoData {
@SuppressLint("RestrictedApi")
@Override
protected boolean prepare() throws NoSuchAlgorithmException {
// insert metadata into database
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name("ReposListCache.realm").allowWritesOnUiThread(true).allowWritesOnUiThread(true).directory(cacheRoot).build();
Realm realm = Realm.getInstance(realmConfiguration);
realm.beginTransaction();
ReposList repo = realm.where(ReposList.class).equalTo("id", this.id).findFirst();
if (repo == null) {
repo = realm.createObject(ReposList.class, this.id);
}
repo.setName(this.defaultName);
repo.setWebsite(this.defaultWebsite);
repo.setSupport(this.defaultSupport);
repo.setDonate(this.defaultDonate);
repo.setSubmitModule(this.defaultSubmitModule);
repo.setLastUpdate(0);
// close realm
realm.commitTransaction();
realm.close();
// If ANDROIDACY_CLIENT_ID is not set or is empty, disable this repo and return
if (Objects.equals(BuildConfig.ANDROIDACY_CLIENT_ID, "")) {
SharedPreferences.Editor editor = MainApplication.getSharedPreferences().edit();

@ -15,6 +15,8 @@ import com.fox2code.mmm.XRepo;
import com.fox2code.mmm.manager.ModuleInfo;
import com.fox2code.mmm.utils.io.Files;
import com.fox2code.mmm.utils.io.PropUtils;
import com.fox2code.mmm.utils.realm.ModuleListCache;
import com.fox2code.mmm.utils.realm.ReposList;
import org.json.JSONArray;
import org.json.JSONException;
@ -22,62 +24,111 @@ import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import io.realm.Realm;
import io.realm.RealmConfiguration;
public class RepoData extends XRepo {
public final String url;
public final String id;
public final File cacheRoot;
public final SharedPreferences cachedPreferences;
public final File metaDataCache;
public JSONObject metaDataCache;
public final HashMap<String, RepoModule> moduleHashMap;
private final Object populateLock = new Object();
public long lastUpdate;
public String name, website, support, donate, submitModule;
public JSONObject supportedProperties = new JSONObject();
protected String defaultName, defaultWebsite, defaultSupport, defaultDonate, defaultSubmitModule;
// array with module info default values
// supported properties for a module
//id=<string>
//name=<string>
//version=<string>
//versionCode=<int>
//author=<string>
//description=<string>
//minApi=<int>
//maxApi=<int>
//minMagisk=<int>
//needRamdisk=<boolean>
//support=<url>
//donate=<url>
//config=<package>
//changeBoot=<boolean>
//mmtReborn=<boolean>
// extra properties only useful for the database
//repoId=<string>
//installed=<boolean>
//installedVersionCode=<int> (only if installed)
private boolean forceHide, enabled; // Cache for speed
public RepoData(String url, File cacheRoot, SharedPreferences cachedPreferences) {
// setup supportedProperties
try {
supportedProperties.put("id", "");
supportedProperties.put("name", "");
supportedProperties.put("version", "");
supportedProperties.put("versionCode", "");
supportedProperties.put("author", "");
supportedProperties.put("description", "");
supportedProperties.put("minApi", "");
supportedProperties.put("maxApi", "");
supportedProperties.put("minMagisk", "");
supportedProperties.put("needRamdisk", "");
supportedProperties.put("support", "");
supportedProperties.put("donate", "");
supportedProperties.put("config", "");
supportedProperties.put("changeBoot", "");
supportedProperties.put("mmtReborn", "");
supportedProperties.put("repoId", "");
supportedProperties.put("installed", "");
supportedProperties.put("installedVersionCode", "");
} catch (JSONException e) {
e.printStackTrace();
}
this.url = url;
this.id = RepoManager.internalIdOfUrl(url);
this.cacheRoot = cacheRoot;
this.cachedPreferences = cachedPreferences;
this.metaDataCache = new File(cacheRoot, "modules.json");
// metadata cache is a realm database from ModuleListCache
this.metaDataCache = null;
this.moduleHashMap = new HashMap<>();
this.defaultName = url; // Set url as default name
this.forceHide = AppUpdateManager.shouldForceHide(this.id);
this.enabled = (!this.forceHide) && MainApplication.getSharedPreferences().getBoolean("pref_" + this.getPreferenceId() + "_enabled", true);
this.defaultWebsite = "https://" + Uri.parse(url).getHost() + "/";
if (!this.cacheRoot.isDirectory()) {
boolean mkdirs = this.cacheRoot.mkdirs();
if (!mkdirs) {
throw new RuntimeException("Failed to create cache directory");
}
} else {
if (this.metaDataCache.exists()) {
this.lastUpdate = metaDataCache.lastModified();
if (this.lastUpdate > System.currentTimeMillis()) {
this.lastUpdate = 0; // Don't allow time travel
}
try {
List<RepoModule> modules = this.populate(new JSONObject(new String(Files.read(this.metaDataCache), StandardCharsets.UTF_8)));
for (RepoModule repoModule : modules) {
if (!this.tryLoadMetadata(repoModule)) {
repoModule.moduleInfo.flags &= ~ModuleInfo.FLAG_METADATA_INVALID;
}
}
} catch (
Exception e) {
boolean delete = this.metaDataCache.delete();
if (!delete) {
throw new RuntimeException("Failed to delete invalid cache file");
}
}
// open realm database
// load metadata from realm database
if (this.enabled) {
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name("ModuleListCache.realm").allowQueriesOnUiThread(true).allowWritesOnUiThread(true).directory(cacheRoot).build();
// load metadata from realm database
Realm.getInstance(realmConfiguration);
this.metaDataCache = ModuleListCache.getRepoModulesAsJson(this.id);
// load repo metadata from ReposList unless it's a built-in repo
if (RepoManager.isBuiltInRepo(this.id)) {
this.name = this.defaultName;
this.website = this.defaultWebsite;
this.support = this.defaultSupport;
this.donate = this.defaultDonate;
this.submitModule = this.defaultSubmitModule;
} else {
// get everything from ReposList realm database
RealmConfiguration realmConfiguration2 = new RealmConfiguration.Builder().name("ReposList.realm").allowQueriesOnUiThread(true).allowWritesOnUiThread(true).directory(cacheRoot).build();
// load metadata from realm database
Realm.getInstance(realmConfiguration2);
this.name = ReposList.getRepo(this.id).getName();
this.website = ReposList.getRepo(this.id).getWebsite();
this.support = ReposList.getRepo(this.id).getSupport();
this.donate = ReposList.getRepo(this.id).getDonate();
this.submitModule = ReposList.getRepo(this.id).getSubmitModule();
}
}
}
@ -225,7 +276,8 @@ public class RepoData extends XRepo {
@Override
public void setEnabled(boolean enabled) {
this.enabled = enabled && !this.forceHide;
if (BuildConfig.DEBUG) { Log.d("RepoData", "Repo " + this.id + " enabled: " + this.enabled + " (forced: " + this.forceHide + ") with preferenceID: " + this.getPreferenceId());
if (BuildConfig.DEBUG) {
Log.d("RepoData", "Repo " + this.id + " enabled: " + this.enabled + " (forced: " + this.forceHide + ") with preferenceID: " + this.getPreferenceId());
}
MainApplication.getSharedPreferences().edit().putBoolean("pref_" + this.getPreferenceId() + "_enabled", enabled).apply();
}
@ -236,7 +288,8 @@ public class RepoData extends XRepo {
return;
}
this.forceHide = AppUpdateManager.shouldForceHide(this.id);
if (BuildConfig.DEBUG) { Log.d("RepoData", "Repo " + this.id + " update enabled: " + this.enabled + " (forced: " + this.forceHide + ") with preferenceID: " + this.getPreferenceId());
if (BuildConfig.DEBUG) {
Log.d("RepoData", "Repo " + this.id + " update enabled: " + this.enabled + " (forced: " + this.forceHide + ") with preferenceID: " + this.getPreferenceId());
}
this.enabled = (!this.forceHide) && MainApplication.getSharedPreferences().getBoolean("pref_" + this.getPreferenceId() + "_enabled", true);
}

@ -4,12 +4,14 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.fox2code.mmm.BuildConfig;
import com.fox2code.mmm.MainActivity;
@ -63,6 +65,7 @@ public final class RepoManager extends SyncManager {
private boolean initialized;
private boolean repoLastSuccess;
@RequiresApi(api = Build.VERSION_CODES.N)
private RepoManager(MainApplication mainApplication) {
INSTANCE = this; // Set early fox XHooks
this.initialized = false;
@ -89,6 +92,7 @@ public final class RepoManager extends SyncManager {
this.initialized = true;
}
@RequiresApi(api = Build.VERSION_CODES.N)
public static RepoManager getINSTANCE() {
if (INSTANCE == null || !INSTANCE.initialized) {
synchronized (lock) {
@ -106,6 +110,7 @@ public final class RepoManager extends SyncManager {
return INSTANCE;
}
@RequiresApi(api = Build.VERSION_CODES.N)
public static RepoManager getINSTANCE_UNSAFE() {
if (INSTANCE == null) {
synchronized (lock) {
@ -156,6 +161,7 @@ public final class RepoManager extends SyncManager {
return INSTANCE != null && INSTANCE.androidacyRepoData != null && INSTANCE.androidacyRepoData.isEnabled();
}
@RequiresApi(api = Build.VERSION_CODES.N)
@SuppressWarnings("StatementWithEmptyBody")
private void populateDefaultCache(RepoData repoData) {
for (RepoModule repoModule : repoData.moduleHashMap.values()) {
@ -185,10 +191,12 @@ public final class RepoManager extends SyncManager {
return this.repoData.get(url);
}
@RequiresApi(api = Build.VERSION_CODES.N)
public RepoData addOrGet(String url) {
return this.addOrGet(url, null);
}
@RequiresApi(api = Build.VERSION_CODES.N)
public RepoData addOrGet(String url, String fallBackName) {
if (MAGISK_ALT_REPO_JSDELIVR.equals(url))
url = MAGISK_ALT_REPO;
@ -211,6 +219,8 @@ public final class RepoManager extends SyncManager {
return repoData;
}
@SuppressWarnings("StatementWithEmptyBody")
@RequiresApi(api = Build.VERSION_CODES.N)
@SuppressLint("StringFormatInvalid")
protected void scanInternal(@NonNull UpdateListener updateListener) {
// Refuse to start if first_launch is not false in shared preferences
@ -378,9 +388,10 @@ public final class RepoManager extends SyncManager {
return this.hasInternet;
}
@RequiresApi(api = Build.VERSION_CODES.N)
private RepoData addRepoData(String url, String fallBackName) {
String id = internalIdOfUrl(url);
File cacheRoot = new File(this.mainApplication.getCacheDir(), id);
File cacheRoot = new File(this.mainApplication.getDataDir(), id);
SharedPreferences sharedPreferences = this.mainApplication.getSharedPreferences("mmm_" + id, Context.MODE_PRIVATE);
RepoData repoData = id.startsWith("repo_") ? new CustomRepoData(url, cacheRoot, sharedPreferences) : new RepoData(url, cacheRoot, sharedPreferences);
if (fallBackName != null && !fallBackName.isEmpty()) {
@ -404,8 +415,10 @@ public final class RepoManager extends SyncManager {
return repoData;
}
@RequiresApi(api = Build.VERSION_CODES.N)
private AndroidacyRepoData addAndroidacyRepoData() {
File cacheRoot = new File(this.mainApplication.getCacheDir(), "androidacy_repo");
// cache dir is actually under app data
File cacheRoot = new File(this.mainApplication.getDataDir(), "androidacy_repo");
SharedPreferences sharedPreferences = this.mainApplication.getSharedPreferences("mmm_androidacy_repo", Context.MODE_PRIVATE);
AndroidacyRepoData repoData = new AndroidacyRepoData(cacheRoot, sharedPreferences, MainApplication.isAndroidacyTestMode());
this.repoData.put(ANDROIDACY_MAGISK_REPO_ENDPOINT, repoData);

@ -1,20 +1,25 @@
package com.fox2code.mmm.repo;
import android.os.Build;
import android.util.Log;
import com.fox2code.mmm.BuildConfig;
import com.fox2code.mmm.utils.io.Files;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import com.fox2code.mmm.utils.io.Http;
import com.fox2code.mmm.utils.realm.ModuleListCache;
import org.json.JSONObject;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import io.realm.Realm;
import io.realm.RealmConfiguration;
public class RepoUpdater {
private static final String TAG = "RepoUpdater";
public final RepoData repoData;
@ -26,6 +31,7 @@ public class RepoUpdater {
this.repoData = repoData;
}
@RequiresApi(api = Build.VERSION_CODES.N)
public int fetchIndex() {
if (!RepoManager.getINSTANCE().hasConnectivity()) {
this.indexRaw = null;
@ -79,12 +85,134 @@ public class RepoUpdater {
}
if (this.indexRaw != null) {
try {
Files.write(this.repoData.metaDataCache, this.indexRaw);
if (BuildConfig.DEBUG) {
Log.d(TAG, "Wrote index of " + this.repoData.id);
// iterate over modules, using this.supportedProperties as a template to attempt to get each property from the module. everything that is not null is added to the module
// use realm to insert to
// props avail:
//
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder().name("ModuleListCache.realm").schemaVersion(1).deleteRealmIfMigrationNeeded().build();
// array with module info default values
// supported properties for a module
//id=<string>
//name=<string>
//version=<string>
//versionCode=<int>
//author=<string>
//description=<string>
//minApi=<int>
//maxApi=<int>
//minMagisk=<int>
//needRamdisk=<boolean>
//support=<url>
//donate=<url>
//config=<package>
//changeBoot=<boolean>
//mmtReborn=<boolean>
// extra properties only useful for the database
//repoId=<string>
//installed=<boolean>
//installedVersionCode=<int> (only if installed)
//
// all except first six can be null
for (JSONObject module : new JSONObject[]{new JSONObject(new String(this.indexRaw, StandardCharsets.UTF_8))}) {
// get module id
String id = module.getString("id");
// get module name
String name = module.getString("name");
// get module version
String version = module.getString("version");
// get module version code
int versionCode = module.getInt("versionCode");
// get module author
String author = module.getString("author");
// get module description
String description = module.getString("description");
// get module min api
int minApi = module.getInt("minApi");
// get module max api
int maxApi = module.getInt("maxApi");
// get module min magisk
int minMagisk = module.getInt("minMagisk");
// get module need ramdisk
boolean needRamdisk = module.getBoolean("needRamdisk");
// get module support
String support = module.getString("support");
// get module donate
String donate = module.getString("donate");
// get module config
String config = module.getString("config");
// get module change boot
boolean changeBoot = module.getBoolean("changeBoot");
// get module mmt reborn
boolean mmtReborn = module.getBoolean("mmtReborn");
// get module repo id
String repoId = this.repoData.id;
// get module installed
boolean installed = false;
// get module installed version code
int installedVersionCode = 0;
// insert module to realm
// first create a collection of all the properties
// then insert to realm
// then commit
// then close
Realm.getInstanceAsync(realmConfiguration, new Realm.Callback() {
@Override
public void onSuccess(@NonNull Realm realm) {
realm.executeTransactionAsync(r -> {
// create a new module
ModuleListCache moduleListCache = r.createObject(ModuleListCache.class);
// set module id
moduleListCache.setId(id);
// set module name
moduleListCache.setName(name);
// set module version
moduleListCache.setVersion(version);
// set module version code
moduleListCache.setVersionCode(versionCode);
// set module author
moduleListCache.setAuthor(author);
// set module description
moduleListCache.setDescription(description);
// set module min api
moduleListCache.setMinApi(minApi);
// set module max api
moduleListCache.setMaxApi(maxApi);
// set module min magisk
moduleListCache.setMinMagisk(minMagisk);
// set module need ramdisk
moduleListCache.setNeedRamdisk(needRamdisk);
// set module support
moduleListCache.setSupport(support);
// set module donate
moduleListCache.setDonate(donate);
// set module config
moduleListCache.setConfig(config);
// set module change boot
moduleListCache.setChangeBoot(changeBoot);
// set module mmt reborn
moduleListCache.setMmtReborn(mmtReborn);
// set module repo id
moduleListCache.setRepoId(repoId);
// set module installed
moduleListCache.setInstalled(installed);
// set module installed version code
moduleListCache.setInstalledVersionCode(installedVersionCode);
}, () -> {
// Transaction was a success.
Log.d(TAG, "onSuccess: Transaction was a success.");
// close realm
realm.close();
}, error -> {
// Transaction failed and was automatically canceled.
Log.e(TAG, "onError: Transaction failed and was automatically canceled.", error);
// close realm
realm.close();
});
}
});
}
} catch (
IOException e) {
Exception e) {
e.printStackTrace();
}
this.indexRaw = null;
@ -93,4 +221,5 @@ public class RepoUpdater {
this.toApply = null;
return success;
}
}

@ -11,27 +11,6 @@ import io.realm.annotations.Required;
@SuppressWarnings("unused")
public class ModuleListCache extends RealmObject {
// supported properties for a module
//id=<string>
//name=<string>
//version=<string>
//versionCode=<int>
//author=<string>
//description=<string>
//minApi=<int>
//maxApi=<int>
//minMagisk=<int>
//needRamdisk=<boolean>
//support=<url>
//donate=<url>
//config=<package>
//changeBoot=<boolean>
//mmtReborn=<boolean>
// extra properties only useful for the database
//repoId=<string>
//installed=<boolean>
//installedVersionCode=<int> (only if installed)
// for compatibility, only id is required
@PrimaryKey
@Required
@ -53,8 +32,9 @@ public class ModuleListCache extends RealmObject {
private String repoId;
private boolean installed;
private int installedVersionCode;
private int lastUpdate;
public ModuleListCache(String id, String name, String version, int versionCode, String author, String description, int minApi, int maxApi, int minMagisk, boolean needRamdisk, String support, String donate, String config, boolean changeBoot, boolean mmtReborn, String repoId, boolean installed, int installedVersionCode) {
public ModuleListCache(String id, String name, String version, int versionCode, String author, String description, int minApi, int maxApi, int minMagisk, boolean needRamdisk, String support, String donate, String config, boolean changeBoot, boolean mmtReborn, String repoId, boolean installed, int installedVersionCode, int lastUpdate) {
this.id = id;
this.name = name;
this.version = version;
@ -73,6 +53,7 @@ public class ModuleListCache extends RealmObject {
this.repoId = repoId;
this.installed = installed;
this.installedVersionCode = installedVersionCode;
this.lastUpdate = lastUpdate;
}
public ModuleListCache() {
@ -239,6 +220,14 @@ public class ModuleListCache extends RealmObject {
this.id = id;
}
public int getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(int lastUpdate) {
this.lastUpdate = lastUpdate;
}
private JSONObject toJson() {
JSONObject jsonObject = new JSONObject();
try {
@ -264,4 +253,12 @@ public class ModuleListCache extends RealmObject {
}
return jsonObject;
}
public RealmResults<ModuleListCache> getModules() {
// return all modules matching the repo id
Realm realm = Realm.getDefaultInstance();
RealmResults<ModuleListCache> modules = realm.where(ModuleListCache.class).equalTo("repoId", repoId).findAll();
realm.close();
return modules;
}
}

@ -1,5 +1,6 @@
package com.fox2code.mmm.utils.realm;
import io.realm.Realm;
import io.realm.RealmObject;
import io.realm.annotations.Required;
@ -15,6 +16,10 @@ public class ReposList extends RealmObject {
private boolean enabled;
private String donate;
private String support;
private String submitModule;
private int lastUpdate;
private String website;
private String name;
public ReposList(String id, String url, boolean enabled, String donate, String support) {
this.id = id;
@ -22,6 +27,8 @@ public class ReposList extends RealmObject {
this.enabled = enabled;
this.donate = donate;
this.support = support;
this.submitModule = null;
this.lastUpdate = 0;
}
public ReposList() {
@ -66,4 +73,44 @@ public class ReposList extends RealmObject {
public void setSupport(String support) {
this.support = support;
}
// get metadata for a repo
public static ReposList getRepo(String id) {
Realm realm = Realm.getDefaultInstance();
ReposList repo = realm.where(ReposList.class).equalTo("id", id).findFirst();
realm.close();
return repo;
}
public String getSubmitModule() {
return submitModule;
}
public void setSubmitModule(String submitModule) {
this.submitModule = submitModule;
}
public int getLastUpdate() {
return lastUpdate;
}
public void setLastUpdate(int lastUpdate) {
this.lastUpdate = lastUpdate;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getWebsite() {
return website;
}
public void setWebsite(String website) {
this.website = website;
}
}

Loading…
Cancel
Save