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) {
remoteVersionCode = String.valueOf(repoModule.moduleInfo.versionCode);
}
if (!version.isEmpty()) {
int localVersionCode = Integer.parseInt(String.valueOf(localModuleInfo.versionCode));
int remoteVersionCodeInt = Integer.parseInt(remoteVersionCode);
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
continue;
}
}
if (localModuleInfo.updateVersionCode > localModuleInfo.versionCode && !PropUtils.isNullString(localModuleInfo.updateVersion)) {
moduleUpdateCount++;
updateableModules.put(localModuleInfo.name, localModuleInfo.version);

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

@ -671,8 +671,9 @@ public class SettingsActivity extends FoxActivity implements LanguageActivity {
EditText editText = (EditText) layout.getChildAt(i);
String text = editText.getText().toString();
if (!text.isEmpty()) {
// text can only contain numbers
text = text.replaceAll("[^0-9]", "");
// text can only contain numbers and the characters ^ and $
// 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
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());

Loading…
Cancel
Save