@radhya/mach-push-react-native 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -7
- package/ios/MachPush.swift +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,19 +11,16 @@ mach push setup
|
|
|
11
11
|
The command installs this package, adds automatic startup to the app entry
|
|
12
12
|
point, and creates `mach-push.ts` (or `.js`) with editable receive, tap,
|
|
13
13
|
registration, permission, and error callbacks. Re-running setup preserves that
|
|
14
|
-
file.
|
|
14
|
+
file. The generated config can be project-only; Mach resolves the project's
|
|
15
|
+
single active push app during registration.
|
|
15
16
|
|
|
16
17
|
For a custom integration, use the low-level client:
|
|
17
18
|
|
|
18
19
|
```ts
|
|
19
20
|
import { createMachPush } from "@radhya/mach-push-react-native";
|
|
21
|
+
import { machPushConfig } from "./mach-push.generated";
|
|
20
22
|
|
|
21
|
-
const push = createMachPush(
|
|
22
|
-
projectId: "project_...",
|
|
23
|
-
appId: "push_app_...",
|
|
24
|
-
publishableKey: "mach_pk_...",
|
|
25
|
-
environment: __DEV__ ? "development" : "production",
|
|
26
|
-
});
|
|
23
|
+
const push = createMachPush(machPushConfig);
|
|
27
24
|
|
|
28
25
|
await push.requestPermission();
|
|
29
26
|
const registration = await push.register();
|
|
@@ -35,3 +32,12 @@ push.addNotificationResponseReceivedListener(console.log);
|
|
|
35
32
|
Expo Go is not supported. Expo apps use `@radhya/mach/expo-plugin` from the
|
|
36
33
|
main `@radhya/mach` package and then create a development or production build.
|
|
37
34
|
Android requires the app's Firebase configuration.
|
|
35
|
+
|
|
36
|
+
Provider credentials are managed from the normal Mach credentials flow:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
mach credentials
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Choose Push Notifications, then upload the APNs key or Firebase service-account
|
|
43
|
+
JSON for the selected bundle/package.
|
package/ios/MachPush.swift
CHANGED
|
@@ -65,7 +65,7 @@ final class MachPush: RCTEventEmitter {
|
|
|
65
65
|
reject: @escaping RCTPromiseRejectBlock
|
|
66
66
|
) {
|
|
67
67
|
UNUserNotificationCenter.current().requestAuthorization(
|
|
68
|
-
options: [.alert, .badge, .sound
|
|
68
|
+
options: [.alert, .badge, .sound]
|
|
69
69
|
) { granted, error in
|
|
70
70
|
if let error {
|
|
71
71
|
reject("MACH_PUSH_PERMISSION", error.localizedDescription, error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radhya/mach-push-react-native",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MACH Push for React Native and Expo development builds",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@radhya/mach-push-core": "^0.1.
|
|
32
|
+
"@radhya/mach-push-core": "^0.1.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=18",
|