Skip to content

Commit ba7b04a

Browse files
authored
Merge branch 'main' into analytics-dll-secure
2 parents 57f303d + d299673 commit ba7b04a

File tree

8 files changed

+1637
-69
lines changed

8 files changed

+1637
-69
lines changed

AGENTS.md

Lines changed: 626 additions & 0 deletions
Large diffs are not rendered by default.

app/src/invites/ios/invites_ios_startup.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ @implementation UIApplication (FIRFBI)
286286
+ (void)load {
287287
// C++ constructors may not be called yet so call NSLog rather than LogDebug.
288288
NSLog(@"Loading UIApplication category for Firebase App");
289-
::firebase::util::ForEachAppDelegateClass(^(Class clazz) {
289+
::firebase::util::RunOnAppDelegateClasses(^(Class clazz) {
290290
::firebase::invites::HookAppDelegateMethods(clazz);
291291
});
292292
}

app/src/util_ios.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,12 @@ typedef BOOL (
185185
id self, SEL selector_value, UIApplication *application,
186186
NSUserActivity *user_activity, void (^restoration_handler)(NSArray *));
187187

188-
// Call the given block once for every Objective-C class that exists that
189-
// implements the UIApplicationDelegate protocol (except for those in a
190-
// blacklist we keep).
191-
void ForEachAppDelegateClass(void (^block)(Class));
188+
// Calls the given block for each unique Objective-C class that has been
189+
// previously passed to [UIApplication setDelegate:]. The block is executed
190+
// immediately for all currently known unique delegate classes.
191+
// Additionally, the block is queued to be executed if any new, unique
192+
// Objective-C class is passed to [UIApplication setDelegate:] in the future.
193+
void RunOnAppDelegateClasses(void (^block)(Class));
192194

193195
// Convert a string array into an NSMutableArray.
194196
NSMutableArray *StringVectorToNSMutableArray(

app/src/util_ios.mm

Lines changed: 268 additions & 60 deletions
Large diffs are not rendered by default.

messaging/src/ios/messaging.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ @implementation UIApplication (FIRFCM)
870870
+ (void)load {
871871
// C++ constructors may not be called yet so call NSLog rather than LogInfo.
872872
NSLog(@"FCM: Loading UIApplication FIRFCM category");
873-
::firebase::util::ForEachAppDelegateClass(^(Class clazz) {
873+
::firebase::util::RunOnAppDelegateClasses(^(Class clazz) {
874874
FirebaseMessagingHookAppDelegate(clazz);
875875
});
876876
}

release_build_files/readme.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,30 @@ addition to any you may have implemented.
537537

538538
The Firebase Cloud Messaging library needs to attach
539539
handlers to the application delegate using method swizzling. If you are using
540-
these libraries, at load time, Firebase will identify your `AppDelegate` class
541-
and swizzle the required methods onto it, chaining a call back to your existing
542-
method implementation.
540+
these libraries, at load time, Firebase will typically identify your `AppDelegate`
541+
class and swizzle the required methods onto it.
542+
543+
#### Specifying Your AppDelegate Class Directly (iOS)
544+
545+
For a more direct approach, or if you encounter issues with the default
546+
method swizzling, you can explicitly tell Firebase which class is your
547+
application's `AppDelegate`. To do this, add the `FirebaseAppDelegateClassName`
548+
key to your app's `Info.plist` file:
549+
550+
* **Key:** `FirebaseAppDelegateClassName`
551+
* **Type:** `String`
552+
* **Value:** Your AppDelegate's class name (e.g., `MyCustomAppDelegate`)
553+
554+
**Example `Info.plist` entry:**
555+
```xml
556+
<key>FirebaseAppDelegateClassName</key>
557+
<string>MyCustomAppDelegate</string>
558+
```
559+
560+
If this key is provided with a valid class name, Firebase will use that class
561+
directly for its AppDelegate-related interactions. If the key is not present,
562+
is invalid, or the class is not found, Firebase will use its standard method
563+
swizzling approach.
543564

544565
### Custom Android Build Systems
545566

@@ -654,6 +675,14 @@ workflow use only during the development of your app, not for publicly shipping
654675
code.
655676

656677
## Release Notes
678+
### Upcoming Release
679+
- Changes
680+
- iOS: Added an option to explicitly specify your app's `AppDelegate` class
681+
name via the `FirebaseAppDelegateClassName` key in `Info.plist`. This
682+
provides a more direct way for Firebase to interact with your specified
683+
AppDelegate. See "Platform Notes > iOS Method Swizzling >
684+
Specifying Your AppDelegate Class Directly (iOS)" for details.
685+
657686
### 12.8.0
658687
- Changes
659688
- General (iOS): Update to Firebase Cocoapods version 11.14.0.

scripts/dumpsrc.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/bash
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Print a formatted list of source files from specific directories.
17+
# Suggested usage: dumpsrc.sh <path1> [path2] [path3] [...] | pbcopy
18+
19+
included_files=(
20+
'*.swig'
21+
'*.i'
22+
'*.c'
23+
'*.cc'
24+
'*.cpp'
25+
'*.cs'
26+
'*.cmake'
27+
'*.fbs'
28+
'*.gradle'
29+
'*.h'
30+
'*.hh'
31+
'*.java'
32+
'*.js'
33+
'*.json'
34+
'*.md'
35+
'*.m'
36+
'*.mm'
37+
'CMakeLists.txt'
38+
'Podfile'
39+
)
40+
41+
get_markdown_language_for_file() {
42+
local filename="$1"
43+
local base="$(basename "$filename")"
44+
local ext="${base##*.}"
45+
if [[ "$base" == "$ext" && "$base" != .* ]]; then
46+
ext="" # No extension
47+
fi
48+
49+
# Handle special filename case first
50+
if [[ "$base" == "CMakeLists.txt" ]]; then
51+
echo "cmake"
52+
return 0
53+
fi
54+
55+
# Main logic using case based on extension
56+
case "$ext" in
57+
c) echo "c" ;;
58+
cc) echo "cpp" ;;
59+
cs) echo "csharp" ;;
60+
hh) echo "cpp" ;;
61+
m) echo "objectivec" ;;
62+
mm) echo "objectivec" ;;
63+
sh) echo "bash" ;;
64+
py) echo "python" ;;
65+
md) echo "markdown" ;;
66+
json) echo "js" ;;
67+
h)
68+
if grep -qE "\@interface|\#import" "$filename"; then
69+
echo "objectivec";
70+
else
71+
echo "cpp";
72+
fi
73+
;;
74+
"") # Explicitly handle no extension (after CMakeLists.txt check)
75+
: # Output nothing
76+
;;
77+
*) # Default case for any other non-empty extension
78+
echo "$ext"
79+
;;
80+
esac
81+
return 0
82+
}
83+
84+
85+
if [[ -z "$1" ]]; then
86+
echo "Usage: $0 <path1> [path2] [path3] ..."
87+
exit 1
88+
fi
89+
90+
find_cmd_args=('-name' 'UNUSED')
91+
92+
for pattern in "${included_files[@]}"; do
93+
if [[ -n "${pattern}" ]]; then
94+
find_cmd_args+=('-or' '-name' "$pattern")
95+
fi
96+
done
97+
98+
for f in `find $* -type f -and "${find_cmd_args[@]}"`; do
99+
echo "*** BEGIN CONTENTS OF FILE '$f' ***";
100+
echo '```'$(get_markdown_language_for_file "$f");
101+
cat "$f";
102+
echo '```';
103+
echo "*** END CONTENTS OF FILE '$f' ***";
104+
echo
105+
done

0 commit comments

Comments
 (0)