vibes-react-native 1.0.0
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/LICENSE +21 -0
- package/README.md +280 -0
- package/android/build.gradle +61 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +28 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/PushEvtEmitter.java +65 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesAppHelper.java +100 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesModule.java +327 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesPackage.java +28 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/Fms.java +116 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/PayloadWrapper.java +23 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/VibesPushReceiver.java +60 -0
- package/ios/Configuration.swift +68 -0
- package/ios/Notifications.swift +72 -0
- package/ios/Vibes-Bridging-Header.h +2 -0
- package/ios/Vibes.m +31 -0
- package/ios/Vibes.swift +236 -0
- package/ios/Vibes.xcodeproj/project.pbxproj +293 -0
- package/ios/VibesClient.swift +35 -0
- package/ios/VibesPluginLogger.swift +160 -0
- package/lib/commonjs/index.js +53 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +31 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.d.ts +8 -0
- package/package.json +149 -0
- package/src/index.tsx +48 -0
- package/vibes-react-native.podspec +20 -0
package/package.json
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vibes-react-native",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The React Native plugin for the Vibes Mobile SDKs",
|
|
5
|
+
"author": "Vibes",
|
|
6
|
+
"main": "lib/commonjs/index",
|
|
7
|
+
"module": "lib/module/index",
|
|
8
|
+
"types": "lib/typescript/index.d.ts",
|
|
9
|
+
"react-native": "src/index",
|
|
10
|
+
"source": "src/index",
|
|
11
|
+
"files": [
|
|
12
|
+
"src",
|
|
13
|
+
"lib",
|
|
14
|
+
"android",
|
|
15
|
+
"ios",
|
|
16
|
+
"cpp",
|
|
17
|
+
"vibes-react-native.podspec",
|
|
18
|
+
"!lib/typescript/sample-app",
|
|
19
|
+
"!android/build",
|
|
20
|
+
"!ios/build",
|
|
21
|
+
"!**/__tests__",
|
|
22
|
+
"!**/__fixtures__",
|
|
23
|
+
"!**/__mocks__"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "jest",
|
|
27
|
+
"typescript": "tsc --noEmit",
|
|
28
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
29
|
+
"prepare": "bob build",
|
|
30
|
+
"release": "release-it",
|
|
31
|
+
"example": "yarn --cwd sample-app",
|
|
32
|
+
"pods": "cd sample-app && pod-install --quiet",
|
|
33
|
+
"bootstrap": "yarn example && yarn && yarn pods"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"react-native",
|
|
37
|
+
"ios",
|
|
38
|
+
"android"
|
|
39
|
+
],
|
|
40
|
+
"repository": "https://github.com/vibes/vibes-react-native",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/vibes/vibes-react-native/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/vibes/vibes-react-native#readme",
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
51
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
52
|
+
"@release-it/conventional-changelog": "^2.0.0",
|
|
53
|
+
"@types/jest": "^26.0.0",
|
|
54
|
+
"@types/react": "^16.9.19",
|
|
55
|
+
"@types/react-native": "0.62.13",
|
|
56
|
+
"commitlint": "^11.0.0",
|
|
57
|
+
"eslint": "^7.2.0",
|
|
58
|
+
"eslint-config-prettier": "^7.0.0",
|
|
59
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
60
|
+
"husky": "^6.0.0",
|
|
61
|
+
"jest": "^26.0.1",
|
|
62
|
+
"pod-install": "^0.1.0",
|
|
63
|
+
"prettier": "^2.0.5",
|
|
64
|
+
"react": "16.13.1",
|
|
65
|
+
"react-native": "0.65.0",
|
|
66
|
+
"react-native-push-notification": "^3.1.9",
|
|
67
|
+
"react-native-builder-bob": "^0.18.0",
|
|
68
|
+
"release-it": "^14.2.2",
|
|
69
|
+
"typescript": "^4.1.3"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"react": "*",
|
|
73
|
+
"react-native": "*",
|
|
74
|
+
"react-native-push-notification": "*"
|
|
75
|
+
},
|
|
76
|
+
"jest": {
|
|
77
|
+
"preset": "react-native",
|
|
78
|
+
"modulePathIgnorePatterns": [
|
|
79
|
+
"<rootDir>/sample-app/node_modules",
|
|
80
|
+
"<rootDir>/lib/"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"commitlint": {
|
|
84
|
+
"extends": [
|
|
85
|
+
"@commitlint/config-conventional"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"release-it": {
|
|
89
|
+
"git": {
|
|
90
|
+
"commitMessage": "chore: release ${version}",
|
|
91
|
+
"tagName": "v${version}"
|
|
92
|
+
},
|
|
93
|
+
"npm": {
|
|
94
|
+
"publish": true
|
|
95
|
+
},
|
|
96
|
+
"github": {
|
|
97
|
+
"release": true
|
|
98
|
+
},
|
|
99
|
+
"plugins": {
|
|
100
|
+
"@release-it/conventional-changelog": {
|
|
101
|
+
"preset": "angular"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"eslintConfig": {
|
|
106
|
+
"root": true,
|
|
107
|
+
"extends": [
|
|
108
|
+
"@react-native-community",
|
|
109
|
+
"prettier"
|
|
110
|
+
],
|
|
111
|
+
"rules": {
|
|
112
|
+
"prettier/prettier": [
|
|
113
|
+
"error",
|
|
114
|
+
{
|
|
115
|
+
"quoteProps": "consistent",
|
|
116
|
+
"singleQuote": true,
|
|
117
|
+
"tabWidth": 2,
|
|
118
|
+
"trailingComma": "es5",
|
|
119
|
+
"useTabs": false
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"eslintIgnore": [
|
|
125
|
+
"node_modules/",
|
|
126
|
+
"lib/"
|
|
127
|
+
],
|
|
128
|
+
"prettier": {
|
|
129
|
+
"quoteProps": "consistent",
|
|
130
|
+
"singleQuote": true,
|
|
131
|
+
"tabWidth": 2,
|
|
132
|
+
"trailingComma": "es5",
|
|
133
|
+
"useTabs": false
|
|
134
|
+
},
|
|
135
|
+
"react-native-builder-bob": {
|
|
136
|
+
"source": "src",
|
|
137
|
+
"output": "lib",
|
|
138
|
+
"targets": [
|
|
139
|
+
"commonjs",
|
|
140
|
+
"module",
|
|
141
|
+
[
|
|
142
|
+
"typescript",
|
|
143
|
+
{
|
|
144
|
+
"project": "tsconfig.build.json"
|
|
145
|
+
}
|
|
146
|
+
]
|
|
147
|
+
]
|
|
148
|
+
}
|
|
149
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'vibes-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo managed workflow\n';
|
|
8
|
+
|
|
9
|
+
const Vibes = NativeModules.Vibes
|
|
10
|
+
? NativeModules.Vibes
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export function registerDevice(): Promise<any> {
|
|
21
|
+
return Vibes.registerDevice();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function unregisterDevice(): Promise<any> {
|
|
25
|
+
return Vibes.unregisterDevice();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function registerPush(): Promise<any> {
|
|
29
|
+
return Vibes.registerPush();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function getVibesDeviceInfo(): Promise<any> {
|
|
33
|
+
return Vibes.getVibesDeviceInfo();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function updateDevice(
|
|
37
|
+
updateCredential: boolean,
|
|
38
|
+
latitude: number,
|
|
39
|
+
longitude: number
|
|
40
|
+
): Promise<any> {
|
|
41
|
+
return Vibes.updateDevice(updateCredential, latitude, longitude);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function associatePerson(externalPersonId: string): Promise<any> {
|
|
45
|
+
return Vibes.associatePerson(externalPersonId);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default Vibes;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "vibes-react-native"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "10.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/vibes/vibes-react-native.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
|
|
18
|
+
s.dependency "React-Core"
|
|
19
|
+
s.dependency "VibesPush", "4.5.0"
|
|
20
|
+
end
|