Skip to content

Commit 1cdd634

Browse files
authored
Merge pull request #62 from firebase/feat/update-admob
feat: Update Admob to latest version
2 parents 2880c00 + 4f1a7e4 commit 1cdd634

File tree

8 files changed

+253
-56
lines changed

8 files changed

+253
-56
lines changed

admob/analysis_options.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ linter:
2222
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
2323
# producing the lint.
2424
rules:
25-
# avoid_print: false # Uncomment to disable the `avoid_print` rule
25+
avoid_print: false # Uncomment to disable the `avoid_print` rule
2626
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27-
2827
# Additional information about this file can be found at
2928
# https://dart.dev/guides/language/analysis-options

admob/ios/Podfile.lock

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
PODS:
2+
- Flutter (1.0.0)
3+
- Google-Mobile-Ads-SDK (10.11.0):
4+
- GoogleAppMeasurement (< 11.0, >= 7.0)
5+
- GoogleUserMessagingPlatform (>= 1.1)
6+
- google_mobile_ads (1.0.0):
7+
- Flutter
8+
- Google-Mobile-Ads-SDK (~> 10.11.0)
9+
- webview_flutter_wkwebview
10+
- GoogleAppMeasurement (10.19.0):
11+
- GoogleAppMeasurement/AdIdSupport (= 10.19.0)
12+
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
13+
- GoogleUtilities/MethodSwizzler (~> 7.11)
14+
- GoogleUtilities/Network (~> 7.11)
15+
- "GoogleUtilities/NSData+zlib (~> 7.11)"
16+
- nanopb (< 2.30910.0, >= 2.30908.0)
17+
- GoogleAppMeasurement/AdIdSupport (10.19.0):
18+
- GoogleAppMeasurement/WithoutAdIdSupport (= 10.19.0)
19+
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
20+
- GoogleUtilities/MethodSwizzler (~> 7.11)
21+
- GoogleUtilities/Network (~> 7.11)
22+
- "GoogleUtilities/NSData+zlib (~> 7.11)"
23+
- nanopb (< 2.30910.0, >= 2.30908.0)
24+
- GoogleAppMeasurement/WithoutAdIdSupport (10.19.0):
25+
- GoogleUtilities/AppDelegateSwizzler (~> 7.11)
26+
- GoogleUtilities/MethodSwizzler (~> 7.11)
27+
- GoogleUtilities/Network (~> 7.11)
28+
- "GoogleUtilities/NSData+zlib (~> 7.11)"
29+
- nanopb (< 2.30910.0, >= 2.30908.0)
30+
- GoogleUserMessagingPlatform (2.1.0)
31+
- GoogleUtilities/AppDelegateSwizzler (7.12.0):
32+
- GoogleUtilities/Environment
33+
- GoogleUtilities/Logger
34+
- GoogleUtilities/Network
35+
- GoogleUtilities/Environment (7.12.0):
36+
- PromisesObjC (< 3.0, >= 1.2)
37+
- GoogleUtilities/Logger (7.12.0):
38+
- GoogleUtilities/Environment
39+
- GoogleUtilities/MethodSwizzler (7.12.0):
40+
- GoogleUtilities/Logger
41+
- GoogleUtilities/Network (7.12.0):
42+
- GoogleUtilities/Logger
43+
- "GoogleUtilities/NSData+zlib"
44+
- GoogleUtilities/Reachability
45+
- "GoogleUtilities/NSData+zlib (7.12.0)"
46+
- GoogleUtilities/Reachability (7.12.0):
47+
- GoogleUtilities/Logger
48+
- nanopb (2.30909.1):
49+
- nanopb/decode (= 2.30909.1)
50+
- nanopb/encode (= 2.30909.1)
51+
- nanopb/decode (2.30909.1)
52+
- nanopb/encode (2.30909.1)
53+
- PromisesObjC (2.3.1)
54+
- webview_flutter_wkwebview (0.0.1):
55+
- Flutter
56+
57+
DEPENDENCIES:
58+
- Flutter (from `Flutter`)
59+
- google_mobile_ads (from `.symlinks/plugins/google_mobile_ads/ios`)
60+
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)
61+
62+
SPEC REPOS:
63+
trunk:
64+
- Google-Mobile-Ads-SDK
65+
- GoogleAppMeasurement
66+
- GoogleUserMessagingPlatform
67+
- GoogleUtilities
68+
- nanopb
69+
- PromisesObjC
70+
71+
EXTERNAL SOURCES:
72+
Flutter:
73+
:path: Flutter
74+
google_mobile_ads:
75+
:path: ".symlinks/plugins/google_mobile_ads/ios"
76+
webview_flutter_wkwebview:
77+
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"
78+
79+
SPEC CHECKSUMS:
80+
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
81+
Google-Mobile-Ads-SDK: 58b4fda3f9758fc1ed210aa5cf7777b5eb55d47e
82+
google_mobile_ads: 511febb4768edc860ee455a9e201ff52de385908
83+
GoogleAppMeasurement: 68afe759316673c6554dac35a0c7ae8f5d6cb4ed
84+
GoogleUserMessagingPlatform: dce302b8f1b84d6e945812ee7a15c3f65a102cbf
85+
GoogleUtilities: 0759d1a57ebb953965c2dfe0ba4c82e95ccc2e34
86+
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
87+
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
88+
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a
89+
90+
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
91+
92+
COCOAPODS: 1.13.0

