capacitor-plugin-vonage 0.0.4 → 0.0.6

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.
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
14
14
  s.ios.deployment_target = '13.0'
15
15
  s.dependency 'Capacitor'
16
16
  #s.dependency 'OpenTok','2.25.0'
17
- s.dependency 'OTXCFramework','2.26.1'
17
+ s.dependency 'OTXCFramework','2.26.2'
18
18
  s.swift_version = '5.1'
19
19
  s.static_framework = true
20
20
  end
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,29 +22,42 @@ 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
43
51
  var timer = Timer()
52
+ var activityView: UIActivityIndicatorView?
44
53
  override func viewDidLoad() {
45
54
 
46
55
  super.viewDidLoad()
47
56
  self.navigationController?.navigationBar.isHidden = true
57
+ self.view.backgroundColor = .white
58
+ NotificationCenter.default.addObserver(self, selector: #selector(appMovedToBackground), name: UIApplication.willResignActiveNotification, object: nil)
59
+ NotificationCenter.default.addObserver(self, selector: #selector(appMovedToForeground), name: UIApplication.willEnterForegroundNotification, object: nil)
60
+ showActivityIndicator()
48
61
  self.viewSetupMethod()
49
62
  // let jsonParam = videoCallParam.toJSON() as? [String:AnyObject] // can be any type here
50
63
  // print(jsonParam as Any)
@@ -86,7 +99,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
86
99
  // })
87
100
  }
88
101
  override func viewDidAppear(_ animated: Bool) {
102
+ print("viewDidAppear")
89
103
  super.viewDidAppear(animated)
104
+ NotificationCenter.default.addObserver(self, selector: #selector(deviceOrientationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil)
105
+ NotificationCenter.default.addObserver(self, selector: #selector(setPatientOnlineStatus), name: NSNotification.Name ("PatientOnlineStatus"), object: nil)
90
106
  NotificationCenter.default.addObserver(self,selector:#selector(endVideoCall(_:)),name: NSNotification.Name ("EndVideoCall"),object: nil)
91
107
  // DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: {
92
108
  //
@@ -99,9 +115,61 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
99
115
  // }
100
116
  // turnOnAndOffVideo()
101
117
  }
118
+ func showActivityIndicator() {
119
+ activityView = UIActivityIndicatorView(style: .large)
120
+ activityView?.center = self.view.center
121
+ activityView?.layer.zPosition = 20;
122
+ self.view.addSubview(activityView!)
123
+ activityView?.startAnimating()
124
+ }
125
+
126
+ func hideActivityIndicator(){
127
+ if (activityView != nil){
128
+ activityView?.stopAnimating()
129
+ }
130
+ }
102
131
  override func viewDidDisappear(_ animated: Bool) {
132
+ print("viewDidDisappear")
103
133
  super.viewDidDisappear(animated)
104
- NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
134
+ let userInfo = ["userInfo": ["isProvider": self.isProvider]]
135
+ NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
136
+
137
+ // NotificationCenter.default.removeObserver(self, name: NSNotification.Name("EndVideoCall"), object: nil)
138
+ NotificationCenter.default.removeObserver(self)
139
+ NotificationCenter.default.post(name: NSNotification.Name("RemoveObservers"),object: nil,userInfo: userInfo)
140
+ }
141
+ @objc func appMovedToBackground() {
142
+ print("App moved to background!")
143
+ }
144
+ @objc func appMovedToForeground() {
145
+ print("App moved to forground!")
146
+ }
147
+ @objc func deviceOrientationDidChange(_ notification: Notification) {
148
+ let orientation = UIDevice.current.orientation
149
+ print(orientation)
150
+ // self.remoteView.setNeedsLayout()
151
+ // self.localView.setNeedsLayout()
152
+ // self.bottomView.setNeedsLayout()
153
+ }
154
+ @objc func setPatientOnlineStatus(_ notification: Notification) {
155
+ // let userinfo = notification.userInfo?["isOnline"] as? Bool
156
+ if(!isCallInProgress){
157
+ if let ispatientOnline = notification.userInfo?["isOnline"] as? Bool{
158
+ isPatientOnLine = ispatientOnline
159
+ }else{
160
+ isPatientOnLine = false
161
+ }
162
+ DispatchQueue.main.async {
163
+ self.patientStatusChanged()
164
+ }
165
+ }
166
+ // if let isOnline = notification.userInfo?["isOnline"] as? Bool , !isCallInProgress {
167
+ // isPatientOnLine = isOnline
168
+ // DispatchQueue.main.async {
169
+ // self.patientStatusChanged()
170
+ // }
171
+ // }
172
+
105
173
  }
106
174
  @objc func endVideoCall(_ notification: Notification){
107
175
  print("end video call called")
@@ -113,8 +181,11 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
113
181
  timer = Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(timerAction), userInfo: nil, repeats: true)
114
182
  }
115
183
  func stopTimer(){
116
- timer.invalidate()
117
- counter = 0
184
+ if(timer.isValid){
185
+ timer.invalidate()
186
+ counter = 0
187
+ }
188
+
118
189
  }
119
190
  @objc func timerAction() {
120
191
  counter += 1
@@ -140,25 +211,31 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
140
211
  let screenWidth = self.view.frame.width
141
212
 
142
213
  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)
214
+ remoteView.backgroundColor = .white//UIColor(red: 83/255, green: 83/255, blue: 83/255, alpha: 1.0)
215
+ centerView.layer.zPosition = 1
216
+ centerView.frame = CGRect(x: 0, y: 0, width: 250, height: 400)
217
+ // centerView.backgroundColor = .blue
218
+ centerView.center.x = remoteView.center.x
219
+ centerView.center.y = remoteView.center.y - 20
144
220
 
145
221
  subscriberLabel = UILabel(frame: CGRect(x: 20, y: Int(screenHeight) - 180, width: Int(remoteView.frame.size.width - 180), height: 40))
146
222
  subscriberLabel.text = subscriberName
147
223
  //subscriberLabel.backgroundColor = UIColor(red: 31/255, green: 33/255, blue: 36/255, alpha: 1.0)
148
- subscriberLabel.textColor = .white
224
+ subscriberLabel.textColor = .white//UIColor(hex: "#000000")
149
225
  subscriberLabel.textAlignment = .left
150
- subscriberLabel.font = subscriberLabel.font.withSize(dynamicFontSize(15))
226
+ subscriberLabel.font = subscriberLabel.font.withSize(dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 10 : 15))
151
227
  subscriberLabel.layer.zPosition = 1;
152
228
 
153
229
  timerLabel = UILabel(frame: CGRect(x: 30, y: Int(screenHeight) - 155, width: Int(remoteView.frame.size.width - 140), height: 40))
154
230
  //timerLabel.text = "00:00:00"
155
231
  //subscriberLabel.backgroundColor = UIColor(red: 31/255, green: 33/255, blue: 36/255, alpha: 1.0)
156
- timerLabel.textColor = .white
232
+ timerLabel.textColor = .black//UIColor(hex: "#000000")
157
233
  timerLabel.textAlignment = .left
158
- timerLabel.font = subscriberLabel.font.withSize(dynamicFontSize(15))
234
+ timerLabel.font = timerLabel.font.withSize(dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 10 : 15))
159
235
  timerLabel.layer.zPosition = 1;
160
- let url = URL(string: "https://www.gravatar.com/avatar/?d=mp")!
161
-
236
+ let dummmyUrl = "https://www.gravatar.com/avatar/?d=mp"
237
+ let url = URL(string: profilePicApiUrl.count > 10 ? profilePicApiUrl : dummmyUrl)!
238
+
162
239
  DispatchQueue.global().async {
163
240
  // Fetch Image Data
164
241
  if let data = try? Data(contentsOf: url) {
@@ -168,19 +245,79 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
168
245
  }
169
246
  }
170
247
  }
171
- subscriberImg.layer.zPosition = 1
172
- subscriberImg.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
173
- subscriberImg.layer.cornerRadius = 100
248
+ //subscriberImg.layer.zPosition = 1
249
+ subscriberImg.frame = CGRect(x: (centerView.frame.width / 2) - 90, y: 0, width: 180, height: 180)
250
+ subscriberImg.layer.cornerRadius = 90
174
251
  subscriberImg.clipsToBounds = true
175
- subscriberImg.center.x = remoteView.center.x
176
- subscriberImg.center.y = remoteView.center.y - 100
252
+ subscriberImg.contentMode = .scaleAspectFill
253
+ //subscriberImg.center = CGPoint(x: self.view.frame.size.width / 2, y: 0)
254
+ //subscriberImg.center.x = remoteView.center.x - 70
255
+ //subscriberImg.center.y = centerView.center.y - 100
256
+
257
+ subscriberStatusLabel = UILabel(frame: CGRect(x: (centerView.frame.width / 2) - 80, y: 230, width: 160, height: 30))
258
+ subscriberStatusLabel.text = "WAITING"
259
+ subscriberStatusLabel.backgroundColor = UIColor(hex: "#DFF6ED")
260
+ subscriberStatusLabel.textColor = UIColor(hex: "#000000")
261
+ subscriberStatusLabel.textAlignment = .center
262
+ //subscriberStatusLabel.center.x = remoteView.center.x
263
+
264
+ subscriberNameLabel = UILabel(frame: CGRect(x: 0, y: 190, width: centerView.frame.width, height: 40))
265
+ subscriberNameLabel.text = subscriberName
266
+ subscriberNameLabel.backgroundColor = .clear
267
+ subscriberNameLabel.textColor = UIColor(hex: "#000000")
268
+ subscriberNameLabel.textAlignment = .center
269
+ subscriberNameLabel.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 10 : 20 ))
270
+
271
+ adminBtn = UIButton(frame: CGRect(x: (centerView.frame.width/2) - 10 - 100, y: 275, width: 100, height: 50))
272
+ adminBtn.backgroundColor = UIColor(hex: "#DFF6ED")
273
+ adminBtn.layer.borderColor = UIColor(hex: "#60D2A7").cgColor
274
+ adminBtn.layer.borderWidth = 2
275
+ adminBtn.layer.cornerRadius = 10
276
+ adminBtn.setTitleColor(UIColor(hex: "#000000"), for: .normal)
277
+ adminBtn.setTitle("ADMIT", for: .normal)
278
+ adminBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 10 : 15))
279
+ // adminBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
280
+ adminBtn.addTarget(self, action:#selector(self.adminbuttonClicked), for: .touchUpInside)
281
+ let sendBtnWidth = UIDevice.current.userInterfaceIdiom == .pad ? 270 : 220
282
+ sendNotificationBtn = UIButton(frame: CGRect(x: (Int(centerView.frame.width)/2) - (sendBtnWidth/2), y: 275, width: sendBtnWidth, height: 50))
283
+ sendNotificationBtn.backgroundColor = UIColor(hex: "#DFF6ED")
284
+ sendNotificationBtn.layer.borderColor = UIColor(hex: "#60D2A7").cgColor
285
+ sendNotificationBtn.layer.borderWidth = 2
286
+ sendNotificationBtn.layer.cornerRadius = 10
287
+ sendNotificationBtn.setTitleColor(UIColor(hex: "#000000"), for: .normal)
288
+ sendNotificationBtn.setTitle(isPatientFromWeb ? "SEND EMAIL NOTIFICATION" : "SEND NOTIFICATION", for: .normal)
289
+ sendNotificationBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 7 : 15))
290
+ // adminBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
291
+ sendNotificationBtn.addTarget(self, action:#selector(self.sendNotificationbuttonClicked), for: .touchUpInside)
292
+
293
+ denyBtn = UIButton(frame: CGRect(x: (centerView.frame.width/2) + 10, y: 275, width: 100, height: 50))
294
+ denyBtn.backgroundColor = UIColor(hex: "#E4EAED")
295
+ denyBtn.layer.borderColor = UIColor(hex: "#C4CBCF").cgColor
296
+ denyBtn.layer.borderWidth = 2
297
+ denyBtn.layer.cornerRadius = 10
298
+ denyBtn.setTitleColor(UIColor(hex: "#000000"), for: .normal)
299
+ denyBtn.setTitle("DENY", for: .normal)
300
+ denyBtn.titleLabel?.font = UIFont.boldSystemFont(ofSize: dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 10 : 15))
301
+ // adminBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
302
+ denyBtn.addTarget(self, action:#selector(self.denybuttonClicked), for: .touchUpInside)
303
+
304
+ centerView.addSubview(denyBtn)
305
+ centerView.addSubview(adminBtn)
306
+ centerView.addSubview(subscriberImg)
307
+ centerView.addSubview(subscriberStatusLabel)
308
+ centerView.addSubview(subscriberNameLabel)
309
+ centerView.addSubview(sendNotificationBtn)
310
+ //patientStatusChanged()
311
+ centerView.isHidden = true
312
+
177
313
  // subscriberImg = UIImageView(image: <#T##UIImage?#>)
178
- remoteView.addSubview(subscriberImg)
314
+ remoteView.addSubview(centerView)
179
315
  remoteView.addSubview(timerLabel)
180
316
  remoteView.addSubview(subscriberLabel)
317
+
181
318
  self.view.addSubview(remoteView)
182
319
  // someImageViewConstraints()
183
- let bottomView = UIView(frame: CGRect(x: 0, y: screenHeight - 90, width: 320, height: 90))
320
+ bottomView = UIView(frame: CGRect(x: 0, y: screenHeight - 90, width: 320, height: 90))
184
321
  bottomView.backgroundColor = UIColor.clear
185
322
  bottomView.center = CGPoint(x: self.view.frame.size.width / 2, y: self.view.frame.size.height - 50)
186
323
 
@@ -191,57 +328,129 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
191
328
 
192
329
  localView.layer.cornerRadius = 10;
193
330
  localView.clipsToBounds = true
331
+ localView.isHidden = true
194
332
 
195
333
  publisherLabel = UILabel(frame: CGRect(x: 0, y: Int(localView.frame.size.height - 40.0), width: Int(localView.frame.size.width), height: 40))
196
334
  publisherLabel.text = publisherName
197
335
  // publisherLabel.backgroundColor = UIColor(red: 31/255, green: 33/255, blue: 36/255, alpha: 1.0)
198
- publisherLabel.textColor = .white
336
+ publisherLabel.textColor = .white//UIColor(hex: "#000000")
199
337
  publisherLabel.textAlignment = .center
200
338
  publisherLabel.layer.zPosition = 1;
201
- publisherLabel.font = publisherLabel.font.withSize(dynamicFontSize(15))
339
+ publisherLabel.font = publisherLabel.font.withSize(dynamicFontSize(UIDevice.current.userInterfaceIdiom == .pad ? 10 : 15))
202
340
  localView.addSubview(publisherLabel)
203
341
  self.view.addSubview(localView)
204
342
 
205
- callBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 60, height: 60))
343
+ callBtn = UIButton(frame: CGRect(x: 240, y: 0, width: 60, height: 60))
206
344
  callBtn.backgroundColor = .clear
