1
This commit is contained in:
parent
4ba6ab3d17
commit
577b642fdb
@ -5,6 +5,7 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:wallpaperx/common/components/easy_loading.dart';
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
||||||
import 'package:wallpaperx/common/http/http.dart';
|
import 'package:wallpaperx/common/http/http.dart';
|
||||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
import 'package:wallpaperx/firebase/firebase_analytics_manager.dart';
|
import 'package:wallpaperx/firebase/firebase_analytics_manager.dart';
|
||||||
|
|
||||||
///网络请求工具类
|
///网络请求工具类
|
||||||
@ -25,6 +26,12 @@ class HttpUtil {
|
|||||||
bool? showLoading, //是否返回Response类型数据
|
bool? showLoading, //是否返回Response类型数据
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
|
String http = "http://91.199.84.164:8001";
|
||||||
|
String httpCfg = UPCache.getInstance().get<String>("http") ?? "";
|
||||||
|
if (httpCfg.isNotEmpty && httpCfg != "null") {
|
||||||
|
http = httpCfg;
|
||||||
|
}
|
||||||
|
url = "$http$url";
|
||||||
Map<String, dynamic> headers = {};
|
Map<String, dynamic> headers = {};
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
params["use_whitelist"] = true;
|
params["use_whitelist"] = true;
|
||||||
@ -59,6 +66,9 @@ class HttpUtil {
|
|||||||
bool? isBackResponse = false,
|
bool? isBackResponse = false,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
|
String http = UPCache.getInstance().get<String>("http") ??
|
||||||
|
"http://91.199.84.164:8001";
|
||||||
|
url = "$http$url";
|
||||||
Map<String, dynamic> headers = {};
|
Map<String, dynamic> headers = {};
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
LogPrint.d("e: ${params.toString()}");
|
LogPrint.d("e: ${params.toString()}");
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
class Url {
|
class Url {
|
||||||
Url._();
|
Url._();
|
||||||
|
|
||||||
static const String HOST = 'http://91.199.84.164:8001';
|
// static const String HOST = 'http://91.199.84.164:8001';
|
||||||
|
|
||||||
// 获取图片列表,分页
|
// 获取图片列表,分页
|
||||||
static const String getImages = "$HOST/images";
|
static const String getImages = "/images";
|
||||||
|
|
||||||
// 获取图片搜索
|
// 获取图片搜索
|
||||||
static const String searchImages = "$HOST/images/search";
|
static const String searchImages = "/images/search";
|
||||||
|
|
||||||
// 分类
|
// 分类
|
||||||
static const String byCategory = "$HOST/images/by-category";
|
static const String byCategory = "/images/by-category";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ class FirebaseRemoteConfigManager {
|
|||||||
final remoteConfig = FirebaseRemoteConfig.instance;
|
final remoteConfig = FirebaseRemoteConfig.instance;
|
||||||
await remoteConfig.setConfigSettings(RemoteConfigSettings(
|
await remoteConfig.setConfigSettings(RemoteConfigSettings(
|
||||||
fetchTimeout: const Duration(minutes: 1),
|
fetchTimeout: const Duration(minutes: 1),
|
||||||
minimumFetchInterval: const Duration(minutes: 1),
|
minimumFetchInterval: const Duration(minutes: 0),
|
||||||
));
|
));
|
||||||
remoteConfig.onConfigUpdated.listen((event) async {
|
remoteConfig.onConfigUpdated.listen((event) async {
|
||||||
remoteConfig.fetchAndActivate().then((e) {
|
remoteConfig.fetchAndActivate().then((e) {
|
||||||
@ -28,8 +28,14 @@ class FirebaseRemoteConfigManager {
|
|||||||
|
|
||||||
setIsOpenSetting(FirebaseRemoteConfig remoteConfig) async {
|
setIsOpenSetting(FirebaseRemoteConfig remoteConfig) async {
|
||||||
RemoteConfigValue all = remoteConfig.getValue("isopen");
|
RemoteConfigValue all = remoteConfig.getValue("isopen");
|
||||||
Map isOpen = jsonDecode(all.asString());
|
if (all.asString() == "") {
|
||||||
UPCache.getInstance().setData<bool>("showAd", isOpen["isadopen"]);
|
UPCache.getInstance().setData<bool>("showAd", false);
|
||||||
UPCache.getInstance().setData<String>("version", isOpen["version"]);
|
UPCache.getInstance().setData<String>("version", "");
|
||||||
|
} else {
|
||||||
|
Map isOpen = jsonDecode(all.asString());
|
||||||
|
UPCache.getInstance().setData<bool>("showAd", isOpen["isadopen"]);
|
||||||
|
UPCache.getInstance().setData<String>("version", isOpen["version"]);
|
||||||
|
UPCache.getInstance().setData<String>("http", isOpen["http"]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user