pushwoosh-cordova-plugin 8.3.56 → 8.3.58
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 +2 -2
- package/example_voip/LICENSE +21 -0
- package/example_voip/README.md +156 -0
- package/example_voip/Screenshots/Android.png +0 -0
- package/example_voip/Screenshots/iOS.png +0 -0
- package/example_voip/Screenshots/xcode_appgroups.png +0 -0
- package/example_voip/demovoip/README.md +181 -0
- package/example_voip/demovoip/config.xml +22 -0
- package/example_voip/demovoip/google-services.json +86 -0
- package/example_voip/demovoip/hooks/after_platform_add/010_install_plugin.js +46 -0
- package/example_voip/demovoip/hooks/after_prepare/010_setup_gradle_wrapper.js +34 -0
- package/example_voip/demovoip/hooks/after_prepare/015_fix_agp_version.js +36 -0
- package/example_voip/demovoip/hooks/after_prepare/020_copy_google_services.js +23 -0
- package/example_voip/demovoip/hooks/after_prepare/025_add_voip_pod.js +43 -0
- package/example_voip/demovoip/hooks/after_prepare.js +28 -0
- package/example_voip/demovoip/package-lock.json +1104 -0
- package/example_voip/demovoip/package.json +34 -0
- package/example_voip/demovoip/www/css/index.css +605 -0
- package/example_voip/demovoip/www/img/logo.png +0 -0
- package/example_voip/demovoip/www/index.html +175 -0
- package/example_voip/demovoip/www/js/index.js +419 -0
- package/package.json +1 -1
- package/plugin.xml +10 -10
- package/src/android/add-android-voip.gradle +1 -1
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/CallsAdapter.java +0 -1
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/NoopCallsAdapter.java +0 -5
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/PushNotifications.java +2 -7
- package/src/android/src/com/pushwoosh/plugin/pushnotifications/calls/PushwooshCallsAdapter.java +0 -14
- package/src/ios/PushNotification.m +0 -5
- package/types/PushNotification.d.ts +0 -1
- package/www/PushNotification.js +0 -4
package/README.md
CHANGED
|
@@ -14,13 +14,13 @@ Cross-Platform push notifications by Pushwoosh for Cordova / PhoneGap
|
|
|
14
14
|
Using npm:
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
cordova plugin add pushwoosh-cordova-plugin@8.3.
|
|
17
|
+
cordova plugin add pushwoosh-cordova-plugin@8.3.58
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Using git:
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.
|
|
23
|
+
cordova plugin add https://github.com/Pushwoosh/pushwoosh-phonegap-plugin.git#8.3.58
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Guide
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Pushwoosh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# CORDOVA VOIP SAMPLE
|
|
2
|
+
|
|
3
|
+
## VoIP Demo application showcasing Pushwoosh SDK VoIP functionality with CallKit integration
|
|
4
|
+
|
|
5
|
+
### iOS, Android
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
### 1. Add platforms
|
|
10
|
+
|
|
11
|
+
Simply add the required platforms — all dependencies will be installed automatically:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd demovoip
|
|
15
|
+
npm install
|
|
16
|
+
|
|
17
|
+
# Add iOS platform
|
|
18
|
+
cordova platform add ios
|
|
19
|
+
|
|
20
|
+
# Add Android platform
|
|
21
|
+
cordova platform add android
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**What happens automatically:**
|
|
25
|
+
- `pushwoosh-cordova-plugin` is installed with VoIP enabled for the added platform
|
|
26
|
+
- iOS: `PW_VOIP_IOS_ENABLED=true` is set automatically
|
|
27
|
+
- Android: `PW_VOIP_ANDROID_ENABLED=true` is set in gradle.properties
|
|
28
|
+
- Gradle 8.9 and AGP 8.5.1 are configured for Android
|
|
29
|
+
- `google-services.json` is copied for Firebase/FCM
|
|
30
|
+
|
|
31
|
+
### 2. Configure your VoIP App Code
|
|
32
|
+
|
|
33
|
+
Open the app and set your VoIP App Code in the UI, or modify the default value in `www/index.html`:
|
|
34
|
+
|
|
35
|
+
```html
|
|
36
|
+
<input type="text" id="pushAppId" value="YOUR-APP-ID">
|
|
37
|
+
<input type="text" id="pushProjectId" value="YOUR-FCM-PROJECT-ID">
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. [Android] Configure Firebase
|
|
41
|
+
|
|
42
|
+
Place your `google-services.json` in the project root. The file will be automatically copied to `platforms/android/app/` when running `cordova prepare`.
|
|
43
|
+
|
|
44
|
+
To work with Firebase/FCM:
|
|
45
|
+
1. Download `google-services.json` from Firebase Console
|
|
46
|
+
2. Place it in `/demovoip/google-services.json`
|
|
47
|
+
3. Run `cordova prepare android`
|
|
48
|
+
|
|
49
|
+
### 4. [iOS] VoIP Push Notifications Setup
|
|
50
|
+
|
|
51
|
+
#### a. Enable VoIP Push in your Apple Developer Account
|
|
52
|
+
- Navigate to your App ID settings
|
|
53
|
+
- Enable "Background Modes" → "Voice over IP"
|
|
54
|
+
- Enable "Push Notifications"
|
|
55
|
+
|
|
56
|
+
#### b. Configure CallKit in Xcode
|
|
57
|
+
Open the Xcode project (`platforms/ios/demovoip.xcworkspace`) and ensure:
|
|
58
|
+
- Background Modes → Voice over IP is enabled
|
|
59
|
+
- Push Notifications capability is added
|
|
60
|
+
|
|
61
|
+
### 5. Build and Run
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# iOS
|
|
65
|
+
cordova build ios
|
|
66
|
+
|
|
67
|
+
# Android
|
|
68
|
+
cordova build android
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Features
|
|
72
|
+
|
|
73
|
+
- VoIP push notifications support
|
|
74
|
+
- CallKit integration (iOS)
|
|
75
|
+
- Android calling support with permissions
|
|
76
|
+
- Real-time VoIP event monitoring
|
|
77
|
+
- Interactive demo UI with event logging
|
|
78
|
+
- Manual SDK initialization with App ID input
|
|
79
|
+
- VoIP parameters configuration (video, ringtone, handle type)
|
|
80
|
+
|
|
81
|
+
## App Features
|
|
82
|
+
|
|
83
|
+
### Push Notifications Setup
|
|
84
|
+
- Initialize Pushwoosh SDK with App ID and FCM Project ID
|
|
85
|
+
- Automatically set VoIP App Code
|
|
86
|
+
|
|
87
|
+
### VoIP Parameters
|
|
88
|
+
- Enable/disable video support
|
|
89
|
+
- Configure ringtone sound (iOS only)
|
|
90
|
+
- Select handle type (Generic, Phone Number, Email)
|
|
91
|
+
|
|
92
|
+
### Call Permissions (Android)
|
|
93
|
+
- Request call permission (Android 12+)
|
|
94
|
+
- Check permission status
|
|
95
|
+
|
|
96
|
+
### Push Notifications (Android)
|
|
97
|
+
- Register for regular push notifications
|
|
98
|
+
- Get push token
|
|
99
|
+
|
|
100
|
+
### Call Controls
|
|
101
|
+
- End active VoIP call
|
|
102
|
+
|
|
103
|
+
### VoIP Events Log
|
|
104
|
+
- Monitor all VoIP events:
|
|
105
|
+
- `voipPushPayload` - VoIP notification received
|
|
106
|
+
- `answer` - Incoming call answered
|
|
107
|
+
- `reject` - Incoming call rejected
|
|
108
|
+
- `hangup` - Call ended
|
|
109
|
+
- `muted` / `unmuted` - Microphone muted/unmuted
|
|
110
|
+
- `held` / `unheld` - Call held/unheld
|
|
111
|
+
- `dtmf` - DTMF tones
|
|
112
|
+
- `audioInterruption` - Audio interruption
|
|
113
|
+
- `callFailed` - Call failed
|
|
114
|
+
- `providerDidActivate` / `providerDidDeactivate` - CallKit activation/deactivation
|
|
115
|
+
- `incomingCallSuccess` / `incomingCallFailure` - Incoming call success/failure
|
|
116
|
+
- `voipDidRegisterTokenSuccessfully` / `voipDidFailToRegisterTokenWithError` - VoIP token registration
|
|
117
|
+
|
|
118
|
+
## Testing VoIP Calls
|
|
119
|
+
|
|
120
|
+
### iOS
|
|
121
|
+
1. Build and run the app on a physical device (VoIP doesn't work on simulator)
|
|
122
|
+
2. The app will automatically register for VoIP notifications
|
|
123
|
+
3. Send a VoIP push from Pushwoosh Control Panel using the VoIP App Code
|
|
124
|
+
4. Receive an incoming call via CallKit
|
|
125
|
+
|
|
126
|
+
### Android
|
|
127
|
+
1. Build and run the app
|
|
128
|
+
2. Grant call permission (Android 12+)
|
|
129
|
+
3. Tap "Register for Push Notifications" to register
|
|
130
|
+
4. Send a VoIP push from Pushwoosh Control Panel
|
|
131
|
+
5. Receive an incoming call via Android Calling API
|
|
132
|
+
|
|
133
|
+
## Troubleshooting
|
|
134
|
+
|
|
135
|
+
### Android: "Minimum supported Gradle version is 8.9"
|
|
136
|
+
The hook automatically creates `gradle-wrapper.properties` with Gradle 8.9. If the error appears, run:
|
|
137
|
+
```bash
|
|
138
|
+
cordova prepare android
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Android: "Incompatible AGP version"
|
|
142
|
+
The hook automatically fixes AGP to 8.5.1. If the error appears, run:
|
|
143
|
+
```bash
|
|
144
|
+
cordova prepare android
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Android: Firebase FIS_AUTH_ERROR
|
|
148
|
+
Make sure that:
|
|
149
|
+
1. `google-services.json` is in the project root
|
|
150
|
+
2. An Android app with package name `com.pushwoosh.demovoip` is added in Firebase Console
|
|
151
|
+
3. `oauth_client` arrays are populated in `google-services.json`
|
|
152
|
+
|
|
153
|
+
### iOS: VoIP events not firing
|
|
154
|
+
Make sure that:
|
|
155
|
+
1. `registerVoIPEvents()` is called immediately in `onDeviceReady()`, BEFORE SDK initialization
|
|
156
|
+
2. The app is running on a physical device (not simulator)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
# Pushwoosh VoIP Demo App
|
|
2
|
+
|
|
3
|
+
Demo application for testing Pushwoosh SDK VoIP functionality in Cordova.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### 1. Adding Platforms
|
|
8
|
+
|
|
9
|
+
Simply add the required platforms — all dependencies will be installed automatically:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Add iOS platform
|
|
13
|
+
cordova platform add ios
|
|
14
|
+
|
|
15
|
+
# Add Android platform
|
|
16
|
+
cordova platform add android
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**What happens automatically:**
|
|
20
|
+
- `pushwoosh-cordova-plugin` is installed with VoIP enabled for the added platform
|
|
21
|
+
- iOS: `PW_VOIP_IOS_ENABLED=true` is set automatically
|
|
22
|
+
- Android: `PW_VOIP_ANDROID_ENABLED=true` is set in gradle.properties
|
|
23
|
+
- Gradle 8.9 and AGP 8.5.1 are configured for Android
|
|
24
|
+
- `google-services.json` is copied for Firebase/FCM
|
|
25
|
+
|
|
26
|
+
### 2. Configuration
|
|
27
|
+
|
|
28
|
+
#### App ID and VoIP App Code
|
|
29
|
+
By default, the test App ID is used: `7BCDB-76CBE`
|
|
30
|
+
|
|
31
|
+
To use your own App ID, change the values in `www/index.html`:
|
|
32
|
+
```html
|
|
33
|
+
<input type="text" id="pushAppId" value="YOUR-APP-ID">
|
|
34
|
+
<input type="text" id="pushProjectId" value="YOUR-FCM-PROJECT-ID">
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### Google Services (Android)
|
|
38
|
+
To work with Firebase/FCM, place your `google-services.json` in the project root. The file will be automatically copied to `platforms/android/app/` when running `cordova prepare`.
|
|
39
|
+
|
|
40
|
+
### 3. Build
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# iOS
|
|
44
|
+
cordova build ios
|
|
45
|
+
|
|
46
|
+
# Android
|
|
47
|
+
cordova build android
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Project Structure
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
demovoip/
|
|
54
|
+
├── www/ # Application sources
|
|
55
|
+
│ ├── index.html # Main page with UI
|
|
56
|
+
│ ├── js/index.js # Application logic
|
|
57
|
+
│ └── css/index.css # Styles
|
|
58
|
+
├── hooks/ # Cordova hooks (automation)
|
|
59
|
+
│ ├── after_prepare/ # Run after cordova prepare
|
|
60
|
+
│ │ ├── 010_setup_gradle_wrapper.js # Sets up Gradle 8.9
|
|
61
|
+
│ │ ├── 015_fix_agp_version.js # Fixes AGP to 8.5.1
|
|
62
|
+
│ │ └── 020_copy_google_services.js # Copies google-services.json
|
|
63
|
+
│ └── after_platform_add/ # Run after platform add
|
|
64
|
+
│ └── 010_install_plugin.js # Installs Pushwoosh plugin
|
|
65
|
+
├── google-services.json # Firebase configuration for Android
|
|
66
|
+
├── config.xml # Cordova configuration
|
|
67
|
+
└── package.json # npm dependencies
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Application Features
|
|
72
|
+
|
|
73
|
+
### Push Notifications Setup
|
|
74
|
+
- Initialize Pushwoosh SDK with App ID and FCM Project ID
|
|
75
|
+
- Automatically set VoIP App Code
|
|
76
|
+
|
|
77
|
+
### VoIP Parameters
|
|
78
|
+
- Enable/disable video support
|
|
79
|
+
- Configure ringtone sound (iOS only)
|
|
80
|
+
- Select handle type (Generic, Phone Number, Email)
|
|
81
|
+
|
|
82
|
+
### Call Permissions (Android)
|
|
83
|
+
- Request call permission (Android 12+)
|
|
84
|
+
- Check permission status
|
|
85
|
+
|
|
86
|
+
### Push Notifications (Android)
|
|
87
|
+
- Register for regular push notifications
|
|
88
|
+
- Get push token
|
|
89
|
+
|
|
90
|
+
### Call Controls
|
|
91
|
+
- End active VoIP call
|
|
92
|
+
|
|
93
|
+
### VoIP Events Log
|
|
94
|
+
- Monitor all VoIP events:
|
|
95
|
+
- `voipPushPayload` - VoIP notification received
|
|
96
|
+
- `answer` - Incoming call answered
|
|
97
|
+
- `reject` - Incoming call rejected
|
|
98
|
+
- `hangup` - Call ended
|
|
99
|
+
- `muted` / `unmuted` - Microphone muted/unmuted
|
|
100
|
+
- `held` / `unheld` - Call held/unheld
|
|
101
|
+
- `dtmf` - DTMF tones
|
|
102
|
+
- `audioInterruption` - Audio interruption
|
|
103
|
+
- `callFailed` - Call failed
|
|
104
|
+
- `providerDidActivate` / `providerDidDeactivate` - CallKit activation/deactivation
|
|
105
|
+
- `incomingCallSuccess` / `incomingCallFailure` - Incoming call success/failure
|
|
106
|
+
- `voipDidRegisterTokenSuccessfully` / `voipDidFailToRegisterTokenWithError` - VoIP token registration
|
|
107
|
+
|
|
108
|
+
## Configuration (config.xml)
|
|
109
|
+
|
|
110
|
+
### Android Settings
|
|
111
|
+
```xml
|
|
112
|
+
<platform name="android">
|
|
113
|
+
<preference name="GradleVersion" value="8.9" />
|
|
114
|
+
<preference name="AndroidGradlePluginVersion" value="8.5.1" />
|
|
115
|
+
<preference name="android-minSdkVersion" value="24" />
|
|
116
|
+
<preference name="android-targetSdkVersion" value="35" />
|
|
117
|
+
</platform>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Hooks
|
|
121
|
+
```xml
|
|
122
|
+
<hook type="after_prepare" src="hooks/after_prepare/010_setup_gradle_wrapper.js" />
|
|
123
|
+
<hook type="after_prepare" src="hooks/after_prepare/015_fix_agp_version.js" />
|
|
124
|
+
<hook type="after_prepare" src="hooks/after_prepare/020_copy_google_services.js" />
|
|
125
|
+
<hook type="after_platform_add" src="hooks/after_platform_add/010_install_plugin.js" />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Testing VoIP
|
|
129
|
+
|
|
130
|
+
### iOS
|
|
131
|
+
1. Build and run the app on a physical device (VoIP doesn't work on simulator)
|
|
132
|
+
2. The app will automatically register for VoIP notifications
|
|
133
|
+
3. Send a VoIP push from Pushwoosh Control Panel using the VoIP App Code
|
|
134
|
+
4. Receive an incoming call via CallKit
|
|
135
|
+
|
|
136
|
+
### Android
|
|
137
|
+
1. Build and run the app
|
|
138
|
+
2. Grant call permission (Android 12+)
|
|
139
|
+
3. Tap "Register for Push Notifications" to register
|
|
140
|
+
4. Send a VoIP push from Pushwoosh Control Panel
|
|
141
|
+
5. Receive an incoming call via Android Calling API
|
|
142
|
+
|
|
143
|
+
## Requirements
|
|
144
|
+
|
|
145
|
+
- Node.js 14+
|
|
146
|
+
- Cordova CLI 12+
|
|
147
|
+
- For iOS: Xcode 14+, macOS
|
|
148
|
+
- For Android: Android Studio, JDK 17, Android SDK
|
|
149
|
+
|
|
150
|
+
## Versions
|
|
151
|
+
|
|
152
|
+
- Cordova Android: 14.0.1
|
|
153
|
+
- Cordova iOS: 7.1.1
|
|
154
|
+
- Pushwoosh Cordova Plugin: 8.3.49
|
|
155
|
+
- Gradle: 8.9
|
|
156
|
+
- Android Gradle Plugin: 8.5.1
|
|
157
|
+
|
|
158
|
+
## Troubleshooting
|
|
159
|
+
|
|
160
|
+
### Android: "Minimum supported Gradle version is 8.9"
|
|
161
|
+
The hook automatically creates `gradle-wrapper.properties` with Gradle 8.9. If the error appears, run:
|
|
162
|
+
```bash
|
|
163
|
+
cordova prepare android
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Android: "Incompatible AGP version"
|
|
167
|
+
The hook automatically fixes AGP to 8.5.1. If the error appears, run:
|
|
168
|
+
```bash
|
|
169
|
+
cordova prepare android
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Android: Firebase FIS_AUTH_ERROR
|
|
173
|
+
Make sure that:
|
|
174
|
+
1. `google-services.json` is in the project root
|
|
175
|
+
2. An Android app with package name `com.pushwoosh.demovoip` is added in Firebase Console
|
|
176
|
+
3. `oauth_client` arrays are populated in `google-services.json`
|
|
177
|
+
|
|
178
|
+
### iOS: VoIP events not firing
|
|
179
|
+
Make sure that:
|
|
180
|
+
1. `registerVoIPEvents()` is called immediately in `onDeviceReady()`, BEFORE SDK initialization
|
|
181
|
+
2. The app is running on a physical device (not simulator)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<?xml version='1.0' encoding='utf-8'?>
|
|
2
|
+
<widget id="com.pushwoosh.demovoip" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
3
|
+
<name>demovoip</name>
|
|
4
|
+
<description>Pushwoosh VoIP Sample App</description>
|
|
5
|
+
<author email="support@pushwoosh.com" href="https://www.pushwoosh.com">
|
|
6
|
+
Pushwoosh Team
|
|
7
|
+
</author>
|
|
8
|
+
<content src="index.html" />
|
|
9
|
+
<allow-intent href="http://*/*" />
|
|
10
|
+
<allow-intent href="https://*/*" />
|
|
11
|
+
<platform name="android">
|
|
12
|
+
<preference name="GradleVersion" value="8.9" />
|
|
13
|
+
<preference name="AndroidGradlePluginVersion" value="8.5.1" />
|
|
14
|
+
<preference name="android-minSdkVersion" value="24" />
|
|
15
|
+
<preference name="android-targetSdkVersion" value="35" />
|
|
16
|
+
</platform>
|
|
17
|
+
<hook type="after_prepare" src="hooks/after_prepare/010_setup_gradle_wrapper.js" />
|
|
18
|
+
<hook type="after_prepare" src="hooks/after_prepare/015_fix_agp_version.js" />
|
|
19
|
+
<hook type="after_prepare" src="hooks/after_prepare/020_copy_google_services.js" />
|
|
20
|
+
<hook type="after_platform_add" src="hooks/after_platform_add/010_install_plugin.js" />
|
|
21
|
+
|
|
22
|
+
</widget>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"project_info": {
|
|
3
|
+
"project_number": "843884467752",
|
|
4
|
+
"project_id": "demoapp-33098",
|
|
5
|
+
"storage_bucket": "demoapp-33098.firebasestorage.app"
|
|
6
|
+
},
|
|
7
|
+
"client": [
|
|
8
|
+
{
|
|
9
|
+
"client_info": {
|
|
10
|
+
"mobilesdk_app_id": "1:843884467752:android:38e0329182de6fb22ec71d",
|
|
11
|
+
"android_client_info": {
|
|
12
|
+
"package_name": "com.pushwoosh.demoapp"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"oauth_client": [],
|
|
16
|
+
"api_key": [
|
|
17
|
+
{
|
|
18
|
+
"current_key": "AIzaSyD0fJnFrwLD820xFNFuE38csE2bm5Jn1EY"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"services": {
|
|
22
|
+
"appinvite_service": {
|
|
23
|
+
"other_platform_oauth_client": []
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"client_info": {
|
|
29
|
+
"mobilesdk_app_id": "1:843884467752:android:a894ac7d888708bd2ec71d",
|
|
30
|
+
"android_client_info": {
|
|
31
|
+
"package_name": "com.pushwoosh.demoappunity"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"oauth_client": [],
|
|
35
|
+
"api_key": [
|
|
36
|
+
{
|
|
37
|
+
"current_key": "AIzaSyD0fJnFrwLD820xFNFuE38csE2bm5Jn1EY"
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"services": {
|
|
41
|
+
"appinvite_service": {
|
|
42
|
+
"other_platform_oauth_client": []
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"client_info": {
|
|
48
|
+
"mobilesdk_app_id": "1:843884467752:android:5594d785995d41832ec71d",
|
|
49
|
+
"android_client_info": {
|
|
50
|
+
"package_name": "com.pushwoosh.demovoip"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"oauth_client": [],
|
|
54
|
+
"api_key": [
|
|
55
|
+
{
|
|
56
|
+
"current_key": "AIzaSyD0fJnFrwLD820xFNFuE38csE2bm5Jn1EY"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"services": {
|
|
60
|
+
"appinvite_service": {
|
|
61
|
+
"other_platform_oauth_client": []
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"client_info": {
|
|
67
|
+
"mobilesdk_app_id": "1:843884467752:android:5e6b23b8939b0d3b2ec71d",
|
|
68
|
+
"android_client_info": {
|
|
69
|
+
"package_name": "com.pushwoosh.newdemo"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"oauth_client": [],
|
|
73
|
+
"api_key": [
|
|
74
|
+
{
|
|
75
|
+
"current_key": "AIzaSyD0fJnFrwLD820xFNFuE38csE2bm5Jn1EY"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"services": {
|
|
79
|
+
"appinvite_service": {
|
|
80
|
+
"other_platform_oauth_client": []
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
"configuration_version": "1"
|
|
86
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { exec } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
module.exports = function(context) {
|
|
8
|
+
const projectRoot = context.opts.projectRoot;
|
|
9
|
+
|
|
10
|
+
const platforms = context.opts.platforms || [];
|
|
11
|
+
const addedPlatform = platforms[0]; // Платформа которую только что добавили
|
|
12
|
+
|
|
13
|
+
console.log(`[Hook] Platform added: ${addedPlatform}`);
|
|
14
|
+
console.log('[Hook] Installing pushwoosh-cordova-plugin with VoIP enabled...');
|
|
15
|
+
|
|
16
|
+
let voipFlags = '';
|
|
17
|
+
if (addedPlatform === 'ios') {
|
|
18
|
+
voipFlags = '--variable PW_VOIP_IOS_ENABLED=true';
|
|
19
|
+
console.log('[Hook] Enabling VoIP for iOS');
|
|
20
|
+
} else if (addedPlatform === 'android') {
|
|
21
|
+
voipFlags = '--variable PW_VOIP_ANDROID_ENABLED=true';
|
|
22
|
+
console.log('[Hook] Enabling VoIP for Android');
|
|
23
|
+
} else {
|
|
24
|
+
console.log('[Hook] No VoIP flags for this platform');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const command = `cordova plugin add ../../ --link ${voipFlags}`;
|
|
28
|
+
|
|
29
|
+
return new Promise((resolve, reject) => {
|
|
30
|
+
exec(command, { cwd: projectRoot }, (error, stdout, stderr) => {
|
|
31
|
+
if (error) {
|
|
32
|
+
if (stderr.includes('already installed') || stdout.includes('already installed')) {
|
|
33
|
+
console.log('[Hook] Plugin already installed, skipping');
|
|
34
|
+
resolve();
|
|
35
|
+
} else {
|
|
36
|
+
console.error('[Hook] Error installing plugin:', stderr);
|
|
37
|
+
reject(error);
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
console.log('[Hook] Plugin installed successfully');
|
|
41
|
+
console.log(stdout);
|
|
42
|
+
resolve();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
module.exports = function(context) {
|
|
7
|
+
const platforms = context.opts.platforms;
|
|
8
|
+
|
|
9
|
+
if (platforms.indexOf('android') === -1) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const platformRoot = path.join(context.opts.projectRoot, 'platforms/android');
|
|
14
|
+
const wrapperDir = path.join(platformRoot, 'gradle/wrapper');
|
|
15
|
+
const wrapperPropsPath = path.join(wrapperDir, 'gradle-wrapper.properties');
|
|
16
|
+
|
|
17
|
+
// Create wrapper directory if it doesn't exist
|
|
18
|
+
if (!fs.existsSync(wrapperDir)) {
|
|
19
|
+
fs.mkdirSync(wrapperDir, { recursive: true });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Write gradle-wrapper.properties with Gradle 8.7
|
|
23
|
+
const wrapperContent = `distributionBase=GRADLE_USER_HOME
|
|
24
|
+
distributionPath=wrapper/dists
|
|
25
|
+
distributionUrl=https\\://services.gradle.org/distributions/gradle-8.7-all.zip
|
|
26
|
+
networkTimeout=10000
|
|
27
|
+
validateDistributionUrl=true
|
|
28
|
+
zipStoreBase=GRADLE_USER_HOME
|
|
29
|
+
zipStorePath=wrapper/dists
|
|
30
|
+
`;
|
|
31
|
+
|
|
32
|
+
fs.writeFileSync(wrapperPropsPath, wrapperContent, 'utf8');
|
|
33
|
+
console.log('[Hook] Created gradle-wrapper.properties with Gradle 8.7');
|
|
34
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
module.exports = function(context) {
|
|
7
|
+
const platforms = context.opts.platforms;
|
|
8
|
+
|
|
9
|
+
if (platforms.indexOf('android') === -1) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const platformRoot = path.join(context.opts.projectRoot, 'platforms/android');
|
|
14
|
+
const configPath = path.join(platformRoot, 'cdv-gradle-config.json');
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(configPath)) {
|
|
17
|
+
console.log('[Hook] cdv-gradle-config.json not found, skipping AGP fix');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
const configContent = fs.readFileSync(configPath, 'utf8');
|
|
23
|
+
const config = JSON.parse(configContent);
|
|
24
|
+
|
|
25
|
+
// Fix AGP version to 8.5.1 (compatible with Android Studio)
|
|
26
|
+
if (config.AGP_VERSION !== '8.5.1') {
|
|
27
|
+
config.AGP_VERSION = '8.5.1';
|
|
28
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + '\n', 'utf8');
|
|
29
|
+
console.log('[Hook] Fixed AGP version to 8.5.1 in cdv-gradle-config.json');
|
|
30
|
+
} else {
|
|
31
|
+
console.log('[Hook] AGP version already correct (8.5.1)');
|
|
32
|
+
}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
console.error('[Hook] Error fixing AGP version:', error.message);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
module.exports = function(context) {
|
|
7
|
+
const platforms = context.opts.platforms;
|
|
8
|
+
|
|
9
|
+
if (platforms.indexOf('android') === -1) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const projectRoot = context.opts.projectRoot;
|
|
14
|
+
const sourceFile = path.join(projectRoot, 'google-services.json');
|
|
15
|
+
const targetFile = path.join(projectRoot, 'platforms/android/app/google-services.json');
|
|
16
|
+
|
|
17
|
+
if (fs.existsSync(sourceFile)) {
|
|
18
|
+
fs.copyFileSync(sourceFile, targetFile);
|
|
19
|
+
console.log('[Hook] Copied google-services.json to platforms/android/app/');
|
|
20
|
+
} else {
|
|
21
|
+
console.log('[Hook] Warning: google-services.json not found in project root');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
module.exports = function(context) {
|
|
7
|
+
const platforms = context.opts.platforms;
|
|
8
|
+
|
|
9
|
+
if (platforms.indexOf('ios') === -1) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const iosPlatformRoot = path.join(context.opts.projectRoot, 'platforms', 'ios');
|
|
14
|
+
const podfilePath = path.join(iosPlatformRoot, 'Podfile');
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(podfilePath)) {
|
|
17
|
+
console.log('[Hook] Podfile not found, skipping VoIP pod injection');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let podfileContent = fs.readFileSync(podfilePath, 'utf8');
|
|
22
|
+
|
|
23
|
+
// Check if PushwooshVoIP already added
|
|
24
|
+
if (podfileContent.includes("pod 'PushwooshVoIP'")) {
|
|
25
|
+
console.log('[Hook] PushwooshVoIP pod already present in Podfile');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Find the target block and add PushwooshVoIP pod
|
|
30
|
+
const targetRegex = /(target\s+'[^']+'\s+do[\s\S]*?pod\s+'Pushwoosh'[^\n]*\n)/;
|
|
31
|
+
|
|
32
|
+
if (targetRegex.test(podfileContent)) {
|
|
33
|
+
podfileContent = podfileContent.replace(
|
|
34
|
+
targetRegex,
|
|
35
|
+
"$1 pod 'PushwooshXCFramework/PushwooshVoIP'\n"
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
fs.writeFileSync(podfilePath, podfileContent, 'utf8');
|
|
39
|
+
console.log('[Hook] Added PushwooshVoIP pod to Podfile');
|
|
40
|
+
} else {
|
|
41
|
+
console.log('[Hook] Could not find Pushwoosh pod in Podfile, skipping VoIP pod injection');
|
|
42
|
+
}
|
|
43
|
+
};
|