fix crashes related to broken excludes parsing

Signed-off-by: androidacy-user <opensource@androidacy.com>
pull/27/head
androidacy-user 2 years ago
parent aa34e36559
commit 1a45f984fe

@ -157,6 +157,7 @@ public class BackgroundUpdateChecker extends Worker {
if (repoModule != null) { if (repoModule != null) {
remoteVersionCode = String.valueOf(repoModule.moduleInfo.versionCode); remoteVersionCode = String.valueOf(repoModule.moduleInfo.versionCode);
} }
if (!version.isEmpty()) {
int localVersionCode = Integer.parseInt(String.valueOf(localModuleInfo.versionCode)); int localVersionCode = Integer.parseInt(String.valueOf(localModuleInfo.versionCode));
int remoteVersionCodeInt = Integer.parseInt(remoteVersionCode); int remoteVersionCodeInt = Integer.parseInt(remoteVersionCode);
int wantsVersion = Integer.parseInt(version.split(":")[1].replaceAll("[^0-9]", "")); int wantsVersion = Integer.parseInt(version.split(":")[1].replaceAll("[^0-9]", ""));
@ -178,6 +179,7 @@ public class BackgroundUpdateChecker extends Worker {
// if it is, we skip it // if it is, we skip it
continue; continue;
} }
}
if (localModuleInfo.updateVersionCode > localModuleInfo.versionCode && !PropUtils.isNullString(localModuleInfo.updateVersion)) { if (localModuleInfo.updateVersionCode > localModuleInfo.versionCode && !PropUtils.isNullString(localModuleInfo.updateVersion)) {
moduleUpdateCount++; moduleUpdateCount++;
updateableModules.put(localModuleInfo.name, localModuleInfo.version); updateableModules.put(localModuleInfo.name, localModuleInfo.version);

@ -156,6 +156,7 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
if (repoModule != null) { if (repoModule != null) {
remoteVersionCode = String.valueOf(repoModule.moduleInfo.versionCode); remoteVersionCode = String.valueOf(repoModule.moduleInfo.versionCode);
} }
if (!version.isEmpty()) {
// now, coerce everything into an int // now, coerce everything into an int
int localVersionCode = Integer.parseInt(String.valueOf(moduleInfo.versionCode)); int localVersionCode = Integer.parseInt(String.valueOf(moduleInfo.versionCode));
int remoteVersionCodeInt = Integer.parseInt(remoteVersionCode); int remoteVersionCodeInt = Integer.parseInt(remoteVersionCode);
@ -178,18 +179,20 @@ public final class ModuleHolder implements Comparable<ModuleHolder> {
// if it is, we skip it // if it is, we skip it
ignoreUpdate = true; ignoreUpdate = true;
} }
}
if (ignoreUpdate) {
Timber.d("Module %s has update, but is ignored", this.moduleId);
return Type.INSTALLABLE;
} else {
MainApplication.getINSTANCE().modulesHaveUpdates = true; MainApplication.getINSTANCE().modulesHaveUpdates = true;
if (!MainApplication.getINSTANCE().updateModules.contains(this.moduleId)) { if (!MainApplication.getINSTANCE().updateModules.contains(this.moduleId)) {
MainApplication.getINSTANCE().updateModules.add(this.moduleId); MainApplication.getINSTANCE().updateModules.add(this.moduleId);
MainApplication.getINSTANCE().updateModuleCount++; MainApplication.getINSTANCE().updateModuleCount++;
} }
Timber.d("modulesHaveUpdates = %s, updateModuleCount = %s", MainApplication.getINSTANCE().modulesHaveUpdates, MainApplication.getINSTANCE().updateModuleCount); Timber.d("modulesHaveUpdates = %s, updateModuleCount = %s", MainApplication.getINSTANCE().modulesHaveUpdates, MainApplication.getINSTANCE().updateModuleCount);
if (ignoreUpdate) {
Timber.d("Module %s has update, but is ignored", this.moduleId);
return Type.INSTALLABLE;
}
Timber.d("Module %s has update", this.moduleId); Timber.d("Module %s has update", this.moduleId);
return Type.UPDATABLE; return Type.UPDATABLE;
}
} else { } else {
return Type.INSTALLED; return Type.INSTALLED;
} }

@ -671,8 +671,9 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
EditText editText = (EditText) layout.getChildAt(i); EditText editText = (EditText) layout.getChildAt(i);
String text = editText.getText().toString(); String text = editText.getText().toString();
if (!text.isEmpty()) { if (!text.isEmpty()) {
// text can only contain numbers // text can only contain numbers and the characters ^ and $
text = text.replaceAll("[^0-9]", ""); // so we remove all non-numbers and non ^ and $
text = text.replaceAll("[^0-9^$]", "");
// we have to use module id even though we show name // we have to use module id even though we show name
stringSetTemp.add(localModuleInfos.stream().filter(localModuleInfo -> localModuleInfo.name.equals(editText.getHint().toString())).findFirst().orElse(null).id + ":" + text); stringSetTemp.add(localModuleInfos.stream().filter(localModuleInfo -> localModuleInfo.name.equals(editText.getHint().toString())).findFirst().orElse(null).id + ":" + text);
Timber.d("text is %s for %s", text, editText.getHint().toString()); Timber.d("text is %s for %s", text, editText.getHint().toString());

Loading…
Cancel
Save