OsIndependentString* TextSecurePreferences::GetGcmRegistrationId(OsIndependentContext* context) { int storedRegistrationIdVersion = GetIntegerPreference(context, (OsIndependentString*)GCM_REGISTRATION_ID_VERSION_PREF, 0); if (storedRegistrationIdVersion != Util::GetCurrentApkReleaseVersion(context)) { return nullptr; } else { return GetStringPreference(context, (OsIndependentString*)GCM_REGISTRATION_ID_PREF, nullptr); } }
int TextSecurePreferences::GetRepeatAlertsCount(OsIndependentContext* context) { //try //{ return GetStringPreference(context, (OsIndependentString*)REPEAT_ALERTS_PREF, (OsIndependentString*)"0")->ConvertToInt(); //} //catch (NumberFormatException e) { // Log.w(TAG, e); // return 0; //} }
std::string GetExternalApplication(const char* appType, const DirectoryGroups& dirGroups, bool forceQuery) { TDEBUG_ENTER("GetExternalApplication"); std::string regName; wxString dialogTitle; if (stricmp(appType, "Diff") == 0) { regName = "External Diff Application"; dialogTitle = _("Choose external diff application"); } else if (stricmp(appType, "Merge") == 0) { regName = "External Merge Application"; dialogTitle = _("Choose external merge application"); } else { return ""; } TDEBUG_TRACE("RegKey: " << regName); std::string externalApp = dirGroups.GetStringPreference(regName); if (externalApp.empty() || (externalApp == "?")) // Module preference not set, use global externalApp = GetStringPreference(regName); TDEBUG_TRACE("App: " << externalApp); // Only ask the user once for external diff application if (externalApp.empty() && !forceQuery) return externalApp; // A question mark signals to ask the user if (externalApp == "?" || forceQuery) { do { if (externalApp == "?") externalApp = ""; externalApp = DoOpenFileDialog(0, dialogTitle, externalApp, wxString(_("Executables")) + wxString(wxT(" (*.exe)|*.exe"))); } while (!(externalApp.empty() || FileExists(externalApp.c_str()))); // Always set global preference SetStringPreferenceRootModule(regName, externalApp, ""); } return externalApp; }
bool GetHomeDirectory(std::string& HomeDirectory) { TDEBUG_ENTER("GetHomeDirectory"); std::string home(""); bool SuccessValue; // We usually recalculate home every time - so ignore the // value in the registry. The user can turn that off though! if (!GetBooleanPreference("Always Recalculate Home")) home = GetStringPreference("HOME"); if (home.empty() || !IsDirectory(home.c_str())) SuccessValue = GetCalculatedHomeDirectory(home); else SuccessValue = true; TDEBUG_TRACE("Home directory is " << home); SuccessValue = (SuccessValue && !home.empty() && IsDirectory(home.c_str())); if (SuccessValue) HomeDirectory = home; return SuccessValue; }
OsIndependentString* TextSecurePreferences::GetTheme(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)THEME_PREF, FactoryString::GetInstance()->CreateNewString("light")); }
NotificationPrivacyPreference* TextSecurePreferences::GetNotificationPrivacy(OsIndependentContext* context) { return new NotificationPrivacyPreference(GetStringPreference(context, (OsIndependentString*)NOTIFICATION_PRIVACY_PREF, (OsIndependentString*)"all")); }
OsIndependentString* TextSecurePreferences::GetLocalNumber(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)LOCAL_NUMBER_PREF, (OsIndependentString*)"No Stored Number"); }
OsIndependentString* TextSecurePreferences::GetNotificationLedPatternCustom(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)LED_BLINK_PREF_CUSTOM, FactoryString::GetInstance()->CreateNewString("500,2000")); }
int TextSecurePreferences::GetThreadTrimLength(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)THREAD_TRIM_LENGTH, FactoryString::GetInstance()->CreateNewString("500"))->ConvertToInt(); }
OsIndependentString* TextSecurePreferences::GetNotificationRingtone(OsIndependentContext* context) { // public static final Uri DEFAULT_NOTIFICATION_URI = getUriFor(NOTIFICATION_SOUND) // public static final String NOTIFICATION_SOUND = "notification_sound"; return GetStringPreference(context, (OsIndependentString*)RINGTONE_PREF, FactoryString::GetInstance()->CreateNewString("notification_sound")); }
OsIndependentString* TextSecurePreferences::GetNotificationLedColor(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)LED_COLOR_PREF, FactoryString::GetInstance()->CreateNewString("blue")); }
OsIndependentString* TextSecurePreferences::GetPushServerPassword(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)GCM_PASSWORD_PREF, nullptr); }
OsIndependentString* TextSecurePreferences::GetLanguage(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)LANGUAGE_PREF, FactoryString::GetInstance()->CreateNewString("zz")); }
OsIndependentString* TextSecurePreferences::GetIdentityContactUri(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)IDENTITY_PREF, nullptr); }
OsIndependentString* TextSecurePreferences::GetMmscPassword(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)MMSC_PASSWORD_PREF, FactoryString::GetInstance()->CreateNewString("")); }
OsIndependentString* TextSecurePreferences::GetMmscUsername(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)MMSC_USERNAME_PREF, FactoryString::GetInstance()->CreateNewString("")); }
OsIndependentString* TextSecurePreferences::GetMmscProxyPort(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)MMSC_PROXY_PORT_PREF, FactoryString::GetInstance()->CreateNewString("")); }
OsIndependentString* TextSecurePreferences::GetSignalingKey(OsIndependentContext* context) { return GetStringPreference(context, (OsIndependentString*)SIGNALING_KEY_PREF, nullptr); }