Skip to content

Commit

Permalink
feat(ios)!: move last bit of firebase & imports to PushPluginFCM
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Sep 18, 2024
1 parent eb05beb commit 6386944
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
#import "PushPluginSettings.h"
#import "AppDelegate+notification.h"

@import Firebase;
@import FirebaseCore;
@import FirebaseMessaging;

@interface PushPlugin ()

@property (nonatomic, strong) PushPluginFCM *pushPluginFCM;
Expand Down Expand Up @@ -128,7 +124,10 @@ - (void)init:(CDVInvokedUrlCommand *)command {
} else {
NSLog(@"[PushPlugin] VoIP missing or false");
if ([self.pushPluginFCM isFCMEnabled]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setFCMTokenWithCompletion) name:FIRMessagingRegistrationTokenRefreshedNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(setFCMTokenWithCompletion)
name:[PushPluginFCM pushPluginFCMMessagingRegistrationTokenRefreshedNotification]
object:nil];
}

[self.commandDelegate runInBackground:^ {
Expand Down
6 changes: 6 additions & 0 deletions src/ios/PushPluginFCM.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
@import Firebase;

NS_ASSUME_NONNULL_BEGIN

@interface PushPluginFCM : NSObject

@property (nonatomic, assign) BOOL isFCMEnabled;
Expand All @@ -17,4 +19,8 @@
- (void)unsubscribeFromTopic:(NSString *)topic;
- (void)unsubscribeFromTopics:(NSArray *)topics;

+ (NSNotificationName)pushPluginFCMMessagingRegistrationTokenRefreshedNotification;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions src/ios/PushPluginFCM.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,8 @@ - (void)unsubscribeFromTopic:(NSString *)topic {
NSLog(@"[PushPlugin] Successfully unsubscribed from topic %@", topic);
}

+ (NSNotificationName)pushPluginFCMMessagingRegistrationTokenRefreshedNotification {
return FIRMessagingRegistrationTokenRefreshedNotification;
}

@end

0 comments on commit 6386944

Please sign in to comment.