feat(ads): 네이티브 광고 적용 및 디버그 스위치 이동
This commit is contained in:
@@ -19,6 +19,14 @@ class AppConstants {
|
||||
static const String iosAdAppId = 'ca-app-pub-3940256099942544~1458002511';
|
||||
static const String interstitialAdUnitId =
|
||||
'ca-app-pub-3940256099942544/1033173712';
|
||||
static const String androidNativeAdUnitId =
|
||||
'ca-app-pub-6691216385521068/7939870622';
|
||||
static const String iosNativeAdUnitId =
|
||||
'ca-app-pub-6691216385521068/7939870622';
|
||||
static const String testAndroidNativeAdUnitId =
|
||||
'ca-app-pub-3940256099942544/2247696110';
|
||||
static const String testIosNativeAdUnitId =
|
||||
'ca-app-pub-3940256099942544/3986624511';
|
||||
|
||||
// Hive Box Names
|
||||
static const String restaurantBox = 'restaurants';
|
||||
|
||||
28
lib/core/utils/ad_helper.dart
Normal file
28
lib/core/utils/ad_helper.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../constants/app_constants.dart';
|
||||
|
||||
class AdHelper {
|
||||
static bool get isMobilePlatform {
|
||||
if (kIsWeb) return false;
|
||||
return defaultTargetPlatform == TargetPlatform.android ||
|
||||
defaultTargetPlatform == TargetPlatform.iOS;
|
||||
}
|
||||
|
||||
static String get nativeAdUnitId {
|
||||
if (!isMobilePlatform) {
|
||||
throw UnsupportedError('Native ads are only supported on mobile.');
|
||||
}
|
||||
|
||||
final isIOS = defaultTargetPlatform == TargetPlatform.iOS;
|
||||
if (isIOS) {
|
||||
if (kDebugMode) {
|
||||
return AppConstants.testIosNativeAdUnitId;
|
||||
}
|
||||
return AppConstants.iosNativeAdUnitId;
|
||||
}
|
||||
|
||||
// Android는 디버그/릴리즈 모두 실제 광고 단위 ID 사용
|
||||
return AppConstants.androidNativeAdUnitId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user