|
|
@@ -15,10 +15,7 @@ import '../api/response/configs_response.dart';
|
|
|
class ConfigRepository {
|
|
|
final String tag = 'ConfigRepository';
|
|
|
|
|
|
- static const int configCustomId = 2;
|
|
|
- static const int configVirtualFriendId = 4;
|
|
|
- static const int configAddFriendTipId = 5;
|
|
|
- static const int configAccountLogoutId = 12;
|
|
|
+ static const String keyVirtualFriend = 'virtual_friend';
|
|
|
|
|
|
bool? _isShowVirtualFriend;
|
|
|
|
|
|
@@ -45,17 +42,11 @@ class ConfigRepository {
|
|
|
return;
|
|
|
}
|
|
|
for (var item in list) {
|
|
|
- final id = item.id;
|
|
|
- switch (id) {
|
|
|
- case configCustomId:
|
|
|
- break;
|
|
|
- case configVirtualFriendId:
|
|
|
+ final confCode = item.confCode;
|
|
|
+ switch (confCode) {
|
|
|
+ case keyVirtualFriend:
|
|
|
_dealWithVirtualFriendSetting(item);
|
|
|
break;
|
|
|
- case configAddFriendTipId:
|
|
|
- break;
|
|
|
- case configAccountLogoutId:
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -63,28 +54,23 @@ class ConfigRepository {
|
|
|
|
|
|
Future<ConfigsResponse> requestConfigsData() {
|
|
|
return atmobApi
|
|
|
- .getConfigs(ConfigsRequest(ids: [
|
|
|
- configCustomId,
|
|
|
- configVirtualFriendId,
|
|
|
- configAddFriendTipId,
|
|
|
- configAccountLogoutId
|
|
|
- ]))
|
|
|
+ .getConfigs(ConfigsRequest([keyVirtualFriend]))
|
|
|
.then(HttpHandler.handle(true));
|
|
|
}
|
|
|
|
|
|
void _dealWithVirtualFriendSetting(ConfigBean item) {
|
|
|
- final cfg = item.cfg;
|
|
|
+ final cfg = item.value;
|
|
|
if (cfg == null || cfg.isEmpty == true) {
|
|
|
return;
|
|
|
}
|
|
|
- // "virtualFriendEnabled": true, 是否开启虚拟好友
|
|
|
+ // virtualFriendEnabled 是否开启虚拟好友
|
|
|
if (cfg.containsKey("virtualFriendEnabled")) {
|
|
|
_isShowVirtualFriend = cfg["virtualFriendEnabled"];
|
|
|
if (_isShowVirtualFriend == true) {
|
|
|
friendsRepository.refreshVirtualFriend();
|
|
|
}
|
|
|
}
|
|
|
- //"freeMemberEnabled": false 是否开启免费会员体验
|
|
|
+ //freeMemberEnabled 是否开启免费会员体验
|
|
|
if (cfg.containsKey("freeMemberEnabled")) {
|
|
|
isOpenFreeMember.value = cfg["freeMemberEnabled"];
|
|
|
}
|