This commit is contained in:
brontomark committed 2026-11-15 12:18:00 +01:00
1 parent 1f2fcb68ea
commit 28009867d8
4 files changed
+35 -22

No files matched your search

+3 -4
View File
@@ -30,6 +30,7 @@ android {
// For more information, see: https://flutter.dev/to/review-gradle-config. // For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
multiDexEnabled = true
// Uses the version code from pubspec.yaml. When using split APKs, 1000 * ABI_VERSION // 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) // 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` // You can force using the value of versionCode by specifying the `-P force-version-code-ignoring-abi=true`
@@ -56,10 +57,8 @@ android {
} else { } else {
signingConfigs.getByName("debug") signingConfigs.getByName("debug")
} }
proguardFiles( isMinifyEnabled = false
getDefaultProguardFile("proguard-android-optimize.txt"), isShrinkResources = false
"proguard-rules.pro"
)
} }
} }
} }
+25 -16
View File
@@ -37,7 +37,10 @@ class AdService {
try { try {
await MobileAds.instance.initialize(); await MobileAds.instance.initialize();
_isInitialized = true; _isInitialized = true;
loadRewardedAd(); // Preload after the first UI frames have settled
Future.delayed(const Duration(seconds: 2), () {
loadRewardedAd();
});
} catch (e) { } catch (e) {
debugPrint('AdService initialize error: $e'); debugPrint('AdService initialize error: $e');
} }
@@ -47,21 +50,27 @@ class AdService {
if (_isFlutterTest || kIsWeb || _isLoading || _rewardedAd != null) return; if (_isFlutterTest || kIsWeb || _isLoading || _rewardedAd != null) return;
_isLoading = true; _isLoading = true;
RewardedAd.load( try {
adUnitId: rewardedAdUnitId, RewardedAd.load(
request: const AdRequest(), adUnitId: rewardedAdUnitId,
rewardedAdLoadCallback: RewardedAdLoadCallback( request: const AdRequest(),
onAdLoaded: (ad) { rewardedAdLoadCallback: RewardedAdLoadCallback(
_rewardedAd = ad; onAdLoaded: (ad) {
_isLoading = false; _rewardedAd = ad;
}, _isLoading = false;
onAdFailedToLoad: (error) { },
debugPrint('RewardedAd failed to load: $error'); onAdFailedToLoad: (error) {
_rewardedAd = null; debugPrint('RewardedAd failed to load: $error');
_isLoading = false; _rewardedAd = null;
}, _isLoading = false;
), },
); ),
);
} catch (e) {
debugPrint('RewardedAd.load exception: $e');
_rewardedAd = null;
_isLoading = false;
}
} }
Future<bool> showRewardedAd({required VoidCallback onUserEarnedReward}) async { Future<bool> showRewardedAd({required VoidCallback onUserEarnedReward}) async {
+6 -1
View File
@@ -38,7 +38,12 @@ void main() async {
// Core services // Core services
const feedbackService = FeedbackService(); const feedbackService = FeedbackService();
final adService = AdService()..initialize(); final adService = AdService();
try {
await adService.initialize();
} catch (e) {
debugPrint('AdService init error: $e');
}
// Repositories // Repositories
final SettingsRepository settingsRepository = SettingsRepositoryImpl( final SettingsRepository settingsRepository = SettingsRepositoryImpl(
+1 -1
View File
@@ -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 # 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 # 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. # 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: environment:
sdk: ^3.13.4 sdk: ^3.13.4