Skip to content

Commit

Permalink
refactor(ios)!: move AppDelegate to CDVAppDelegate
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Sep 11, 2024
1 parent 4c1b14d commit 0571913
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@
<string>production</string>
</config-file>

<source-file src="src/ios/AppDelegate+notification.m"/>
<source-file src="src/ios/CDVAppDelegate+notification.m"/>
<source-file src="src/ios/PushPlugin.m"/>
<header-file src="src/ios/AppDelegate+notification.h"/>
<header-file src="src/ios/CDVAppDelegate+notification.h"/>
<header-file src="src/ios/PushPlugin.h"/>

<framework src="PushKit.framework"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//
// AppDelegate+notification.h
// CDVAppDelegate+notification.h
//
// Created by Robert Easterday on 10/26/12.
//

#import "AppDelegate.h"
#import "Cordova/CDVAppDelegate.h"
@import UserNotifications;

@interface AppDelegate (notification) <UNUserNotificationCenterDelegate>
@interface CDVAppDelegate (notification) <UNUserNotificationCenterDelegate>

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// AppDelegate+notification.m
// CDVAppDelegate+notification.m
//
// Created by Robert Easterday on 10/26/12.
//

#import "AppDelegate+notification.h"
#import "CDVAppDelegate+notification.h"
#import "PushPlugin.h"
#import <objc/runtime.h>

@implementation AppDelegate (notification)
@implementation CDVAppDelegate (notification)

// its dangerous to override a method from within a category.
// Instead we will use method swizzling. we set this up in the load call.
Expand Down Expand Up @@ -41,12 +41,12 @@ + (void)load
});
}

- (AppDelegate *)pushPluginSwizzledInit
- (CDVAppDelegate *)pushPluginSwizzledInit
{
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
center.delegate = self;

// This actually calls the original init method over in AppDelegate. Equivilent to calling super
// This actually calls the original init method over in CDVAppDelegate. Equivilent to calling super
// on an overrided method, this is not recursive, although it appears that way. neat huh?
return [self pushPluginSwizzledInit];
}
Expand Down

0 comments on commit 0571913

Please sign in to comment.