Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve FirebaseMessaging remote notification proxy source code #13818

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions FirebaseMessaging/Sources/FIRMessagingRemoteNotificationsProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ - (void)swizzleSelector:(SEL)originalSelector
IMP originalMethodImplementation =
method_setImplementation(originalMethod, swizzledImplementation);

IMP nonexistantMethodImplementation = [self nonExistantMethodImplementationForClass:klass];
IMP nonexistentMethodImplementation = [self nonExistentMethodImplementationForClass:klass];

if (originalMethodImplementation &&
originalMethodImplementation != nonexistantMethodImplementation &&
originalMethodImplementation != nonexistentMethodImplementation &&
originalMethodImplementation != swizzledImplementation) {
[self saveOriginalImplementation:originalMethodImplementation forSelector:originalSelector];
}
Expand Down Expand Up @@ -344,8 +344,8 @@ - (void)unswizzleSelector:(SEL)selector inClass:(Class)klass {
// behavior as if the method was not implemented.
// See: http://stackoverflow.com/a/8276527/9849

IMP nonExistantMethodImplementation = [self nonExistantMethodImplementationForClass:klass];
method_setImplementation(swizzledMethod, nonExistantMethodImplementation);
IMP nonExistentMethodImplementation = [self nonExistentMethodImplementationForClass:klass];
method_setImplementation(swizzledMethod, nonExistentMethodImplementation);
}
}

Expand All @@ -354,10 +354,10 @@ - (void)unswizzleSelector:(SEL)selector inClass:(Class)klass {
// This is useful to generate from a stable, "known missing" selector, as the IMP can be compared
// in case we are setting an implementation for a class that was previously "unswizzled" into a
// non-existent implementation.
- (IMP)nonExistantMethodImplementationForClass:(Class)klass {
SEL nonExistantSelector = NSSelectorFromString(@"aNonExistantMethod");
IMP nonExistantMethodImplementation = class_getMethodImplementation(klass, nonExistantSelector);
return nonExistantMethodImplementation;
- (IMP)nonExistentMethodImplementationForClass:(Class)klass {
SEL nonExistentSelector = NSSelectorFromString(@"aNonExistentMethod");
IMP nonExistentMethodImplementation = class_getMethodImplementation(klass, nonExistentSelector);
return nonExistentMethodImplementation;
}

// A safe, non-leaky way return a property object by its name
Expand Down
Loading