Skip to content

Commit 03aeda3

Browse files
feat(control): Mobile Ads (Banner and Interstitial) (#3288)
* initial commit * Create Abstract class BaseAd * NativeAd: initial commit * update * comment out nativeAd * update versions * fix imports * bump google_mobile_ads to 5.2.0 and flet_mobile_ads to 0.24.1 * Override webview_flutter_android with 4.0.0 * override webview_flutter_android * rename flet_mobile_ads package to flet_ads * make unit_id required * Podfile.lock * Delete sdk/python/packages/flet-core/src/flet_core/__init__.py --------- Co-authored-by: Feodor Fitsner <feodor@appveyor.com>
1 parent 4a3ccbb commit 03aeda3

File tree

25 files changed

+1344
-23
lines changed

25 files changed

+1344
-23
lines changed

client/android/app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/> <!-- Google TV -->
5050
</intent-filter>
5151
</activity>
52+
<!-- Below is a test AdMob ID.
53+
Guide: https://developers.google.com/admob/flutter/quick-start#platform_specific_setup -->
54+
<meta-data
55+
android:name="com.google.android.gms.ads.APPLICATION_ID"
56+
android:value="ca-app-pub-3940256099942544~3347511713"/>
5257
<!-- Don't delete the meta-data below.
5358
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
5459
<meta-data

client/ios/Podfile.lock

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
PODS:
22
- audioplayers_darwin (0.0.1):
33
- Flutter
4-
- DKImagePickerController/Core (4.3.4):
4+
- DKImagePickerController/Core (4.3.9):
55
- DKImagePickerController/ImageDataManager
66
- DKImagePickerController/Resource
7-
- DKImagePickerController/ImageDataManager (4.3.4)
8-
- DKImagePickerController/PhotoGallery (4.3.4):
7+
- DKImagePickerController/ImageDataManager (4.3.9)
8+
- DKImagePickerController/PhotoGallery (4.3.9):
99
- DKImagePickerController/Core
1010
- DKPhotoGallery
11-
- DKImagePickerController/Resource (4.3.4)
12-
- DKPhotoGallery (0.0.17):
13-
- DKPhotoGallery/Core (= 0.0.17)
14-
- DKPhotoGallery/Model (= 0.0.17)
15-
- DKPhotoGallery/Preview (= 0.0.17)
16-
- DKPhotoGallery/Resource (= 0.0.17)
11+
- DKImagePickerController/Resource (4.3.9)
12+
- DKPhotoGallery (0.0.19):
13+
- DKPhotoGallery/Core (= 0.0.19)
14+
- DKPhotoGallery/Model (= 0.0.19)
15+
- DKPhotoGallery/Preview (= 0.0.19)
16+
- DKPhotoGallery/Resource (= 0.0.19)
1717
- SDWebImage
1818
- SwiftyGif
19-
- DKPhotoGallery/Core (0.0.17):
19+
- DKPhotoGallery/Core (0.0.19):
2020
- DKPhotoGallery/Model
2121
- DKPhotoGallery/Preview
2222
- SDWebImage
2323
- SwiftyGif
24-
- DKPhotoGallery/Model (0.0.17):
24+
- DKPhotoGallery/Model (0.0.19):
2525
- SDWebImage
2626
- SwiftyGif
27-
- DKPhotoGallery/Preview (0.0.17):
27+
- DKPhotoGallery/Preview (0.0.19):
2828
- DKPhotoGallery/Model
2929
- DKPhotoGallery/Resource
3030
- SDWebImage
3131
- SwiftyGif
32-
- DKPhotoGallery/Resource (0.0.17):
32+
- DKPhotoGallery/Resource (0.0.19):
3333
- SDWebImage
3434
- SwiftyGif
3535
- file_picker (0.0.1):
@@ -38,6 +38,13 @@ PODS:
3838
- Flutter (1.0.0)
3939
- geolocator_apple (1.2.0):
4040
- Flutter
41+
- Google-Mobile-Ads-SDK (11.10.0):
42+
- GoogleUserMessagingPlatform (>= 1.1)
43+
- google_mobile_ads (5.2.0):
44+
- Flutter
45+
- Google-Mobile-Ads-SDK (~> 11.10.0)
46+
- webview_flutter_wkwebview
47+
- GoogleUserMessagingPlatform (2.7.0)
4148
- integration_test (0.0.1):
4249
- Flutter
4350
- media_kit_libs_ios_video (1.0.4):
@@ -60,15 +67,15 @@ PODS:
6067
- Flutter
6168
- screen_brightness_ios (0.1.0):
6269
- Flutter
63-
- SDWebImage (5.13.2):
64-
- SDWebImage/Core (= 5.13.2)
65-
- SDWebImage/Core (5.13.2)
70+
- SDWebImage (5.20.0):
71+
- SDWebImage/Core (= 5.20.0)
72+
- SDWebImage/Core (5.20.0)
6673
- sensors_plus (0.0.1):
6774
- Flutter
6875
- shared_preferences_foundation (0.0.1):
6976
- Flutter
7077
- FlutterMacOS
71-
- SwiftyGif (5.4.3)
78+
- SwiftyGif (5.4.5)
7279
- torch_light (0.0.1):
7380
- Flutter
7481
- url_launcher_ios (0.0.1):
@@ -86,6 +93,7 @@ DEPENDENCIES:
8693
- file_picker (from `.symlinks/plugins/file_picker/ios`)
8794
- Flutter (from `Flutter`)
8895
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
96+
- google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`)
8997
- integration_test (from `.symlinks/plugins/integration_test/ios`)
9098
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
9199
- media_kit_native_event_loop (from `.symlinks/plugins/media_kit_native_event_loop/ios`)
@@ -108,6 +116,8 @@ SPEC REPOS:
108116
trunk:
109117
- DKImagePickerController
110118
- DKPhotoGallery
119+
- Google-Mobile-Ads-SDK
120+
- GoogleUserMessagingPlatform
111121
- SDWebImage
112122
- SwiftyGif
113123

@@ -120,6 +130,8 @@ EXTERNAL SOURCES:
120130
:path: Flutter
121131
geolocator_apple:
122132
:path: ".symlinks/plugins/geolocator_apple/ios"
133+
google_mobile_ads:
134+
:path: ".symlinks/plugins/google_mobile_ads/ios"
123135
integration_test:
124136
:path: ".symlinks/plugins/integration_test/ios"
125137
media_kit_libs_ios_video:
@@ -157,11 +169,14 @@ EXTERNAL SOURCES:
157169

158170
SPEC CHECKSUMS:
159171
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
160-
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
161-
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
172+
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
173+
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
162174
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
163175
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
164176
geolocator_apple: 6cbaf322953988e009e5ecb481f07efece75c450
177+
Google-Mobile-Ads-SDK: 13e6e98edfd78ad8d8a791edb927658cc260a56f
178+
google_mobile_ads: 2a538d8e42b1813809782792e48f8cf4374c2180
179+
GoogleUserMessagingPlatform: a8b56893477f67212fbc8411c139e61d463349f5
165180
integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573
166181
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
167182
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
@@ -172,10 +187,10 @@ SPEC CHECKSUMS:
172187
record_darwin: df0a677188e5fed18472550298e675f19ddaffbe
173188
rive_common: c537b4eed761e903a9403d93c347b69bd7a4762f
174189
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
175-
SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866
190+
SDWebImage: 73c6079366fea25fa4bb9640d5fb58f0893facd8
176191
sensors_plus: 42b9de1b8237675fa8d8121e4bb93be0f79fa61d
177192
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
178-
SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780
193+
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
179194
torch_light: 682062fa12102172fa38b6b14c106d93b060f83e
180195
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
181196
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9

client/ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
<false />
5050
<key>NSPhotoLibraryUsageDescription</key>
5151
<string>The app needs access to photo library, so that photos can be selected.</string>
52+
<key>GADApplicationIdentifier</key>
53+
<string>ca-app-pub-3940256099942544~1458002511</string>
5254
<key>UIApplicationSupportsIndirectInputEvents</key>
5355
<true />
5456
<key>NSAppTransportSecurity</key>

client/lib/main.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'package:flet_map/flet_map.dart' as flet_map;
1313
import 'package:flet_permission_handler/flet_permission_handler.dart'
1414
as flet_permission_handler;
1515
import 'package:flet_rive/flet_rive.dart' as flet_rive;
16+
import 'package:flet_ads/flet_ads.dart' as flet_ads;
1617
// --FAT_CLIENT_START--
1718
import 'package:flet_video/flet_video.dart' as flet_video;
1819
// --FAT_CLIENT_END--
@@ -42,6 +43,7 @@ void main([List<String>? args]) async {
4243
flet_permission_handler.ensureInitialized();
4344
flet_lottie.ensureInitialized();
4445
flet_map.ensureInitialized();
46+
flet_ads.ensureInitialized();
4547
flet_rive.ensureInitialized();
4648
flet_webview.ensureInitialized();
4749
flet_flashlight.ensureInitialized();
@@ -111,6 +113,7 @@ void main([List<String>? args]) async {
111113
flet_permission_handler.createControl,
112114
flet_lottie.createControl,
113115
flet_map.createControl,
116+
flet_ads.createControl,
114117
flet_rive.createControl,
115118
flet_webview.createControl,
116119
flet_flashlight.createControl,

client/pubspec.lock

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ packages:
248248
relative: true
249249
source: path
250250
version: "0.24.1"
251+
flet_ads:
252+
dependency: "direct main"
253+
description:
254+
path: "../packages/flet_ads"
255+
relative: true
256+
source: path
257+
version: "0.24.1"
251258
flet_audio:
252259
dependency: "direct main"
253260
description:
@@ -476,6 +483,14 @@ packages:
476483
url: "https://pub.dev"
477484
source: hosted
478485
version: "0.2.3"
486+
google_mobile_ads:
487+
dependency: transitive
488+
description:
489+
name: google_mobile_ads
490+
sha256: "4775006383a27a5d86d46f8fb452bfcb17794fc0a46c732979e49a8eb1c8963f"
491+
url: "https://pub.dev"
492+
source: hosted
493+
version: "5.2.0"
479494
graphs:
480495
dependency: transitive
481496
description:
@@ -1447,7 +1462,7 @@ packages:
14471462
source: hosted
14481463
version: "4.10.0"
14491464
webview_flutter_android:
1450-
dependency: transitive
1465+
dependency: "direct overridden"
14511466
description:
14521467
name: webview_flutter_android
14531468
sha256: "74693a212d990b32e0b7055d27db973a18abf31c53942063948cdfaaef9787ba"

client/pubspec.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ dependencies:
4343
path: ../packages/flet_lottie
4444
flet_map:
4545
path: ../packages/flet_map
46+
flet_ads:
47+
path: ../packages/flet_ads
4648
flet_rive:
4749
path: ../packages/flet_rive
4850
flet_audio_recorder:
4951
path: ../packages/flet_audio_recorder
5052
flet_permission_handler:
51-
path: ../packages/flet_permission_handler
53+
path: ../packages/flet_permission_handler
5254
flet_geolocator:
5355
path: ../packages/flet_geolocator
5456
flet_webview:
@@ -62,6 +64,9 @@ dependencies:
6264
integration_test:
6365
sdk: flutter
6466

67+
dependency_overrides:
68+
webview_flutter_android: ^4.0.0
69+
6570
dev_dependencies:
6671
flutter_test:
6772
sdk: flutter

packages/flet_ads/.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
build/
30+
.flutter-plugins
31+
.flutter-plugins-dependencies

packages/flet_ads/.metadata

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: "2e9cb0aa71a386a91f73f7088d115c0d96654829"
8+
channel: "stable"
9+
10+
project_type: package

packages/flet_ads/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 0.24.0
2+
3+
Initial release of the package.

0 commit comments

Comments
 (0)