Skip to content

Commit dfafdf2

Browse files
chore(firebase_messaging): update FlutterFire Messaging example app for iOS (#9098)
1 parent 25d4eaf commit dfafdf2

File tree

5 files changed

+74
-11
lines changed

5 files changed

+74
-11
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Uncomment this line to define a global platform for your project
2+
platform :ios, '11.0'
3+
4+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6+
7+
project 'Runner', {
8+
'Debug' => :debug,
9+
'Profile' => :release,
10+
'Release' => :release,
11+
}
12+
13+
def flutter_root
14+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15+
unless File.exist?(generated_xcode_build_settings_path)
16+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17+
end
18+
19+
File.foreach(generated_xcode_build_settings_path) do |line|
20+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
21+
return matches[1].strip if matches
22+
end
23+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24+
end
25+
26+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27+
28+
flutter_ios_podfile_setup
29+
30+
target 'Runner' do
31+
use_frameworks!
32+
use_modular_headers!
33+
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
34+
end
35+
36+
post_install do |installer|
37+
installer.pods_project.targets.each do |target|
38+
flutter_additional_ios_build_settings(target)
39+
end
40+
end

packages/firebase_messaging/firebase_messaging/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
00E92990C987F9E25B63A112 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 45E51992A527D76267EB20C4 /* Pods_Runner.framework */; };
1011
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1112
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1213
465BDD1E283BB5B000437DF4 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 465BDD1D283BB5B000437DF4 /* GoogleService-Info.plist */; };
13-
88A1BA888F20E378BC794541 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 61672002202DF3E143D4F450 /* libPods-Runner.a */; };
1414
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1515
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
1616
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -36,9 +36,9 @@
3636
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3737
27715A442538A1AE00757C2A /* Firebase Cloud Messaging Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Firebase Cloud Messaging Example.entitlements"; sourceTree = "<group>"; };
3838
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
39+
45E51992A527D76267EB20C4 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3940
465BDD1D283BB5B000437DF4 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
4041
5213D4DB21693B7FDB92C6A0 /* 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>"; };
41-
61672002202DF3E143D4F450 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4242
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4343
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4444
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -59,7 +59,7 @@
5959
isa = PBXFrameworksBuildPhase;
6060
buildActionMask = 2147483647;
6161
files = (
62-
88A1BA888F20E378BC794541 /* libPods-Runner.a in Frameworks */,
62+
00E92990C987F9E25B63A112 /* Pods_Runner.framework in Frameworks */,
6363
);
6464
runOnlyForDeploymentPostprocessing = 0;
6565
};
@@ -135,7 +135,7 @@
135135
C6DFB291D4DE268ECF1E3926 /* Frameworks */ = {
136136
isa = PBXGroup;
137137
children = (
138-
61672002202DF3E143D4F450 /* libPods-Runner.a */,
138+
45E51992A527D76267EB20C4 /* Pods_Runner.framework */,
139139
);
140140
name = Frameworks;
141141
sourceTree = "<group>";
@@ -154,6 +154,7 @@
154154
97C146EC1CF9000F007C117D /* Resources */,
155155
9705A1C41CF9048500538489 /* Embed Frameworks */,
156156
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
157+
03DD25D3A2B7EE1A2C7F7CC0 /* [CP] Embed Pods Frameworks */,
157158
);
158159
buildRules = (
159160
);
@@ -212,6 +213,23 @@
212213
/* End PBXResourcesBuildPhase section */
213214

214215
/* Begin PBXShellScriptBuildPhase section */
216+
03DD25D3A2B7EE1A2C7F7CC0 /* [CP] Embed Pods Frameworks */ = {
217+
isa = PBXShellScriptBuildPhase;
218+
buildActionMask = 2147483647;
219+
files = (
220+
);
221+
inputFileListPaths = (
222+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
223+
);
224+
name = "[CP] Embed Pods Frameworks";
225+
outputFileListPaths = (
226+
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
227+
);
228+
runOnlyForDeploymentPostprocessing = 0;
229+
shellPath = /bin/sh;
230+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
231+
showEnvVarsInLog = 0;
232+
};
215233
095EEB27D2A4AE080033180A /* [CP] Check Pods Manifest.lock */ = {
216234
isa = PBXShellScriptBuildPhase;
217235
buildActionMask = 2147483647;
@@ -320,6 +338,7 @@
320338
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
321339
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
322340
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
341+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
323342
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
324343
CLANG_WARN_STRICT_PROTOTYPES = YES;
325344
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -338,7 +357,7 @@
338357
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
339358
GCC_WARN_UNUSED_FUNCTION = YES;
340359
GCC_WARN_UNUSED_VARIABLE = YES;
341-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
360+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
342361
MTL_ENABLE_DEBUG_INFO = NO;
343362
SDKROOT = iphoneos;
344363
SUPPORTED_PLATFORMS = iphoneos;
@@ -402,6 +421,7 @@
402421
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
403422
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
404423
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
424+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
405425
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
406426
CLANG_WARN_STRICT_PROTOTYPES = YES;
407427
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -426,7 +446,7 @@
426446
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
427447
GCC_WARN_UNUSED_FUNCTION = YES;
428448
GCC_WARN_UNUSED_VARIABLE = YES;
429-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
449+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
430450
MTL_ENABLE_DEBUG_INFO = YES;
431451
ONLY_ACTIVE_ARCH = YES;
432452
SDKROOT = iphoneos;
@@ -457,6 +477,7 @@
457477
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
458478
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
459479
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
480+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
460481
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
461482
CLANG_WARN_STRICT_PROTOTYPES = YES;
462483
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -475,7 +496,7 @@
475496
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
476497
GCC_WARN_UNUSED_FUNCTION = YES;
477498
GCC_WARN_UNUSED_VARIABLE = YES;
478-
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
499+
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
479500
MTL_ENABLE_DEBUG_INFO = NO;
480501
SDKROOT = iphoneos;
481502
SUPPORTED_PLATFORMS = iphoneos;

packages/firebase_messaging/firebase_messaging/example/ios/Runner/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,7 @@
4646
</array>
4747
<key>UIViewControllerBasedStatusBarAppearance</key>
4848
<false/>
49+
<key>CADisableMinimumFrameDurationOnPhone</key>
50+
<true/>
4951
</dict>
5052
</plist>

packages/firebase_messaging/firebase_messaging/example/lib/main.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ late FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
3838
Future<void> main() async {
3939
WidgetsFlutterBinding.ensureInitialized();
4040
await Firebase.initializeApp();
41-
4241
// Set the background messaging handler early on, as a named top-level function
4342
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
4443

4544
if (!kIsWeb) {
4645
channel = const AndroidNotificationChannel(
4746
'high_importance_channel', // id
4847
'High Importance Notifications', // title
49-
'This channel is used for important notifications.', // description
48+
description:
49+
'This channel is used for important notifications.', // description
5050
importance: Importance.high,
5151
);
5252

@@ -144,7 +144,7 @@ class _Application extends State<Application> {
144144
android: AndroidNotificationDetails(
145145
channel.id,
146146
channel.name,
147-
channel.description,
147+
channelDescription: channel.description,
148148
// TODO add a proper drawable resource to android, for now using
149149
// one that already exists in example app.
150150
icon: 'launch_background',

packages/firebase_messaging/firebase_messaging/example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
path: ../
1313
flutter:
1414
sdk: flutter
15-
flutter_local_notifications: ^8.2.0
15+
flutter_local_notifications: ^9.7.0
1616
http: ^0.13.0
1717

1818
dependency_overrides:

0 commit comments

Comments
 (0)