admob/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 50;
6+
objectVersion = 54;
77
objects = {
88

99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12+
6F1EB87BE6EB1CE545C6C6D8 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0554B3A0B085A39FA12E9253 /* Pods_Runner.framework */; };
1213
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
1314
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1415
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
@@ -29,12 +30,16 @@
2930
/* End PBXCopyFilesBuildPhase section */
3031

3132
/* Begin PBXFileReference section */
33+
0554B3A0B085A39FA12E9253 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3234
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
3335
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
36+
328D3A16E752CEED566AB6BB /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
37+
33CAF77D97F7CA280CE2DDCF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
3438
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3539
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
3640
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3741
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
42+
828F7299D9587EB1F6C559E1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
3843
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
3944
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
4045
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -49,12 +54,21 @@
4954
isa = PBXFrameworksBuildPhase;
5055
buildActionMask = 2147483647;
5156
files = (
57+
6F1EB87BE6EB1CE545C6C6D8 /* Pods_Runner.framework in Frameworks */,
5258
);
5359
runOnlyForDeploymentPostprocessing = 0;
5460
};
5561
/* End PBXFrameworksBuildPhase section */
5662

5763
/* Begin PBXGroup section */
64+
90D84C5DA31C2FF6A4C6E362 /* Frameworks */ = {
65+
isa = PBXGroup;
66+
children = (
67+
0554B3A0B085A39FA12E9253 /* Pods_Runner.framework */,
68+
);
69+
name = Frameworks;
70+
sourceTree = "<group>";
71+
};
5872
9740EEB11CF90186004384FC /* Flutter */ = {
5973
isa = PBXGroup;
6074
children = (
@@ -72,6 +86,8 @@
7286
9740EEB11CF90186004384FC /* Flutter */,
7387
97C146F01CF9000F007C117D /* Runner */,
7488
97C146EF1CF9000F007C117D /* Products */,
89+
D592F3B67D19BD8FC8AC80DF /* Pods */,
90+
90D84C5DA31C2FF6A4C6E362 /* Frameworks */,
7591
);
7692
sourceTree = "<group>";
7793
};
@@ -98,19 +114,33 @@
98114
path = Runner;
99115
sourceTree = "<group>";
100116
};
117+
D592F3B67D19BD8FC8AC80DF /* Pods */ = {
118+
isa = PBXGroup;
119+
children = (
120+
828F7299D9587EB1F6C559E1 /* Pods-Runner.debug.xcconfig */,
121+
33CAF77D97F7CA280CE2DDCF /* Pods-Runner.release.xcconfig */,
122+
328D3A16E752CEED566AB6BB /* Pods-Runner.profile.xcconfig */,
123+
);
124+
name = Pods;
125+
path = Pods;
126+
sourceTree = "<group>";
127+
};
101128
/* End PBXGroup section */
102129

