Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit 9332d66

Browse files
author
Dick Smith
committed
Merge branch 'master' of github.com:EddyVerbruggen/nativescript-plugin-firebase
2 parents 5f09214 + d7499af commit 9332d66

File tree

10 files changed

+34
-13
lines changed

10 files changed

+34
-13
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
[Firebase Android SDK Changelog](https://firebase.google.com/support/release-notes/android)
55

66

7+
## 5.1.8 (2018, March 1)
8+
9+
### New
10+
11+
- [#633](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/633) The plugin is too picky about the name of the entitlements file
12+
13+
714
## 5.1.7 (2018, February 11)
815

916
### New

demo-ng/app/item/items.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,4 @@ export class ItemsComponent {
268268
})
269269
.catch(error => console.log("doWebGetValueForCompanies error: " + error));
270270
}
271-
}
271+
}

demo-ng/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@angular/platform-browser-dynamic": "~5.2.0",
2424
"@angular/router": "~5.2.0",
2525
"nativescript-angular": "~5.2.0",
26-
"nativescript-plugin-firebase": "5.1.4",
26+
"nativescript-plugin-firebase": "5.1.8",
2727
"nativescript-theme-core": "~1.0.4",
2828
"reflect-metadata": "~0.1.10",
2929
"rxjs": "~5.5.0",

demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
},
1111
"dependencies": {
12-
"nativescript-plugin-firebase": "5.1.5",
12+
"nativescript-plugin-firebase": "5.1.8",
1313
"nativescript-theme-core": "^1.0.4",
1414
"nativescript-unit-test-runner": "^0.3.4",
1515
"tns-core-modules": "~3.4.0"

docs/INVITES_DYNAMICLINKS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ so it's not removed when you remove and re-add the iOS platform. The relevant co
8080
</array>
8181
```
8282

83+
> Note that since plugin version 5.1.8 the name of the file can either be `<YourAppName>.entitlements` or `app.entitlements`. `YourAppName` is the iOS foldername, see the path above.
84+
8385
## Functions
8486

8587
### invites.sendInvitation

docs/MESSAGING.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ so it's not removed when you remove and re-add the iOS platform. The relevant co
4949
<string>development</string>
5050
```
5151

52-
Since plugin version 3.11.0 the plugin will pick up that file during a build and integrates it with the built app
53-
so you no longer need to continually manually enable push notifications in Xcode.
52+
> Note that since plugin version 5.1.8 the name of the file can either be `<YourAppName>.entitlements` or `app.entitlements`. `YourAppName` is the iOS foldername, see the path above.
5453
5554
#### Allow processing when a background push is received
5655
Open `app/App_Resources/iOS/Info.plist` and add this to the bottom:
@@ -62,9 +61,6 @@ Open `app/App_Resources/iOS/Info.plist` and add this to the bottom:
6261
</array>
6362
```
6463

65-
#### Cleanup an old script
66-
Versions up to 3.9.2 of this plugin added the script `/hooks/after-prepare/firebase-install-ios-entitlements.js`, please remove it.
67-
6864
#### Provisioning hell
6965
Follow [this guide](https://firebase.google.com/docs/cloud-messaging/ios/certs) to the letter. Once you've done it run `tns run ios` and upon starting the app it should prompt you for notification support. That also works on the simulator, but actually receiving (background) notifications is __only__ possible on a real device.
7066

@@ -165,8 +161,8 @@ Using the Firebase Console gives you most flexibility, but you can quickly and e
165161
curl -X POST --header "Authorization: key=SERVER_KEY" --Header "Content-Type: application/json" https://fcm.googleapis.com/fcm/send -d "{\"notification\":{\"title\": \"My title\", \"text\": \"My text\", \"badge\": \"1\", \"sound\": \"default\"}, \"data\":{\"foo\":\"bar\"}, \"priority\": \"High\", \"to\": \"DEVICE_TOKEN\"}"
166162
```
167163

168-
* SERVER_KEY: see below
169-
* DEVICE_TOKEN: the one you got in `addOnPushTokenReceivedCallback` or `init`'s `onPushTokenReceivedCallback`
164+
* SERVER_KEY: see the image below (make sure to use the 'Legacy' server key).
165+
* DEVICE_TOKEN: the one you got in `addOnPushTokenReceivedCallback` or `init`'s `onPushTokenReceivedCallback`.
170166

171167
Examples:
172168

@@ -181,3 +177,9 @@ curl -X POST --header "Authorization: key=AAAA9SHtZvM:APA91bGoY0H2nS8GlzzypDXSiU
181177
If you don't want a badge on the app icon, remove the `badge` property or set it to 0. Note that launching the app clears the badge anyway.
182178

183179
<img src="images/push-server-key.png" width="459px" height="220px" alt="Push server key"/>
180+
181+
## What if iOS doesn't receive notifications in the background?
182+
Make sure you [`require` the plugin in `app.ts`](https://github.com/EddyVerbruggen/nativescript-plugin-firebase/blob/55cfb4f69cf8939f9101712fed22383196b08d36/demo/app/app.ts#L5)
183+
*before* `application.start()`, and do `init()` *after* the app has started (not in `app.ts` - not even in a timeout; move it out of `app.ts` entirely!).
184+
185+
> Make sure to use `require`, *not* `import` in `app.ts` because TSC will remove the import in case you're not using it.

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-plugin-firebase",
3-
"version": "5.1.7",
3+
"version": "5.1.8",
44
"description": "Fire. Base. Firebase!",
55
"main": "firebase",
66
"typings": "index.d.ts",

src/scripts/entitlements-after-prepare.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,16 @@ module.exports = function (logger, platformsData, projectData, hookArgs) {
88
projectRoot = path.join(projectData.platformsDir, "ios"),
99
project = path.join(projectRoot, projectData.projectName);
1010

11+
// look for both <projectname.entitlements and app.entitlements
12+
if (!fs.existsSync(entitlementsFile)) {
13+
entitlementsFile = path.join(appResourcesDirectoryPath, "iOS", "app.entitlements");
14+
}
15+
1116
return new Promise(function (resolve, reject) {
1217
if (platform === 'ios' && fs.existsSync(entitlementsFile)) {
1318
var dest = path.join(project, projectData.projectName + ".entitlements");
1419
fs.createReadStream(entitlementsFile).pipe(fs.createWriteStream(dest));
1520
}
1621
resolve();
1722
});
18-
};
23+
};

src/scripts/entitlements-before-prepare.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ module.exports = function (logger, platformsData, projectData, hookArgs) {
77
entitlementsFile = path.join(appResourcesDirectoryPath, "iOS", projectData.projectName + ".entitlements"),
88
platformResourcesDirectory = path.join(appResourcesDirectoryPath, 'iOS');
99

10+
// look for both <projectname.entitlements and app.entitlements
11+
if (!fs.existsSync(entitlementsFile)) {
12+
entitlementsFile = path.join(appResourcesDirectoryPath, "iOS", "app.entitlements");
13+
}
14+
1015
return new Promise(function (resolve, reject) {
1116
if (platform === 'ios' && fs.existsSync(entitlementsFile)) {
1217
var target = path.join(platformResourcesDirectory, 'build.xcconfig');
@@ -23,4 +28,4 @@ module.exports = function (logger, platformsData, projectData, hookArgs) {
2328
}
2429
resolve();
2530
});
26-
};
31+
};

0 commit comments

Comments
 (0)