From e8734b0df4aeaa30da18cc8c05a01572aa5ad86d Mon Sep 17 00:00:00 2001 From: eld_master Date: Mon, 3 Feb 2025 16:16:13 +0900 Subject: [PATCH] =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EA=B9=A8=EC=A7=90?= =?UTF-8?q?=ED=98=84=EC=83=81=20=EB=B2=84=EA=B7=B8=EB=93=A4=20=EC=A1=B0?= =?UTF-8?q?=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 4 +- android/app/google-services.json | 15 +++ android/app/src/main/AndroidManifest.xml | 8 +- lib/dialogs/user_info_private_dialog.dart | 22 ++-- lib/dialogs/user_info_team_dialog.dart | 21 ++-- lib/main.dart | 6 + lib/plugins/admob.dart | 146 +++++++++++----------- pubspec.yaml | 2 +- 8 files changed, 125 insertions(+), 99 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 6deef19..fae90f9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -20,8 +20,8 @@ android { applicationId "com.allscore_app" minSdkVersion 23 targetSdkVersion 34 - versionCode 4 - versionName "1.0.3" + versionCode 6 + versionName "1.0.5" } // ... diff --git a/android/app/google-services.json b/android/app/google-services.json index 8a0e07a..ea4aa2c 100644 --- a/android/app/google-services.json +++ b/android/app/google-services.json @@ -14,6 +14,14 @@ } }, "oauth_client": [ + { + "client_id": "452355332155-lqtr6l2qg0pn62vi5nccggldmcm21qdl.apps.googleusercontent.com", + "client_type": 1, + "android_info": { + "package_name": "com.allscore_app", + "certificate_hash": "761f8d2290ebb091acdf3cf8400df65245047fb8" + } + }, { "client_id": "452355332155-t29ceato8o62c9kq9drefe7b6hd1ka1d.apps.googleusercontent.com", "client_type": 1, @@ -38,6 +46,13 @@ { "client_id": "452355332155-jv26k1rs4tro38tc99mffid2e3gbra6j.apps.googleusercontent.com", "client_type": 3 + }, + { + "client_id": "452355332155-fo49j1u3qfup1sa3gj33bko6q269pqo4.apps.googleusercontent.com", + "client_type": 2, + "ios_info": { + "bundle_id": "com.example.allscoreApp" + } } ] } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index c040afe..22ed864 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -11,15 +11,15 @@ android:icon="@mipmap/ic_launcher"> - + android:value="ca-app-pub-3940256099942544~3347511713" /> --> - + android:value="19981745655-3dadv7n64jqcada6mtc1ao25k1m90gp3.apps.googleusercontent.com" /> --> { ], ), ] else ...[ - ElevatedButton( - onPressed: () => Navigator.pop(context), - style: ElevatedButton.styleFrom(backgroundColor: Colors.black, padding: EdgeInsets.zero, minimumSize: Size(0, 30), tapTargetSize: MaterialTapTargetSize.shrinkWrap), - child: FittedBox( - fit: BoxFit.contain, - child: Text( - 'OK' - /* '확인' */, - style: TextStyle(color: Colors.white, fontSize: 12 * scaleFactor), + SizedBox( + width: 80 * scaleFactor, + height: 40 * scaleFactor, + child: ElevatedButton( + onPressed: () => Navigator.pop(context), + style: ElevatedButton.styleFrom(backgroundColor: Colors.black, padding: EdgeInsets.zero, minimumSize: Size(0, 30), tapTargetSize: MaterialTapTargetSize.shrinkWrap), + child: FittedBox( + fit: BoxFit.contain, + child: Text( + 'OK' + /* '확인' */, + style: TextStyle(color: Colors.white, fontSize: 12 * scaleFactor), + ), ), ), ), diff --git a/lib/dialogs/user_info_team_dialog.dart b/lib/dialogs/user_info_team_dialog.dart index 4f7227c..6f9e1b7 100644 --- a/lib/dialogs/user_info_team_dialog.dart +++ b/lib/dialogs/user_info_team_dialog.dart @@ -428,15 +428,18 @@ class _UserInfoTeamDialogState extends State { ], ), ] else ...[ - // If not the master, only "OK" (일반 유저는 "확인"만) - ElevatedButton( - onPressed: () => Navigator.pop(context), - style: ElevatedButton.styleFrom(backgroundColor: Colors.black, padding: EdgeInsets.zero, minimumSize: Size(0, 30), tapTargetSize: MaterialTapTargetSize.shrinkWrap), - child: AutoSizeText( - 'OK' - /* '확인' */, - maxLines: 1, - style: const TextStyle(color: Colors.white), + SizedBox( + width: 80 * scaleFactor, + height: 40 * scaleFactor, + child: ElevatedButton( + onPressed: () => Navigator.pop(context), + style: ElevatedButton.styleFrom(backgroundColor: Colors.black, padding: EdgeInsets.zero, minimumSize: Size(0, 30), tapTargetSize: MaterialTapTargetSize.shrinkWrap), + child: AutoSizeText( + 'OK' + /* '확인' */, + maxLines: 1, + style: const TextStyle(color: Colors.white), + ), ), ), ], diff --git a/lib/main.dart b/lib/main.dart index 0ea362d..47214f8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -24,6 +24,12 @@ void main() async { // 모바일 광고 초기화 MobileAds.instance.initialize(); + + RequestConfiguration configuration = RequestConfiguration( + testDeviceIds: ["CF2323B16A2434EF4291F29404AD42AC"], // 여기에 자신의 기기 ID 추가 + ); + + MobileAds.instance.updateRequestConfiguration(configuration); runApp(const MyApp()); } diff --git a/lib/plugins/admob.dart b/lib/plugins/admob.dart index 7f0ead9..0b813d4 100644 --- a/lib/plugins/admob.dart +++ b/lib/plugins/admob.dart @@ -1,85 +1,83 @@ import 'package:flutter/material.dart'; -// import 'package:google_mobile_ads/google_mobile_ads.dart'; -// import '../config/config.dart'; +import 'package:google_mobile_ads/google_mobile_ads.dart'; +import '../config/config.dart'; -/* // ================== 기존 코드 (전체 주석 처리) ================== -// class AdBannerWidget extends StatefulWidget { -// const AdBannerWidget({Key? key}) : super(key: key); - -// @override -// State createState() => _AdBannerWidgetState(); -// } - -// class _AdBannerWidgetState extends State { -// BannerAd? _bannerAd; // 광고 객체 - -// @override -// void initState() { -// super.initState(); -// _initBannerAd(); -// } - -// @override -// void dispose() { -// _bannerAd?.dispose(); -// super.dispose(); -// } - -// /// 배너 광고를 초기화 & 로드 -// void _initBannerAd() { -// _bannerAd = BannerAd( -// size: AdSize.banner, // 배너 사이즈(고정) -// adUnitId: Config.adUnitId, // 광고 단위 ID (Config에서 직접 가져옴) -// listener: BannerAdListener( -// onAdLoaded: (Ad ad) { -// // 로드 성공 시: _bannerAd를 그대로 두면 됨. -// setState(() {/* 굳이 아무 것도 안 해도 됨 */}); -// }, -// onAdFailedToLoad: (Ad ad, LoadAdError error) { -// // 실패 시: 자원 정리 & null 처리 -// ad.dispose(); -// setState(() { -// _bannerAd = null; -// }); -// }, -// ), -// request: const AdRequest(), -// ); - -// // 실제 로드 시작 -// _bannerAd!.load(); -// } - -// @override -// Widget build(BuildContext context) { -// // 로딩 전/실패 시 _bannerAd가 null → 빈 위젯 반환 -// if (_bannerAd == null) { -// return const SizedBox.shrink(); -// } -// // 로딩 완료 시 Container에 AdWidget으로 표시 -// return Container( -// color: Colors.white, // 배경색 흰색으로 고정 -// width: _bannerAd!.size.width.toDouble(), -// height: _bannerAd!.size.height.toDouble(), -// child: AdWidget(ad: _bannerAd!), -// ); -// } -// } -*/ - -// ================== 임시/빈 컴포넌트 ================== -class AdBannerWidget extends StatelessWidget { +class AdBannerWidget extends StatefulWidget { const AdBannerWidget({Key? key}) : super(key: key); + @override + State createState() => _AdBannerWidgetState(); +} + +class _AdBannerWidgetState extends State { + BannerAd? _bannerAd; // 광고 객체 + + @override + void initState() { + super.initState(); + _initBannerAd(); + } + + @override + void dispose() { + _bannerAd?.dispose(); + super.dispose(); + } + + /// 배너 광고를 초기화 & 로드 + void _initBannerAd() { + _bannerAd = BannerAd( + size: AdSize.banner, // 배너 사이즈(고정) + adUnitId: Config.adUnitId, // 광고 단위 ID (Config에서 직접 가져옴) + listener: BannerAdListener( + onAdLoaded: (Ad ad) { + // 로드 성공 시: _bannerAd를 그대로 두면 됨. + setState(() {/* 굳이 아무 것도 안 해도 됨 */}); + }, + onAdFailedToLoad: (Ad ad, LoadAdError error) { + // 실패 시: 자원 정리 & null 처리 + ad.dispose(); + setState(() { + _bannerAd = null; + }); + }, + ), + request: const AdRequest(), + ); + + // 실제 로드 시작 + _bannerAd!.load(); + } + @override Widget build(BuildContext context) { - // (예시) 50dp 높이의 빈 영역을 차지 - // or return SizedBox.shrink() 로 아예 공간을 안 쓰는 방법도 가능 - return const SizedBox( - height: 50, // 원하는 높이 - child: ColoredBox(color: Colors.white), // 배경 흰색 + // 로딩 전/실패 시 _bannerAd가 null → 빈 위젯 반환 + if (_bannerAd == null) { + return const SizedBox.shrink(); + } + // 로딩 완료 시 Container에 AdWidget으로 표시 + return Container( + color: Colors.white, // 배경색 흰색으로 고정 + width: _bannerAd!.size.width.toDouble(), + height: _bannerAd!.size.height.toDouble(), + child: AdWidget(ad: _bannerAd!), ); } } + +// ================== 임시/빈 컴포넌트 ================== +// class AdBannerWidget extends StatelessWidget { +// const AdBannerWidget({Key? key}) : super(key: key); + +// @override +// Widget build(BuildContext context) { +// // (예시) 50dp 높이의 빈 영역을 차지 +// // or return SizedBox.shrink() 로 아예 공간을 안 쓰는 방법도 가능 +// return const SizedBox( +// height: 50, // 원하는 높이 +// child: ColoredBox(color: Colors.white), // 배경 흰색 +// ); +// } +// } diff --git a/pubspec.yaml b/pubspec.yaml index 959527a..0b09c49 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: allscore_app description: "A new Flutter project." publish_to: 'none' -version: 1.0.3+4 +version: 1.0.5+6 environment: sdk: ^3.6.0