public static Configuration load(SharedPreferences prefs) { String json = prefs.getString(Constants.PREF_KEY_APP_CONFIG_JSON, null); try { if (json != null) { return new Configuration(json); } } catch (JSONException e) { ApptentiveLog.e(e, "Error loading Configuration from SharedPreferences."); logException(e); } return new Configuration(); }
public boolean isMessageCenterEnabled() { return getBoolean(KEY_MESSAGE_CENTER_ENABLED, Constants.CONFIG_DEFAULT_MESSAGE_CENTER_ENABLED); }
public boolean hasConfigurationCacheExpired() { return getConfigurationCacheExpirationMillis() < System.currentTimeMillis(); }
public long getConfigurationCacheExpirationMillis() { try { if (!isNull(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS)) { return getLong(KEY_CONFIGURATION_CACHE_EXPIRATION_MILLIS); } } catch (JSONException e) { logException(e); } return Constants.CONFIG_DEFAULT_APP_CONFIG_EXPIRATION_MILLIS; }
private JSONObject getMessageCenter() { try { if (!isNull(KEY_MESSAGE_CENTER)) { return getJSONObject(KEY_MESSAGE_CENTER); } } catch (JSONException e) { logException(e); } return null; }
MessagePollingWorker(MessageManager messageManager) { if (messageManager == null) { throw new IllegalArgumentException("Message manager is null"); } this.messageManager = messageManager; conf = Configuration.load(); backgroundPollingInterval = conf.getMessageCenterBgPoll() * 1000; foregroundPollingInterval = conf.getMessageCenterFgPoll() * 1000; ApptentiveLog.v(MESSAGES, "Message Polling Worker: bg=%d, fg=%d", backgroundPollingInterval, foregroundPollingInterval); }
public String getBody(Context context) { InteractionConfiguration configuration = getConfiguration(); if (configuration != null && !configuration.isNull(KEY_BODY)) { return configuration.optString(KEY_BODY, null); } return String.format(context.getResources().getString(R.string.apptentive_rating_message_fs), Configuration.load().getAppDisplayName()); }
public String getAppDisplayName() { try { if (!isNull(KEY_APP_DISPLAY_NAME)) { return getString(KEY_APP_DISPLAY_NAME); } } catch (JSONException e) { logException(e); } return ApptentiveInternal.getInstance().getDefaultAppDisplayName(); }
public boolean isHideBranding(Context context) { try { if (!isNull(KEY_HIDE_BRANDING)) { return getBoolean(KEY_HIDE_BRANDING); } } catch (JSONException e) { logException(e); } try { ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); Bundle metaData = ai.metaData; return metaData.getBoolean(Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING, Constants.CONFIG_DEFAULT_HIDE_BRANDING); } catch (Exception e) { ApptentiveLog.w(CONVERSATION, e, "Unexpected error while reading %s manifest setting.", Constants.MANIFEST_KEY_INITIALLY_HIDE_BRANDING); logException(e); } return Constants.CONFIG_DEFAULT_HIDE_BRANDING; }
public int getMessageCenterBgPoll() { try { JSONObject messageCenter = getMessageCenter(); if (messageCenter != null) { if (!messageCenter.isNull(KEY_MESSAGE_CENTER_BG_POLL)) { return messageCenter.getInt(KEY_MESSAGE_CENTER_BG_POLL); } } } catch (JSONException e) { logException(e); } return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_BG_POLL_SECONDS; }
public boolean isMessageCenterNotificationPopupEnabled() { JSONObject messageCenter = getMessageCenter(); if (messageCenter != null) { if (!messageCenter.isNull(KEY_MESSAGE_CENTER_NOTIFICATION_POPUP)) { JSONObject notificationPopup = messageCenter.optJSONObject(KEY_MESSAGE_CENTER_NOTIFICATION_POPUP); if (notificationPopup != null) { return notificationPopup.optBoolean(KEY_MESSAGE_CENTER_NOTIFICATION_POPUP_ENABLED, Constants.CONFIG_DEFAULT_MESSAGE_CENTER_NOTIFICATION_POPUP_ENABLED); } } } return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_NOTIFICATION_POPUP_ENABLED; }
public String getRateText(Context context) { InteractionConfiguration configuration = getConfiguration(); if (configuration != null && !configuration.isNull(KEY_RATE_TEXT)) { return configuration.optString(KEY_RATE_TEXT, null); } return String.format(context.getResources().getString(R.string.apptentive_rate_this_app), Configuration.load().getAppDisplayName()); }
public int getMessageCenterFgPoll() { try { JSONObject messageCenter = getMessageCenter(); if (messageCenter != null) { if (!messageCenter.isNull(KEY_MESSAGE_CENTER_FG_POLL)) { return messageCenter.getInt(KEY_MESSAGE_CENTER_FG_POLL); } } } catch (JSONException e) { logException(e); } return Constants.CONFIG_DEFAULT_MESSAGE_CENTER_FG_POLL_SECONDS; }
public String getTitle() { InteractionConfiguration configuration = getConfiguration(); if (configuration != null && !configuration.isNull(KEY_TITLE)) { return configuration.optString(KEY_TITLE, null); } return ApptentiveInternal.getInstance().getApplicationContext().getResources(). getString(R.string.apptentive_do_you_love_this_app, Configuration.load().getAppDisplayName()); }
public boolean isMetricsEnabled() { return getBoolean(KEY_METRICS_ENABLED, true); }
errorMessage = ratingProvider.activityNotFoundMessage(activity); String appDisplayName = Configuration.load().getAppDisplayName(); Map<String, String> ratingProviderArgs = ApptentiveInternal.getInstance().getRatingProviderArgs(); Map<String, String> finalRatingProviderArgs;
public boolean isCollectingAdID() { return getBoolean(KEY_COLLECT_AD_ID, false); }