207
345
  callBtn.setBackgroundImage(UIImage(named: "callEnd"), for: .normal)
208
346
  callBtn.addTarget(self, action:#selector(self.callBtnbuttonClicked), for: .touchUpInside)
209
347
  bottomView.addSubview(callBtn)
210
348
 
211
- camaraBtn = UIButton(frame: CGRect(x: 80, y: 0, width: 60, height: 60))
349
+ camaraBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 60, height: 60))
212
350
  camaraBtn.backgroundColor = .clear
213
351
  camaraBtn.setBackgroundImage(UIImage(named: "cameraSwitch"), for: .normal)
214
352
  camaraBtn.addTarget(self, action:#selector(self.camaraBtnbuttonClicked), for: .touchUpInside)
215
353
  bottomView.addSubview(camaraBtn)
216
354
 
217
- videoBtn = UIButton(frame: CGRect(x: 160, y: 0, width: 60, height: 60))
355
+ videoBtn = UIButton(frame: CGRect(x: 80, y: 0, width: 60, height: 60))
218
356
  videoBtn.backgroundColor = .clear
219
357
  videoBtn.setBackgroundImage(UIImage(named: "cameraOnWhite"), for: .normal)
220
358
  videoBtn.addTarget(self, action:#selector(self.videoBtnbuttonClicked), for: .touchUpInside)
221
359
  bottomView.addSubview(videoBtn)
222
360
 
223
- audioBtn = UIButton(frame: CGRect(x: 240, y: 0, width: 60, height: 60))
361
+ audioBtn = UIButton(frame: CGRect(x: 160, y: 0, width: 60, height: 60))
224
362
  audioBtn.backgroundColor = .clear
225
363
  audioBtn.setBackgroundImage(UIImage(named: "microphoneOnWhite"), for: .normal)
226
364
  audioBtn.addTarget(self, action:#selector(self.audioBtnbuttonClicked), for: .touchUpInside)
227
365
  bottomView.addSubview(audioBtn)
228
366
 
367
+
229
368
  }
230
369
  deinit{
231
370
  if(!isCallEnded){
232
371
  let userInfo = ["userInfo": ["isProvider": self.isProvider]]
233
372
  NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
373
+ NotificationCenter.default.post(name: NSNotification.Name("RemoveObservers"),object: nil,userInfo: userInfo)
234
374
  }
235
375
 
236
376
  }
237
-
238
- @objc func callBtnbuttonClicked() {
239
-
377
+ func patientStatusChanged(){
378
+ if(isProvider && isPatientOnLine){
379
+ centerView.isHidden = false
380
+ sendNotificationBtn.isHidden = true
381
+ adminBtn.isHidden = false
382
+ denyBtn.isHidden = false
383
+ subscriberStatusLabel.text = "WAITING"
384
+ subscriberStatusLabel.backgroundColor = UIColor(hex: "#DFF6ED")
385
+ subscriberNameLabel.isHidden = false
386
+ }else if(isProvider && !isPatientOnLine){
387
+ centerView.isHidden = false
388
+ sendNotificationBtn.isHidden = false
389
+ adminBtn.isHidden = true
390
+ denyBtn.isHidden = true
391
+ subscriberStatusLabel.text = "OFFLINE"
392
+ subscriberStatusLabel.backgroundColor = UIColor(hex: "#ffd6ca")
393
+ subscriberNameLabel.isHidden = false
394
+ }else{
395
+ centerView.isHidden = false
396
+ sendNotificationBtn.isHidden = true
397
+ adminBtn.isHidden = true
398
+ denyBtn.isHidden = true
399
+ subscriberStatusLabel.isHidden = true
400
+ subscriberNameLabel.isHidden = false
401
+
402
+ }
403
+ }
404
+ @objc func sendNotificationbuttonClicked() {
405
+ print("sendNotificationbuttonClicked")
406
+ centerView.isHidden = false
407
+ sendNotificationBtn.isHidden = true
408
+ adminBtn.isHidden = true
409
+ denyBtn.isHidden = true
410
+ subscriberStatusLabel.isHidden = false
411
+ subscriberNameLabel.isHidden = false
412
+ subscriberStatusLabel.text = "Please Wait.."
413
+ let userInfo = ["userInfo": ["isProvider": isProvider]]
414
+ NotificationCenter.default.post(name: NSNotification.Name("SendNotification"),object: nil,userInfo: userInfo)
415
+ // self.session?.disconnect(nil)
416
+ // self.stopTimer()
417
+ // self.dismiss(animated: true, completion: nil)
418
+ }
419
+ @objc func adminbuttonClicked() {
420
+ print("Admin button clicked")
421
+ centerView.isHidden = false
422
+ sendNotificationBtn.isHidden = true
423
+ adminBtn.isHidden = true
424
+ denyBtn.isHidden = true
425
+ subscriberStatusLabel.isHidden = false
426
+ subscriberNameLabel.isHidden = false
427
+ subscriberStatusLabel.text = "Please Wait.."
428
+ //subscriberStatusLabel.frame.width =
429
+ // let userInfo = ["userInfo": ["isProvider": isProvider]]
430
+ // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
431
+ // self.session?.disconnect(nil)
432
+ // self.stopTimer()
433
+ // self.dismiss(animated: true, completion: nil)
434
+ let userInfo = ["userInfo": ["isProvider": isProvider]]
435
+ NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
436
+ }
437
+ @objc func denybuttonClicked() {
438
+ print("deny button clicked")
439
+ centerView.isHidden = true
240
440
  let userInfo = ["userInfo": ["isProvider": isProvider]]
441
+
241
442
  NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
242
443
  self.session?.disconnect(nil)
243
444
  self.stopTimer()
244
445
  self.dismiss(animated: true, completion: nil)
446
+ NotificationCenter.default.post(name: NSNotification.Name("RemoveObservers"),object: nil,userInfo: userInfo)
447
+ }
448
+
449
+ @objc func callBtnbuttonClicked() {
450
+
451
+ let userInfo = ["userInfo": ["isProvider": isProvider]]
452
+ NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
453
+ self.endVonageCall()
245
454
  }
246
455
 
247
456
  @objc func camaraBtnbuttonClicked() {
@@ -276,6 +485,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
276
485
  if (self.isAudioMute) {
277
486
 
278
487
  self.publisher?.publishAudio = true
488
+ //self.publisher.del
279
489
  self.audioBtn.setImage(UIImage(named : "microphoneOnWhite"), for: .normal)
280
490
  self.isAudioMute = false
281
491
  } else {
@@ -297,10 +507,14 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
297
507
 
298
508
  //session methods
299
509
  func sessionDidConnect(_ session: OTSession) {
510
+ hideActivityIndicator()
511
+ localView.isHidden = false
300
512
  print("The client connected to the OpenTok session.")
301
513
  let userInfo = ["userInfo": ["isProvider": isProvider]]
302
- NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
514
+ // NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoStarted),object: nil,userInfo: userInfo)
303
515
  let settings = OTPublisherSettings()
516
+ settings.cameraResolution = .high
517
+ settings.cameraFrameRate = .rate30FPS
304
518
  settings.name = publisherName
305
519
  guard let publisher = OTPublisher(delegate: self, settings: settings) else {
306
520
  print("publisher create error")
@@ -325,6 +539,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
325
539
 
326
540
  localView.addSubview(publisherView)
327
541
  startTimer()
542
+ DispatchQueue.main.async {
543
+ self.patientStatusChanged()
544
+ }
545
+
328
546
  }
329
547
 
330
548
  func sessionDidDisconnect(_ session: OTSession) {
@@ -356,6 +574,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
356
574
  }
357
575
 
358
576
  guard let subscriberView = subscriber.view else {
577
+ print("subscriberView empty")
359
578
  return
360
579
  }
361
580
 
@@ -378,11 +597,13 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
378
597
  // cleanupSubscriber()
379
598
  let userInfo = ["userInfo": ["isProvider": isProvider]]
380
599
  NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
381
- self.session?.disconnect(nil)
382
- self.dismiss(animated: true, completion: nil)
600
+ // self.session?.disconnect(nil)
601
+ self.endVonageCall()
602
+ //self.dismiss(animated: true, completion: nil)
383
603
  }
384
604
  if(stream.videoType != .screen){
385
605
  subscriberImg.isHidden = false
606
+ subscriberNameLabel.isHidden = false
386
607
  showToast(message: "\(subscriberName) is left the call")
387
608
  cleanupSubscriber()
388
609
  }
@@ -415,6 +636,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
415
636
  public func subscriberDidConnect(toStream subscriber: OTSubscriberKit) {
416
637
  print("The subscriber did connect to the stream.")
417
638
  subscriberImg.isHidden = true
639
+ subscriberStatusLabel.isHidden = true
640
+ subscriberNameLabel.isHidden = true
641
+ timerLabel.textColor = .white
642
+ isCallInProgress = true
418
643
  if(subscriber.stream?.videoType != .screen){
419
644
  showToast(message: "\(subscriberName) is joined the call")
420
645
  }
@@ -428,13 +653,20 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
428
653
 
429
654
  func subscriberVideoDisabled(_ subscriber: OTSubscriberKit, reason: OTSubscriberVideoEventReason) {
430
655
  // Display the video disabled indicator
656
+ print("subscriberVideoDisabled")
431
657
  showToast(message: "\(subscriberName) video disabled")
432
658
  subscriberImg.isHidden = false
659
+ subscriberNameLabel.isHidden = false
660
+ remoteView.backgroundColor = .white
433
661
  }
434
662
 
435
663
  func subscriberVideoEnabled(_ subscriber: OTSubscriberKit, reason: OTSubscriberVideoEventReason) {
664
+ print("subscriberVideoEnabled")
436
665
  showToast(message: "\(subscriberName) video enabled")
437
666
  subscriberImg.isHidden = true
667
+ subscriberStatusLabel.isHidden = true
668
+ subscriberNameLabel.isHidden = true
669
+ timerLabel.textColor = .white
438
670
  // showToast(message: "is provider \(isProvider) video enabled")
439
671
 
440
672
  // Remove the video disabled indicator
@@ -443,23 +675,34 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
443
675
  @IBAction func endCallAction(_ sender: Any) {
444
676
  isCallEnded = true
445
677
  let userInfo = ["userInfo": ["isProvider": self.isProvider]]
678
+
446
679
  NotificationCenter.default.post(name: NSNotification.Name(NotificationNames.videoEnded),object: nil,userInfo: userInfo)
447
680
  endVonageCall()
448
681
  }
449
682
  fileprivate func endVonageCall(){
450
683
  isCallEnded = true
684
+ let userInfo = ["userInfo": ["isProvider": self.isProvider]]
685
+ NotificationCenter.default.post(name: NSNotification.Name("RemoveObservers"),object: nil,userInfo: userInfo)
451
686
  DispatchQueue.main.async {
687
+ print("video ended called")
688
+ self.session?.disconnect(nil)
689
+
690
+ // self.publisher?.publishVideo = false
691
+ self.publisher?.videoCapture?.stop()
692
+ // self.publisher?.publishAudio = false
452
693
 
453
694
  self.cleanupSubscriber()
454
695
  self.cleanupPublisher()
455
- self.session?.disconnect(nil)
456
696
  self.stopTimer()
457
- // self.dismiss(animated: true, completion: nil)
697
+ self.dismiss(animated: true) {
698
+ print("video ended")
699
+ }
458
700
  }
459
701
  }
460
702
  fileprivate func cleanupSubscriber() {
461
703
  subscriber?.view?.removeFromSuperview()
462
704
  subscriber = nil
705
+ remoteView.backgroundColor = .white
463
706
  }
464
707
 
465
708
  fileprivate func cleanupPublisher() {
@@ -472,6 +715,50 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
472
715
  subscriberImg.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
473
716
  subscriberImg.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: 28).isActive = true
474
717
  }
718
+ // override func viewDidLayoutSubviews() {
719
+ // super.viewDidLayoutSubviews()
720
+ // let screenHeight = self.view.bounds.height
721
+ // let screenWidth = self.view.bounds.width
722
+ //
723
+ // remoteView.frame = CGRect(x: 0, y: 0, width: self.view.bounds.width, height:self.view.bounds.height)
724
+ // subscriberLabel.frame = CGRect(x: 20, y: Int(screenHeight) - 180, width: Int(remoteView.frame.size.width - 180), height: 40)
725
+ // subscriberLabel.layer.zPosition = 1;
726
+ //
727
+ // timerLabel.frame = CGRect(x: 30, y: Int(screenHeight) - 155, width: Int(remoteView.frame.size.width - 140), height: 40)
728
+ // timerLabel.layer.zPosition = 1;
729
+ //
730
+ // subscriberImg.layer.zPosition = 1
731
+ // subscriberImg.frame = CGRect(x: 0, y: 0, width: 200, height: 200)
732
+ // subscriberImg.layer.cornerRadius = 100
733
+ // subscriberImg.clipsToBounds = true
734
+ // subscriberImg.center.x = centerView.center.x
735
+ // //subscriberImg.center.y = centerView.center.y - 100
736
+ //
737
+ // bottomView.frame = CGRect(x: 0, y: screenHeight - 90, width: 320, height: 90)
738
+ // bottomView.center = CGPoint(x: self.view.frame.size.width / 2, y: self.view.frame.size.height - 50)
739
+ //
740
+ // localView.frame = CGRect(x: screenWidth - 140, y: screenHeight - 250, width: 120, height: 120)
741
+ //
742
+ // localView.layer.cornerRadius = 10;
743
+ // localView.clipsToBounds = true
744
+ //
745
+ // publisherLabel.frame = CGRect(x: 0, y: Int(localView.frame.size.height - 40.0), width: Int(localView.frame.size.width), height: 40)
746
+ //
747
+ // publisherLabel.layer.zPosition = 1;
748
+ //
749
+ //
750
+ // callBtn.frame = CGRect(x: 0, y: 0, width: 60, height: 60)
751
+ //
752
+ //
753
+ // camaraBtn.frame = CGRect(x: 80, y: 0, width: 60, height: 60)
754
+ //
755
+ //
756
+ // videoBtn.frame = CGRect(x: 160, y: 0, width: 60, height: 60)
757
+ //
758
+ //
759
+ // audioBtn.frame = CGRect(x: 240, y: 0, width: 60, height: 60)
760
+ // }
761
+
475
762
  }
476
763
 
477
764
  extension String {
@@ -484,10 +771,10 @@ extension UIViewController {
484
771
 
485
772
  func showToast(message : String) {
486
773
  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
774
+ let toastLabel = UILabel(frame: CGRect(x: 100, y: 40, width: self.view.frame.size.width - 100, height: 50))
775
+ // toastLabel.center.x = self.view.center.x
776
+ toastLabel.backgroundColor = UIColor(hex: "#0B6623")//UIColor.white.withAlphaComponent(0.6)
777
+ toastLabel.textColor = .white//UIColor.black
491
778
  toastLabel.font = .systemFont(ofSize: 12.0)
492
779
  toastLabel.textAlignment = .center;
493
780
  toastLabel.text = message
@@ -504,3 +791,21 @@ func showToast(message : String) {
504
791
  }
505
792
 
506
793
  }
794
+ extension UIColor {
795
+ convenience init(hex: String, alpha: CGFloat = 1.0) {
796
+ var hexValue = hex.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).uppercased()
797
+
798
+ if hexValue.hasPrefix("#") {
799
+ hexValue.remove(at: hexValue.startIndex)
800
+ }
801
+
802
+ var rgbValue: UInt64 = 0
803
+ Scanner(string: hexValue).scanHexInt64(&rgbValue)
804
+
805
+ let red = CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0
806
+ let green = CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0
807
+ let blue = CGFloat(rgbValue & 0x0000FF) / 255.0
808
+
809
+ self.init(red: red, green: green, blue: blue, alpha: alpha)
810
+ }
811
+ }
@@ -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,16 @@ 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(sendNotification(_:)),name: NSNotification.Name ("SendNotification"),object: nil)
38
+ NotificationCenter.default.addObserver(self,selector:#selector(removeObservers(_:)),name: NSNotification.Name ("RemoveObservers"),object: nil)
34
39
  // if let visibleViewCtrl = UIApplication.topViewController() {
35
40
  // // do whatever you want with your `visibleViewCtrl`
36
41
  // print(visibleViewCtrl)
@@ -46,17 +51,32 @@ public class vonagePlugin: CAPPlugin {
46
51
 
47
52
  call.resolve(["value": "Video call initiated"])
48
53
  }
54
+ @objc func setPatientOnlineStatus(_ call: CAPPluginCall) {
55
+
56
+ let isOnline = call.getBool("isOnline") ?? false
57
+
58
+ NotificationCenter.default.post(name: NSNotification.Name("PatientOnlineStatus"),object: nil,userInfo: ["isOnline":isOnline])
59
+
60
+ call.resolve(["value": "setPatientOnlineStatus"])
61
+ }
49
62
  @objc func endVideoCall(_ call: CAPPluginCall) {
50
63
  NotificationCenter.default.post(name: NSNotification.Name("EndVideoCall"),object: nil,userInfo: nil)
51
64
  call.resolve(["value": "Video call ended."])
52
65
  }
53
66
  @objc func videoEnded(_ notification: Notification){
54
67
  self.notifyListeners(NotificationNames.videoEnded, data: notification.userInfo?["userInfo"] as? [String: Any] ?? [:])
55
- NotificationCenter.default.removeObserver(self, name: NSNotification.Name(NotificationNames.videoEnded), object: nil)
68
+ // NotificationCenter.default.removeObserver(self, name: NSNotification.Name(NotificationNames.videoEnded), object: nil)
56
69
  }
57
70
  @objc func videoStarted(_ notification: Notification){
58
71
  self.notifyListeners(NotificationNames.videoStarted, data: notification.userInfo?["userInfo"] as? [String: Any] ?? [:])
59
- NotificationCenter.default.removeObserver(self, name: NSNotification.Name(NotificationNames.videoStarted), object: nil)
72
+ // NotificationCenter.default.removeObserver(self, name: NSNotification.Name(NotificationNames.videoStarted), object: nil)
73
+ }
74
+ @objc func sendNotification(_ notification: Notification){
75
+ self.notifyListeners("SendNotification", data: notification.userInfo?["userInfo"] as? [String: Any] ?? [:])
76
+ // NotificationCenter.default.removeObserver(self, name: NSNotification.Name("SendNotification"), object: nil)
77
+ }
78
+ @objc func removeObservers(_ notification: Notification){
79
+ NotificationCenter.default.removeObserver(self)
60
80
  }
61
81
  }
62
82
  extension UIApplication {
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.6",
4
4
  "description": "opentok sdk capacitor plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",