capacitor-plugin-vonage 0.0.4 → 0.0.5

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 CHANGED
@@ -16,7 +16,8 @@ npx cap sync
16
16
  * [`echo(...)`](#echo)
17
17
  * [`openVideoCallWindow(...)`](#openvideocallwindow)
18
18
  * [`endVideoCall()`](#endvideocall)
19
- * [`addListener([eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void], ...)`](#addlistenereventname-videocallended-listenerfunc-info-any--void--eventname-videocallstarted-listenerfunc-info-any--void)
19
+ * [`setPatientOnlineStatus(...)`](#setpatientonlinestatus)
20
+ * [`addListener([eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'SendNotification', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void], ...)`](#addlistenereventname-videocallended-listenerfunc-info-any--void--eventname-sendnotification-listenerfunc-info-any--void--eventname-videocallstarted-listenerfunc-info-any--void)
20
21
  * [Interfaces](#interfaces)
21
22
  * [Type Aliases](#type-aliases)
22
23
 
@@ -66,15 +67,30 @@ endVideoCall() => Promise<{ value: string; }>
66
67
  --------------------
67
68
 
68
69
 
69
- ### addListener([eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void], ...)
70
+ ### setPatientOnlineStatus(...)
70
71
 
71
72
  ```typescript
72
- addListener(...args: [eventName: "VideoCallEnded", listenerFunc: (info: any) => void] | [eventName: "VideoCallStarted", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle
73
+ setPatientOnlineStatus(options: Object) => Promise<{ value: any; }>
73
74
  ```
74
75
 
75
- | Param | Type |
76
- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
77
- | **`args`** | <code>[eventName: 'VideoCallEnded', listenerFunc: (info: any) =&gt; void] \| [eventName: 'VideoCallStarted', listenerFunc: (info: any) =&gt; void]</code> |
76
+ | Param | Type |
77
+ | ------------- | ----------------------------------------- |
78
+ | **`options`** | <code><a href="#object">Object</a></code> |
79
+
80
+ **Returns:** <code>Promise&lt;{ value: any; }&gt;</code>
81
+
82
+ --------------------
83
+
84
+
85
+ ### addListener([eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'SendNotification', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void], ...)
86
+
87
+ ```typescript
88
+ addListener(...args: [eventName: "VideoCallEnded", listenerFunc: (info: any) => void] | [eventName: "SendNotification", listenerFunc: (info: any) => void] | [eventName: "VideoCallStarted", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle
89
+ ```
90
+
91
+ | Param | Type |
92
+ | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
93
+ | **`args`** | <code>[eventName: 'VideoCallEnded', listenerFunc: (info: any) =&gt; void] \| [eventName: 'SendNotification', listenerFunc: (info: any) =&gt; void] \| [eventName: 'VideoCallStarted', listenerFunc: (info: any) =&gt; void]</code> |
78
94
 
79
95
  **Returns:** <code>Promise&lt;<a href="#pluginlistenerhandle">PluginListenerHandle</a>&gt; & <a href="#pluginlistenerhandle">PluginListenerHandle</a></code>
80
96
 
package/dist/docs.json CHANGED
@@ -49,14 +49,32 @@
49
49
  "complexTypes": [],
50
50
  "slug": "endvideocall"
51
51
  },
52
+ {
53
+ "name": "setPatientOnlineStatus",
54
+ "signature": "(options: Object) => Promise<{ value: any; }>",
55
+ "parameters": [
56
+ {
57
+ "name": "options",
58
+ "docs": "",
59
+ "type": "Object"
60
+ }
61
+ ],
62
+ "returns": "Promise<{ value: any; }>",
63
+ "tags": [],
64
+ "docs": "",
65
+ "complexTypes": [
66
+ "Object"
67
+ ],
68
+ "slug": "setpatientonlinestatus"
69
+ },
52
70
  {
53
71
  "name": "addListener",
54
- "signature": "(...args: [eventName: \"VideoCallEnded\", listenerFunc: (info: any) => void] | [eventName: \"VideoCallStarted\", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle",
72
+ "signature": "(...args: [eventName: \"VideoCallEnded\", listenerFunc: (info: any) => void] | [eventName: \"SendNotification\", listenerFunc: (info: any) => void] | [eventName: \"VideoCallStarted\", listenerFunc: (info: any) => void]) => Promise<PluginListenerHandle> & PluginListenerHandle",
55
73
  "parameters": [
56
74
  {
57
75
  "name": "args",
58
76
  "docs": "",
59
- "type": "[eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]"
77
+ "type": "[eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'SendNotification', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]"
60
78
  }
61
79
  ],
62
80
  "returns": "Promise<PluginListenerHandle> & PluginListenerHandle",
@@ -65,7 +83,7 @@
65
83
  "complexTypes": [
66
84
  "PluginListenerHandle"
67
85
  ],
68
- "slug": "addlistenereventname-videocallended-listenerfunc-info-any--void--eventname-videocallstarted-listenerfunc-info-any--void"
86
+ "slug": "addlistenereventname-videocallended-listenerfunc-info-any--void--eventname-sendnotification-listenerfunc-info-any--void--eventname-videocallstarted-listenerfunc-info-any--void"
69
87
  }
70
88
  ],
71
89
  "properties": []
@@ -11,5 +11,8 @@ export interface vonagePlugin {
11
11
  endVideoCall(): Promise<{
12
12
  value: string;
13
13
  }>;
14
- addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;
14
+ setPatientOnlineStatus(options: Object): Promise<{
15
+ value: any;
16
+ }>;
17
+ addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'SendNotification', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;
15
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface vonagePlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n openVideoCallWindow(options: Object): Promise<{ value: any }>;\n endVideoCall(): Promise<{ value: string }>;\n addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n}\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { PluginListenerHandle } from \"@capacitor/core\";\n\nexport interface vonagePlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n openVideoCallWindow(options: Object): Promise<{ value: any }>;\n endVideoCall(): Promise<{ value: string }>;\n setPatientOnlineStatus(options: Object): Promise<{ value: any }>;\n addListener(...args: [eventName: 'VideoCallEnded', listenerFunc: (info: any) => void] | [eventName: 'SendNotification', listenerFunc: (info: any) => void] | [eventName: 'VideoCallStarted', listenerFunc: (info: any) => void]): Promise<PluginListenerHandle> & PluginListenerHandle;\n\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -12,4 +12,7 @@ export declare class vonageWeb extends WebPlugin implements vonagePlugin {
12
12
  openVideoCallWindow(options: Object): Promise<{
13
13
  value: any;
14
14
  }>;
15
+ setPatientOnlineStatus(options: Object): Promise<{
16
+ value: any;
17
+ }>;
15
18
  }
package/dist/esm/web.js CHANGED
@@ -13,5 +13,10 @@ export class vonageWeb extends WebPlugin {
13
13
  console.log('openVideoCallWindow', options);
14
14
  return dummyValue;
15
15
  }
16
+ async setPatientOnlineStatus(options) {
17
+ let dummyValue;
18
+ console.log('setPatientOnlineStatus', options);
19
+ return dummyValue;
20
+ }
16
21
  }
17
22
  //# sourceMappingURL=web.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,YAAY;QACV,IAAI,UAAc,CAAC;QACnB,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,mBAAmB,CAAC,OAAe;QACvC,IAAI,UAAc,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { vonagePlugin } from './definitions';\n\nexport class vonageWeb extends WebPlugin implements vonagePlugin {\n endVideoCall(): Promise<{ value: string; }> {\n let dummyValue:any;\n return dummyValue;\n }\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options: Object): Promise<{ value: any }>{\n let dummyValue:any;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n"]}
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,YAAY;QACV,IAAI,UAAc,CAAC;QACnB,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,KAAK,CAAC,mBAAmB,CAAC,OAAe;QACvC,IAAI,UAAc,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QAC5C,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,KAAK,CAAC,sBAAsB,CAAC,OAAe;QAC1C,IAAI,UAAc,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,UAAU,CAAC;IACpB,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { vonagePlugin } from './definitions';\n\nexport class vonageWeb extends WebPlugin implements vonagePlugin {\n endVideoCall(): Promise<{ value: string; }> {\n let dummyValue:any;\n return dummyValue;\n }\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options: Object): Promise<{ value: any }>{\n let dummyValue:any;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n async setPatientOnlineStatus(options: Object): Promise<{ value: any }>{\n let dummyValue:any;\n console.log('setPatientOnlineStatus', options);\n return dummyValue;\n }\n}\n"]}
@@ -22,6 +22,11 @@ class vonageWeb extends core.WebPlugin {
22
22
  console.log('openVideoCallWindow', options);
23
23
  return dummyValue;
24
24
  }
25
+ async setPatientOnlineStatus(options) {
26
+ let dummyValue;
27
+ console.log('setPatientOnlineStatus', options);
28
+ return dummyValue;
29
+ }
25
30
  }
26
31
 
27
32
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n endVideoCall() {\n let dummyValue;\n return dummyValue;\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACFM,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,YAAY,GAAG;AACnB,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;AACvC,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AACpD,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n endVideoCall() {\n let dummyValue;\n return dummyValue;\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n async setPatientOnlineStatus(options) {\n let dummyValue;\n console.log('setPatientOnlineStatus', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;;;AACK,MAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;AACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;AAC3D,CAAC;;ACFM,MAAM,SAAS,SAASC,cAAS,CAAC;AACzC,IAAI,YAAY,GAAG;AACnB,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACrC,QAAQ,OAAO,OAAO,CAAC;AACvB,KAAK;AACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;AACvC,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AACpD,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL,IAAI,MAAM,sBAAsB,CAAC,OAAO,EAAE;AAC1C,QAAQ,IAAI,UAAU,CAAC;AACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;AACvD,QAAQ,OAAO,UAAU,CAAC;AAC1B,KAAK;AACL;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -19,6 +19,11 @@ var capacitorvonage = (function (exports, core) {
19
19
  console.log('openVideoCallWindow', options);
20
20
  return dummyValue;
21
21
  }
22
+ async setPatientOnlineStatus(options) {
23
+ let dummyValue;
24
+ console.log('setPatientOnlineStatus', options);
25
+ return dummyValue;
26
+ }
22
27
  }
23
28
 
24
29
  var web = /*#__PURE__*/Object.freeze({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n endVideoCall() {\n let dummyValue;\n return dummyValue;\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICFM,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,YAAY,GAAG;IACnB,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACpD,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst vonage = registerPlugin('vonage', {\n web: () => import('./web').then(m => new m.vonageWeb()),\n});\nexport * from './definitions';\nexport { vonage };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class vonageWeb extends WebPlugin {\n endVideoCall() {\n let dummyValue;\n return dummyValue;\n }\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async openVideoCallWindow(options) {\n let dummyValue;\n console.log('openVideoCallWindow', options);\n return dummyValue;\n }\n async setPatientOnlineStatus(options) {\n let dummyValue;\n console.log('setPatientOnlineStatus', options);\n return dummyValue;\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,MAAM,GAAGA,mBAAc,CAAC,QAAQ,EAAE;IACxC,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;IAC3D,CAAC;;ICFM,MAAM,SAAS,SAASC,cAAS,CAAC;IACzC,IAAI,YAAY,GAAG;IACnB,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,OAAO,OAAO,CAAC;IACvB,KAAK;IACL,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACpD,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL,IAAI,MAAM,sBAAsB,CAAC,OAAO,EAAE;IAC1C,QAAQ,IAAI,UAAU,CAAC;IACvB,QAAQ,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,OAAO,CAAC,CAAC;IACvD,QAAQ,OAAO,UAAU,CAAC;IAC1B,KAAK;IACL;;;;;;;;;;;;;;;;;"}
@@ -22,21 +22,29 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
22
22
  var isVideoMute = false
23
23
  var isBackCameraFace = false
24
24
  var isCallInProgress = false
25
-
25
+ var isPatientOnLine = true
26
+ var isPatientFromWeb = true
26
27
  var videoCallParam = String()
27
-
28
+ var profilePicApiUrl = ""
28
29
  var session: OTSession?
29
30
  var publisher: OTPublisher?
30
31
  var subscriber: OTSubscriber?
31
32
 
33
+ var bottomView = UIView()
32
34
  var remoteView = UIView()
33
35
  var localView = UIView()
36
+ var centerView = UIView()
37
+ var adminBtn = UIButton()
38
+ var denyBtn = UIButton()
39
+ var sendNotificationBtn = UIButton()
34
40
  var camaraBtn = UIButton()
35
41
  var videoBtn = UIButton()
36
42
  var audioBtn = UIButton()
37
43
  var callBtn = UIButton()
44
+ var subscriberStatusLabel = UILabel()
38
45
  var publisherLabel = UILabel()
39
46
  var subscriberLabel = UILabel()
47
+ var subscriberNameLabel = UILabel()
40
48
  var timerLabel = UILabel()
41
49
  var subscriberImg = UIImageView()
42
50
  var counter = 0
@@ -45,6 +53,9 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
45
53
 
46
54
  super.viewDidLoad()
47
55
  self.navigationController?.navigationBar.isHidden = true
56
+ self.view.backgroundColor = .white
57
+ NotificationCenter.default.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.willResignActiveNotification, object: nil)
58
+ NotificationCenter.default.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
48
59
  self.viewSetupMethod()
49
60
  // let jsonParam = videoCallParam.toJSON() as? [String:AnyObject] // can be any type here
50
61
  // print(jsonParam as Any)
@@ -86,7 +97,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
86
97
  // })
87
98
  }
88
99
  override func viewDidAppear(_ animated: Bool) {
100
+ print("viewDidAppear")
89
101
  super.viewDidAppear(animated)
102
+ NotificationCenter.default.addObserver(self, selector: #selector(deviceOrientationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil)
103
+ NotificationCenter.default.addObserver(self, selector: #selector(setPatientOnlineStatus), name: NSNotification.Name ("PatientOnlineStatus"), object: nil)
90
104
  NotificationCenter.default.addObserver(self,selector:#selector(endVideoCall(_:)),name: NSNotification.Name ("EndVideoCall"),object: nil)
91
105
  // DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
92
106
  //
@@ -100,8 +114,36 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
100
114
  // turnOnAndOffVideo()
101
115
  }
102
116
  override func viewDidDisappear(_ animated: Bool) {
117
+ print("viewDidDisappear")
103
118
  super.viewDidDisappear(animated)
104
- NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
119
+ let userInfo = ["userInfo": ["isProvider": self.isProvider]]
120
+ NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
121
+ // NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
122
+ NotificationCenter.default.removeObserver(self)
123
+ }
124
+ @objc func appMovedToBackground() {
125
+ print("App moved to background!")
126
+ }
127
+ @objc func appMovedToForeground() {
128
+ print("App moved to forground!")
129
+ }
130
+ @objc func deviceOrientationDidChange(_ notification: Notification) {
131
+ let orientation = UIDevice.current.orientation
132
+ print(orientation)
133
+ // self.remoteView.setNeedsLayout()
134
+ // self.localView.setNeedsLayout()
135
+ // self.bottomView.setNeedsLayout()
136
+ }
137
+ @objc func setPatientOnlineStatus(_ notification: Notification) {
138
+ // let userinfo = notification.userInfo?["isOnline"] as? Bool
139
+
140
+ if let isOnline = notification.userInfo?["isOnline"] as? Bool , !isCallInProgress {
141
+ isPatientOnLine = isOnline
142
+ DispatchQueue.main.async {
143
+ self.patientStatusChanged()
144
+ }
145
+ }
146
+
105
147
  }
106
148
  @objc func endVideoCall(_ notification: Notification){
107
149
  print("end video call called")
@@ -140,12 +182,17 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
140
182
  let screenWidth = self.view.frame.width
141
183
 
142
184
  remoteView = UIView(frame: CGRect(x: 0, y: 0, width: screenWidth, height:screenHeight))
143
- remoteView.backgroundColor = UIColor(red: 83/255, green: 83/255, blue: 83/255, alpha: 1.0)
185
+ remoteView.backgroundColor = .white//UIColor(red: 83/255, green: 83/255, blue: 83/255, alpha: 1.0)
186
+ centerView.layer.zPosition = 1
187
+ centerView.frame = CGRect(x: 0, y: 0, width: 250, height: 400)
188
+ // centerView.backgroundColor = .blue
189
+ centerView.center.x = remoteView.center.x
190
+ centerView.center.y = remoteView.center.y - 20
144
191
 
145
192
  subscriberLabel = UILabel(frame: CGRect(x: 20, y: Int(screenHeight) - 180, width: Int(remoteView.frame.size.width - 180), height: 40))
146
193
  subscriberLabel.text = subscriberName
147
194
  //subscriberLabel.backgroundColor = UIColor(red: 31/255, green: 33/255, blue: 36/255, alpha: 1.0)
148
- subscriberLabel.textColor = .white
195
+ subscriberLabel.textColor = .white//UIColor(hex: "#000000")
149
196
  subscriberLabel.textAlignment = .left
150
197
  subscriberLabel.font = subscriberLabel.font.withSize(dynamicFontSize(15))
151
198
  subscriberLabel.layer.zPosition = 1;
@@ -153,12 +200,13 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
153
200
  timerLabel = UILabel(frame: CGRect(x: 30, y: Int(screenHeight) - 155, width: Int(remoteView.frame.size.width - 140), height: 40))
154
201
  //timerLabel.text = "00:00:00"
155
202
  //subscriberLabel.backgroundColor = UIColor(red: 31/255, green: 33/255, blue: 36/255, alpha: 1.0)
156
- timerLabel.textColor = .white
203
+ timerLabel.textColor = .black//UIColor(hex: "#000000")
157
204
  timerLabel.textAlignment = .left
158
- timerLabel.font = subscriberLabel.font.withSize(dynamicFontSize(15))
205
+ timerLabel.font = timerLabel.font.withSize(dynamicFontSize(15))
159
206
  timerLabel.layer.zPosition = 1;
160
- let url = URL(string: "https://www.gravatar.com/avatar/?d=mp")!
161
-
207
+ let dummmyUrl = "https://www.gravatar.com/avatar/?d=mp"
208
+ let url = URL(string: profilePicApiUrl.count > 10 ? profilePicApiUrl : dummmyUrl)!
209
+
162
210
  DispatchQueue.global().async {
163
211
  // Fetch Image Data
164
212
  if let data = try? Data(contentsOf: url) {
@@ -168,19 +216,78 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
168
216
  }
169
217
  }
170
218
  }
171
- subscriberImg.layer.zPosition = 1
172
- subscriberImg.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
173
- subscriberImg.layer.cornerRadius = 100
219
+ //subscriberImg.layer.zPosition = 1
220
+ subscriberImg.frame = CGRect(x: (centerView.frame.width / 2) - 90, y: 0, width: 180, height: 180)
221
+ subscriberImg.layer.cornerRadius = 90
174
222
  subscriberImg.clipsToBounds = true
175
- subscriberImg.center.x = remoteView.center.x
176
- subscriberImg.center.y = remoteView.center.y - 100
223
+ //subscriberImg.center = CGPoint(x: self.view.frame.size.width / 2, y: 0)
224
+ //subscriberImg.center.x = remoteView.center.x - 70
225
+ //subscriberImg.center.y = centerView.center.y - 100
226
+
227
+ subscriberStatusLabel = UILabel(frame: CGRect(x: (centerView.frame.width / 2) - 80, y: 230, width: 160, height: 30))
228
+ subscriberStatusLabel.text = "WAITING"
229
+ subscriberStatusLabel.backgroundColor = UIColor(hex: "#DFF6ED")
230
+ subscriberStatusLabel.textColor = UIColor(hex: "#000000")
231
+ subscriberStatusLabel.textAlignment = .center
232
+ //subscriberStatusLabel.center.x = remoteView.center.x
233
+
234
+ subscriberNameLabel = UILabel(frame: CGRect(x: 0, y: 190, width: centerView.frame.width, height: 40))
235
+ subscriberNameLabel.text = subscriberName
236
+ subscriberNameLabel.backgroundColor = .clear
237
+ subscriberNameLabel.textColor = UIColor(hex: "#000000")
238
+ subscriberNameLabel.textAlignment = .center
239
+ subscriberNameLabel.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(20))
240
+
241
+ adminBtn = UIButton(frame: CGRect(x: (centerView.frame.width/2) - 10 - 100, y: 275, width: 100, height: 50))
242
+ adminBtn.backgroundColor = UIColor(hex: "#DFF6ED")
243
+ adminBtn.layer.borderColor = UIColor(hex: "#60D2A7").cgColor
244
+ adminBtn.layer.borderWidth = 2
245
+ adminBtn.layer.cornerRadius = 10
246
+ adminBtn.setTitleColor(UIColor(hex: "#000000"), for: .normal)
247
+ adminBtn.setTitle("ADMIT", for: .normal)
248
+ adminBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(15))
249
+ // adminBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
250
+ adminBtn.addTarget(self, action:#selector(self.adminbuttonClicked), for: .touchUpInside)
251
+
252
+ sendNotificationBtn = UIButton(frame: CGRect(x: (centerView.frame.width/2) - 110, y: 275, width: 220, height: 50))
253
+ sendNotificationBtn.backgroundColor = UIColor(hex: "#DFF6ED")
254
+ sendNotificationBtn.layer.borderColor = UIColor(hex: "#60D2A7").cgColor
255
+ sendNotificationBtn.layer.borderWidth = 2
256
+ sendNotificationBtn.layer.cornerRadius = 10
257
+ sendNotificationBtn.setTitleColor(UIColor(hex: "#000000"), for: .normal)
258
+ sendNotificationBtn.setTitle(isPatientFromWeb ? "SEND EMAIL NOTIFICATION" : "SEND NOTIFICATION", for: .normal)
259
+ sendNotificationBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(15))
260
+ // adminBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
261
+ sendNotificationBtn.addTarget(self, action:#selector(self.sendNotificationbuttonClicked), for: .touchUpInside)
262
+
263
+ denyBtn = UIButton(frame: CGRect(x: (centerView.frame.width/2) + 10, y: 275, width: 100, height: 50))
264
+ denyBtn.backgroundColor = UIColor(hex: "#E4EAED")
265
+ denyBtn.layer.borderColor = UIColor(hex: "#C4CBCF").cgColor
266
+ denyBtn.layer.borderWidth = 2
267
+ denyBtn.layer.cornerRadius = 10
268
+ denyBtn.setTitleColor(UIColor(hex: "#000000"), for: .normal)
269
+ denyBtn.setTitle("DENY", for: .normal)
270
+ denyBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(15))
271
+ // adminBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
272
+ denyBtn.addTarget(self, action:#selector(self.denybuttonClicked), for: .touchUpInside)
273
+
274
+ centerView.addSubview(denyBtn)
275
+ centerView.addSubview(adminBtn)
276
+ centerView.addSubview(subscriberImg)
277
+ centerView.addSubview(subscriberStatusLabel)
278
+ centerView.addSubview(subscriberNameLabel)
279
+ centerView.addSubview(sendNotificationBtn)
280
+ //patientStatusChanged()
281
+ centerView.isHidden = true
282
+
177
283
  // subscriberImg = UIImageView(image: <#T##UIImage?#>)
178
- remoteView.addSubview(subscriberImg)
284
+ remoteView.addSubview(centerView)
179
285
  remoteView.addSubview(timerLabel)
180
286
  remoteView.addSubview(subscriberLabel)
287
+
181
288
  self.view.addSubview(remoteView)
182
289
  // someImageViewConstraints()
183
- let bottomView = UIView(frame: CGRect(x: 0, y: screenHeight - 90, width: 320, height: 90))
290
+ bottomView = UIView(frame: CGRect(x: 0, y: screenHeight - 90, width: 320, height: 90))
184
291
  bottomView.backgroundColor = UIColor.clear
185
292
  bottomView.center = CGPoint(x: self.view.frame.size.width / 2, y: self.view.frame.size.height - 50)
186
293
 
@@ -195,7 +302,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
195
302
  publisherLabel = UILabel(frame: CGRect(x: 0, y: Int(localView.frame.size.height - 40.0), width: Int(localView.frame.size.width), height: 40))
196
303
  publisherLabel.text = publisherName
197
304
  // publisherLabel.backgroundColor = UIColor(red: 31/255, green: 33/255, blue: 36/255, alpha: 1.0)
198
- publisherLabel.textColor = .white
305
+ publisherLabel.textColor = .white//UIColor(hex: "#000000")
199
306
  publisherLabel.textAlignment = .center
200
307
  publisherLabel.layer.zPosition = 1;
201
308
  publisherLabel.font = publisherLabel.font.withSize(dynamicFontSize(15))
@@ -226,6 +333,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
226
333
  audioBtn.addTarget(self, action:#selector(self.audioBtnbuttonClicked), for: .touchUpInside)
227
334
  bottomView.addSubview(audioBtn)
228
335
 
336
+
229
337
  }
230
338
  deinit{
231
339
  if(!isCallEnded){
@@ -234,6 +342,75 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
234
342
  }
235
343
 
236
344
  }
345
+ func patientStatusChanged(){
346
+ if(isProvider && isPatientOnLine){
347
+ centerView.isHidden = false
348
+ sendNotificationBtn.isHidden = true
349
+ adminBtn.isHidden = false
350
+ denyBtn.isHidden = false
351
+ subscriberStatusLabel.text = "WAITING"
352
+ subscriberStatusLabel.backgroundColor = UIColor(hex: "#DFF6ED")
353
+ subscriberNameLabel.isHidden = false
354
+ }else if(isProvider && !isPatientOnLine){
355
+ centerView.isHidden = false
356
+ sendNotificationBtn.isHidden = false
357
+ adminBtn.isHidden = true
358
+ denyBtn.isHidden = true
359
+ subscriberStatusLabel.text = "OFFLINE"
360
+ subscriberStatusLabel.backgroundColor = UIColor(hex: "#ffd6ca")
361
+ subscriberNameLabel.isHidden = false
362
+ }else{
363
+ centerView.isHidden = false
364
+ sendNotificationBtn.isHidden = true
365
+ adminBtn.isHidden = true
366
+ denyBtn.isHidden = true
367
+ subscriberStatusLabel.isHidden = true
368
+ subscriberNameLabel.isHidden = false
369
+
370
+ }
371
+ }
372
+ @objc func sendNotificationbuttonClicked() {
373
+ print("sendNotificationbuttonClicked")
374
+ centerView.isHidden = false
375
+ sendNotificationBtn.isHidden = true
376
+ adminBtn.isHidden = true
377
+ denyBtn.isHidden = true
378
+ subscriberStatusLabel.isHidden = false
379
+ subscriberNameLabel.isHidden = false
380
+ subscriberStatusLabel.text = "Please Wait.."
381
+ let userInfo = ["userInfo": ["isProvider": isProvider]]
382
+ NotificationCenter.default.post(name: NSNotification.Name("SendNotification"),object: nil,userInfo: userInfo)
383
+ // self.session?.disconnect(nil)
384
+ // self.stopTimer()
385
+ // self.dismiss(animated: true, completion: nil)
386
+ }
387
+ @objc func adminbuttonClicked() {
388
+ print("Admin button clicked")
389
+ centerView.isHidden = false
390
+ sendNotificationBtn.isHidden = true
391
+ adminBtn.isHidden = true
392
+ denyBtn.isHidden = true
393
+ subscriberStatusLabel.isHidden = false
394
+ subscriberNameLabel.isHidden = false
395
+ subscriberStatusLabel.text = "Please Wait.."
396
+ //subscriberStatusLabel.frame.width =
397
+ // let userInfo = ["userInfo": ["isProvider": isProvider]]
398
+ // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
399
+ // self.session?.disconnect(nil)
400
+ // self.stopTimer()
401
+ // self.dismiss(animated: true, completion: nil)
402
+ let userInfo = ["userInfo": ["isProvider": isProvider]]
403
+ NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
404
+ }
405
+ @objc func denybuttonClicked() {
406
+ print("deny button clicked")
407
+ centerView.isHidden = true
408
+ let userInfo = ["userInfo": ["isProvider": isProvider]]
409
+ NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
410
+ self.session?.disconnect(nil)
411
+ self.stopTimer()
412
+ self.dismiss(animated: true, completion: nil)
413
+ }
237
414
 
238
415
  @objc func callBtnbuttonClicked() {
239
416
 
@@ -299,8 +476,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
299
476
  func sessionDidConnect(_ session: OTSession) {
300
477
  print("The client connected to the OpenTok session.")
301
478
  let userInfo = ["userInfo": ["isProvider": isProvider]]
302
- NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
479
+ // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
303
480
  let settings = OTPublisherSettings()
481
+ settings.cameraResolution = .high
482
+ settings.cameraFrameRate = .rate30FPS
304
483
  settings.name = publisherName
305
484
  guard let publisher = OTPublisher(delegate: self, settings: settings) else {
306
485
  print("publisher create error")
@@ -325,6 +504,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
325
504
 
326
505
  localView.addSubview(publisherView)
327
506
  startTimer()
507
+ DispatchQueue.main.async {
508
+ self.patientStatusChanged()
509
+ }
510
+
328
511
  }
329
512
 
330
513
  func sessionDidDisconnect(_ session: OTSession) {
@@ -356,6 +539,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
356
539
  }
357
540
 
358
541
  guard let subscriberView = subscriber.view else {
542
+ print("subscriberView empty")
359
543
  return
360
544
  }
361
545
 
@@ -383,6 +567,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
383
567
  }
384
568
  if(stream.videoType != .screen){
385
569
  subscriberImg.isHidden = false
570
+ subscriberNameLabel.isHidden = false
386
571
  showToast(message: "\(subscriberName) is left the call")
387
572
  cleanupSubscriber()
388
573
  }
@@ -415,6 +600,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
415
600
  public func subscriberDidConnect(toStream subscriber: OTSubscriberKit) {
416
601
  print("The subscriber did connect to the stream.")
417
602
  subscriberImg.isHidden = true
603
+ subscriberStatusLabel.isHidden = true
604
+ subscriberNameLabel.isHidden = true
605
+ timerLabel.textColor = .white
606
+ isCallInProgress = true
418
607
  if(subscriber.stream?.videoType != .screen){
419
608
  showToast(message: "\(subscriberName) is joined the call")
420
609
  }
@@ -428,13 +617,20 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
428
617
 
429
618
  func subscriberVideoDisabled(_ subscriber: OTSubscriberKit, reason: OTSubscriberVideoEventReason) {
430
619
  // Display the video disabled indicator
620
+ print("subscriberVideoDisabled")
431
621
  showToast(message: "\(subscriberName) video disabled")
432
622
  subscriberImg.isHidden = false
623
+ subscriberNameLabel.isHidden = false
624
+ remoteView.backgroundColor = .white
433
625
  }
434
626
 
435
627
  func subscriberVideoEnabled(_ subscriber: OTSubscriberKit, reason: OTSubscriberVideoEventReason) {
628
+ print("subscriberVideoEnabled")
436
629
  showToast(message: "\(subscriberName) video enabled")
437
630
  subscriberImg.isHidden = true
631
+ subscriberStatusLabel.isHidden = true
632
+ subscriberNameLabel.isHidden = true
633
+ timerLabel.textColor = .white
438
634
  // showToast(message: "is provider \(isProvider) video enabled")
439
635
 
440
636
  // Remove the video disabled indicator
@@ -460,6 +656,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
460
656
  fileprivate func cleanupSubscriber() {
461
657
  subscriber?.view?.removeFromSuperview()
462
658
  subscriber = nil
659
+ remoteView.backgroundColor = .white
463
660
  }
464
661
 
465
662
  fileprivate func cleanupPublisher() {
@@ -472,6 +669,50 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
472
669
  subscriberImg.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
473
670
  subscriberImg.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 28).isActive = true
474
671
  }
672
+ // override func viewDidLayoutSubviews() {
673
+ // super.viewDidLayoutSubviews()
674
+ // let screenHeight = self.view.bounds.height
675
+ // let screenWidth = self.view.bounds.width
676
+ //
677
+ // remoteView.frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height:self.view.bounds.height)
678
+ // subscriberLabel.frame = CGRect(x: 20, y: Int(screenHeight) - 180, width: Int(remoteView.frame.size.width - 180), height: 40)
679
+ // subscriberLabel.layer.zPosition = 1;
680
+ //
681
+ // timerLabel.frame = CGRect(x: 30, y: Int(screenHeight) - 155, width: Int(remoteView.frame.size.width - 140), height: 40)
682
+ // timerLabel.layer.zPosition = 1;
683
+ //
684
+ // subscriberImg.layer.zPosition = 1
685
+ // subscriberImg.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
686
+ // subscriberImg.layer.cornerRadius = 100
687
+ // subscriberImg.clipsToBounds = true
688
+ // subscriberImg.center.x = centerView.center.x
689
+ // //subscriberImg.center.y = centerView.center.y - 100
690
+ //
691
+ // bottomView.frame = CGRect(x: 0, y: screenHeight - 90, width: 320, height: 90)
692
+ // bottomView.center = CGPoint(x: self.view.frame.size.width / 2, y: self.view.frame.size.height - 50)
693
+ //
694
+ // localView.frame = CGRect(x: screenWidth - 140, y: screenHeight - 250, width: 120, height: 120)
695
+ //
696
+ // localView.layer.cornerRadius = 10;
697
+ // localView.clipsToBounds = true
698
+ //
699
+ // publisherLabel.frame = CGRect(x: 0, y: Int(localView.frame.size.height - 40.0), width: Int(localView.frame.size.width), height: 40)
700
+ //
701
+ // publisherLabel.layer.zPosition = 1;
702
+ //
703
+ //
704
+ // callBtn.frame = CGRect(x: 0, y: 0, width: 60, height: 60)
705
+ //
706
+ //
707
+ // camaraBtn.frame = CGRect(x: 80, y: 0, width: 60, height: 60)
708
+ //
709
+ //
710
+ // videoBtn.frame = CGRect(x: 160, y: 0, width: 60, height: 60)
711
+ //
712
+ //
713
+ // audioBtn.frame = CGRect(x: 240, y: 0, width: 60, height: 60)
714
+ // }
715
+
475
716
  }
476
717
 
477
718
  extension String {
@@ -484,10 +725,10 @@ extension UIViewController {
484
725
 
485
726
  func showToast(message : String) {
486
727
  DispatchQueue.main.async {
487
- let toastLabel = UILabel(frame: CGRect(x: 0, y: self.view.frame.size.height-300, width: self.view.frame.size.width - 100, height: 50))
488
- toastLabel.center.x = self.view.center.x
489
- toastLabel.backgroundColor = UIColor.white.withAlphaComponent(0.6)
490
- toastLabel.textColor = UIColor.black
728
+ let toastLabel = UILabel(frame: CGRect(x: 100, y: 40, width: self.view.frame.size.width - 100, height: 50))
729
+ // toastLabel.center.x = self.view.center.x
730
+ toastLabel.backgroundColor = UIColor(hex: "#0B6623")//UIColor.white.withAlphaComponent(0.6)
731
+ toastLabel.textColor = .white//UIColor.black
491
732
  toastLabel.font = .systemFont(ofSize: 12.0)
492
733
  toastLabel.textAlignment = .center;
493
734
  toastLabel.text = message
@@ -504,3 +745,21 @@ func showToast(message : String) {
504
745
  }
505
746
 
506
747
  }
748
+ extension UIColor {
749
+ convenience init(hex: String, alpha: CGFloat = 1.0) {
750
+ var hexValue = hex.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased()
751
+
752
+ if hexValue.hasPrefix("#") {
753
+ hexValue.remove(at: hexValue.startIndex)
754
+ }
755
+
756
+ var rgbValue: UInt64 = 0
757
+ Scanner(string: hexValue).scanHexInt64(&rgbValue)
758
+
759
+ let red = CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0
760
+ let green = CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0
761
+ let blue = CGFloat(rgbValue & 0x0000FF) / 255.0
762
+
763
+ self.init(red: red, green: green, blue: blue, alpha: alpha)
764
+ }
765
+ }
@@ -7,4 +7,5 @@ CAP_PLUGIN(vonagePlugin, "vonage",
7
7
  CAP_PLUGIN_METHOD(echo, CAPPluginReturnPromise);
8
8
  CAP_PLUGIN_METHOD(openVideoCallWindow, CAPPluginReturnPromise);
9
9
  CAP_PLUGIN_METHOD(endVideoCall, CAPPluginReturnPromise);
10
+ CAP_PLUGIN_METHOD(setPatientOnlineStatus, CAPPluginReturnPromise);
10
11
  )
@@ -15,8 +15,9 @@ public class vonagePlugin: CAPPlugin {
15
15
 
16
16
  let publisherName = call.getString("publisherName") ?? ""
17
17
  let subscriberName = call.getString("subscriberName") ?? ""
18
- let isProvider = call.getBool("isProvider") ?? false
19
-
18
+ let isProvider = call.getBool("isProvider") ?? false //profilePicApiUrl
19
+ let isPatientOnline = call.getBool("isPatientOnline") ?? false
20
+ let profilePhoto = call.getString("profilePhoto") ?? ""
20
21
  DispatchQueue.main.async {
21
22
  let vc = VideoChatViewController()
22
23
  vc.kApiKey = apiKey
@@ -25,12 +26,15 @@ public class vonagePlugin: CAPPlugin {
25
26
  vc.publisherName = publisherName
26
27
  vc.subscriberName = subscriberName
27
28
  vc.isProvider = isProvider
29
+ vc.isPatientOnLine = isPatientOnline
30
+ vc.profilePicApiUrl = profilePhoto
28
31
  // vc.videoCallParam = value
29
32
  vc.modalPresentationStyle = .fullScreen
30
33
  self.bridge?.viewController?.present(vc, animated: true, completion: nil)
31
34
  }
32
35
  NotificationCenter.default.addObserver(self,selector:#selector(videoEnded(_:)),name: NSNotification.Name (NotificationNames.videoEnded),object: nil)
33
36
  NotificationCenter.default.addObserver(self,selector:#selector(videoStarted(_:)),name: NSNotification.Name (NotificationNames.videoStarted),object: nil)
37
+ NotificationCenter.default.addObserver(self,selector:#selector(videoStarted(_:)),name: NSNotification.Name ("SendNotification"),object: nil)
34
38
  // if let visibleViewCtrl = UIApplication.topViewController() {
35
39
  // // do whatever you want with your `visibleViewCtrl`
36
40
  // print(visibleViewCtrl)
@@ -46,6 +50,14 @@ public class vonagePlugin: CAPPlugin {
46
50
 
47
51
  call.resolve(["value": "Video call initiated"])
48
52
  }
53
+ @objc func setPatientOnlineStatus(_ call: CAPPluginCall) {
54
+
55
+ let isOnline = call.getBool("isOnline") ?? false
56
+
57
+ NotificationCenter.default.post(name: NSNotification.Name("PatientOnlineStatus"),object: nil,userInfo: ["isOnline":isOnline])
58
+
59
+ call.resolve(["value": "setPatientOnlineStatus"])
60
+ }
49
61
  @objc func endVideoCall(_ call: CAPPluginCall) {
50
62
  NotificationCenter.default.post(name: NSNotification.Name("EndVideoCall"),object: nil,userInfo: nil)
51
63
  call.resolve(["value": "Video call ended."])
@@ -58,6 +70,10 @@ public class vonagePlugin: CAPPlugin {
58
70
  self.notifyListeners(NotificationNames.videoStarted, data: notification.userInfo?["userInfo"] as? [String: Any] ?? [:])
59
71
  NotificationCenter.default.removeObserver(self, name: NSNotification.Name(NotificationNames.videoStarted), object: nil)
60
72
  }
73
+ @objc func sendNotification(_ notification: Notification){
74
+ self.notifyListeners("SendNotification", data: notification.userInfo?["userInfo"] as? [String: Any] ?? [:])
75
+ NotificationCenter.default.removeObserver(self, name: NSNotification.Name("SendNotification"), object: nil)
76
+ }
61
77
  }
62
78
  extension UIApplication {
63
79
  class func topViewController(base: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> UIViewController? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-plugin-vonage",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "opentok sdk capacitor plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",