CallNative.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. package com.nxsample;
  2. import androidx.annotation.NonNull;
  3. import com.facebook.react.bridge.Promise;
  4. import com.facebook.react.bridge.ReactApplicationContext;
  5. import com.facebook.react.bridge.ReactContextBaseJavaModule;
  6. import com.facebook.react.bridge.ReactMethod;
  7. import io.nexilis.ui.API;
  8. public class CallNative extends ReactContextBaseJavaModule {
  9. CallNative(ReactApplicationContext context) {
  10. super(context);
  11. }
  12. @NonNull
  13. @Override
  14. public String getName() {
  15. return "CallNative";
  16. }
  17. @ReactMethod
  18. public void openContactCenter(Promise promise) {
  19. String response = API.openContactCenter();
  20. promise.resolve(response);
  21. }
  22. @ReactMethod
  23. public void openChat(Promise promise) {
  24. String response = API.openChat();
  25. promise.resolve(response);
  26. }
  27. @ReactMethod
  28. public void openCall(Promise promise) {
  29. String response = API.openCall();
  30. promise.resolve(response);
  31. }
  32. @ReactMethod
  33. public void openStreaming(Promise promise) {
  34. String response = API.openLiveStreaming();
  35. promise.resolve(response);
  36. }
  37. @ReactMethod
  38. public void openSetting() {
  39. API.openSettings();
  40. }
  41. @ReactMethod
  42. public void openProfile() {
  43. API.openProfile();
  44. }
  45. @ReactMethod
  46. public void openWhiteboard(Promise promise) {
  47. String response = API.openWhiteboard();
  48. promise.resolve(response);
  49. }
  50. @ReactMethod
  51. public void openChatGPT(Promise promise) {
  52. String response = API.openSmartChatbot();
  53. promise.resolve(response);
  54. }
  55. @ReactMethod
  56. public void openContactCenterChat(int category, Promise promise) {
  57. String response = API.openContactCenter(0, category);
  58. promise.resolve(response);
  59. }
  60. @ReactMethod
  61. public void openContactCenterAudioCall(int category, Promise promise) {
  62. String response = API.openContactCenter(1, category);
  63. promise.resolve(response);
  64. }
  65. @ReactMethod
  66. public void openContactCenterVideoCall(int category, Promise promise) {
  67. String response = API.openContactCenter(2, category);
  68. promise.resolve(response);
  69. }
  70. @ReactMethod
  71. public void signInAdmin(String pwd, Promise promise) {
  72. if(pwd.trim().isEmpty()) {
  73. promise.reject("signInAdmin error", "pwd is null");
  74. return;
  75. }
  76. String response = API.signInAdmin(pwd);
  77. promise.resolve(response);
  78. }
  79. @ReactMethod
  80. public void openSetOfficer(Promise promise) {
  81. String response = API.openSetAsOfficerForm();
  82. promise.resolve(response);
  83. }
  84. @ReactMethod
  85. public void openSecureFolder(Promise promise) {
  86. String response = API.openSecureFolder();
  87. promise.resolve(response);
  88. }
  89. @ReactMethod
  90. public void openNotificationCenter(Promise promise) {
  91. String response = API.openNotificationCenter();
  92. promise.resolve(response);
  93. }
  94. }