chore: merge branch dev to main (#280)

This commit is contained in:
oSumAtrIX 2023-01-07 14:41:14 +01:00 committed by GitHub
commit e833d16bb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 8 deletions

View File

@ -1,3 +1,10 @@
## [0.92.2-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.92.1...v0.92.2-dev.1) (2023-01-07)
### Bug Fixes
* load numeric preferences as type String ([212d3a7](https://github.com/revanced/revanced-integrations/commit/212d3a72d879189c061fb77805cda81ca0519495))
## [0.92.1](https://github.com/revanced/revanced-integrations/compare/v0.92.0...v0.92.1) (2023-01-07)

View File

@ -280,7 +280,7 @@ public enum SettingsEnum {
private static void load() {
Context context = ReVancedUtils.getContext();
if (context == null) {
Log.e("revanced: SettingsEnum", "Context returned null! Setings NOT initialized");
LogHelper.printException(() -> "SettingsEnum.load() called before ReVancedUtils.init()");
return;
}
for (SettingsEnum setting : values()) {

View File

@ -34,17 +34,36 @@ public class SharedPrefHelper {
return getPreferences(prefName).getBoolean(key, _default);
}
public static long getLong(SharedPrefNames prefName, String key, long _default) {
return getPreferences(prefName).getLong(key, _default);
// region Hack, unknown why required
public static Long getLong(SharedPrefNames prefName, String key, Long _default) {
SharedPreferences sharedPreferences = getPreferences(prefName);
try {
return Long.valueOf(sharedPreferences.getString(key, _default + ""));
} catch (ClassCastException ex) {
return sharedPreferences.getLong(key, _default);
}
}
public static float getFloat(SharedPrefNames prefName, String key, float _default) {
return getPreferences(prefName).getFloat(key, _default);
public static Float getFloat(SharedPrefNames prefName, String key, Float _default) {
SharedPreferences sharedPreferences = getPreferences(prefName);
try {
return Float.valueOf(sharedPreferences.getString(key, _default + ""));
} catch (ClassCastException ex) {
return sharedPreferences.getFloat(key, _default);
}
}
public static int getInt(SharedPrefNames prefName, String key, int _default) {
return getPreferences(prefName).getInt(key, _default);
public static Integer getInt(SharedPrefNames prefName, String key, Integer _default) {
SharedPreferences sharedPreferences = getPreferences(prefName);
try {
return Integer.valueOf(sharedPreferences.getString(key, _default + ""));
} catch (ClassCastException ex) {
return sharedPreferences.getInt(key, _default);
}
}
// endregion
public static SharedPreferences getPreferences(SharedPrefNames name) {
return Objects.requireNonNull(ReVancedUtils.getContext()).getSharedPreferences(name.getName(), Context.MODE_PRIVATE);

View File

@ -1,3 +1,3 @@
org.gradle.jvmargs = -Xmx2048m
android.useAndroidX = true
version = 0.92.1
version = 0.92.2-dev.1