103130
/* Begin PBXNativeTarget section */
104131
97C146ED1CF9000F007C117D /* Runner */ = {
105132
isa = PBXNativeTarget;
106133
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
107134
buildPhases = (
135+
EA8FA25447621806A7F1B212 /* [CP] Check Pods Manifest.lock */,
108136
9740EEB61CF901F6004384FC /* Run Script */,
109137
97C146EA1CF9000F007C117D /* Sources */,
110138
97C146EB1CF9000F007C117D /* Frameworks */,
111139
97C146EC1CF9000F007C117D /* Resources */,
112140
9705A1C41CF9048500538489 /* Embed Frameworks */,
113141
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
142+
D8DA98AB9D98E67F63D4D976 /* [CP] Embed Pods Frameworks */,
143+
66181D404FB9AB067CCC5685 /* [CP] Copy Pods Resources */,
114144
);
115145
buildRules = (
116146
);
@@ -127,7 +157,7 @@
127157
97C146E61CF9000F007C117D /* Project object */ = {
128158
isa = PBXProject;
129159
attributes = {
130-
LastUpgradeCheck = 1300;
160+
LastUpgradeCheck = 1430;
131161
ORGANIZATIONNAME = "";
132162
TargetAttributes = {
133163
97C146ED1CF9000F007C117D = {
@@ -171,10 +201,12 @@
171201
/* Begin PBXShellScriptBuildPhase section */
172202
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
173203
isa = PBXShellScriptBuildPhase;
204+
alwaysOutOfDate = 1;
174205
buildActionMask = 2147483647;
175206
files = (
176207
);
177208
inputPaths = (
209+
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
178210
);
179211
name = "Thin Binary";
180212
outputPaths = (
@@ -183,8 +215,26 @@
183215
shellPath = /bin/sh;
184216
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
185217
};
218+
66181D404FB9AB067CCC5685 /* [CP] Copy Pods Resources */ = {
219+
isa = PBXShellScriptBuildPhase;
220+
buildActionMask = 2147483647;
221+
files = (
222+
);
223+
inputFileListPaths = (
224+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
225+
);
226+
name = "[CP] Copy Pods Resources";
227+
outputFileListPaths = (
228+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
229+
);
230+
runOnlyForDeploymentPostprocessing = 0;
231+
shellPath = /bin/sh;
232+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
233+
showEnvVarsInLog = 0;
234+
};
186235
9740EEB61CF901F6004384FC /* Run Script */ = {
187236
isa = PBXShellScriptBuildPhase;
237+
alwaysOutOfDate = 1;
188238
buildActionMask = 2147483647;
189239
files = (
190240
);
@@ -197,6 +247,45 @@
197247
shellPath = /bin/sh;
198248
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
199249
};
250+
D8DA98AB9D98E67F63D4D976 /* [CP] Embed Pods Frameworks */ = {
251+
isa = PBXShellScriptBuildPhase;
252+
buildActionMask = 2147483647;
253+
files = (
254+
);
255+
inputFileListPaths = (
256+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
257+
);
258+
name = "[CP] Embed Pods Frameworks";
259+
outputFileListPaths = (
260+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
261+
);
262+
runOnlyForDeploymentPostprocessing = 0;
263+
shellPath = /bin/sh;
264+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
265+
showEnvVarsInLog = 0;
266+
};
267+
EA8FA25447621806A7F1B212 /* [CP] Check Pods Manifest.lock */ = {
268+
isa = PBXShellScriptBuildPhase;
269+
buildActionMask = 2147483647;
270+
files = (
271+
);
272+
inputFileListPaths = (
273+
);
274+
inputPaths = (
275+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
276+
"${PODS_ROOT}/Manifest.lock",
277+
);
278+
name = "[CP] Check Pods Manifest.lock";
279+
outputFileListPaths = (
280+
);
281+
outputPaths = (
282+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
283+
);
284+
runOnlyForDeploymentPostprocessing = 0;
285+
shellPath = /bin/sh;
286+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
287+
showEnvVarsInLog = 0;
288+
};
200289
/* End PBXShellScriptBuildPhase section */
201290

202291
/* Begin PBXSourcesBuildPhase section */

admob/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1430"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

admob/ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

admob/lib/main.dart

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,17 @@ import 'dart:io';
22

33
import 'package:flutter/material.dart';
44
import 'package:google_mobile_ads/google_mobile_ads.dart';
5-
import 'package:provider/provider.dart';
65

76
void main() {
87
WidgetsFlutterBinding.ensureInitialized();
98

10-
runApp(ChangeNotifierProvider(
11-
create: (context) => ApplicationState(),
12-
builder: (context, child) => const MyApp(),
13-
));
9+
runApp(MyApp(state: ApplicationState()));
1410
}
1511

1612
class MyApp extends StatelessWidget {
17-
const MyApp({super.key});
13+
const MyApp({super.key, required this.state});
14+
15+
final ApplicationState state;
1816

1917
// This widget is the root of your application.
2018
@override
@@ -33,13 +31,15 @@ class MyApp extends StatelessWidget {
3331
// is not restarted.
3432
primarySwatch: Colors.blue,
3533
),
36-
home: const MyHomePage(title: 'AdMob Quickstart'),
34+
home: MyHomePage(title: 'AdMob Quickstart', state: state),
3735
);
3836
}
3937
}
4038

4139
class MyHomePage extends StatelessWidget {
42-
const MyHomePage({super.key, required this.title});
40+
const MyHomePage({super.key, required this.title, required this.state});
41+
42+
final ApplicationState state;
4343

4444
final String title;
4545
@override
@@ -48,8 +48,9 @@ class MyHomePage extends StatelessWidget {
4848
appBar: AppBar(
4949
title: Text(title),
5050
),
51-
body: Consumer<ApplicationState>(
52-
builder: (context, appState, _) => Column(
51+
body: ListenableBuilder(
52+
listenable: state,
53+
builder: (context, child) => Column(
5354
children: <Widget>[
5455
const Padding(
5556
padding: EdgeInsets.all(64.0),
@@ -66,22 +67,22 @@ class MyHomePage extends StatelessWidget {
6667
'analytics capabilities.'),
6768
),
6869
ElevatedButton(
69-
onPressed: appState.interstitialAd != null
70+
onPressed: state.interstitialAd != null
7071
? () {
71-
appState.showInterstitial();
72+
state.showInterstitial();
7273
}
7374
: null,
7475
child: const Text('Load Interstitial'),
7576
),
7677
const Expanded(child: SizedBox.shrink()),
77-
appState.bannerAd != null
78+
state.bannerAd != null
7879
? Align(
7980
alignment: Alignment.bottomCenter,
8081
child: Container(
8182
alignment: Alignment.bottomCenter,
82-
width: appState.bannerAd!.size.width.toDouble(),
83-
height: appState.bannerAd!.size.height.toDouble(),
84-
child: AdWidget(ad: appState.bannerAd!),
83+
width: state.bannerAd!.size.width.toDouble(),
84+
height: state.bannerAd!.size.height.toDouble(),
85+
child: AdWidget(ad: state.bannerAd!),
8586
),
8687
)
8788
: const SizedBox.shrink(),

0 commit comments

Comments
 (0)