1
This commit is contained in:
parent
3bf5f4fa10
commit
4ba6ab3d17
@ -405,6 +405,7 @@
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -550,6 +551,7 @@
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
@ -585,6 +587,7 @@
|
||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
|
||||
@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:applovin_max/applovin_max.dart';
|
||||
import 'package:package_info_plus/package_info_plus.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';
|
||||
@ -118,13 +119,20 @@ class ApplovinUtil {
|
||||
|
||||
/// 显示插页广告,如果准备好
|
||||
Future showAdIfReady({String? adUnitId}) async {
|
||||
bool? showAd = UPCache.getInstance().get<bool>("showAd")??false;
|
||||
if (!showAd) return;
|
||||
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
String version = UPCache.getInstance().get<String>("version")??"";
|
||||
if (version == packageInfo.version) return;
|
||||
|
||||
int lastAdTime = UPCache.getInstance().get<int>("lastAdTime") ?? 0;
|
||||
int now = DateTime.now().millisecondsSinceEpoch;
|
||||
DateTime timestamp1 = DateTime.fromMillisecondsSinceEpoch(lastAdTime);
|
||||
DateTime timestamp2 = DateTime.fromMillisecondsSinceEpoch(now);
|
||||
Duration difference = timestamp2.difference(timestamp1);
|
||||
LogPrint.d("广告间隔:${difference.inSeconds}");
|
||||
if (difference.inSeconds <= 5) return;
|
||||
|
||||
if (!isInitialized) return;
|
||||
adUnitId ??= (adUnitIds..shuffle()).toList()[0];
|
||||
bool isReady = (await AppLovinMAX.isInterstitialReady(adUnitId))!;
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
// Author: fengshengxiong
|
||||
// Date: 2024/6/26
|
||||
// Description: firebase_analytics管理
|
||||
|
||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
35
lib/firebase/firebase_remote_config_manager.dart
Normal file
35
lib/firebase/firebase_remote_config_manager.dart
Normal file
@ -0,0 +1,35 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:firebase_remote_config/firebase_remote_config.dart';
|
||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||
|
||||
class FirebaseRemoteConfigManager {
|
||||
Future init() async {
|
||||
try {
|
||||
final remoteConfig = FirebaseRemoteConfig.instance;
|
||||
await remoteConfig.setConfigSettings(RemoteConfigSettings(
|
||||
fetchTimeout: const Duration(minutes: 1),
|
||||
minimumFetchInterval: const Duration(minutes: 1),
|
||||
));
|
||||
remoteConfig.onConfigUpdated.listen((event) async {
|
||||
remoteConfig.fetchAndActivate().then((e) {
|
||||
setIsOpenSetting(remoteConfig);
|
||||
});
|
||||
});
|
||||
remoteConfig.fetchAndActivate().then((e) {
|
||||
setIsOpenSetting(remoteConfig);
|
||||
});
|
||||
} catch (e) {
|
||||
LogPrint.d(e);
|
||||
}
|
||||
}
|
||||
|
||||
setIsOpenSetting(FirebaseRemoteConfig remoteConfig) async {
|
||||
RemoteConfigValue all = remoteConfig.getValue("isopen");
|
||||
Map isOpen = jsonDecode(all.asString());
|
||||
UPCache.getInstance().setData<bool>("showAd", isOpen["isadopen"]);
|
||||
UPCache.getInstance().setData<String>("version", isOpen["version"]);
|
||||
}
|
||||
}
|
||||
@ -15,6 +15,7 @@ import 'package:wallpaperx/common/utils/log_print.dart';
|
||||
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||
import 'package:wallpaperx/config/applovin.dart';
|
||||
import 'package:wallpaperx/firebase/firebase_options.dart';
|
||||
import 'package:wallpaperx/firebase/firebase_remote_config_manager.dart';
|
||||
import 'package:wallpaperx/res/themes/app_themes.dart';
|
||||
import 'package:wallpaperx/res/values/strings.dart';
|
||||
import 'package:wallpaperx/routes/app_pages.dart';
|
||||
@ -52,11 +53,13 @@ void main() async {
|
||||
// 初始化广告sdk
|
||||
await ApplovinUtil().initApplovin();
|
||||
|
||||
UPCache.preInit();
|
||||
|
||||
await FirebaseRemoteConfigManager().init();
|
||||
|
||||
// 初始化Hive
|
||||
await initHive();
|
||||
|
||||
UPCache.preInit();
|
||||
|
||||
// EasyLoading配置
|
||||
configLoading();
|
||||
|
||||
|
||||
@ -104,6 +104,7 @@ class RecommendController extends GetxController {
|
||||
}
|
||||
}
|
||||
},
|
||||
showLoading: false,
|
||||
errorCallback: (e) {
|
||||
refreshController.finishLoad();
|
||||
},
|
||||
|
||||
@ -2,7 +2,7 @@ name: wallpaperx
|
||||
description: "A new Flutter project."
|
||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
|
||||
version: 1.0.0+3
|
||||
version: 1.0.1+1
|
||||
|
||||
environment:
|
||||
sdk: '>=3.4.3 <4.0.0'
|
||||
@ -108,9 +108,10 @@ dependencies:
|
||||
crop_your_image: ^1.1.0
|
||||
|
||||
# Firebase
|
||||
firebase_core: ^2.32.0
|
||||
firebase_analytics: ^10.10.7
|
||||
firebase_crashlytics: ^3.5.7
|
||||
firebase_core: ^3.2.0
|
||||
firebase_analytics: ^11.2.0
|
||||
firebase_crashlytics: ^4.0.3
|
||||
firebase_remote_config: ^5.0.3
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: "launcher_icon"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user