Skip to content

Commit aac2e06

Browse files
committed
Merge branch 'master' into prod
2 parents 8910e58 + 729ec23 commit aac2e06

File tree

5 files changed

+35
-16
lines changed

5 files changed

+35
-16
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.0.3+1
2+
3+
* BREAKING CHANGE: Use `WebCallKitWeb` instead of `WebCallKit`.
4+
* update docs
5+
16
## 0.0.3
27

38
* BREAKING CHANGE: Update Callkit Models & Enums with `CK` prefix

NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@ Future work may include:
1515
- Audio & VIDEO handling
1616
- Integration with native callkit frameworks
1717

18+
### Regarding imports
19+
20+
So, this is a tricky one I hope to resolve soon. For now, one should use the web_callkit_web.dart import instead of the web_callkit.dart import.
21+
22+
This is because the web_callkit.dart import is a stub for the web_callkit_web.dart import. This is due to multiple instances are created when calling `WebCallKit.instance` in a web OS environment. Even though a `WebCallKitWeb` object is created and registered with the plugin, it seems the Flutter still prefers the MethodChannel file filled with stubs.
23+
24+
If you have a solution for this, please let me know. I would love to hear it or submit a PR addressing the issue. Note, the issue crops up in child dependencies of the plugin, e.g. [twilio_voice](https://pub.dev/packages/twilio_voice) but is not found in the example project.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ for more information
4545
### Import the package
4646

4747
```dart
48-
import 'package:web_callkit/web_callkit.dart';
48+
import 'package:web_callkit/web_callkit_web.dart';
4949
```
5050

5151
### Display the system call screen
@@ -54,7 +54,7 @@ Inform the plugin that an incoming call is being received. This will hook into t
5454
notification system.
5555

5656
```dart
57-
WebCallKit.instance.displayIncomingCall(uuid: '1234',handle: 'John Doe',);
57+
WebCallKitWeb.instance.displayIncomingCall(uuid: '1234',handle: 'John Doe',);
5858
```
5959

6060
### End the call
@@ -65,7 +65,7 @@ or disconnects with VoIP calls due to internet disruptions.
6565

6666
The CallKit supports `DisconnectResponse` enum to specify the reason for the call disconnection.
6767

68-
e.g. `WebCallKit.instance.reportCallDisconnected('1234', response: DisconnectResponse.local);`
68+
e.g. `WebCallKitWeb.instance.reportCallDisconnected('1234', response: DisconnectResponse.local);`
6969

7070
| Reason | Description |
7171
|----------|---------------------------------------------------------------------------------------|
@@ -92,7 +92,7 @@ Incoming calls are displayed on the screen with the caller's name and number. Th
9292
customized with the caller's name, number, and profile picture.
9393

9494
```dart
95-
WebCallKit.instance.reportNewCall(uuid: '1234', handle: 'John Doe',);
95+
WebCallKitWeb.instance.reportNewCall(uuid: '1234', handle: 'John Doe',);
9696
```
9797

9898
##### End Calls
@@ -101,7 +101,7 @@ End calls by calling the `endCall` method. This will remove the call screen and
101101
notification.
102102

103103
```dart
104-
WebCallKit.instance.reportCallDisconnected('1234', response:DisconnectResponse.local);
104+
WebCallKitWeb.instance.reportCallDisconnected('1234', response:DisconnectResponse.local);
105105
```
106106

107107
The response parameter is an enum of `DisconnectResponse` which specifies the reason for the call
@@ -145,7 +145,7 @@ The following describes the capabilities available:
145145
The following provides an example of how to report call capabilities:
146146

147147
```dart
148-
WebCallKit.instance.reportCallCapabilities('1234', capabilities: [CallCapability.hold, CallCapability.mute]);
148+
WebCallKitWeb.instance.reportCallCapabilities('1234', capabilities: [CallCapability.hold, CallCapability.mute]);
149149
```
150150

151151
#### Call Actions

lib/web_callkit_web.dart

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,18 @@ import 'src/models/config/ck_configuration.dart';
3030
import 'src/platform_interface/web_callkit_platform_interface.dart';
3131
import 'src/utils/utils.dart';
3232

33+
export 'src/src.dart';
34+
3335
/// A web implementation of the WebCallkitPlatform of the WebCallkit plugin.
3436
class WebCallkitWeb extends WebCallkitPlatform {
3537
static const tag = 'web_callkit';
3638

39+
static final WebCallkitWeb _instance = WebCallkitWeb._internal();
40+
41+
static WebCallkitWeb get instance => _instance;
42+
3743
static void registerWith(Registrar registrar) {
38-
WebCallkitPlatform.instance = WebCallkitWeb();
44+
WebCallkitPlatform.instance = WebCallkitWeb._internal();
3945
}
4046

4147
final Map<String, CallTimer> _timers = {};
@@ -55,22 +61,23 @@ class WebCallkitWeb extends WebCallkitPlatform {
5561
OnCallTypeChangeListener? _onCallTypeChangeListener;
5662
OnDismissedListener? _onDismissedListener;
5763

58-
CKConfiguration _configuration;
64+
late CKConfiguration _configuration;
5965
final Map<String, bool> _defaultFlags = {
6066
NotificationManager.CK_EXTRA_PERSIST: true,
6167
};
6268

6369
/// The method channel used to interact with the native platform.
6470
// @visibleForTesting
6571
// final methodChannel = const MethodChannel('web_callkit');
72+
factory WebCallkitWeb() {
73+
return _instance;
74+
}
75+
76+
WebCallkitWeb._internal() {
77+
_callManager = CallManager();
78+
_notificationManager = NotificationManagerImplWeb();
79+
_configuration = WebCallkitPlatform.defaultConfiguration;
6680

67-
WebCallkitWeb({
68-
CKConfiguration? configuration,
69-
}) : /*_audioManager = audioManager ?? AudioManager(),*/
70-
_callManager = CallManager(),
71-
_notificationManager = NotificationManagerImplWeb(),
72-
_configuration = configuration ?? WebCallkitPlatform.defaultConfiguration,
73-
super() {
7481
_setupNotificationEventListeners();
7582
_callManager.setOnCallUpdate(_onCallUpdated);
7683
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: web_callkit
22
description: "Manage calls with an iOS-inspired Callkit for Flutter Web applications."
3-
version: 0.0.3
3+
version: 0.0.3+1
44
homepage: "https://github.com/cybex-dev/web_callkit"
55
platforms:
66
web:

0 commit comments

Comments
 (0)