Skip to content

Commit

Permalink
feat(android): optimize TiProperties (#13944)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga authored Jan 11, 2024
1 parent d9ae9ba commit e364209
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public TiProperties(Context context, String name, boolean clear)
{
preferences = context.getSharedPreferences(name, Context.MODE_PRIVATE);
if (clear) {
preferences.edit().clear().commit();
preferences.edit().clear().apply();
}
}

Expand Down Expand Up @@ -103,7 +103,7 @@ public void setString(String key, String value)
} else {
editor.putString(key, value);
}
editor.commit();
editor.apply();
}

/**
Expand Down Expand Up @@ -160,7 +160,7 @@ public void setInt(String key, int value)

SharedPreferences.Editor editor = preferences.edit();
editor.putInt(key, value);
editor.commit();
editor.apply();
}

/**
Expand Down Expand Up @@ -208,7 +208,7 @@ public void setDouble(String key, double value)

SharedPreferences.Editor editor = preferences.edit();
editor.putString(key, value + "");
editor.commit();
editor.apply();
}

/**
Expand Down Expand Up @@ -266,7 +266,7 @@ public void setBool(String key, boolean value)

SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean(key, value);
editor.commit();
editor.apply();
}

/**
Expand Down Expand Up @@ -311,7 +311,7 @@ public void setList(String key, String[] value)
}
editor.putInt(key + ".length", value.length);

editor.commit();
editor.apply();
}

/**
Expand Down Expand Up @@ -377,7 +377,7 @@ public void removeProperty(String key)
if (preferences.contains(key)) {
SharedPreferences.Editor editor = preferences.edit();
editor.remove(key);
editor.commit();
editor.apply();
}
}

Expand All @@ -386,7 +386,7 @@ public void removeProperty(String key)
*/
public void removeAllProperties()
{
preferences.edit().clear().commit();
preferences.edit().clear().apply();
}

public static void setSystemProperties(JSONObject prop)
Expand Down

0 comments on commit e364209

Please sign in to comment.