|
|
@ -94,9 +94,9 @@ public class ActFmPreferenceService extends SyncProviderUtilities {
|
|
|
|
* @return
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static JSONObject userFromModel(RemoteModel model) {
|
|
|
|
public static JSONObject userFromModel(RemoteModel model) {
|
|
|
|
if(model.getValue(RemoteModel.USER_ID_PROPERTY) == 0)
|
|
|
|
if(model.getValue(RemoteModel.USER_ID_PROPERTY) == 0) {
|
|
|
|
return thisUser();
|
|
|
|
return thisUser();
|
|
|
|
else {
|
|
|
|
}else {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return new JSONObject(model.getValue(RemoteModel.USER_JSON_PROPERTY));
|
|
|
|
return new JSONObject(model.getValue(RemoteModel.USER_JSON_PROPERTY));
|
|
|
|
} catch (JSONException e) {
|
|
|
|
} catch (JSONException e) {
|
|
|
@ -118,10 +118,23 @@ public class ActFmPreferenceService extends SyncProviderUtilities {
|
|
|
|
return String.format("%s: %s", updateUser.optString("name"), description);
|
|
|
|
return String.format("%s: %s", updateUser.optString("name"), description);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("nls")
|
|
|
|
|
|
|
|
public synchronized static JSONObject thisUser() {
|
|
|
|
public synchronized static JSONObject thisUser() {
|
|
|
|
if(user == null) {
|
|
|
|
if(user == null) {
|
|
|
|
user = new JSONObject();
|
|
|
|
user = new JSONObject();
|
|
|
|
|
|
|
|
populateUser();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return user;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public synchronized static void reloadThisUser() {
|
|
|
|
|
|
|
|
if (user == null)
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
populateUser();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings("nls")
|
|
|
|
|
|
|
|
private static void populateUser() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
user.put("name", Preferences.getStringValue(PREF_NAME));
|
|
|
|
user.put("name", Preferences.getStringValue(PREF_NAME));
|
|
|
|
user.put("first_name", Preferences.getStringValue(PREF_FIRST_NAME));
|
|
|
|
user.put("first_name", Preferences.getStringValue(PREF_FIRST_NAME));
|
|
|
@ -134,8 +147,6 @@ public class ActFmPreferenceService extends SyncProviderUtilities {
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return user;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean isPremiumUser() {
|
|
|
|
public static boolean isPremiumUser() {
|
|
|
|
return Preferences.getBoolean(PREF_PREMIUM, false);
|
|
|
|
return Preferences.getBoolean(PREF_PREMIUM, false);
|
|
|
|