CallNative.java 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. package com.nexilissamplecode;
  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.service.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 openWhiteboard(Promise promise) {
  43. String response = API.openWhiteboard();
  44. promise.resolve(response);
  45. }
  46. @ReactMethod
  47. public void openChatGPT(Promise promise) {
  48. String response = API.openSmartChatbot();
  49. promise.resolve(response);
  50. }
  51. @ReactMethod
  52. public void openContactCenterChat(int category, Promise promise) {
  53. String response = API.openContactCenter(0, category);
  54. promise.resolve(response);
  55. }
  56. @ReactMethod
  57. public void openContactCenterAudioCall(int category, Promise promise) {
  58. String response = API.openContactCenter(1, category);
  59. promise.resolve(response);
  60. }
  61. @ReactMethod
  62. public void openContactCenterVideoCall(int category, Promise promise) {
  63. String response = API.openContactCenter(2, category);
  64. promise.resolve(response);
  65. }
  66. @ReactMethod
  67. public void signInAdmin(String pwd, Promise promise) {
  68. if(pwd.trim().isEmpty()) {
  69. promise.reject("signInAdmin error", "pwd is null");
  70. return;
  71. }
  72. String response = API.signInAdmin(pwd);
  73. promise.resolve(response);
  74. }
  75. @ReactMethod
  76. public void openSetOfficer(Promise promise) {
  77. String response = API.openSetAsOfficerForm();
  78. promise.resolve(response);
  79. }
  80. }