fix
This commit is contained in:
1 parent
1f2fcb68ea
commit
28009867d8
4 files changed
+19
-6
No files matched your search
@@ -30,6 +30,7 @@ android {
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
multiDexEnabled = true
|
||||
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION
|
||||
// is added automatically by Flutter. (https://developer.android.com/studio/build/configure-apk-splits#configure-APK-versions)
|
||||
// You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
|
||||
@@ -56,10 +57,8 @@ android {
|
||||
} else {
|
||||
signingConfigs.getByName("debug")
|
||||
}
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,10 @@ class AdService {
|
||||
try {
|
||||
await MobileAds.instance.initialize();
|
||||
_isInitialized = true;
|
||||
// Preload after the first UI frames have settled
|
||||
Future.delayed(const Duration(seconds: 2), () {
|
||||
loadRewardedAd();
|
||||
});
|
||||
} catch (e) {
|
||||
debugPrint('AdService initialize error: $e');
|
||||
}
|
||||
@@ -47,6 +50,7 @@ class AdService {
|
||||
if (_isFlutterTest || kIsWeb || _isLoading || _rewardedAd != null) return;
|
||||
_isLoading = true;
|
||||
|
||||
try {
|
||||
RewardedAd.load(
|
||||
adUnitId: rewardedAdUnitId,
|
||||
request: const AdRequest(),
|
||||
@@ -62,6 +66,11 @@ class AdService {
|
||||
},
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('RewardedAd.load exception: $e');
|
||||
_rewardedAd = null;
|
||||
_isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> showRewardedAd({required VoidCallback onUserEarnedReward}) async {
|
||||
|
||||
+6
-1
@@ -38,7 +38,12 @@ void main() async {
|
||||
|
||||
// Core services
|
||||
const feedbackService = FeedbackService();
|
||||
final adService = AdService()..initialize();
|
||||
final adService = AdService();
|
||||
try {
|
||||
await adService.initialize();
|
||||
} catch (e) {
|
||||
debugPrint('AdService init error: $e');
|
||||
}
|
||||
|
||||
// Repositories
|
||||
final SettingsRepository settingsRepository = SettingsRepositoryImpl(
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.5+6
|
||||
version: 1.0.6+7
|
||||
|
||||
environment:
|
||||
sdk: ^3.13.4
|
||||
|
||||
Reference in new issue
Block a user