You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Feat: [macOS] Add native microphone permission with `AVCaptureDevice` (this replaces `getUserMedia()` from js interop available on localhost/https only). [@AndreiMisiukevich](https://github.com/AndreiMisiukevich)
11
13
* Fix/Update: [macOS] correct runtime entitlement for `audio-input` permission. [@AndreiMisiukevich](https://github.com/AndreiMisiukevich)
Copy file name to clipboardExpand all lines: NOTES.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,17 @@
1
1
2
2
# Notes
3
3
4
+
### Web
5
+
6
+
Web implementation relies on the [js_notifications](https://pub.dev/packages/js_notifications) package for browser notifications. These notifications including Call functionality is used by a middleware package [web_callkit](https://pub.dev/packages/web_callkit) which provides boilerplate for call management and browser notification integration.
7
+
8
+
-`js_notifications` requires the service worker file `js_notifications-sw.js` to be copied to your web directory. This file is used for handling notifications in the background.
9
+
-`web_callkit` provides the boilerplate for call management and browser notification integration, however this package requires both files used in `js_notifications` package.
10
+
11
+
Further, and most importantly the `twilio_voice` package makes use of custom [twilio_voice.js](https://github.com/twilio/twilio-voice.js/) implementation (these changes are purely to provided Flutter status outputs allowing Flutter to monitor the status of the Twilio Device).
12
+
13
+
The javascript files required by `twilio_voice` is `twilio.min.js`, which is found in the `example/web` folder. This may in future be loaded dynamically, but for now is required to be provided in the `web/` folder.
Copy file name to clipboardExpand all lines: README.md
+22-33Lines changed: 22 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,22 +185,32 @@ See [example](https://github.com/cybex-dev/twilio_voice/blob/master/example/andr
185
185
- Callback action on post dialer screen may not work as expected - this is platform and manufacturer specific. PRs are welcome here.
186
186
- Complete integration with showing missed calls. This is a work in progress.
187
187
188
-
### Web Setup:
189
188
190
-
There are 4 important files for Twilio incoming/missed call notifications to work:
189
+
Web requires 2 files to be copied over/provided for web implementation to work correctly. These files are:
190
+
1. `twilio.min.js`
191
+
2. `js_notifications-sw.js`
191
192
192
-
- `notifications.js`is the main file, it handles the notifications and the service worker.
193
-
- `twilio-sw.js`is the service worker _content_ used to work with the default `flutter_service_worker.js` (this can be found in `build/web/flutter_service_worker.js` after calling `flutter build web`). This file's contents are to be copied into the `flutter_service_worker.js` file after you've built your application.
193
+
Both of these files need to be copied over to the `web/` directory of your project. See [[Notes]](https://github.com/cybex-dev/twilio_voice/blob/master/NOTES.md#ios--macos)
194
194
195
-
Also, the twilio javascript SDK itself, `twilio.min.js` is needed.
195
+
_The names of these files are very important, so make sure to have the file names exactly as described above._
196
196
197
-
### To ensure proper/as intended setup:
197
+
The folder structure should look like this:
198
198
199
-
1. Copy files `example/web/notifications.js` and `example/web/twilio.min.js` into your application's `web` folder.
200
-
2. This step should be done AFTER you've built your application, every time the `flutter_service_worker.js` changes (this includes hot reloads on your local machine unfortunately)
201
-
1. Copy the contents of `example/web/twilio-sw.js` into your `build/web/flutter_service_worker.js` file, **at the end of the file**. See [service-worker](#service-worker) for more information.
199
+
```
200
+
your_project/
201
+
├── ...
202
+
├── lib/
203
+
├── web/
204
+
│ ├── ...
205
+
│ ├── index.html
206
+
│ ├── twilio.min.js
207
+
│ ├── js_notifications-sw.js
208
+
│ ├── ...
209
+
├── ...
210
+
```
202
211
203
-
Note, these files can be changed to suite your needs - however the core functionality should remain the same: responding to `notificationclick`, `notificationclose`, `message` events and associated sub-functions.
212
+
**Note:** This is required for the browser to handle notifications in the background. The service
213
+
worker will handle incoming call notifications and display them even when the app is not in focus.
204
214
205
215
Finally, add the following code to your `index.html` file, **at the end of body tag**:
206
216
@@ -221,32 +231,11 @@ Finally, add the following code to your `index.html` file, **at the end of body
221
231
#### Web Considerations
222
232
223
233
_If you need to debug the service worker, open up Chrome Devtools, go to Application tab, and select Service Workers from the left menu. There you can see the service workers and their status.
224
-
To review service worker `notificationclick`, `notificationclose`, `message`, etc events - do this using Chrome Devtools (Sources tab, left panel below 'site code' the service workers are listed)_
225
-
226
-
##### Service Worker
227
-
228
-
Unifying the service worker(s) is best done via post-compilation tools or a CI/CD pipeline (suggested).
229
-
230
-
A snippet of the suggested service worker integration is as follows:
231
-
232
-
```yaml
233
-
#...
234
-
- run: cd ./example; flutter build web --release --target=lib/main.dart --output=build/web
A complete example could be found in the github workflows `.github/workflows/flutter.yml` file, see [here](https://github.com/cybex-dev/twilio_voice/blob/master/.github/workflows/flutter.yml).
234
+
To review service worker `notificationclick`, `notificationclose`, `message`, etc events - do this using Chrome Devtools (Sources tab, left panel below 'site code' the service workers are listed)_
242
235
243
236
##### Web Notifications
244
237
245
-
2 types of notifications are shown:
246
-
- Incoming call notifications with 2 buttons: `Answer`and `Reject`,
247
-
- Missed call notifications with 1 button: `Call back`.
248
-
249
-
Notifications are presented as **alerts**. These notifications may not always been shown, check:
238
+
Notifications are presented as **alerts**. If you notifications aren't shown or visible, check:
250
239
- if the browser supports notifications,
251
240
- if the user has granted permissions to show notifications,
252
241
- if the notifications display method / notifications is enabled by the system (e.g. macOS notifications are disabled, or Windows notifications are disabled, etc).
0 commit comments