capacitor-plugin-vonage 0.1.6 → 0.1.8
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/android/src/main/java/com/managemyhealth/plugin/vonage/VideoCallActivity.java +50 -48
- package/android/src/main/java/com/managemyhealth/plugin/vonage/vonagePlugin.java +2 -0
- package/ios/Plugin/VideoChatViewController.swift +25 -12
- package/ios/Plugin/vonagePlugin.swift +2 -1
- package/package.json +1 -1
@@ -51,6 +51,7 @@ import pub.devrel.easypermissions.EasyPermissions;
|
|
51
51
|
public class VideoCallActivity extends AppCompatActivity implements EasyPermissions.PermissionCallbacks, Application.ActivityLifecycleCallbacks {
|
52
52
|
private static final String TAG = VideoCallActivity.class.getSimpleName();
|
53
53
|
private static Toast GlobalToast;
|
54
|
+
// public Integer streamCount =0;
|
54
55
|
public Session session;
|
55
56
|
private static Bridge staticBridge = null;
|
56
57
|
private String dummyProfile = "https://www.gravatar.com/avatar/?d=mp";
|
@@ -61,6 +62,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
61
62
|
String PUBLISHERNAME;
|
62
63
|
String profilePicApiUrl;
|
63
64
|
boolean isPatientOnline = false;
|
65
|
+
boolean enableVCConfig = false;
|
64
66
|
boolean isMuted = false;
|
65
67
|
boolean isCamOff = false;
|
66
68
|
public boolean temptest = false;
|
@@ -108,6 +110,9 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
108
110
|
private final Session.SessionListener sessionListener = new Session.SessionListener() {
|
109
111
|
@Override
|
110
112
|
public void onConnected(Session session) {
|
113
|
+
if(!enableVCConfig){
|
114
|
+
notifyObservers("admit");
|
115
|
+
}
|
111
116
|
main.setVisibility(View.VISIBLE);
|
112
117
|
startTimer();
|
113
118
|
progressBar.setVisibility(View.INVISIBLE);
|
@@ -371,6 +376,7 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
371
376
|
PUBLISHERNAME = intent.getStringExtra("publisherName");
|
372
377
|
profilePicApiUrl = intent.getStringExtra("profilePicApiUrl");
|
373
378
|
isPatientOnline = intent.getBooleanExtra("isPatientOnline",false);
|
379
|
+
enableVCConfig = intent.getBooleanExtra("enableVCConfig",false);
|
374
380
|
ISPROVIDER = intent.getBooleanExtra("isProvider",false);
|
375
381
|
publisherViewContainer = findViewById(R.id.publisher_container);
|
376
382
|
subscriberViewContainer = findViewById(R.id.subscriber_container);
|
@@ -379,20 +385,27 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
379
385
|
publisherNameTextView = findViewById(R.id.publisherName);
|
380
386
|
publishernameView = findViewById(R.id.publisherNameView);
|
381
387
|
TextView subscriberNameTextView = findViewById(R.id.subscriberName);
|
382
|
-
if(
|
383
|
-
if (
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
388
|
+
if(enableVCConfig){
|
389
|
+
if (ISPROVIDER) {
|
390
|
+
if (isPatientOnline) {
|
391
|
+
patientStatus.setText("WAITING");
|
392
|
+
sendNotifications.setVisibility(View.GONE);
|
393
|
+
admit.setVisibility(View.VISIBLE);
|
394
|
+
deny.setVisibility(View.VISIBLE);
|
395
|
+
patientStatus.setBackgroundColor(getResources().getColor(R.color.waiting));
|
396
|
+
} else {
|
397
|
+
admit.setVisibility(View.GONE);
|
398
|
+
deny.setVisibility(View.GONE);
|
399
|
+
sendNotifications.setVisibility(View.VISIBLE);
|
400
|
+
patientStatus.setText("OFFLINE");
|
401
|
+
patientStatus.setBackgroundColor(getResources().getColor(R.color.offline));
|
402
|
+
}
|
395
403
|
}
|
404
|
+
}else{
|
405
|
+
admit.setVisibility(View.GONE);
|
406
|
+
deny.setVisibility(View.GONE);
|
407
|
+
sendNotifications.setVisibility(View.GONE);
|
408
|
+
patientStatus.setVisibility(View.GONE);
|
396
409
|
}
|
397
410
|
publisherNameTextView.setText(SUBSCRIBERNAME);
|
398
411
|
publishernameView.setText(SUBSCRIBERNAME);
|
@@ -579,45 +592,34 @@ public class VideoCallActivity extends AppCompatActivity implements EasyPermissi
|
|
579
592
|
}
|
580
593
|
}
|
581
594
|
public void patientStatusChanged(Boolean isOnline) {
|
582
|
-
Log.d("patientStatusChanged", String.valueOf(isOnline));
|
583
|
-
Log.d("patientStatusChanged2", String.valueOf(isOnline));
|
584
|
-
Log.d("patientStatusChanged2", String.valueOf(isOnline));
|
585
|
-
Log.d("patientStatusChanged2", String.valueOf(instance.ISPROVIDER));
|
586
|
-
|
587
|
-
// if(instance.ISPROVIDER){
|
588
|
-
Log.d("patientStatuISPROVIDER", String.valueOf(isOnline));
|
589
|
-
|
590
|
-
if(subscriber==null){
|
591
|
-
runOnUiThread(new Runnable() {
|
592
|
-
@Override
|
593
|
-
public void run() {
|
594
|
-
temptest = isOnline;
|
595
|
-
if (isOnline) {
|
596
|
-
Log.d("isOnline", String.valueOf(isOnline));
|
597
595
|
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
596
|
+
if(enableVCConfig) {
|
597
|
+
if (subscriber == null) {
|
598
|
+
runOnUiThread(new Runnable() {
|
599
|
+
@Override
|
600
|
+
public void run() {
|
601
|
+
temptest = isOnline;
|
602
|
+
if (isOnline) {
|
603
|
+
patientStatus.setText("WAITING");
|
604
|
+
sendNotifications.setVisibility(View.GONE);
|
605
|
+
admit.setVisibility(View.VISIBLE);
|
606
|
+
deny.setVisibility(View.VISIBLE);
|
607
|
+
publishernameView.setVisibility(View.VISIBLE);
|
608
|
+
patientStatus.setBackgroundResource(R.color.waiting);
|
609
|
+
} else {
|
610
|
+
patientStatus.setText("OFFLINE");
|
611
|
+
admit.setVisibility(View.GONE);
|
612
|
+
deny.setVisibility(View.GONE);
|
613
|
+
publishernameView.setVisibility(View.VISIBLE);
|
614
|
+
sendNotifications.setVisibility(View.VISIBLE);
|
615
|
+
patientStatus.setText("OFFLINE");
|
616
|
+
patientStatus.setBackgroundResource(R.color.offline);
|
617
|
+
}
|
614
618
|
}
|
619
|
+
});
|
620
|
+
}
|
615
621
|
|
616
|
-
|
617
|
-
}
|
618
|
-
});
|
619
622
|
}
|
620
|
-
// }
|
621
623
|
}
|
622
624
|
public static void showGreenToast(Context context, String message) {
|
623
625
|
if(GlobalToast!=null){
|
@@ -128,6 +128,7 @@ public class vonagePlugin extends Plugin{
|
|
128
128
|
final String SUBSCRIBERNAME = call.getString("subscriberName");
|
129
129
|
final Boolean ISPROVIDER = call.getBoolean("isProvider");
|
130
130
|
final Boolean isPatientOnline = call.getBoolean("isPatientOnline");
|
131
|
+
final Boolean enableVCConfig = call.getBoolean("enableVCConfig");
|
131
132
|
final String profilePicApiUrl = call.getString("profilePhoto");
|
132
133
|
showLog("profilePicApiUrl");
|
133
134
|
showLog(profilePicApiUrl);
|
@@ -142,6 +143,7 @@ public class vonagePlugin extends Plugin{
|
|
142
143
|
intent.putExtra("isProvider", ISPROVIDER);
|
143
144
|
intent.putExtra("isPatientOnline", isPatientOnline);
|
144
145
|
intent.putExtra("profilePicApiUrl", profilePicApiUrl);
|
146
|
+
intent.putExtra("enableVCConfig", enableVCConfig);
|
145
147
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);//|Intent.FLAG_ACTIVITY_NEW_TASK
|
146
148
|
try {
|
147
149
|
showLog("try======");
|
@@ -25,6 +25,7 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
25
25
|
var isPatientOnLine = true
|
26
26
|
var isPatientFromWeb = true
|
27
27
|
var videoCallParam = String()
|
28
|
+
var enableVCConfig = false
|
28
29
|
var profilePicApiUrl = ""
|
29
30
|
// var session: OTSession?
|
30
31
|
//var publisher: OTPublisher?
|
@@ -168,7 +169,10 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
168
169
|
isPatientOnLine = false
|
169
170
|
}
|
170
171
|
DispatchQueue.main.async {
|
171
|
-
self.
|
172
|
+
if(self.enableVCConfig){
|
173
|
+
self.patientStatusChanged()
|
174
|
+
}
|
175
|
+
|
172
176
|
}
|
173
177
|
|
174
178
|
// }
|
@@ -333,7 +337,11 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
333
337
|
centerView.addSubview(subscriberNameLabel)
|
334
338
|
centerView.addSubview(sendNotificationBtn)
|
335
339
|
//patientStatusChanged()
|
336
|
-
centerView.isHidden =
|
340
|
+
centerView.isHidden = false
|
341
|
+
adminBtn.isHidden = true
|
342
|
+
denyBtn.isHidden = true
|
343
|
+
sendNotificationBtn.isHidden = true
|
344
|
+
subscriberStatusLabel.isHidden = true
|
337
345
|
|
338
346
|
// subscriberImg = UIImageView(image: <#T##UIImage?#>)
|
339
347
|
//remoteView.addSubview(centerView)
|
@@ -572,7 +580,12 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
572
580
|
localView.addSubview(publisherView)
|
573
581
|
startTimer()
|
574
582
|
DispatchQueue.main.async {
|
575
|
-
self.
|
583
|
+
if(self.enableVCConfig){
|
584
|
+
self.patientStatusChanged()
|
585
|
+
}else{
|
586
|
+
let userInfo = ["isProvider": self.isProvider]
|
587
|
+
self.delegate?.videoCallStarted(userInfo)
|
588
|
+
}
|
576
589
|
}
|
577
590
|
|
578
591
|
}
|
@@ -672,15 +685,15 @@ class VideoChatViewController: UIViewController,OTSessionDelegate,OTPublisherDel
|
|
672
685
|
|
673
686
|
|
674
687
|
}
|
675
|
-
func sessionDidBeginReconnecting(_ session:OTSession) {
|
676
|
-
// Display a user interface notification.
|
677
|
-
print("sessionDidBeginReconnecting \(session.sessionId)")
|
678
|
-
}
|
679
|
-
|
680
|
-
func sessionDidReconnect(_ session: OTSession) {
|
681
|
-
// Adjust user interface.
|
682
|
-
print("sessionDidReconnect \(session.sessionId)")
|
683
|
-
}
|
688
|
+
// func sessionDidBeginReconnecting(_ session:OTSession) {
|
689
|
+
// // Display a user interface notification.
|
690
|
+
// print("sessionDidBeginReconnecting \(session.sessionId)")
|
691
|
+
// }
|
692
|
+
//
|
693
|
+
// func sessionDidReconnect(_ session: OTSession) {
|
694
|
+
// // Adjust user interface.
|
695
|
+
// print("sessionDidReconnect \(session.sessionId)")
|
696
|
+
// }
|
684
697
|
//Publisher methods
|
685
698
|
func publisher(_ publisher: OTPublisherKit, didFailWithError error: OTError) {
|
686
699
|
print("The publisher failed: \(error)")
|
@@ -17,6 +17,7 @@ public class vonagePlugin: CAPPlugin,VonageSDKInteractionDelegate {
|
|
17
17
|
let isProvider = call.getBool("isProvider") ?? false //profilePicApiUrl
|
18
18
|
let isPatientOnline = call.getBool("isPatientOnline") ?? false
|
19
19
|
let profilePhoto = call.getString("profilePhoto") ?? ""
|
20
|
+
let enableVCConfig = call.getBool("enableVCConfig") ?? false
|
20
21
|
DispatchQueue.main.async {
|
21
22
|
let vc = VideoChatViewController()
|
22
23
|
vc.kApiKey = apiKey
|
@@ -27,7 +28,7 @@ public class vonagePlugin: CAPPlugin,VonageSDKInteractionDelegate {
|
|
27
28
|
vc.isProvider = isProvider
|
28
29
|
vc.isPatientOnLine = isPatientOnline
|
29
30
|
vc.profilePicApiUrl = profilePhoto
|
30
|
-
|
31
|
+
vc.enableVCConfig = enableVCConfig
|
31
32
|
vc.modalPresentationStyle = .fullScreen
|
32
33
|
vc.delegate = self
|
33
34
|
self.bridge?.viewController?.present(vc, animated: true, completion: nil)
|