1.增加埋点
2.调整广告开关配置逻辑
This commit is contained in:
parent
577b642fdb
commit
23e35c5bd8
@ -17,7 +17,7 @@
|
|||||||
<application
|
<application
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/launcher_icon"
|
android:icon="@mipmap/launcher_icon"
|
||||||
android:label="Visual Wallpaper"
|
android:label="@string/app_name"
|
||||||
android:requestLegacyExternalStorage="true"
|
android:requestLegacyExternalStorage="true"
|
||||||
android:enableOnBackInvokedCallback="true"
|
android:enableOnBackInvokedCallback="true"
|
||||||
tools:targetApi="tiramisu">
|
tools:targetApi="tiramisu">
|
||||||
@ -48,6 +48,10 @@
|
|||||||
<meta-data
|
<meta-data
|
||||||
android:name="flutterEmbedding"
|
android:name="flutterEmbedding"
|
||||||
android:value="2" />
|
android:value="2" />
|
||||||
|
|
||||||
|
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
|
||||||
|
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
<!-- Required to query activities that can process text, see:
|
<!-- Required to query activities that can process text, see:
|
||||||
https://developer.android.com/training/package-visibility and
|
https://developer.android.com/training/package-visibility and
|
||||||
|
|||||||
6
android/app/src/main/res/values/strings.xml
Normal file
6
android/app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Visual Wallpaper</string>
|
||||||
|
<string name="facebook_app_id">1212027840144368</string>
|
||||||
|
<string name="facebook_client_token">e8d17552c2378a2c6391ed48055e10a2</string>
|
||||||
|
</resources>
|
||||||
@ -1,5 +1,5 @@
|
|||||||
# Uncomment this line to define a global platform for your project
|
# Uncomment this line to define a global platform for your project
|
||||||
# platform :ios, '12.0'
|
platform :ios, '13.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
@ -31,6 +31,10 @@ target 'Runner' do
|
|||||||
use_frameworks!
|
use_frameworks!
|
||||||
use_modular_headers!
|
use_modular_headers!
|
||||||
|
|
||||||
|
pod 'AppLovinDSPLinkedInAdapter'
|
||||||
|
pod 'AppLovinMediationVungleAdapter'
|
||||||
|
pod 'AppLovinMediationByteDanceAdapter'
|
||||||
|
|
||||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
||||||
# target 'RunnerTests' do
|
# target 'RunnerTests' do
|
||||||
# inherit! :search_paths
|
# inherit! :search_paths
|
||||||
|
|||||||
@ -397,9 +397,9 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_IDENTITY = "Apple Distribution";
|
CODE_SIGN_IDENTITY = "Apple Distribution";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 3;
|
CURRENT_PROJECT_VERSION = 5;
|
||||||
DART_OBFUSCATION = true;
|
DART_OBFUSCATION = true;
|
||||||
DEVELOPMENT_TEAM = TW3K3253KL;
|
DEVELOPMENT_TEAM = TW3K3253KL;
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
||||||
@ -413,7 +413,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.zt.atpaper;
|
PRODUCT_BUNDLE_IDENTIFIER = com.zt.atpaper;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = adpapaer_dis;
|
PROVISIONING_PROFILE_SPECIFIER = adpapaer_dis;
|
||||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adpapaer_dis;
|
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adpapaer_dis_dev;
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
@ -543,9 +543,9 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_IDENTITY = "Apple Distribution";
|
CODE_SIGN_IDENTITY = "Apple Distribution";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 3;
|
CURRENT_PROJECT_VERSION = 5;
|
||||||
DART_OBFUSCATION = true;
|
DART_OBFUSCATION = true;
|
||||||
DEVELOPMENT_TEAM = TW3K3253KL;
|
DEVELOPMENT_TEAM = TW3K3253KL;
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
||||||
@ -559,7 +559,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.zt.atpaper;
|
PRODUCT_BUNDLE_IDENTIFIER = com.zt.atpaper;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = adpapaer_dis;
|
PROVISIONING_PROFILE_SPECIFIER = adpapaer_dis;
|
||||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adpapaer_dis;
|
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adpapaer_dis_dev;
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
@ -579,9 +579,9 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_IDENTITY = "Apple Distribution";
|
CODE_SIGN_IDENTITY = "Apple Distribution";
|
||||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 3;
|
CURRENT_PROJECT_VERSION = 5;
|
||||||
DART_OBFUSCATION = true;
|
DART_OBFUSCATION = true;
|
||||||
DEVELOPMENT_TEAM = TW3K3253KL;
|
DEVELOPMENT_TEAM = TW3K3253KL;
|
||||||
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = TW3K3253KL;
|
||||||
@ -595,7 +595,7 @@
|
|||||||
PRODUCT_BUNDLE_IDENTIFIER = com.zt.atpaper;
|
PRODUCT_BUNDLE_IDENTIFIER = com.zt.atpaper;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = adpapaer_dis;
|
PROVISIONING_PROFILE_SPECIFIER = adpapaer_dis;
|
||||||
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adpapaer_dis;
|
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = adpapaer_dis_dev;
|
||||||
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
|
||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
|
|||||||
@ -39,6 +39,21 @@
|
|||||||
<string>This enables you to upload photos and save wallpapers. Please grant photo library access.</string>
|
<string>This enables you to upload photos and save wallpapers. Please grant photo library access.</string>
|
||||||
<key>NSUserTrackingUsageDescription</key>
|
<key>NSUserTrackingUsageDescription</key>
|
||||||
<string>We need your permission to access the advertising identifier to provide better ad services.</string>
|
<string>We need your permission to access the advertising identifier to provide better ad services.</string>
|
||||||
|
<key>CFBundleURLTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleURLSchemes</key>
|
||||||
|
<array>
|
||||||
|
<string>fb1212027840144368</string>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
<key>FacebookAppID</key>
|
||||||
|
<string>1212027840144368</string>
|
||||||
|
<key>FacebookClientToken</key>
|
||||||
|
<string>e8d17552c2378a2c6391ed48055e10a2</string>
|
||||||
|
<key>FacebookDisplayName</key>
|
||||||
|
<string>Visual Wallpaper: New Style</string>
|
||||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UILaunchStoryboardName</key>
|
<key>UILaunchStoryboardName</key>
|
||||||
@ -58,5 +73,450 @@
|
|||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
</array>
|
</array>
|
||||||
|
<key>SKAdNetworkItems</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>22mmun2rn5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>238da6jt44.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>24t9a8vw3c.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>24zw6aqk47.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>252b5q8x7y.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>275upjj5gd.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>294l99pt4k.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>2fnua5tdw4.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>2u9pt9hc89.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>32z4fx6l9h.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>3l6bd9hu43.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>3qcr597p9d.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>3qy4746246.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>3rd42ekr43.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>3sh42y64q3.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>424m5254lk.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>4468km3ulz.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>44jx6755aq.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>44n7hlldy6.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>47vhws6wlr.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>488r3q3dtq.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>4dzt52r2t5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>4fzdc2evr5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>4mn522wn87.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>4pfyvq9l8r.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>4w7y6s5ca2.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>523jb4fst2.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>52fl2v3hgk.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>54nzkqm89y.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>578prtvx9j.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>5a6flpkh64.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>5l3tpt7t6e.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>5lm9lj6jb7.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>5tjdwbrq8w.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>6964rsfnh4.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>6g9af3uyq4.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>6p4ks3rnbw.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>6v7lgmsu45.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>6xzpu9s2p8.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>737z793b9f.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>74b6s63p6l.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>79pbpufp6p.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>7fmhfwg9en.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>7rz58n8ntl.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>7ug5zh24hu.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>84993kbrcf.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>89z7zv988g.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>8c4e2ghe7u.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>8m87ys6875.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>8r8llnkz5a.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>8s468mfl3y.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>97r2b46745.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>9b89h5y424.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>9nlqeag3gk.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>9rd848q2bz.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>9t245vhmpl.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>9vvzujtq5s.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>9yg77x724h.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>a2p9lx4jpn.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>a7xqa6mtl2.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>a8cz6cu7e5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>av6w8kgt66.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>b9bk5wbcq9.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>bxvub5ada5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>c3frkrj4fj.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>c6k4g5qg8m.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>cg4yq2srnc.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>cj5566h2ga.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>cp8zw746q7.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>cs644xg564.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>cstr6suwn9.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>dbu4b84rxf.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>dkc879ngq3.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>dzg6xy7pwj.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>e5fvkxwrpn.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>ecpz2srf59.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>eh6m2bh4zr.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>ejvt5qm6ak.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>f38h382jlk.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>f73kdq92p3.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>f7s53z58qe.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>feyaarzu9v.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>g28c52eehv.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>g2y4y55b64.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>ggvn48r87g.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>glqzh8vgby.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>gta8lk7p23.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>gta9lk7p23.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>hb56zgv37p.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>hdw39hrw9y.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>hs6bdukanm.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>k674qkevps.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>kbd757ywx3.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>kbmxgpxpgc.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>klf5c3l5u5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>krvm3zuq6h.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>lr83yxwka7.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>ludvb6z3bs.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>m297p6643m.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>m5mvw97r93.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>m8dbw4sv7c.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>mlmmfzh3r3.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>mls7yz5dvl.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>mp6xlyr22a.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>mtkv5xtk9e.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>n38lu8286q.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>n66cz3y3bx.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>n6fk4nfna4.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>n9x2a789qt.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>nzq8sh4pbs.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>p78axxw29g.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>ppxm28t8ap.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>prcb7njmu6.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>pwa73g5rt2.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>pwdxu55a5a.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>qqp299437r.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>r45fhb6rf7.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>rvh3l7un93.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>rx5hdcabgc.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>s39g8k73mm.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>s69wq72ugq.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>su67r6k2v3.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>t38b2kh725.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>tl55sbb4fm.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>u679fj5vs4.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>uw77j35x4d.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>v4nxqhlyqp.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>v72qych5uu.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>v79kvwwj4g.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>v9wttpbfk9.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>vcra2ehyfk.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>vutu7akeur.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>w9q455wk68.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>wg4vff78zm.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>wzmmz9fp6w.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>x44k69ngh6.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>x5l83yy675.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>x8jxxk4ff5.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>x8uqf25wch.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>xy9t38ct57.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>y45688jllp.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>y5ghdn5j9k.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>yclnxrl5pm.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>ydx93a7ass.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>z24wtl6j62.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>zmvfpc5aq8.skadnetwork</string>
|
||||||
|
</dict><dict>
|
||||||
|
<key>SKAdNetworkIdentifier</key>
|
||||||
|
<string>zq492l623r.skadnetwork</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
147
lib/ads/interstitial_ad_manage.dart
Normal file
147
lib/ads/interstitial_ad_manage.dart
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
// Author: fengshengxiong
|
||||||
|
// Date: 2024/5/20
|
||||||
|
// Description: 插页广告管理
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:applovin_max/applovin_max.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/num_util.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
|
import 'package:wallpaperx/firebase/firebase_analytics_manager.dart';
|
||||||
|
import 'package:wallpaperx/page/launch/launch_controller.dart';
|
||||||
|
|
||||||
|
class InterstitialAdManager {
|
||||||
|
InterstitialAdManager._();
|
||||||
|
|
||||||
|
static final InterstitialAdManager _instance = InterstitialAdManager._();
|
||||||
|
|
||||||
|
factory InterstitialAdManager() => _instance;
|
||||||
|
|
||||||
|
/// sdkKey
|
||||||
|
final String applovinKey = 'HXOh4UBLahW9KzBBrxqwniKOvfD_JEDJgE9y2rv8DlmJaJ6xPEXUmmJyeAg0xipqdH_EiHg5NsnvfmIHubSu1k';
|
||||||
|
|
||||||
|
/// 开屏广告
|
||||||
|
final launchAdId = Platform.isAndroid ? '' : 'f4d33bc86b44eb24';
|
||||||
|
|
||||||
|
/// 广告单元Id
|
||||||
|
final adIds = [
|
||||||
|
Platform.isAndroid ? '' : 'e0ac389b7746be38',
|
||||||
|
Platform.isAndroid ? '' : 'a8ecc9c457dee7bf',
|
||||||
|
Platform.isAndroid ? '' : 'f4231f22c0314229',
|
||||||
|
];
|
||||||
|
|
||||||
|
/// 是否已初始化
|
||||||
|
bool isInitialized = false;
|
||||||
|
|
||||||
|
/// 是否显示
|
||||||
|
bool isShowingAd = false;
|
||||||
|
|
||||||
|
/// 重试计数
|
||||||
|
// final _maxExponentialRetryCount = 6;
|
||||||
|
// var _interstitialRetryAttempt = 0;
|
||||||
|
|
||||||
|
Function()? onTap;
|
||||||
|
|
||||||
|
/// 初始化
|
||||||
|
Future<void> init() async {
|
||||||
|
MaxConfiguration? configuration = await AppLovinMAX.initialize(applovinKey);
|
||||||
|
if (configuration != null) {
|
||||||
|
isInitialized = true;
|
||||||
|
_attachAdListeners();
|
||||||
|
loadAllAd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 广告监听
|
||||||
|
void _attachAdListeners() {
|
||||||
|
AppLovinMAX.setInterstitialListener(InterstitialListener(
|
||||||
|
onAdLoadedCallback: (ad) async {
|
||||||
|
LogPrint.d('插页广告加载成功:${ad.adUnitId}');
|
||||||
|
if (ad.adUnitId == launchAdId) {
|
||||||
|
if (Get.isRegistered<LaunchController>()) {
|
||||||
|
LaunchController.to.editChangeValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// _interstitialRetryAttempt = 0;
|
||||||
|
},
|
||||||
|
onAdLoadFailedCallback: (adUnitId, error) {
|
||||||
|
LogPrint.d('插页广告加载失败adUnitId:$adUnitId,code:${error.code},message:${error.message}');
|
||||||
|
// Applovin建议您以指数级更高的延迟重试,最大延迟可达64秒
|
||||||
|
// _interstitialRetryAttempt = _interstitialRetryAttempt + 1;
|
||||||
|
// if (_interstitialRetryAttempt > _maxExponentialRetryCount) return;
|
||||||
|
// int retryDelay = pow(2, min(_maxExponentialRetryCount, _interstitialRetryAttempt)).toInt();
|
||||||
|
|
||||||
|
Future.delayed(const Duration(seconds: 10), () {
|
||||||
|
AppLovinMAX.loadInterstitial(adUnitId);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onAdDisplayedCallback: (ad) {
|
||||||
|
LogPrint.d('插页广告显示成功:${ad.adUnitId}');
|
||||||
|
isShowingAd = true;
|
||||||
|
FirebaseAnalyticsManager.logAdsShow();
|
||||||
|
},
|
||||||
|
onAdDisplayFailedCallback: (ad, error) {
|
||||||
|
LogPrint.d('插页广告显示失败adUnitId:${ad.adUnitId},code:${error.code},message:${error.message}');
|
||||||
|
isShowingAd = false;
|
||||||
|
|
||||||
|
if (onTap != null) onTap!();
|
||||||
|
},
|
||||||
|
onAdClickedCallback: (ad) {},
|
||||||
|
onAdHiddenCallback: (ad) {
|
||||||
|
LogPrint.d('插页广告关闭:${ad.adUnitId}');
|
||||||
|
isShowingAd = false;
|
||||||
|
AppLovinMAX.loadInterstitial(ad.adUnitId);
|
||||||
|
|
||||||
|
if (onTap != null) onTap!();
|
||||||
|
},
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
void loadAllAd() {
|
||||||
|
bool adSwitch = UPCache.getInstance().get<bool>('adSwitch') ?? false;
|
||||||
|
if (!adSwitch) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AppLovinMAX.loadInterstitial(launchAdId);
|
||||||
|
for (var id in adIds) {
|
||||||
|
AppLovinMAX.loadInterstitial(id);
|
||||||
|
}
|
||||||
|
LogPrint.d('插页广告正在加载');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 显示插页广告,如果准备好
|
||||||
|
Future<void> showAdIfReady({bool showLaunchAd = false, Function()? onTap}) async {
|
||||||
|
if (onTap != null) {
|
||||||
|
this.onTap = onTap;
|
||||||
|
}
|
||||||
|
bool adSwitch = UPCache.getInstance().get<bool>('adSwitch') ?? false;
|
||||||
|
if (!adSwitch) {
|
||||||
|
if (this.onTap != null) this.onTap!();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isInitialized) {
|
||||||
|
if (this.onTap != null) this.onTap!();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var adId = launchAdId;
|
||||||
|
if (!showLaunchAd) {
|
||||||
|
int index = NumUtil.getRandomNumber(0, 3);
|
||||||
|
adId = adIds[index];
|
||||||
|
}
|
||||||
|
bool isReady = (await AppLovinMAX.isInterstitialReady(adId))!;
|
||||||
|
if (isReady) {
|
||||||
|
if (isShowingAd) {
|
||||||
|
LogPrint.d('尝试在已显示广告的情况下显示广告');
|
||||||
|
if (this.onTap != null) this.onTap!();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
AppLovinMAX.showInterstitial(adId);
|
||||||
|
} else {
|
||||||
|
if (this.onTap != null) this.onTap!();
|
||||||
|
AppLovinMAX.loadInterstitial(adId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@ class RemindDialog extends StatelessWidget {
|
|||||||
this.title,
|
this.title,
|
||||||
this.content,
|
this.content,
|
||||||
this.showCancelBtn = true,
|
this.showCancelBtn = true,
|
||||||
|
this.enableBack = true,
|
||||||
this.cancelText,
|
this.cancelText,
|
||||||
this.confirmText,
|
this.confirmText,
|
||||||
this.confirmOnTap,
|
this.confirmOnTap,
|
||||||
@ -16,7 +17,8 @@ class RemindDialog extends StatelessWidget {
|
|||||||
|
|
||||||
final String? title;
|
final String? title;
|
||||||
final String? content;
|
final String? content;
|
||||||
final bool? showCancelBtn;
|
final bool showCancelBtn;
|
||||||
|
final bool enableBack;
|
||||||
final String? cancelText;
|
final String? cancelText;
|
||||||
final String? confirmText;
|
final String? confirmText;
|
||||||
final Function()? confirmOnTap;
|
final Function()? confirmOnTap;
|
||||||
@ -61,7 +63,7 @@ class RemindDialog extends StatelessWidget {
|
|||||||
height: 48.h,
|
height: 48.h,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
if (showCancelBtn!) ...[
|
if (showCancelBtn) ...[
|
||||||
_optionButton(cancelText ?? 'Cancel', false),
|
_optionButton(cancelText ?? 'Cancel', false),
|
||||||
Container(
|
Container(
|
||||||
width: 1.w,
|
width: 1.w,
|
||||||
@ -87,7 +89,7 @@ class RemindDialog extends StatelessWidget {
|
|||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Get.back();
|
if (enableBack) Get.back();
|
||||||
if (isConfirm && confirmOnTap != null) {
|
if (isConfirm && confirmOnTap != null) {
|
||||||
confirmOnTap!();
|
confirmOnTap!();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:pin_code_fields/pin_code_fields.dart';
|
import 'package:pin_code_fields/pin_code_fields.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/utils/shared_util.dart';
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
|
|
||||||
class PinCodeVerificationScreen extends StatefulWidget {
|
class PinCodeVerificationScreen extends StatefulWidget {
|
||||||
@ -196,11 +195,12 @@ class _PinCodeVerificationScreenState extends State<PinCodeVerificationScreen> {
|
|||||||
textEditingController.clear();
|
textEditingController.clear();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ApplovinUtil().showAdIfReady();
|
InterstitialAdManager().showAdIfReady(onTap: () {
|
||||||
widget.callback();
|
widget.callback();
|
||||||
setState(() {
|
setState(() {
|
||||||
hasError = false;
|
hasError = false;
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
288
lib/common/utils/date_utils.dart
Normal file
288
lib/common/utils/date_utils.dart
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
class DateFormats {
|
||||||
|
static String full = 'yyyy-MM-dd HH:mm:ss';
|
||||||
|
static String yMoDHM = 'yyyy-MM-dd HH:mm';
|
||||||
|
static String yMoD = 'yyyy-MM-dd';
|
||||||
|
static String yMo = 'yyyy-MM';
|
||||||
|
static String moD = 'MM-dd';
|
||||||
|
static String moDHM = 'MM-dd HH:mm';
|
||||||
|
static String hMS = 'HH:mm:ss';
|
||||||
|
static String hM = 'HH:mm';
|
||||||
|
|
||||||
|
static String zhFull = 'yyyy年MM月dd日 HH时mm分ss秒';
|
||||||
|
static String zhYMoDHM = 'yyyy年MM月dd日 HH时mm分';
|
||||||
|
static String zhYMoD = 'yyyy年MM月dd日';
|
||||||
|
static String zhYMo = 'yyyy年MM月';
|
||||||
|
static String zhMoD = 'MM月dd日';
|
||||||
|
static String zhMoDHM = 'MM月dd日 HH时mm分';
|
||||||
|
static String zhHMS = 'HH时mm分ss秒';
|
||||||
|
static String zhHM = 'HH时mm分';
|
||||||
|
}
|
||||||
|
|
||||||
|
class DateUtils {
|
||||||
|
/// 月->天数.
|
||||||
|
static Map<int, int> monthDay = {
|
||||||
|
1: 31,
|
||||||
|
2: 28,
|
||||||
|
3: 31,
|
||||||
|
4: 30,
|
||||||
|
5: 31,
|
||||||
|
6: 30,
|
||||||
|
7: 31,
|
||||||
|
8: 31,
|
||||||
|
9: 30,
|
||||||
|
10: 31,
|
||||||
|
11: 30,
|
||||||
|
12: 31,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// 获取当前时间,默认格式(yyyy-MM-dd HH:mm:ss)
|
||||||
|
static String getNowTimeStr({String? format}) {
|
||||||
|
return formatDate(DateTime.now(), format: format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 获取当前时间戳
|
||||||
|
static int getNowTimestamp() {
|
||||||
|
return DateTime.now().millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 以毫秒为单位格式化日期
|
||||||
|
static String formatDateMs(int ms, {bool isUtc = false, String? format}) {
|
||||||
|
return formatDate(getDateTimeByMs(ms, isUtc: isUtc), format: format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 毫秒 转 DateTime
|
||||||
|
static DateTime getDateTimeByMs(int ms, {bool isUtc = false}) {
|
||||||
|
return DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 日期str 转 毫秒
|
||||||
|
static int? getDateMsByTimeStr(String dateStr, {bool? isUtc}) {
|
||||||
|
DateTime? dateTime = getDateTime(dateStr, isUtc: isUtc);
|
||||||
|
return dateTime?.millisecondsSinceEpoch;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 按日期str格式化日期
|
||||||
|
static String formatDateStr(String dateStr, {bool? isUtc, String? format}) {
|
||||||
|
return formatDate(getDateTime(dateStr, isUtc: isUtc), format: format);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 日期str 转 DateTime
|
||||||
|
static DateTime? getDateTime(String dateStr, {bool? isUtc}) {
|
||||||
|
DateTime? dateTime = DateTime.tryParse(dateStr);
|
||||||
|
if (isUtc != null) {
|
||||||
|
if (isUtc) {
|
||||||
|
dateTime = dateTime?.toUtc();
|
||||||
|
} else {
|
||||||
|
dateTime = dateTime?.toLocal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 按DateTime格式化日期
|
||||||
|
/// format 转换格式(已提供常用格式 DateFormats,可以自定义格式:'yyyy/MM/dd HH:mm:ss')
|
||||||
|
/// 格式要求
|
||||||
|
/// year -> yyyy/yy month -> MM/M day -> dd/d
|
||||||
|
/// hour -> HH/H minute -> mm/m second -> ss/s
|
||||||
|
static String formatDate(DateTime? dateTime, {String? format}) {
|
||||||
|
if (dateTime == null) return '';
|
||||||
|
format = format ?? DateFormats.full;
|
||||||
|
if (format.contains('yy')) {
|
||||||
|
String year = dateTime.year.toString();
|
||||||
|
if (format.contains('yyyy')) {
|
||||||
|
format = format.replaceAll('yyyy', year);
|
||||||
|
} else {
|
||||||
|
format = format.replaceAll(
|
||||||
|
'yy', year.substring(year.length - 2, year.length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
format = _comFormat(dateTime.month, format, 'M', 'MM');
|
||||||
|
format = _comFormat(dateTime.day, format, 'd', 'dd');
|
||||||
|
format = _comFormat(dateTime.hour, format, 'H', 'HH');
|
||||||
|
format = _comFormat(dateTime.minute, format, 'm', 'mm');
|
||||||
|
format = _comFormat(dateTime.second, format, 's', 'ss');
|
||||||
|
format = _comFormat(dateTime.millisecond, format, 'S', 'SSS');
|
||||||
|
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String _comFormat(int value, String format, String single, String full) {
|
||||||
|
if (format.contains(single)) {
|
||||||
|
if (format.contains(full)) {
|
||||||
|
format = format.replaceAll(full, value < 10 ? '0$value' : value.toString());
|
||||||
|
} else {
|
||||||
|
format = format.replaceAll(single, value.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 工作日
|
||||||
|
/// dateTime
|
||||||
|
/// isUtc
|
||||||
|
/// languageCode zh or en
|
||||||
|
/// short
|
||||||
|
static String getWeekday(DateTime? dateTime, {String languageCode = 'zh', bool short = false}) {
|
||||||
|
if (dateTime == null) return '';
|
||||||
|
String weekday = '';
|
||||||
|
switch (dateTime.weekday) {
|
||||||
|
case 1:
|
||||||
|
weekday = languageCode == 'zh' ? '星期一' : 'Monday';
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
weekday = languageCode == 'zh' ? '星期二' : 'Tuesday';
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
weekday = languageCode == 'zh' ? '星期三' : 'Wednesday';
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
weekday = languageCode == 'zh' ? '星期四' : 'Thursday';
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
weekday = languageCode == 'zh' ? '星期五' : 'Friday';
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
weekday = languageCode == 'zh' ? '星期六' : 'Saturday';
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
weekday = languageCode == 'zh' ? '星期日' : 'Sunday';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return languageCode == 'zh'
|
||||||
|
? (short ? weekday.replaceAll('星期', '周') : weekday)
|
||||||
|
: weekday.substring(0, short ? 3 : weekday.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 以毫秒计算工作日
|
||||||
|
static String getWeekdayByMs(int milliseconds, {bool isUtc = false, String languageCode = 'zh', bool short = false}) {
|
||||||
|
DateTime dateTime = getDateTimeByMs(milliseconds, isUtc: isUtc);
|
||||||
|
return getWeekday(dateTime, languageCode: languageCode, short: short);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 在今年的第几天
|
||||||
|
static int getDayOfYear(DateTime dateTime) {
|
||||||
|
int year = dateTime.year;
|
||||||
|
int month = dateTime.month;
|
||||||
|
int days = dateTime.day;
|
||||||
|
for (int i = 1; i < month; i++) {
|
||||||
|
days = days + monthDay[i]!;
|
||||||
|
}
|
||||||
|
if (isLeapYearByYear(year) && month > 2) {
|
||||||
|
days = days + 1;
|
||||||
|
}
|
||||||
|
return days;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 在今年的第几天
|
||||||
|
static int getDayOfYearByMs(int ms, {bool isUtc = false}) {
|
||||||
|
return getDayOfYear(DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否是当天
|
||||||
|
static bool isToday(int? milliseconds, {bool isUtc = false, int? locMs}) {
|
||||||
|
if (milliseconds == null || milliseconds == 0) return false;
|
||||||
|
DateTime old =
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(milliseconds, isUtc: isUtc);
|
||||||
|
DateTime now;
|
||||||
|
if (locMs != null) {
|
||||||
|
now = DateUtils.getDateTimeByMs(locMs);
|
||||||
|
} else {
|
||||||
|
now = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
|
||||||
|
}
|
||||||
|
return old.year == now.year && old.month == now.month && old.day == now.day;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否是昨天.
|
||||||
|
static bool isYesterday(DateTime dateTime, DateTime locDateTime) {
|
||||||
|
if (yearIsEqual(dateTime, locDateTime)) {
|
||||||
|
int spDay = getDayOfYear(locDateTime) - getDayOfYear(dateTime);
|
||||||
|
return spDay == 1;
|
||||||
|
} else {
|
||||||
|
return ((locDateTime.year - dateTime.year == 1) &&
|
||||||
|
dateTime.month == 12 &&
|
||||||
|
locDateTime.month == 1 &&
|
||||||
|
dateTime.day == 31 &&
|
||||||
|
locDateTime.day == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否是昨天
|
||||||
|
static bool isYesterdayByMs(int ms, int locMs) {
|
||||||
|
return isYesterday(DateTime.fromMillisecondsSinceEpoch(ms),
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(locMs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否是本周
|
||||||
|
static bool isWeek(int? ms, {bool isUtc = false, int? locMs}) {
|
||||||
|
if (ms == null || ms <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
DateTime oldT = DateTime.fromMillisecondsSinceEpoch(ms, isUtc: isUtc);
|
||||||
|
DateTime nowT;
|
||||||
|
if (locMs != null) {
|
||||||
|
nowT = DateUtils.getDateTimeByMs(locMs, isUtc: isUtc);
|
||||||
|
} else {
|
||||||
|
nowT = isUtc ? DateTime.now().toUtc() : DateTime.now().toLocal();
|
||||||
|
}
|
||||||
|
|
||||||
|
DateTime old =
|
||||||
|
nowT.millisecondsSinceEpoch > oldT.millisecondsSinceEpoch ? oldT : nowT;
|
||||||
|
DateTime now =
|
||||||
|
nowT.millisecondsSinceEpoch > oldT.millisecondsSinceEpoch ? nowT : oldT;
|
||||||
|
return (now.weekday >= old.weekday) &&
|
||||||
|
(now.millisecondsSinceEpoch - old.millisecondsSinceEpoch <=
|
||||||
|
7 * 24 * 60 * 60 * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否同年
|
||||||
|
static bool yearIsEqual(DateTime dateTime, DateTime locDateTime) {
|
||||||
|
return dateTime.year == locDateTime.year;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否同年
|
||||||
|
static bool yearIsEqualByMs(int ms, int locMs) {
|
||||||
|
return yearIsEqual(DateTime.fromMillisecondsSinceEpoch(ms),
|
||||||
|
DateTime.fromMillisecondsSinceEpoch(locMs));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否是闰年
|
||||||
|
static bool isLeapYear(DateTime dateTime) {
|
||||||
|
return isLeapYearByYear(dateTime.year);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 是否是闰年
|
||||||
|
static bool isLeapYearByYear(int year) {
|
||||||
|
return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 判断两个 DateTime 是否是同一天
|
||||||
|
static bool isSameDay(String date1, String date2) {
|
||||||
|
final dateTime1 = getDateTime(date1);
|
||||||
|
final dateTime2 = getDateTime(date2);
|
||||||
|
if(dateTime1?.year == dateTime2?.year && dateTime1?.month == dateTime2?.month && dateTime1?.day == dateTime2?.day) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 如果如果当前月是12,下月年份需要+1
|
||||||
|
static int getNextMonthToYear() {
|
||||||
|
DateTime dateTime = DateTime.now();
|
||||||
|
if(dateTime.month == 12) {
|
||||||
|
return dateTime.year + 1;
|
||||||
|
}
|
||||||
|
return dateTime.year;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 获取当前下月
|
||||||
|
static int getNextMonth() {
|
||||||
|
DateTime dateTime = DateTime.now();
|
||||||
|
if (dateTime.month == 12) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return dateTime.month + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
class NumUtil {
|
class NumUtil {
|
||||||
static int getInt(num? value) {
|
static int getInt(num? value) {
|
||||||
if (value == null) return 0;
|
if (value == null) return 0;
|
||||||
@ -21,4 +23,11 @@ class NumUtil {
|
|||||||
static double strToDouble(String valueStr, {double defValue = 0.0}) {
|
static double strToDouble(String valueStr, {double defValue = 0.0}) {
|
||||||
return double.tryParse(valueStr) ?? defValue;
|
return double.tryParse(valueStr) ?? defValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 获取一个随机随
|
||||||
|
static int getRandomNumber(int min, int max) {
|
||||||
|
Random random = Random();
|
||||||
|
int randomNumber = random.nextInt(max - min) + min;
|
||||||
|
return randomNumber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,10 +1,10 @@
|
|||||||
class ObjUtil {
|
// Author: fengshengxiong
|
||||||
static bool isNotEmptyStr(String? str) {
|
// Date: 2024/5/7
|
||||||
return str != null && str.trim().isNotEmpty;
|
// Description: 对象工具类
|
||||||
}
|
|
||||||
|
|
||||||
|
class ObjUtil {
|
||||||
static String getStr(String? str) {
|
static String getStr(String? str) {
|
||||||
return isNotEmptyStr(str) ? str! : '';
|
return isNotEmpty(str) ? str! : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isNotEmptyList(Iterable? list) {
|
static bool isNotEmptyList(Iterable? list) {
|
||||||
@ -15,6 +15,10 @@ class ObjUtil {
|
|||||||
return map != null && map.isNotEmpty;
|
return map != null && map.isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool isNotEmpty(Object? object) {
|
||||||
|
return !isEmpty(object);
|
||||||
|
}
|
||||||
|
|
||||||
static bool isEmpty(Object? object) {
|
static bool isEmpty(Object? object) {
|
||||||
if (object == null) return true;
|
if (object == null) return true;
|
||||||
if (object is String && object.trim().isEmpty) {
|
if (object is String && object.trim().isEmpty) {
|
||||||
@ -27,10 +31,6 @@ class ObjUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isNotEmpty(Object? object) {
|
|
||||||
return !isEmpty(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns true Two List Is Equal.
|
/// Returns true Two List Is Equal.
|
||||||
static bool twoListIsEqual(List? listA, List? listB) {
|
static bool twoListIsEqual(List? listA, List? listB) {
|
||||||
if (listA == listB) return true;
|
if (listA == listB) return true;
|
||||||
|
|||||||
@ -1,146 +0,0 @@
|
|||||||
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';
|
|
||||||
|
|
||||||
class ApplovinUtil {
|
|
||||||
ApplovinUtil._();
|
|
||||||
|
|
||||||
static final ApplovinUtil _instance = ApplovinUtil._();
|
|
||||||
|
|
||||||
factory ApplovinUtil() => _instance;
|
|
||||||
|
|
||||||
/// sdkKey
|
|
||||||
final String applovinKey =
|
|
||||||
'HXOh4UBLahW9KzBBrxqwniKOvfD_JEDJgE9y2rv8DlmJaJ6xPEXUmmJyeAg0xipqdH_EiHg5NsnvfmIHubSu1k';
|
|
||||||
|
|
||||||
/// 广告单元Id
|
|
||||||
final String adUnitId = 'f4d33bc86b44eb24';
|
|
||||||
|
|
||||||
final List<String> adUnitIds = [
|
|
||||||
'e0ac389b7746be38',
|
|
||||||
'a8ecc9c457dee7bf',
|
|
||||||
'f4231f22c0314229',
|
|
||||||
];
|
|
||||||
|
|
||||||
/// 是否已初始化
|
|
||||||
bool isInitialized = false;
|
|
||||||
|
|
||||||
/// 是否是启动屏幕
|
|
||||||
bool isSplashScreen = true;
|
|
||||||
|
|
||||||
/// 重试计数
|
|
||||||
final _maxExponentialRetryCount = 6;
|
|
||||||
var _interstitialRetryAttempt = 0;
|
|
||||||
|
|
||||||
/// 初始化
|
|
||||||
Future<void> initApplovin() async {
|
|
||||||
MaxConfiguration? configuration = await AppLovinMAX.initialize(applovinKey);
|
|
||||||
if (configuration != null) {
|
|
||||||
isInitialized = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 初始化插页广告
|
|
||||||
void initializeInterstitialAds({required Function() onGoHomeTap}) {
|
|
||||||
if (isInitialized) {
|
|
||||||
AppLovinMAX.setInterstitialListener(InterstitialListener(
|
|
||||||
onAdLoadedCallback: (ad) async {
|
|
||||||
LogPrint.d('AdLoadedSuccess:${ad.adUnitId}');
|
|
||||||
if (ad.adUnitId == adUnitId && isSplashScreen) {
|
|
||||||
await showAdIfReady(adUnitId: adUnitId);
|
|
||||||
AppLovinMAX.loadInterstitial(adUnitId);
|
|
||||||
isSplashScreen = false;
|
|
||||||
onGoHomeTap();
|
|
||||||
}
|
|
||||||
_interstitialRetryAttempt = 0;
|
|
||||||
},
|
|
||||||
onAdLoadFailedCallback: (adUnitId, error) {
|
|
||||||
LogPrint.d(
|
|
||||||
'AdLoadFailed:$adUnitId,code:${error.code},message:${error.message}',
|
|
||||||
);
|
|
||||||
if (adUnitId == this.adUnitId && isSplashScreen) {
|
|
||||||
isSplashScreen = false;
|
|
||||||
onGoHomeTap();
|
|
||||||
}
|
|
||||||
// Applovin建议您以指数级更高的延迟重试,最大延迟可达64秒
|
|
||||||
_interstitialRetryAttempt = _interstitialRetryAttempt + 1;
|
|
||||||
if (_interstitialRetryAttempt > _maxExponentialRetryCount) return;
|
|
||||||
int retryDelay = pow(
|
|
||||||
2,
|
|
||||||
min(
|
|
||||||
_maxExponentialRetryCount,
|
|
||||||
_interstitialRetryAttempt,
|
|
||||||
)).toInt();
|
|
||||||
|
|
||||||
Future.delayed(Duration(milliseconds: retryDelay * 1000), () {
|
|
||||||
AppLovinMAX.loadInterstitial(adUnitId);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onAdDisplayedCallback: (ad) {
|
|
||||||
LogPrint.d('AdDisplayedSuccess:${ad.adUnitId}');
|
|
||||||
UPCache.getInstance().setData<int>(
|
|
||||||
"lastAdTime",
|
|
||||||
DateTime.now().millisecondsSinceEpoch,
|
|
||||||
);
|
|
||||||
// 打点
|
|
||||||
FirebaseAnalyticsManager.logAdImpression(
|
|
||||||
ad.adUnitId, ad.networkName, 1, 1, 0);
|
|
||||||
},
|
|
||||||
onAdDisplayFailedCallback: (ad, error) {
|
|
||||||
LogPrint.d(
|
|
||||||
'AdDisplayFailed:${ad.adUnitId},code:${error.code},message:${error.message}',
|
|
||||||
);
|
|
||||||
// 打点
|
|
||||||
FirebaseAnalyticsManager.logAdImpression(
|
|
||||||
ad.adUnitId, ad.networkName, 1, 0, 1);
|
|
||||||
},
|
|
||||||
onAdClickedCallback: (ad) {},
|
|
||||||
onAdHiddenCallback: (ad) {
|
|
||||||
LogPrint.d('AdHidden:${ad.adUnitId}');
|
|
||||||
UPCache.getInstance().setData<int>(
|
|
||||||
"lastAdTime",
|
|
||||||
DateTime.now().millisecondsSinceEpoch,
|
|
||||||
);
|
|
||||||
AppLovinMAX.loadInterstitial(ad.adUnitId);
|
|
||||||
},
|
|
||||||
));
|
|
||||||
|
|
||||||
AppLovinMAX.loadInterstitial(adUnitId);
|
|
||||||
for (var e in adUnitIds) {
|
|
||||||
AppLovinMAX.loadInterstitial(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 显示插页广告,如果准备好
|
|
||||||
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);
|
|
||||||
if (difference.inSeconds <= 5) return;
|
|
||||||
|
|
||||||
if (!isInitialized) return;
|
|
||||||
adUnitId ??= (adUnitIds..shuffle()).toList()[0];
|
|
||||||
bool isReady = (await AppLovinMAX.isInterstitialReady(adUnitId))!;
|
|
||||||
LogPrint.d("adUnitId:$adUnitId | isReady:$isReady");
|
|
||||||
if (isReady) {
|
|
||||||
AppLovinMAX.showInterstitial(adUnitId);
|
|
||||||
} else {
|
|
||||||
AppLovinMAX.loadInterstitial(adUnitId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
lib/facebook/facebook_manager.dart
Normal file
12
lib/facebook/facebook_manager.dart
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// Author: fengshengxiong
|
||||||
|
// Date: 2024/6/26
|
||||||
|
// Description: facebook管理
|
||||||
|
|
||||||
|
import 'package:facebook_app_events/facebook_app_events.dart';
|
||||||
|
|
||||||
|
class FacebookManager {
|
||||||
|
static void init() {
|
||||||
|
FacebookAppEvents().setAdvertiserTracking(enabled: true);
|
||||||
|
FacebookAppEvents().setAutoLogAppEventsEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,34 +1,38 @@
|
|||||||
import 'package:firebase_analytics/firebase_analytics.dart';
|
import 'package:firebase_analytics/firebase_analytics.dart';
|
||||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
class FirebaseAnalyticsManager {
|
class FirebaseAnalyticsManager {
|
||||||
/// 仅在非调试版本中启用它
|
|
||||||
static Future<void> setCrashlyticsCollectionEnabled() async {
|
|
||||||
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(!kDebugMode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 埋点
|
/// 埋点
|
||||||
/// name:事件名
|
/// name:事件名
|
||||||
/// parameters:业务参数
|
/// parameters:业务参数
|
||||||
static void logEvent(String eventName, {Map<String, Object>? parameters}) {
|
static void logEvent(String eventName, {Map<String, Object>? parameters}) {
|
||||||
|
try {
|
||||||
FirebaseAnalytics.instance.logEvent(
|
FirebaseAnalytics.instance.logEvent(
|
||||||
name: eventName,
|
name: eventName,
|
||||||
parameters: parameters,
|
parameters: parameters,
|
||||||
);
|
);
|
||||||
|
} catch (e) {
|
||||||
|
LogPrint.d(e.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 广告日志记录
|
/// 启动事件:启动时上传
|
||||||
static logAdImpression(String adId, String adName, int shouldCount, int successCount, int failCount) {
|
static void logLaunch() {
|
||||||
FirebaseAnalytics.instance.logEvent(
|
logEvent('launch');
|
||||||
name: 'ad_impression',
|
}
|
||||||
parameters: {
|
|
||||||
'adId': adId,
|
/// 首页PV:首页曝光上传
|
||||||
'adName': adName,
|
static void logHomepage() {
|
||||||
'shouldCount': shouldCount,
|
logEvent('homepage');
|
||||||
'successCount': successCount,
|
}
|
||||||
'failCount': failCount,
|
|
||||||
},
|
/// 加载页PV:加载页面曝光上传
|
||||||
);
|
static void logLoadingPage() {
|
||||||
|
logEvent('loading_page');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 广告展示:所有的广告位只要有广告成功展示出来就上传一条
|
||||||
|
static void logAdsShow() {
|
||||||
|
logEvent('ads_show');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
lib/firebase/firebase_crashlytics_manager.dart
Normal file
28
lib/firebase/firebase_crashlytics_manager.dart
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Author: fengshengxiong
|
||||||
|
// Date: 2024/6/26
|
||||||
|
// Description: firebase_crashlytics管理
|
||||||
|
|
||||||
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
|
||||||
|
class FirebaseCrashlyticsManager {
|
||||||
|
static Future<void> setEnabled() async {
|
||||||
|
await FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(kReleaseMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void recordFlutterError() {
|
||||||
|
FlutterError.onError = (errorDetails) {
|
||||||
|
LogPrint.d(errorDetails.exception);
|
||||||
|
FirebaseCrashlytics.instance.recordFlutterError(errorDetails);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
static void recordError() {
|
||||||
|
PlatformDispatcher.instance.onError = (error, stack) {
|
||||||
|
LogPrint.d(error);
|
||||||
|
FirebaseCrashlytics.instance.recordError(error, stack);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,34 +1,36 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:firebase_remote_config/firebase_remote_config.dart';
|
import 'package:firebase_remote_config/firebase_remote_config.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/obj_util.dart';
|
||||||
import 'package:wallpaperx/common/utils/shared_util.dart';
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
|
|
||||||
class FirebaseRemoteConfigManager {
|
class FirebaseRemoteConfigManager {
|
||||||
Future init() async {
|
static Future init() async {
|
||||||
try {
|
try {
|
||||||
final remoteConfig = FirebaseRemoteConfig.instance;
|
final remoteConfig = FirebaseRemoteConfig.instance;
|
||||||
await remoteConfig.setConfigSettings(RemoteConfigSettings(
|
await remoteConfig.setConfigSettings(RemoteConfigSettings(
|
||||||
fetchTimeout: const Duration(minutes: 1),
|
fetchTimeout: const Duration(seconds: 15),
|
||||||
minimumFetchInterval: const Duration(minutes: 0),
|
minimumFetchInterval: Duration.zero,
|
||||||
));
|
));
|
||||||
remoteConfig.onConfigUpdated.listen((event) async {
|
remoteConfig.onConfigUpdated.listen((event) async {
|
||||||
remoteConfig.fetchAndActivate().then((e) {
|
remoteConfig.fetchAndActivate().then((e) {
|
||||||
setIsOpenSetting(remoteConfig);
|
_setIsOpenSetting(remoteConfig);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
remoteConfig.fetchAndActivate().then((e) {
|
remoteConfig.fetchAndActivate().then((e) {
|
||||||
setIsOpenSetting(remoteConfig);
|
_setIsOpenSetting(remoteConfig);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
LogPrint.d(e);
|
LogPrint.d(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsOpenSetting(FirebaseRemoteConfig remoteConfig) async {
|
static void _setIsOpenSetting(FirebaseRemoteConfig remoteConfig) async {
|
||||||
RemoteConfigValue all = remoteConfig.getValue("isopen");
|
RemoteConfigValue all = remoteConfig.getValue("isopen");
|
||||||
if (all.asString() == "") {
|
if (ObjUtil.isEmpty(all.asString())) {
|
||||||
UPCache.getInstance().setData<bool>("showAd", false);
|
UPCache.getInstance().setData<bool>("showAd", false);
|
||||||
UPCache.getInstance().setData<String>("version", "");
|
UPCache.getInstance().setData<String>("version", "");
|
||||||
} else {
|
} else {
|
||||||
@ -36,6 +38,15 @@ class FirebaseRemoteConfigManager {
|
|||||||
UPCache.getInstance().setData<bool>("showAd", isOpen["isadopen"]);
|
UPCache.getInstance().setData<bool>("showAd", isOpen["isadopen"]);
|
||||||
UPCache.getInstance().setData<String>("version", isOpen["version"]);
|
UPCache.getInstance().setData<String>("version", isOpen["version"]);
|
||||||
UPCache.getInstance().setData<String>("http", isOpen["http"]);
|
UPCache.getInstance().setData<String>("http", isOpen["http"]);
|
||||||
|
|
||||||
|
bool adSwitch = UPCache.getInstance().get<bool>('adSwitch') ?? false;
|
||||||
|
if (!adSwitch) {
|
||||||
|
final packageInfo = await PackageInfo.fromPlatform();
|
||||||
|
if (isOpen["version"] != packageInfo.version) {
|
||||||
|
UPCache.getInstance().setData<bool>("adSwitch", true);
|
||||||
|
InterstitialAdManager().loadAllAd();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
lib/global/app_config.dart
Normal file
13
lib/global/app_config.dart
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'package:wallpaperx/common/utils/date_utils.dart';
|
||||||
|
|
||||||
|
const appName = 'Visual Wallpaper';
|
||||||
|
|
||||||
|
/// 保底逻辑:本地设定截止日期(提交日期+3天,网络时间超过,则默认展示所有广告)
|
||||||
|
DateTime getGuaranteedDate () {
|
||||||
|
DateTime? commitDate = DateUtils.getDateTime('2024-08-14 18:30:00');
|
||||||
|
if (commitDate != null) {
|
||||||
|
return commitDate.add(const Duration(days: 3));
|
||||||
|
} else {
|
||||||
|
return DateTime.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
87
lib/global/app_lifecycle_reactor.dart
Normal file
87
lib/global/app_lifecycle_reactor.dart
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// Author: fengshengxiong
|
||||||
|
// Date: 2024/6/25
|
||||||
|
// Description: 应用程序生命周期反应器
|
||||||
|
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
|
||||||
|
class AppLifecycleReactor {
|
||||||
|
AppLifecycleReactor._();
|
||||||
|
|
||||||
|
static final AppLifecycleReactor _instance = AppLifecycleReactor._();
|
||||||
|
|
||||||
|
factory AppLifecycleReactor() {
|
||||||
|
return _instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
AppLifecycleListener? appLifecycleListener;
|
||||||
|
|
||||||
|
void listenToAppStateChanges() {
|
||||||
|
appLifecycleListener = AppLifecycleListener(
|
||||||
|
onStateChange: onStateChange,
|
||||||
|
onResume: onResume,
|
||||||
|
onInactive: onInactive,
|
||||||
|
onHide: onHide,
|
||||||
|
onShow: onShow,
|
||||||
|
onPause: onPause,
|
||||||
|
onRestart: onRestart,
|
||||||
|
onDetach: onDetach,
|
||||||
|
onExitRequested: onExitRequested,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 监听状态
|
||||||
|
onStateChange(AppLifecycleState state) {
|
||||||
|
LogPrint.d('app_state:$state');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 可见,并且可以响应用户操作时的回调
|
||||||
|
/// 比如应用从后台调度到前台时,在 onShow() 后面 执行
|
||||||
|
/// 注意:这个回调,初始化时 不执行
|
||||||
|
onResume() {
|
||||||
|
LogPrint.d('---onResume');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 可见,但无法响应用户操作时的回调
|
||||||
|
onInactive() {
|
||||||
|
LogPrint.d('---onInactive');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 隐藏时的回调
|
||||||
|
onHide() {
|
||||||
|
LogPrint.d('---onHide');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 显示时的回调,应用从后台调度到前台时
|
||||||
|
onShow() {
|
||||||
|
LogPrint.d('---onShow');
|
||||||
|
InterstitialAdManager().showAdIfReady(showLaunchAd: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 暂停时的回调
|
||||||
|
onPause() {
|
||||||
|
LogPrint.d('---onPause');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 暂停后恢复时的回调
|
||||||
|
onRestart() {
|
||||||
|
LogPrint.d('---onRestart');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 这两个回调,不是所有平台都支持,
|
||||||
|
|
||||||
|
/// 当退出 并将所有视图与引擎分离时的回调(IOS 支持,Android 不支持)
|
||||||
|
onDetach() {
|
||||||
|
LogPrint.d('---onDetach');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 在退出程序时,发出询问的回调(IOS、Android 都不支持)
|
||||||
|
/// 响应 [AppExitResponse.exit] 将继续终止,响应 [AppExitResponse.cancel] 将取消终止。
|
||||||
|
Future<AppExitResponse> onExitRequested() async {
|
||||||
|
LogPrint.d('---onExitRequested');
|
||||||
|
return AppExitResponse.exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,12 @@
|
|||||||
|
// Author: fengshengxiong
|
||||||
|
// Date: 2024/6/26
|
||||||
|
// Description: 应用程序跟踪透明度管理器
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
|
import 'package:app_tracking_transparency/app_tracking_transparency.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
|
||||||
class AppTrackingTransparencyManager {
|
class AppTrackingTransparencyManager {
|
||||||
AppTrackingTransparencyManager._();
|
AppTrackingTransparencyManager._();
|
||||||
@ -21,6 +26,7 @@ class AppTrackingTransparencyManager {
|
|||||||
if (status == TrackingStatus.notDetermined) {
|
if (status == TrackingStatus.notDetermined) {
|
||||||
if (_timer != null && _timer!.isActive) {
|
if (_timer != null && _timer!.isActive) {
|
||||||
final TrackingStatus status = await AppTrackingTransparency.requestTrackingAuthorization();
|
final TrackingStatus status = await AppTrackingTransparency.requestTrackingAuthorization();
|
||||||
|
LogPrint.d('跟踪授权状态: $status');
|
||||||
} else {
|
} else {
|
||||||
_startTimer();
|
_startTimer();
|
||||||
}
|
}
|
||||||
51
lib/global/network_connectivity_service.dart
Normal file
51
lib/global/network_connectivity_service.dart
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// Author: fengshengxiong
|
||||||
|
// Date: 2024/6/26
|
||||||
|
// Description: 网络连接服务
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
|
import 'package:wallpaperx/firebase/firebase_remote_config_manager.dart';
|
||||||
|
import 'package:wallpaperx/page/launch/launch_controller.dart';
|
||||||
|
|
||||||
|
class NetworkConnectivityService extends GetxService {
|
||||||
|
StreamSubscription<List<ConnectivityResult>>? subscription;
|
||||||
|
var isShowNetworkDialog = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
subscription = Connectivity().onConnectivityChanged.listen((List<ConnectivityResult> result) async {
|
||||||
|
LogPrint.d('当前网络连接类型:$result');
|
||||||
|
if (result.contains(ConnectivityResult.none)) {
|
||||||
|
|
||||||
|
if (Get.isRegistered<LaunchController>() && !isShowNetworkDialog) {
|
||||||
|
LaunchController.to.openNetworkDialog();
|
||||||
|
isShowNetworkDialog = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (Get.isRegistered<LaunchController>()) {
|
||||||
|
if (isShowNetworkDialog) {
|
||||||
|
Get.back();
|
||||||
|
}
|
||||||
|
LaunchController.to.startTimer();
|
||||||
|
}
|
||||||
|
bool adSwitch = UPCache.getInstance().get<bool>('adSwitch') ?? false;
|
||||||
|
if (adSwitch) {
|
||||||
|
InterstitialAdManager().loadAllAd();
|
||||||
|
}
|
||||||
|
await FirebaseRemoteConfigManager.init();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
subscription?.cancel();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,64 +1,48 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:bot_toast/bot_toast.dart';
|
import 'package:bot_toast/bot_toast.dart';
|
||||||
import 'package:firebase_core/firebase_core.dart';
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/components/easy_loading.dart';
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
||||||
import 'package:wallpaperx/common/storage/hive_storage.dart';
|
import 'package:wallpaperx/common/storage/hive_storage.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/common/utils/shared_util.dart';
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
import 'package:wallpaperx/facebook/facebook_manager.dart';
|
||||||
|
import 'package:wallpaperx/firebase/firebase_analytics_manager.dart';
|
||||||
|
import 'package:wallpaperx/firebase/firebase_crashlytics_manager.dart';
|
||||||
import 'package:wallpaperx/firebase/firebase_options.dart';
|
import 'package:wallpaperx/firebase/firebase_options.dart';
|
||||||
import 'package:wallpaperx/firebase/firebase_remote_config_manager.dart';
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
import 'package:wallpaperx/res/themes/app_themes.dart';
|
import 'package:wallpaperx/res/themes/app_themes.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
|
||||||
import 'package:wallpaperx/routes/app_pages.dart';
|
import 'package:wallpaperx/routes/app_pages.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
// 初始化Hive
|
||||||
|
await initHive();
|
||||||
|
|
||||||
|
await UPCache.preInit();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 初始化Firebase
|
// 初始化Firebase
|
||||||
await Firebase.initializeApp(
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
||||||
options: DefaultFirebaseOptions.currentPlatform,
|
await FirebaseCrashlyticsManager.setEnabled();
|
||||||
);
|
FirebaseCrashlyticsManager.recordFlutterError();
|
||||||
|
FirebaseCrashlyticsManager.recordError();
|
||||||
|
FirebaseAnalyticsManager.logLaunch();
|
||||||
debugPrint("Firebase initialization OK");
|
debugPrint("Firebase initialization OK");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint("Firebase initialization error: $e");
|
debugPrint("Firebase initialization error: $e");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 非异步错误
|
FacebookManager.init();
|
||||||
FlutterError.onError = (errorDetails) {
|
|
||||||
FirebaseCrashlytics.instance.recordFlutterError(errorDetails);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 异步错误
|
InterstitialAdManager().init();
|
||||||
PlatformDispatcher.instance.onError = (error, stack) {
|
|
||||||
FirebaseCrashlytics.instance.recordError(error, stack, fatal: false);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 竖屏
|
|
||||||
SystemChrome.setPreferredOrientations([
|
|
||||||
DeviceOrientation.portraitUp,
|
|
||||||
DeviceOrientation.portraitDown,
|
|
||||||
]);
|
|
||||||
|
|
||||||
// 初始化广告sdk
|
|
||||||
await ApplovinUtil().initApplovin();
|
|
||||||
|
|
||||||
UPCache.preInit();
|
|
||||||
|
|
||||||
await FirebaseRemoteConfigManager().init();
|
|
||||||
|
|
||||||
// 初始化Hive
|
|
||||||
await initHive();
|
|
||||||
|
|
||||||
// EasyLoading配置
|
// EasyLoading配置
|
||||||
configLoading();
|
configLoading();
|
||||||
@ -73,6 +57,12 @@ void main() async {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 竖屏
|
||||||
|
SystemChrome.setPreferredOrientations([
|
||||||
|
DeviceOrientation.portraitUp,
|
||||||
|
DeviceOrientation.portraitDown,
|
||||||
|
]);
|
||||||
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,15 +87,14 @@ class MyApp extends StatelessWidget {
|
|||||||
theme: lightTheme,
|
theme: lightTheme,
|
||||||
themeMode: ThemeMode.dark,
|
themeMode: ThemeMode.dark,
|
||||||
getPages: AppPages.routes,
|
getPages: AppPages.routes,
|
||||||
initialRoute: AppPages.splash,
|
initialRoute: AppPages.launch,
|
||||||
navigatorObservers: [BotToastNavigatorObserver()],
|
navigatorObservers: [BotToastNavigatorObserver()],
|
||||||
builder: (context, widget) {
|
builder: (context, widget) {
|
||||||
widget = easyLoading(context, widget);
|
widget = easyLoading(context, widget);
|
||||||
child = botToastBuilder(context,widget);
|
child = botToastBuilder(context,widget);
|
||||||
return MediaQuery(
|
return MediaQuery(
|
||||||
// 设置文字大小不随系统设置改变
|
// 设置文字大小不随系统设置改变
|
||||||
data: MediaQuery.of(context)
|
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling),
|
||||||
.copyWith(textScaler: TextScaler.noScaling),
|
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
body: GestureDetector(
|
body: GestureDetector(
|
||||||
@ -120,6 +109,12 @@ class MyApp extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
routingCallback: (routing) {
|
routingCallback: (routing) {
|
||||||
LogPrint.d("路由变化 ${routing?.current}");
|
LogPrint.d("路由变化 ${routing?.current}");
|
||||||
|
if (routing?.current == AppPages.launch) {
|
||||||
|
FirebaseAnalyticsManager.logLoadingPage();
|
||||||
|
}
|
||||||
|
if (routing?.current == AppPages.home) {
|
||||||
|
FirebaseAnalyticsManager.logHomepage();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
|
|
||||||
class AboutController extends GetxController {
|
class AboutController extends GetxController {
|
||||||
var versionName = ''.obs;
|
var versionName = ''.obs;
|
||||||
|
|||||||
@ -3,8 +3,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart';
|
import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart';
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
import 'package:wallpaperx/page/about/about_controller.dart';
|
import 'package:wallpaperx/page/about/about_controller.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
|
||||||
|
|
||||||
class AboutView extends GetView<AboutController> {
|
class AboutView extends GetView<AboutController> {
|
||||||
const AboutView({super.key});
|
const AboutView({super.key});
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart';
|
import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart';
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
|
|
||||||
import 'ai_manager_controller.dart';
|
import 'ai_manager_controller.dart';
|
||||||
|
|
||||||
|
|||||||
@ -2,14 +2,13 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_rx/get_rx.dart';
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/components/easy_loading.dart';
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
||||||
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
||||||
import 'package:wallpaperx/common/http/http_util.dart';
|
import 'package:wallpaperx/common/http/http_util.dart';
|
||||||
import 'package:wallpaperx/common/http/url.dart';
|
import 'package:wallpaperx/common/http/url.dart';
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
import 'package:wallpaperx/routes/app_pages.dart';
|
import 'package:wallpaperx/routes/app_pages.dart';
|
||||||
|
|
||||||
class CategoryController extends GetxController {
|
class CategoryController extends GetxController {
|
||||||
@ -29,7 +28,7 @@ class CategoryController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
ApplovinUtil().showAdIfReady();
|
InterstitialAdManager().showAdIfReady();
|
||||||
scrollController.dispose();
|
scrollController.dispose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import 'package:get/get.dart';
|
|||||||
import 'package:wallpaperx/common/components/image_network_widget.dart';
|
import 'package:wallpaperx/common/components/image_network_widget.dart';
|
||||||
import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart';
|
import 'package:wallpaperx/common/components/navigation_bar/custom_appbar.dart';
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
|
|
||||||
import 'category_item_controller.dart';
|
import 'category_item_controller.dart';
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,19 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
||||||
import 'package:wallpaperx/common/utils/shared_util.dart';
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
import 'package:wallpaperx/config/app_tracking_transparency_manager.dart';
|
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/entity/userinfo_model.dart';
|
import 'package:wallpaperx/entity/userinfo_model.dart';
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
|
import 'package:wallpaperx/global/app_lifecycle_reactor.dart';
|
||||||
|
import 'package:wallpaperx/global/app_tracking_transparency_manager.dart';
|
||||||
import 'package:wallpaperx/page/custom/custom_view.dart';
|
import 'package:wallpaperx/page/custom/custom_view.dart';
|
||||||
import 'package:wallpaperx/page/library/library_view.dart';
|
import 'package:wallpaperx/page/library/library_view.dart';
|
||||||
import 'package:wallpaperx/page/recommend/recommend_view.dart';
|
import 'package:wallpaperx/page/recommend/recommend_view.dart';
|
||||||
import 'package:wallpaperx/page/settings/settings_view.dart';
|
import 'package:wallpaperx/page/settings/settings_view.dart';
|
||||||
import 'package:wallpaperx/routes/app_pages.dart';
|
import 'package:wallpaperx/routes/app_pages.dart';
|
||||||
|
|
||||||
class HomeController extends GetxController with WidgetsBindingObserver {
|
class HomeController extends GetxController {
|
||||||
static HomeController get to => Get.find<HomeController>();
|
static HomeController get to => Get.find<HomeController>();
|
||||||
final pages = [
|
final pages = [
|
||||||
PageItem(Assets.imagesRecommendSelected, const RecommendView()),
|
PageItem(Assets.imagesRecommendSelected, const RecommendView()),
|
||||||
@ -52,32 +53,19 @@ class HomeController extends GetxController with WidgetsBindingObserver {
|
|||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
loadUserInfo();
|
|
||||||
WidgetsBinding.instance.addObserver(this);
|
|
||||||
pageController = PageController(initialPage: currentIndex.value);
|
|
||||||
AppTrackingTransparencyManager().requestATT();
|
AppTrackingTransparencyManager().requestATT();
|
||||||
|
AppLifecycleReactor().listenToAppStateChanges();
|
||||||
|
|
||||||
|
loadUserInfo();
|
||||||
|
pageController = PageController(initialPage: currentIndex.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
|
||||||
pageController.dispose();
|
pageController.dispose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
|
|
||||||
switch (state) {
|
|
||||||
case AppLifecycleState.resumed:
|
|
||||||
break;
|
|
||||||
case AppLifecycleState.inactive:
|
|
||||||
case AppLifecycleState.hidden:
|
|
||||||
case AppLifecycleState.paused:
|
|
||||||
case AppLifecycleState.detached:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void openHomeDrawer() {
|
void openHomeDrawer() {
|
||||||
scaffoldKey.currentState?.openDrawer();
|
scaffoldKey.currentState?.openDrawer();
|
||||||
}
|
}
|
||||||
@ -103,8 +91,8 @@ class HomeController extends GetxController with WidgetsBindingObserver {
|
|||||||
|
|
||||||
/// 跳转分类
|
/// 跳转分类
|
||||||
void toCategory(title, {String? jumpType}) {
|
void toCategory(title, {String? jumpType}) {
|
||||||
|
InterstitialAdManager().showAdIfReady(onTap: () {
|
||||||
scaffoldKey.currentState?.openEndDrawer();
|
scaffoldKey.currentState?.openEndDrawer();
|
||||||
ApplovinUtil().showAdIfReady().then((e) {
|
|
||||||
Get.toNamed(AppPages.category, arguments: {
|
Get.toNamed(AppPages.category, arguments: {
|
||||||
'title': title,
|
'title': title,
|
||||||
});
|
});
|
||||||
|
|||||||
9
lib/page/launch/launch_binding.dart
Normal file
9
lib/page/launch/launch_binding.dart
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:wallpaperx/page/launch/launch_controller.dart';
|
||||||
|
|
||||||
|
class LaunchBinding extends Bindings {
|
||||||
|
@override
|
||||||
|
void dependencies() {
|
||||||
|
Get.lazyPut(() => LaunchController());
|
||||||
|
}
|
||||||
|
}
|
||||||
91
lib/page/launch/launch_controller.dart
Normal file
91
lib/page/launch/launch_controller.dart
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
|
import 'package:wallpaperx/common/components/dialog/remind_dialog.dart';
|
||||||
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
|
import 'package:wallpaperx/global/network_connectivity_service.dart';
|
||||||
|
import 'package:wallpaperx/routes/app_pages.dart';
|
||||||
|
|
||||||
|
class LaunchController extends GetxController with GetSingleTickerProviderStateMixin {
|
||||||
|
static LaunchController get to => Get.find<LaunchController>();
|
||||||
|
Timer? _timer;
|
||||||
|
/// 进度总时长
|
||||||
|
var timeTotal = 15.0 * 1000;
|
||||||
|
/// 当前进度
|
||||||
|
var currentProcess = 0.0.obs;
|
||||||
|
/// 进度每次变化值
|
||||||
|
var changeValue = 10;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() async {
|
||||||
|
super.onReady();
|
||||||
|
await _checkGuaranteedDate();
|
||||||
|
Get.put(NetworkConnectivityService());
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
_stopTimer();
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void openNetworkDialog() {
|
||||||
|
Get.dialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
RemindDialog(
|
||||||
|
content: 'Please check if the wireless or cellular network is turned on?',
|
||||||
|
showCancelBtn: false,
|
||||||
|
enableBack: false,
|
||||||
|
confirmOnTap: () {
|
||||||
|
openAppSettings();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 检查是否到保底日期
|
||||||
|
Future<void> _checkGuaranteedDate() async {
|
||||||
|
bool adSwitch = UPCache.getInstance().get<bool>('adSwitch') ?? false;
|
||||||
|
if (!adSwitch) {
|
||||||
|
if (getGuaranteedDate().isBefore(DateTime.now())) {
|
||||||
|
UPCache.getInstance().setData<bool>("adSwitch", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 开始定时器
|
||||||
|
void startTimer() {
|
||||||
|
_timer = Timer.periodic(const Duration(milliseconds: 10), (Timer t) async {
|
||||||
|
if (currentProcess.value + changeValue >= timeTotal) {
|
||||||
|
currentProcess.value = timeTotal;
|
||||||
|
_stopTimer();
|
||||||
|
_openHome();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
currentProcess.value += changeValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 停止定时器
|
||||||
|
void _stopTimer() {
|
||||||
|
_timer?.cancel();
|
||||||
|
_timer = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 修改进度变化值
|
||||||
|
void editChangeValue() {
|
||||||
|
changeValue = 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _openHome() {
|
||||||
|
InterstitialAdManager().showAdIfReady(
|
||||||
|
showLaunchAd: true,
|
||||||
|
onTap: () {
|
||||||
|
Get.offNamed(AppPages.home);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
65
lib/page/launch/launch_view.dart
Normal file
65
lib/page/launch/launch_view.dart
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
|
import 'package:wallpaperx/page/launch/launch_controller.dart';
|
||||||
|
|
||||||
|
class LaunchView extends StatelessWidget {
|
||||||
|
LaunchView({super.key});
|
||||||
|
|
||||||
|
final controller = Get.find<LaunchController>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Stack(
|
||||||
|
children: [
|
||||||
|
_buildImageBg(),
|
||||||
|
_buildProgress(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildImageBg() {
|
||||||
|
return Image.asset(
|
||||||
|
Assets.imagesSplashBackground,
|
||||||
|
width: 1.sw,
|
||||||
|
height: 1.sh,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildProgress() {
|
||||||
|
return Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
margin: const EdgeInsets.only(bottom: 60).h,
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: 0.6.sw,
|
||||||
|
child: Obx(() {
|
||||||
|
return LinearProgressIndicator(
|
||||||
|
value: controller.currentProcess.value / controller.timeTotal,
|
||||||
|
valueColor: const AlwaysStoppedAnimation<Color>(Color(0xff32ABD1)),
|
||||||
|
backgroundColor: const Color(0xff32ABD1).withOpacity(0.2),
|
||||||
|
borderRadius: BorderRadius.circular(8).r,
|
||||||
|
minHeight: 6.h,
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
Text(
|
||||||
|
'Resource Loading...',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Colors.white,
|
||||||
|
fontSize: 12.sp,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,9 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
|
||||||
import 'package:wallpaperx/common/components/custom_stacked_list_widget.dart';
|
import 'package:wallpaperx/common/components/custom_stacked_list_widget.dart';
|
||||||
import 'package:wallpaperx/common/components/image_network_widget.dart';
|
import 'package:wallpaperx/common/components/image_network_widget.dart';
|
||||||
import 'package:wallpaperx/common/components/navigation_bar/search_appbar.dart';
|
import 'package:wallpaperx/common/components/navigation_bar/search_appbar.dart';
|
||||||
@ -13,8 +11,8 @@ import 'package:wallpaperx/common/components/refresh/base_easyrefresh.dart';
|
|||||||
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
import 'package:wallpaperx/common/components/view_state_widget.dart';
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
import 'package:wallpaperx/res/themes/app_sizes.dart';
|
import 'package:wallpaperx/res/themes/app_sizes.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
|
||||||
|
|
||||||
import 'recommend_controller.dart';
|
import 'recommend_controller.dart';
|
||||||
|
|
||||||
|
|||||||
@ -4,12 +4,11 @@ import 'package:easy_refresh/easy_refresh.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get/get_rx/get_rx.dart';
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/components/easy_loading.dart';
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
||||||
import 'package:wallpaperx/common/http/http_util.dart';
|
import 'package:wallpaperx/common/http/http_util.dart';
|
||||||
import 'package:wallpaperx/common/http/url.dart';
|
import 'package:wallpaperx/common/http/url.dart';
|
||||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/routes/app_pages.dart';
|
import 'package:wallpaperx/routes/app_pages.dart';
|
||||||
|
|
||||||
@ -35,13 +34,13 @@ class SearchImageController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
ApplovinUtil().showAdIfReady();
|
InterstitialAdManager().showAdIfReady();
|
||||||
refreshController.dispose();
|
refreshController.dispose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void searchImages({int? imageType}) {
|
void searchImages({int? imageType}) {
|
||||||
ApplovinUtil().showAdIfReady();
|
InterstitialAdManager().showAdIfReady(onTap: () {
|
||||||
if (searchController.text.isNotEmpty) {
|
if (searchController.text.isNotEmpty) {
|
||||||
loading(show: true);
|
loading(show: true);
|
||||||
HttpUtil.get(Url.searchImages, (callback) async {
|
HttpUtil.get(Url.searchImages, (callback) async {
|
||||||
@ -66,6 +65,7 @@ class SearchImageController extends GetxController {
|
|||||||
} else {
|
} else {
|
||||||
LogPrint.d("搜索内容不能为空");
|
LogPrint.d("搜索内容不能为空");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 上拉加载
|
/// 上拉加载
|
||||||
|
|||||||
@ -10,8 +10,8 @@ import 'package:wallpaperx/common/utils/local_path_util.dart';
|
|||||||
import 'package:wallpaperx/common/utils/shared_util.dart';
|
import 'package:wallpaperx/common/utils/shared_util.dart';
|
||||||
import 'package:wallpaperx/entity/userinfo_model.dart';
|
import 'package:wallpaperx/entity/userinfo_model.dart';
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
import 'package:wallpaperx/generated/assets.dart';
|
||||||
|
import 'package:wallpaperx/global/app_config.dart';
|
||||||
import 'package:wallpaperx/page/home/home_controller.dart';
|
import 'package:wallpaperx/page/home/home_controller.dart';
|
||||||
import 'package:wallpaperx/res/values/strings.dart';
|
|
||||||
import 'package:wallpaperx/routes/app_pages.dart';
|
import 'package:wallpaperx/routes/app_pages.dart';
|
||||||
import 'package:share_plus/share_plus.dart';
|
import 'package:share_plus/share_plus.dart';
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:wallpaperx/page/splash/splash_controller.dart';
|
|
||||||
|
|
||||||
class SplashBinding extends Bindings {
|
|
||||||
@override
|
|
||||||
void dependencies() {
|
|
||||||
Get.lazyPut(() => SplashController());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/routes/app_pages.dart';
|
|
||||||
|
|
||||||
class SplashController extends GetxController {
|
|
||||||
Timer? _timer;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
super.onInit();
|
|
||||||
ApplovinUtil().initializeInterstitialAds(onGoHomeTap: toIndex);
|
|
||||||
_startTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onClose() {
|
|
||||||
_stopTimer();
|
|
||||||
super.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 开始定时器
|
|
||||||
void _startTimer() {
|
|
||||||
_timer = Timer.periodic(const Duration(seconds: 10), (Timer t) {
|
|
||||||
toIndex();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 停止定时器
|
|
||||||
void _stopTimer() {
|
|
||||||
_timer?.cancel();
|
|
||||||
_timer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 打开首页
|
|
||||||
void toIndex() {
|
|
||||||
_stopTimer();
|
|
||||||
Get.offAndToNamed(AppPages.home);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,56 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
import 'package:wallpaperx/generated/assets.dart';
|
|
||||||
import 'package:wallpaperx/page/splash/splash_controller.dart';
|
|
||||||
|
|
||||||
class SplashView extends StatelessWidget {
|
|
||||||
const SplashView({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Get.put(SplashController());
|
|
||||||
return Scaffold(
|
|
||||||
body: Container(
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Colors.black,
|
|
||||||
image: DecorationImage(
|
|
||||||
image: AssetImage(Assets.imagesSplashBackground),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: SafeArea(
|
|
||||||
child: _buildProgress(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildProgress() {
|
|
||||||
return Container(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
margin: const EdgeInsets.only(bottom: 40).h,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: 0.5.sw,
|
|
||||||
child: LinearProgressIndicator(
|
|
||||||
backgroundColor: Colors.grey,
|
|
||||||
valueColor: const AlwaysStoppedAnimation<Color>(Colors.white),
|
|
||||||
borderRadius: BorderRadius.circular(8).r,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
14.verticalSpace,
|
|
||||||
Text(
|
|
||||||
'Resource Loading...',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 12.sp,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -6,13 +6,13 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/components/easy_loading.dart';
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
||||||
import 'package:wallpaperx/common/storage/favorite_data.dart';
|
import 'package:wallpaperx/common/storage/favorite_data.dart';
|
||||||
import 'package:wallpaperx/common/storage/history_data.dart';
|
import 'package:wallpaperx/common/storage/history_data.dart';
|
||||||
import 'package:wallpaperx/common/utils/download_util.dart';
|
import 'package:wallpaperx/common/utils/download_util.dart';
|
||||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
import 'package:wallpaperx/common/utils/permission_util.dart';
|
import 'package:wallpaperx/common/utils/permission_util.dart';
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/entity/generate_info_model.dart';
|
import 'package:wallpaperx/entity/generate_info_model.dart';
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/page/browse_history/browse_history_controller.dart';
|
import 'package:wallpaperx/page/browse_history/browse_history_controller.dart';
|
||||||
@ -47,7 +47,7 @@ class WallpaperDetailController extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
ApplovinUtil().showAdIfReady();
|
InterstitialAdManager().showAdIfReady();
|
||||||
pageController.dispose();
|
pageController.dispose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ class WallpaperDetailController extends GetxController {
|
|||||||
|
|
||||||
/// 翻转并且播放广告
|
/// 翻转并且播放广告
|
||||||
void flipCardAndShowAd() {
|
void flipCardAndShowAd() {
|
||||||
ApplovinUtil().showAdIfReady().then((e) {
|
InterstitialAdManager().showAdIfReady(onTap: () {
|
||||||
flipCardController.toggleCard();
|
flipCardController.toggleCard();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,13 +6,13 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
import 'package:image_gallery_saver/image_gallery_saver.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:wallpaperx/ads/interstitial_ad_manage.dart';
|
||||||
import 'package:wallpaperx/common/components/easy_loading.dart';
|
import 'package:wallpaperx/common/components/easy_loading.dart';
|
||||||
import 'package:wallpaperx/common/storage/favorite_data.dart';
|
import 'package:wallpaperx/common/storage/favorite_data.dart';
|
||||||
import 'package:wallpaperx/common/storage/history_data.dart';
|
import 'package:wallpaperx/common/storage/history_data.dart';
|
||||||
import 'package:wallpaperx/common/utils/download_util.dart';
|
import 'package:wallpaperx/common/utils/download_util.dart';
|
||||||
import 'package:wallpaperx/common/utils/log_print.dart';
|
import 'package:wallpaperx/common/utils/log_print.dart';
|
||||||
import 'package:wallpaperx/common/utils/permission_util.dart';
|
import 'package:wallpaperx/common/utils/permission_util.dart';
|
||||||
import 'package:wallpaperx/config/applovin.dart';
|
|
||||||
import 'package:wallpaperx/entity/generate_info_model.dart';
|
import 'package:wallpaperx/entity/generate_info_model.dart';
|
||||||
import 'package:wallpaperx/entity/image_model.dart';
|
import 'package:wallpaperx/entity/image_model.dart';
|
||||||
import 'package:wallpaperx/page/browse_history/browse_history_controller.dart';
|
import 'package:wallpaperx/page/browse_history/browse_history_controller.dart';
|
||||||
@ -48,7 +48,7 @@ class WallpaperDetailV2Controller extends GetxController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onClose() {
|
void onClose() {
|
||||||
ApplovinUtil().showAdIfReady();
|
InterstitialAdManager().showAdIfReady();
|
||||||
pageController.dispose();
|
pageController.dispose();
|
||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ class WallpaperDetailV2Controller extends GetxController {
|
|||||||
|
|
||||||
/// 翻转并且播放广告
|
/// 翻转并且播放广告
|
||||||
void flipCardAndShowAd() {
|
void flipCardAndShowAd() {
|
||||||
ApplovinUtil().showAdIfReady().then((e) {
|
InterstitialAdManager().showAdIfReady(onTap: () {
|
||||||
flipCardController.toggleCard();
|
flipCardController.toggleCard();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
const appName = 'Visual Wallpaper';
|
|
||||||
@ -13,12 +13,12 @@ import 'package:wallpaperx/page/feed_back/feed_back_binding.dart';
|
|||||||
import 'package:wallpaperx/page/feed_back/feed_back_view.dart';
|
import 'package:wallpaperx/page/feed_back/feed_back_view.dart';
|
||||||
import 'package:wallpaperx/page/home/home_binding.dart';
|
import 'package:wallpaperx/page/home/home_binding.dart';
|
||||||
import 'package:wallpaperx/page/home/home_view.dart';
|
import 'package:wallpaperx/page/home/home_view.dart';
|
||||||
|
import 'package:wallpaperx/page/launch/launch_binding.dart';
|
||||||
|
import 'package:wallpaperx/page/launch/launch_view.dart';
|
||||||
import 'package:wallpaperx/page/login/login_binding.dart';
|
import 'package:wallpaperx/page/login/login_binding.dart';
|
||||||
import 'package:wallpaperx/page/login/login_view.dart';
|
import 'package:wallpaperx/page/login/login_view.dart';
|
||||||
import 'package:wallpaperx/page/search_image/search_image_binding.dart';
|
import 'package:wallpaperx/page/search_image/search_image_binding.dart';
|
||||||
import 'package:wallpaperx/page/search_image/search_image_view.dart';
|
import 'package:wallpaperx/page/search_image/search_image_view.dart';
|
||||||
import 'package:wallpaperx/page/splash/splash_binding.dart';
|
|
||||||
import 'package:wallpaperx/page/splash/splash_view.dart';
|
|
||||||
import 'package:wallpaperx/page/wallpaper_detail/wallpaper_detail_binding.dart';
|
import 'package:wallpaperx/page/wallpaper_detail/wallpaper_detail_binding.dart';
|
||||||
import 'package:wallpaperx/page/wallpaper_detail/wallpaper_detail_view.dart';
|
import 'package:wallpaperx/page/wallpaper_detail/wallpaper_detail_view.dart';
|
||||||
import 'package:wallpaperx/page/wallpaper_detail_v2/wallpaper_detail_v2_binding.dart';
|
import 'package:wallpaperx/page/wallpaper_detail_v2/wallpaper_detail_v2_binding.dart';
|
||||||
@ -30,7 +30,7 @@ class AppPages {
|
|||||||
AppPages._();
|
AppPages._();
|
||||||
|
|
||||||
/// 开屏页
|
/// 开屏页
|
||||||
static const splash = '/splash';
|
static const launch = '/launch';
|
||||||
|
|
||||||
/// 首页
|
/// 首页
|
||||||
static const home = '/home';
|
static const home = '/home';
|
||||||
@ -73,9 +73,9 @@ class AppPages {
|
|||||||
|
|
||||||
static final routes = [
|
static final routes = [
|
||||||
GetPage(
|
GetPage(
|
||||||
name: splash,
|
name: launch,
|
||||||
page: () => const SplashView(),
|
page: () => LaunchView(),
|
||||||
binding: SplashBinding(),
|
binding: LaunchBinding(),
|
||||||
),
|
),
|
||||||
GetPage(
|
GetPage(
|
||||||
name: home,
|
name: home,
|
||||||
|
|||||||
19
pubspec.yaml
19
pubspec.yaml
@ -2,10 +2,10 @@ name: wallpaperx
|
|||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 1.0.1+1
|
version: 1.2.0+5
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.4.3 <4.0.0'
|
sdk: '>=3.4.1 <4.0.0'
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
@ -69,12 +69,6 @@ dependencies:
|
|||||||
# 分享
|
# 分享
|
||||||
share_plus: ^9.0.0
|
share_plus: ^9.0.0
|
||||||
|
|
||||||
# AppLovin
|
|
||||||
applovin_max: ^3.10.0
|
|
||||||
|
|
||||||
# 网络状态监听
|
|
||||||
connectivity_plus: ^6.0.3
|
|
||||||
|
|
||||||
# 二维码扫描
|
# 二维码扫描
|
||||||
qr_flutter: ^4.0.0
|
qr_flutter: ^4.0.0
|
||||||
|
|
||||||
@ -113,6 +107,15 @@ dependencies:
|
|||||||
firebase_crashlytics: ^4.0.3
|
firebase_crashlytics: ^4.0.3
|
||||||
firebase_remote_config: ^5.0.3
|
firebase_remote_config: ^5.0.3
|
||||||
|
|
||||||
|
# facebook
|
||||||
|
facebook_app_events: ^0.19.2
|
||||||
|
|
||||||
|
# 广告
|
||||||
|
applovin_max: ^3.11.0
|
||||||
|
|
||||||
|
# 网络
|
||||||
|
connectivity_plus: ^6.0.4
|
||||||
|
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
android: "launcher_icon"
|
android: "launcher_icon"
|
||||||
ios: true
|
ios: true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user