2018-02-26 14:27:32 +01:00
|
|
|
/* Copyright (C) 2016-2018 Carsten Pfeiffer, Daniele Gobbetti, Felix
|
|
|
|
Konstantin Maurer
|
2017-03-10 14:53:19 +01:00
|
|
|
|
|
|
|
This file is part of Gadgetbridge.
|
|
|
|
|
|
|
|
Gadgetbridge is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published
|
|
|
|
by the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Gadgetbridge is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
2016-04-28 23:17:13 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge.util;
|
|
|
|
|
2016-05-13 23:47:47 +02:00
|
|
|
import java.text.ParseException;
|
|
|
|
import java.util.Date;
|
|
|
|
|
2016-04-28 23:17:13 +02:00
|
|
|
public class GBPrefs {
|
2017-04-22 16:59:55 +02:00
|
|
|
public static final String PACKAGE_BLACKLIST = "package_blacklist";
|
2018-06-18 20:38:37 +02:00
|
|
|
public static final String PACKAGE_PEBBLEMSG_BLACKLIST = "package_pebblemsg_blacklist";
|
2017-08-18 10:30:19 +02:00
|
|
|
public static final String CALENDAR_BLACKLIST = "calendar_blacklist";
|
2016-04-28 23:17:13 +02:00
|
|
|
public static final String AUTO_RECONNECT = "general_autocreconnect";
|
2017-02-17 23:11:44 +01:00
|
|
|
private static final String AUTO_START = "general_autostartonboot";
|
2018-01-08 11:27:28 +01:00
|
|
|
public static final String AUTO_EXPORT_ENABLED = "auto_export_enabled";
|
|
|
|
public static final String AUTO_EXPORT_LOCATION = "auto_export_location";
|
|
|
|
public static final String AUTO_EXPORT_INTERVAL = "auto_export_interval";
|
2017-02-17 23:11:44 +01:00
|
|
|
private static final boolean AUTO_START_DEFAULT = true;
|
2018-01-14 00:20:13 +01:00
|
|
|
private static final String BG_JS_ENABLED = "pebble_enable_background_javascript";
|
|
|
|
private static final boolean BG_JS_ENABLED_DEFAULT = false;
|
2016-04-28 23:17:13 +02:00
|
|
|
public static boolean AUTO_RECONNECT_DEFAULT = true;
|
2016-05-13 23:47:47 +02:00
|
|
|
|
|
|
|
public static final String USER_NAME = "mi_user_alias";
|
|
|
|
public static final String USER_NAME_DEFAULT = "gadgetbridge-user";
|
|
|
|
private static final String USER_BIRTHDAY = "";
|
|
|
|
|
2018-08-16 13:13:12 +02:00
|
|
|
public static final String CHART_MAX_HEART_RATE = "chart_max_heart_rate";
|
|
|
|
public static final String CHART_MIN_HEART_RATE = "chart_min_heart_rate";
|
|
|
|
|
2016-04-28 23:17:13 +02:00
|
|
|
private final Prefs mPrefs;
|
|
|
|
|
|
|
|
public GBPrefs(Prefs prefs) {
|
|
|
|
mPrefs = prefs;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean getAutoReconnect() {
|
|
|
|
return mPrefs.getBoolean(AUTO_RECONNECT, AUTO_RECONNECT_DEFAULT);
|
|
|
|
}
|
2016-05-13 23:47:47 +02:00
|
|
|
|
2017-02-17 23:11:44 +01:00
|
|
|
public boolean getAutoStart() {
|
|
|
|
return mPrefs.getBoolean(AUTO_START, AUTO_START_DEFAULT);
|
|
|
|
}
|
|
|
|
|
2018-01-14 00:20:13 +01:00
|
|
|
public boolean isBackgroundJsEnabled() {
|
|
|
|
return mPrefs.getBoolean(BG_JS_ENABLED, BG_JS_ENABLED_DEFAULT);
|
|
|
|
}
|
|
|
|
|
2016-05-13 23:47:47 +02:00
|
|
|
public String getUserName() {
|
|
|
|
return mPrefs.getString(USER_NAME, USER_NAME_DEFAULT);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Date getUserBirthday() {
|
|
|
|
String date = mPrefs.getString(USER_BIRTHDAY, null);
|
|
|
|
if (date == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
return DateTimeUtils.dayFromString(date);
|
|
|
|
} catch (ParseException ex) {
|
|
|
|
GB.log("Error parsing date: " + date, GB.ERROR, ex);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-22 16:59:55 +02:00
|
|
|
public int getUserGender() {
|
2016-05-13 23:47:47 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2016-04-28 23:17:13 +02:00
|
|
|
}
|