|
|
@@ -2,8 +2,8 @@
|
|
|
import 'package:iquokka/common/AC.dart';
|
|
|
import 'package:iquokka/common/score_rule_model.dart';
|
|
|
import 'package:iquokka/module/home_widget_service.dart';
|
|
|
+import 'package:iquokka/module/shared_prefs_util.dart';
|
|
|
import 'package:iquokka/utils/hex_color.dart';
|
|
|
-import 'package:sp_util/sp_util.dart';
|
|
|
|
|
|
import '../pages/today/main/model/update_tips_model.dart';
|
|
|
|
|
|
@@ -44,128 +44,128 @@ class AppService {
|
|
|
AppService._internal();
|
|
|
|
|
|
isFirstLaunch() {
|
|
|
- return SpUtil.getBool(spFirstLaunch, defValue: true);
|
|
|
+ return SharedPrefsUtil.getBool(spFirstLaunch, defValue: true);
|
|
|
}
|
|
|
|
|
|
setLaunch() {
|
|
|
- SpUtil.putBool(spFirstLaunch, false);
|
|
|
+ SharedPrefsUtil.putBool(spFirstLaunch, false);
|
|
|
}
|
|
|
|
|
|
isAgreeAgreement() {
|
|
|
- return SpUtil.getBool(spAgreeAgreement, defValue: false);
|
|
|
+ return SharedPrefsUtil.getBool(spAgreeAgreement, defValue: false);
|
|
|
}
|
|
|
|
|
|
setAgreeAgreement() {
|
|
|
- SpUtil.putBool(spAgreeAgreement, true);
|
|
|
+ SharedPrefsUtil.putBool(spAgreeAgreement, true);
|
|
|
}
|
|
|
|
|
|
isShowGuide() {
|
|
|
- return SpUtil.getBool(spIsShowGuide, defValue: false);
|
|
|
+ return SharedPrefsUtil.getBool(spIsShowGuide, defValue: false);
|
|
|
}
|
|
|
|
|
|
setShowGuide() {
|
|
|
- SpUtil.putBool(spIsShowGuide, true);
|
|
|
+ SharedPrefsUtil.putBool(spIsShowGuide, true);
|
|
|
}
|
|
|
|
|
|
isPersonalRecommend() {
|
|
|
- return SpUtil.getBool(spIsPersonalRecommend, defValue: false);
|
|
|
+ return SharedPrefsUtil.getBool(spIsPersonalRecommend, defValue: false);
|
|
|
}
|
|
|
|
|
|
setPersonalRecommend(bool value) {
|
|
|
- SpUtil.putBool(spIsPersonalRecommend, value);
|
|
|
+ SharedPrefsUtil.putBool(spIsPersonalRecommend, value);
|
|
|
}
|
|
|
|
|
|
setPracticeFont(int font) {
|
|
|
- SpUtil.putInt(spIsPracticeFont, font);
|
|
|
+ SharedPrefsUtil.putInt(spIsPracticeFont, font);
|
|
|
}
|
|
|
|
|
|
int isPracticeFont() {
|
|
|
- return SpUtil.getInt(spIsPracticeFont, defValue: 0)??0;
|
|
|
+ return SharedPrefsUtil.getInt(spIsPracticeFont, defValue: 0)??0;
|
|
|
}
|
|
|
|
|
|
setPwdLock(String password) {
|
|
|
- SpUtil.putString(spPwdLock, password);
|
|
|
+ SharedPrefsUtil.putString(spPwdLock, password);
|
|
|
}
|
|
|
|
|
|
String getPwdLock() {
|
|
|
- return SpUtil.getString(spPwdLock, defValue: "")??"";
|
|
|
+ return SharedPrefsUtil.getString(spPwdLock, defValue: "")??"";
|
|
|
}
|
|
|
|
|
|
setSentenceBg(int bg) {
|
|
|
- SpUtil.putInt(spSentenceBg, bg);
|
|
|
+ SharedPrefsUtil.putInt(spSentenceBg, bg);
|
|
|
HomeWidgetService().updateWidgetSentenceBg();
|
|
|
}
|
|
|
|
|
|
void setSentenceSlideGuide(bool isShow) {
|
|
|
- SpUtil.putBool(spSentenceSlideGuide, isShow);
|
|
|
+ SharedPrefsUtil.putBool(spSentenceSlideGuide, isShow);
|
|
|
}
|
|
|
|
|
|
bool getSentenceSlideGuide() {
|
|
|
- return SpUtil.getBool(spSentenceSlideGuide, defValue: true)??true;
|
|
|
+ return SharedPrefsUtil.getBool(spSentenceSlideGuide, defValue: true)??true;
|
|
|
}
|
|
|
|
|
|
int getSentenceBg() {
|
|
|
- return SpUtil.getInt(spSentenceBg, defValue: 1)??1;
|
|
|
+ return SharedPrefsUtil.getInt(spSentenceBg, defValue: 1)??1;
|
|
|
}
|
|
|
|
|
|
int getThemeMode() {
|
|
|
- return SpUtil.getInt(spThemeMode, defValue: 0)??0;
|
|
|
+ return SharedPrefsUtil.getInt(spThemeMode, defValue: 0)??0;
|
|
|
}
|
|
|
|
|
|
// 设置主题模式, 0跟随系统,1浅色模式,2深色模式
|
|
|
setThemeMode(int modeType) {
|
|
|
- SpUtil.putInt(spThemeMode, modeType);
|
|
|
+ SharedPrefsUtil.putInt(spThemeMode, modeType);
|
|
|
HexColor.reload();
|
|
|
AC.reload();
|
|
|
HomeWidgetService().updateWidgetTheme();
|
|
|
}
|
|
|
|
|
|
void setLoginDialog(bool isShow) {
|
|
|
- SpUtil.putBool(spLoginDialog, isShow);
|
|
|
+ SharedPrefsUtil.putBool(spLoginDialog, isShow);
|
|
|
}
|
|
|
|
|
|
bool getLoginDialog() {
|
|
|
- return SpUtil.getBool(spLoginDialog, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spLoginDialog, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
void setIsInitMood(bool isInit) {
|
|
|
- SpUtil.putBool(spIsInitMood, isInit);
|
|
|
+ SharedPrefsUtil.putBool(spIsInitMood, isInit);
|
|
|
}
|
|
|
|
|
|
bool getIsInitMood() {
|
|
|
- return SpUtil.getBool(spIsInitMood, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spIsInitMood, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
void setTodayCloseBottomBannerId(List<String> bannerIds) {
|
|
|
- SpUtil.putStringList(spTodayCloseBannerId, bannerIds);
|
|
|
+ SharedPrefsUtil.putStringList(spTodayCloseBannerId, bannerIds);
|
|
|
}
|
|
|
|
|
|
List<String> getTodayCloseBottomBannerIds() {
|
|
|
- return SpUtil.getStringList(spTodayCloseBannerId) ?? [];
|
|
|
+ return SharedPrefsUtil.getStringList(spTodayCloseBannerId) ?? [];
|
|
|
}
|
|
|
|
|
|
void setTodayCloseTopBannerId(List<String> bannerIds) {
|
|
|
- SpUtil.putStringList(spTodayCloseTopBannerId, bannerIds);
|
|
|
+ SharedPrefsUtil.putStringList(spTodayCloseTopBannerId, bannerIds);
|
|
|
}
|
|
|
|
|
|
List<String> getTodayCloseTopBannerIds() {
|
|
|
- return SpUtil.getStringList(spTodayCloseTopBannerId) ?? [];
|
|
|
+ return SharedPrefsUtil.getStringList(spTodayCloseTopBannerId) ?? [];
|
|
|
}
|
|
|
|
|
|
void setCurrentDate(String password) {
|
|
|
- SpUtil.putString(spCurrentDate, password);
|
|
|
+ SharedPrefsUtil.putString(spCurrentDate, password);
|
|
|
}
|
|
|
|
|
|
String getCurrentDate() {
|
|
|
- return SpUtil.getString(spCurrentDate, defValue: "")??"";
|
|
|
+ return SharedPrefsUtil.getString(spCurrentDate, defValue: "")??"";
|
|
|
}
|
|
|
|
|
|
void setVersionUpdateTips(UpdateTipsModel tipsModel) {
|
|
|
- SpUtil.putObject(spVersionUpdateTips, tipsModel);
|
|
|
+ SharedPrefsUtil.putObject(spVersionUpdateTips, tipsModel);
|
|
|
}
|
|
|
|
|
|
UpdateTipsModel getVersionUpdateTips() {
|
|
|
- UpdateTipsModel tipsModel = SpUtil.getObj<UpdateTipsModel?>(spVersionUpdateTips, (v) {
|
|
|
+ UpdateTipsModel tipsModel = SharedPrefsUtil.getObj<UpdateTipsModel?>(spVersionUpdateTips, (v) {
|
|
|
Map<String, dynamic> converted = {};
|
|
|
for (var item in v.keys) {
|
|
|
converted[item.toString()] = v[item];
|
|
|
@@ -177,11 +177,11 @@ class AppService {
|
|
|
}
|
|
|
|
|
|
void setCurrentVersionUpdateContentTips(UpdateTipsModel tipsModel) {
|
|
|
- SpUtil.putObject(spCurrentVersionContentTips, tipsModel);
|
|
|
+ SharedPrefsUtil.putObject(spCurrentVersionContentTips, tipsModel);
|
|
|
}
|
|
|
|
|
|
UpdateTipsModel getCurrentVersionUpdateContentTips() {
|
|
|
- UpdateTipsModel tipsModel = SpUtil.getObj<UpdateTipsModel?>(spCurrentVersionContentTips, (v) {
|
|
|
+ UpdateTipsModel tipsModel = SharedPrefsUtil.getObj<UpdateTipsModel?>(spCurrentVersionContentTips, (v) {
|
|
|
Map<String, dynamic> converted = {};
|
|
|
for (var item in v.keys) {
|
|
|
converted[item.toString()] = v[item];
|
|
|
@@ -193,11 +193,11 @@ class AppService {
|
|
|
}
|
|
|
|
|
|
void setAppStoreScoreRule(ScoreRuleModel ruleModel) {
|
|
|
- SpUtil.putObject(spAppStoreScoreRule, ruleModel);
|
|
|
+ SharedPrefsUtil.putObject(spAppStoreScoreRule, ruleModel);
|
|
|
}
|
|
|
|
|
|
ScoreRuleModel getAppStoreScoreRule() {
|
|
|
- ScoreRuleModel ruleModel = SpUtil.getObj<ScoreRuleModel?>(spAppStoreScoreRule, (v) {
|
|
|
+ ScoreRuleModel ruleModel = SharedPrefsUtil.getObj<ScoreRuleModel?>(spAppStoreScoreRule, (v) {
|
|
|
Map<String, dynamic> converted = {};
|
|
|
for (var item in v.keys) {
|
|
|
converted[item.toString()] = v[item];
|
|
|
@@ -209,27 +209,27 @@ class AppService {
|
|
|
}
|
|
|
|
|
|
void setFootprintHideAiRespond(bool isInit) {
|
|
|
- SpUtil.putBool(spFootprintHideAiRespond, isInit);
|
|
|
+ SharedPrefsUtil.putBool(spFootprintHideAiRespond, isInit);
|
|
|
}
|
|
|
|
|
|
bool getFootprintHideAiRespond() {
|
|
|
- return SpUtil.getBool(spFootprintHideAiRespond, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spFootprintHideAiRespond, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
void setHideAiTips(bool isHide) {
|
|
|
- SpUtil.putBool(spHideAiTips, isHide);
|
|
|
+ SharedPrefsUtil.putBool(spHideAiTips, isHide);
|
|
|
}
|
|
|
|
|
|
bool getHideAiTips() {
|
|
|
- return SpUtil.getBool(spHideAiTips, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spHideAiTips, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
void setSettingRedPoint(int type) {
|
|
|
- SpUtil.putInt(spSettingRedPoint, type);
|
|
|
+ SharedPrefsUtil.putInt(spSettingRedPoint, type);
|
|
|
}
|
|
|
|
|
|
int getSettingRedPoint() {
|
|
|
- return SpUtil.getInt(spSettingRedPoint, defValue: 0)??0;
|
|
|
+ return SharedPrefsUtil.getInt(spSettingRedPoint, defValue: 0)??0;
|
|
|
}
|
|
|
|
|
|
// void setSyncAppleHealth(bool isSync) {
|
|
|
@@ -241,35 +241,35 @@ class AppService {
|
|
|
// }
|
|
|
|
|
|
void setHealthAuthDialog(bool isAuth) {
|
|
|
- SpUtil.putBool(spHealthAuthDialog, isAuth);
|
|
|
+ SharedPrefsUtil.putBool(spHealthAuthDialog, isAuth);
|
|
|
}
|
|
|
|
|
|
bool getHealthAuthDialog() {
|
|
|
- return SpUtil.getBool(spHealthAuthDialog, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spHealthAuthDialog, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
void setChatBg(int type) {
|
|
|
- SpUtil.putInt(spChatBg, type);
|
|
|
+ SharedPrefsUtil.putInt(spChatBg, type);
|
|
|
}
|
|
|
|
|
|
int getChatBg() {
|
|
|
- return SpUtil.getInt(spChatBg, defValue: 0)??0;
|
|
|
+ return SharedPrefsUtil.getInt(spChatBg, defValue: 0)??0;
|
|
|
}
|
|
|
|
|
|
void setHomeChatDialogTips(bool isShow) {
|
|
|
- SpUtil.putBool(spHomeChatDialogTips, isShow);
|
|
|
+ SharedPrefsUtil.putBool(spHomeChatDialogTips, isShow);
|
|
|
}
|
|
|
|
|
|
bool getHomeChatDialogTips() {
|
|
|
- return SpUtil.getBool(spHomeChatDialogTips, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spHomeChatDialogTips, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
void setMoreChatDialogTips(bool isShow) {
|
|
|
- SpUtil.putBool(spMoreChatDialogTips, isShow);
|
|
|
+ SharedPrefsUtil.putBool(spMoreChatDialogTips, isShow);
|
|
|
}
|
|
|
|
|
|
bool getMoreChatDialogTips() {
|
|
|
- return SpUtil.getBool(spMoreChatDialogTips, defValue: false)??false;
|
|
|
+ return SharedPrefsUtil.getBool(spMoreChatDialogTips, defValue: false)??false;
|
|
|
}
|
|
|
|
|
|
|