feat(ads): 네이티브 광고 적용 및 디버그 스위치 이동
This commit is contained in:
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