-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(messaging): ios onNotificationTap
fixes: #42
- Loading branch information
Showing
30 changed files
with
146 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { AppService } from './app.service'; | ||
@Component({ | ||
selector: 'demo-app', | ||
template: `<GridLayout> | ||
<page-router-outlet></page-router-outlet> | ||
</GridLayout>`, | ||
}) | ||
export class AppComponent {} | ||
export class AppComponent { | ||
constructor(appService: AppService){} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { firebase } from '@nativescript/firebase-core'; | ||
import '@nativescript/firebase-messaging'; | ||
|
||
@Injectable() | ||
export class AppService { | ||
constructor() { | ||
const messaging = firebase().messaging(); | ||
messaging.onToken((token) => { | ||
console.log('Firebase onToken', token); | ||
}); | ||
messaging.onMessage((message) => { | ||
console.log('Firebase onMessage', message); | ||
}); | ||
|
||
messaging.onNotificationTap((message) => { | ||
console.log('Firebase onNotificationTap', message); | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
import { runNativeScriptAngularApp, platformNativeScript } from '@nativescript/angular'; | ||
import { AppModule } from './app.module'; | ||
import { firebase } from '@nativescript/firebase-core'; | ||
import { Application } from '@nativescript/core'; | ||
|
||
Application.on('launch', (args) => { | ||
console.log('launch'); | ||
}); | ||
|
||
firebase() | ||
.initializeApp() | ||
.then((done) => { | ||
console.log('initializeApp'); | ||
}); | ||
|
||
const messaging = firebase().messaging(); | ||
|
||
messaging | ||
.requestPermission() | ||
.then(() => { | ||
console.log('requestPermission', 'done'); | ||
messaging.registerDeviceForRemoteMessages().catch((e) => { | ||
console.error('registerDeviceForRemoteMessages', e); | ||
}); | ||
}) | ||
.catch((e) => { | ||
console.error('requestPermission', e); | ||
}); | ||
|
||
runNativeScriptAngularApp({ | ||
appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule), | ||
}); | ||
appModuleBootstrap: () => platformNativeScript().bootstrapModule(AppModule), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#import <Foundation/Foundation.h> | ||
#import "UIApplicationDelegate+LaunchExtension.h" | ||
typedef void(^LaunchCallback)(); | ||
@interface TNSFirebaseCore: NSObject | ||
+(LaunchCallback) onAppFinishLaunchingCallback; | ||
+(void) setOnAppFinishLaunchingCallback:(LaunchCallback)callback; | ||
@end |
12 changes: 12 additions & 0 deletions
12
packages/firebase-core/platforms/ios/src/TNSFirebaseCore.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#import "TNSFirebaseCore.h" | ||
|
||
@implementation TNSFirebaseCore | ||
static LaunchCallback _Nullable _onAppFinishLaunchingCallback; | ||
+ (LaunchCallback)onAppFinishLaunchingCallback { | ||
return _onAppFinishLaunchingCallback; | ||
} | ||
|
||
+ (void)setOnAppFinishLaunchingCallback:(nullable LaunchCallback)callback { | ||
_onAppFinishLaunchingCallback = callback; | ||
} | ||
@end |
2 changes: 2 additions & 0 deletions
2
packages/firebase-core/platforms/ios/src/TNSFirebaseCoreUmbrella.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#import "TNSFirebaseCore.h" | ||
#import "UIApplicationDelegate+LaunchExtension.h" |
5 changes: 5 additions & 0 deletions
5
packages/firebase-core/platforms/ios/src/UIApplicationDelegate+LaunchExtension.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface NSObject (TNSUIAppDelegateExt) <UIApplicationDelegate> | ||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions; | ||
@end |
13 changes: 13 additions & 0 deletions
13
packages/firebase-core/platforms/ios/src/UIApplicationDelegate+LaunchExtension.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#import "UIApplicationDelegate+LaunchExtension.h" | ||
#import "TNSFirebaseCore.h" | ||
#import <objc/runtime.h> | ||
|
||
@implementation NSObject (TNSUIAppDelegateExt) | ||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions { | ||
LaunchCallback callback = [TNSFirebaseCore onAppFinishLaunchingCallback]; | ||
if(callback != nil){ | ||
callback(); | ||
} | ||
return YES; | ||
} | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module TNSFirebaseCore { | ||
umbrella header "TNSFirebaseCoreUmbrella.h" | ||
export * | ||
module * { export * } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/firebase-messaging/platforms/ios/src/TNSFirebaseMessagingLoader.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
@interface TNSFirebaseMessagingLoader: NSObject | ||
@interface TNSFirebaseCoreLoader: NSObject | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.