NativePlugin.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. package com.example.nexilissamplecodeionic;
  2. import com.getcapacitor.JSObject;
  3. import com.getcapacitor.Plugin;
  4. import com.getcapacitor.PluginCall;
  5. import com.getcapacitor.PluginMethod;
  6. import com.getcapacitor.annotation.CapacitorPlugin;
  7. import io.nexilis.service.API;
  8. @CapacitorPlugin(name = "NativeCap")
  9. public class NativePlugin extends Plugin {
  10. @PluginMethod
  11. public void openContactCenter(PluginCall call) {
  12. String response = API.openContactCenter();
  13. JSObject ret = new JSObject();
  14. ret.put("response", response);
  15. call.resolve(ret);
  16. }
  17. @PluginMethod
  18. public void openChat(PluginCall call) {
  19. String response = API.openChat();
  20. JSObject ret = new JSObject();
  21. ret.put("response", response);
  22. call.resolve(ret);
  23. }
  24. @PluginMethod
  25. public void openCall(PluginCall call) {
  26. String response = API.openCall();
  27. JSObject ret = new JSObject();
  28. ret.put("response", response);
  29. call.resolve(ret);
  30. }
  31. @PluginMethod
  32. public void openStreaming(PluginCall call) {
  33. String response = API.openLiveStreaming();
  34. JSObject ret = new JSObject();
  35. ret.put("response", response);
  36. call.resolve(ret);
  37. }
  38. @PluginMethod
  39. public void openChatGPT(PluginCall call) {
  40. String response = API.openSmartChatbot();
  41. JSObject ret = new JSObject();
  42. ret.put("response", response);
  43. call.resolve(ret);
  44. }
  45. @PluginMethod
  46. public void openSetOfficer(PluginCall call) {
  47. String response = API.openSetAsOfficerForm();
  48. JSObject ret = new JSObject();
  49. ret.put("response", response);
  50. call.resolve(ret);
  51. }
  52. @PluginMethod
  53. public void openSettings(PluginCall call) {
  54. API.openSettings();
  55. }
  56. @PluginMethod
  57. public void openProfile(PluginCall call) {
  58. API.openProfile();
  59. }
  60. @PluginMethod
  61. public void openContactCenterChat(PluginCall call) {
  62. int category = call.getInt("category", 0);
  63. String response = API.openContactCenter(0, category);
  64. JSObject ret = new JSObject();
  65. ret.put("response", response);
  66. call.resolve(ret);
  67. }
  68. @PluginMethod
  69. public void openContactCenterAudioCall(PluginCall call) {
  70. int category = call.getInt("category", 0);
  71. String response = API.openContactCenter(1, category);
  72. JSObject ret = new JSObject();
  73. ret.put("response", response);
  74. call.resolve(ret);
  75. }
  76. @PluginMethod
  77. public void openContactCenterVideoCall(PluginCall call) {
  78. int category = call.getInt("category", 0);
  79. String response = API.openContactCenter(2, category);
  80. JSObject ret = new JSObject();
  81. ret.put("response", response);
  82. call.resolve(ret);
  83. }
  84. @PluginMethod
  85. public void adminSignIn(PluginCall call) {
  86. if (!call.getData().has("pwd")) {
  87. call.reject("Must provide an pwd");
  88. return;
  89. }
  90. String pwd = call.getString("pwd");
  91. String response = API.signInAdmin(pwd);
  92. JSObject ret = new JSObject();
  93. ret.put("response", response);
  94. call.resolve(ret);
  95. }
  96. @PluginMethod
  97. public void openWhiteboard(PluginCall call) {
  98. String response = API.openWhiteboard();
  99. JSObject ret = new JSObject();
  100. ret.put("response", response);
  101. call.resolve(ret);
  102. }
  103. @PluginMethod
  104. public void openSecureFolder(PluginCall call) {
  105. String response = API.openSecureFolder();
  106. JSObject ret = new JSObject();
  107. ret.put("response", response);
  108. call.resolve(ret);
  109. }
  110. @PluginMethod
  111. public void openNotificationCenter(PluginCall call) {
  112. String response = API.openNotificationCenter();
  113. JSObject ret = new JSObject();
  114. ret.put("response", response);
  115. call.resolve(ret);
  116. }
  117. }