fcr-ui-scene 3.7.2 → 3.7.3

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.
Files changed (246) hide show
  1. package/lib/creator.js +23 -44
  2. package/lib/electron/app.js +7 -0
  3. package/lib/electron/injections.d.ts +1 -1
  4. package/lib/electron/injections.js +5 -3
  5. package/lib/electron/main.js +3 -1
  6. package/lib/fragments/annotation/index.d.ts +1 -0
  7. package/lib/fragments/annotation/index.js +13 -7
  8. package/lib/fragments/annotation/store.d.ts +8 -4
  9. package/lib/fragments/annotation/store.js +351 -267
  10. package/lib/fragments/annotation/toolbar/components/color-tool/index.js +4 -0
  11. package/lib/fragments/annotation/toolbar/components/graphic-tool/index.js +4 -0
  12. package/lib/fragments/annotation/toolbar/components/item/item.d.ts +2 -0
  13. package/lib/fragments/annotation/toolbar/components/item/item.js +2 -4
  14. package/lib/fragments/annotation/toolbar/components/item/style.css +4 -2
  15. package/lib/fragments/annotation/toolbar/components/pen-tool/index.js +4 -0
  16. package/lib/fragments/annotation/utils.d.ts +1 -0
  17. package/lib/fragments/annotation/utils.js +27 -0
  18. package/lib/fragments/annotation/view.js +1 -6
  19. package/lib/fragments/base.js +5 -3
  20. package/lib/fragments/whiteboard/cursor.css +77 -0
  21. package/lib/fragments/whiteboard/index.d.ts +11 -0
  22. package/lib/fragments/whiteboard/index.js +91 -0
  23. package/lib/fragments/whiteboard/store.d.ts +31 -0
  24. package/lib/fragments/whiteboard/store.js +475 -0
  25. package/lib/fragments/whiteboard/style.css +4 -0
  26. package/lib/fragments/whiteboard/view.d.ts +4 -0
  27. package/lib/fragments/whiteboard/view.js +31 -0
  28. package/lib/index.d.ts +1 -0
  29. package/lib/index.js +1 -0
  30. package/lib/modules/action-bar/components/apps/index.js +15 -5
  31. package/lib/modules/action-bar/components/leave/index.js +4 -11
  32. package/lib/modules/action-bar/view.d.ts +1 -0
  33. package/lib/modules/action-bar/view.js +3 -2
  34. package/lib/modules/annotation/annotation-toolbar-store.d.ts +4 -11
  35. package/lib/modules/annotation/annotation-toolbar-store.js +46 -88
  36. package/lib/modules/annotation/index.d.ts +2 -0
  37. package/lib/modules/annotation/index.js +2 -2
  38. package/lib/modules/annotation/store.d.ts +11 -49
  39. package/lib/modules/annotation/store.js +135 -418
  40. package/lib/modules/annotation/view.js +3 -6
  41. package/lib/modules/components/control-bar/components/loading/index.css +76 -0
  42. package/lib/modules/components/control-bar/components/loading/index.d.ts +8 -0
  43. package/lib/modules/components/control-bar/components/loading/index.js +64 -0
  44. package/lib/modules/components/control-bar/components/loading/loading.png +0 -0
  45. package/lib/modules/components/control-bar/components/progress/index.d.ts +5 -0
  46. package/lib/modules/components/control-bar/components/progress/index.js +43 -0
  47. package/lib/modules/components/control-bar/components/progress/style.css +51 -0
  48. package/lib/modules/components/control-bar/components/switch-theme/index.css +99 -0
  49. package/lib/modules/components/control-bar/components/switch-theme/index.d.ts +9 -0
  50. package/lib/modules/components/control-bar/components/switch-theme/index.js +94 -0
  51. package/lib/modules/components/control-bar/components/switch-theme/item.d.ts +9 -0
  52. package/lib/modules/components/control-bar/components/switch-theme/item.js +54 -0
  53. package/lib/modules/components/control-bar/components/switch-theme/libs.d.ts +4 -0
  54. package/lib/modules/components/control-bar/components/switch-theme/libs.js +31 -0
  55. package/lib/modules/components/control-bar/index.css +87 -0
  56. package/lib/modules/components/control-bar/index.d.ts +20 -0
  57. package/lib/modules/components/control-bar/index.js +276 -0
  58. package/lib/modules/components/leave-meeting/components/index.css +0 -9
  59. package/lib/modules/components/leave-meeting/index.d.ts +2 -1
  60. package/lib/modules/components/leave-meeting/index.js +15 -7
  61. package/lib/modules/components/leave-meeting/portal.d.ts +6 -0
  62. package/lib/modules/components/leave-meeting/portal.js +29 -0
  63. package/lib/modules/components/leave-meeting/style.css +9 -0
  64. package/lib/modules/components/member-window/components/member-actions/components/more-actions.d.ts +5 -2
  65. package/lib/modules/components/member-window/components/member-actions/components/more-actions.js +19 -9
  66. package/lib/modules/components/member-window/components/member-actions/components/share-status.js +4 -4
  67. package/lib/modules/components/member-window/components/member-actions/index.js +13 -6
  68. package/lib/modules/components/member-window/components/member-actions/provider.d.ts +1 -0
  69. package/lib/modules/components/member-window/components/member-actions/provider.js +4 -3
  70. package/lib/modules/components/member-window/components/member-actions/store.d.ts +2 -1
  71. package/lib/modules/components/member-window/components/member-actions/store.js +5 -1
  72. package/lib/modules/components/member-window/index.css +4 -0
  73. package/lib/modules/components/member-window/types.d.ts +6 -2
  74. package/lib/modules/components/toolbar/components/capture-tool/index.d.ts +9 -0
  75. package/lib/modules/components/toolbar/components/capture-tool/index.js +68 -0
  76. package/lib/modules/components/toolbar/components/clean-tool/index.d.ts +11 -0
  77. package/lib/modules/components/toolbar/components/clean-tool/index.js +71 -0
  78. package/lib/modules/components/toolbar/components/color-tool/color-panel/index.d.ts +11 -0
  79. package/lib/modules/components/toolbar/components/color-tool/color-panel/index.js +77 -0
  80. package/lib/modules/components/toolbar/components/color-tool/index.d.ts +14 -0
  81. package/lib/modules/components/toolbar/components/color-tool/index.js +66 -0
  82. package/lib/modules/components/toolbar/components/graphic-tool/graphic-panel/index.d.ts +11 -0
  83. package/lib/modules/components/toolbar/components/graphic-tool/graphic-panel/index.js +64 -0
  84. package/lib/modules/components/toolbar/components/graphic-tool/graphic-panel/libs.d.ts +12 -0
  85. package/lib/modules/components/toolbar/components/graphic-tool/graphic-panel/libs.js +65 -0
  86. package/lib/modules/components/toolbar/components/graphic-tool/index.d.ts +15 -0
  87. package/lib/modules/components/toolbar/components/graphic-tool/index.js +82 -0
  88. package/lib/modules/components/toolbar/components/group-tool/index.d.ts +5 -0
  89. package/lib/modules/components/toolbar/components/group-tool/index.js +43 -0
  90. package/lib/modules/components/toolbar/components/icons/fold-icon.d.ts +2 -0
  91. package/lib/modules/components/toolbar/components/icons/fold-icon.js +41 -0
  92. package/lib/modules/components/toolbar/components/icons/move-icon.d.ts +1 -0
  93. package/lib/modules/components/toolbar/components/icons/move-icon.js +66 -0
  94. package/lib/modules/components/toolbar/components/item/index.d.ts +25 -0
  95. package/lib/modules/components/toolbar/components/item/index.js +165 -0
  96. package/lib/modules/components/toolbar/components/item/style.css +94 -0
  97. package/lib/modules/components/toolbar/components/multiple-color-tool/index.d.ts +12 -0
  98. package/lib/modules/components/toolbar/components/multiple-color-tool/index.js +75 -0
  99. package/lib/modules/components/toolbar/components/panel/index.d.ts +9 -0
  100. package/lib/modules/components/toolbar/components/panel/index.js +28 -0
  101. package/lib/modules/components/toolbar/components/panel/style.css +86 -0
  102. package/lib/modules/components/toolbar/components/pen-tool/index.d.ts +13 -0
  103. package/lib/modules/components/toolbar/components/pen-tool/index.js +62 -0
  104. package/lib/modules/components/toolbar/components/pen-tool/pen-panel/index.d.ts +8 -0
  105. package/lib/modules/components/toolbar/components/pen-tool/pen-panel/index.js +39 -0
  106. package/lib/modules/components/toolbar/components/save-draft/index.d.ts +7 -0
  107. package/lib/modules/components/toolbar/components/save-draft/index.js +59 -0
  108. package/lib/modules/components/toolbar/components/vertical-frame/index.d.ts +8 -0
  109. package/lib/modules/components/toolbar/components/vertical-frame/index.js +179 -0
  110. package/lib/modules/components/toolbar/hooks/use-resize-visible.d.ts +4 -0
  111. package/lib/modules/components/toolbar/hooks/use-resize-visible.js +59 -0
  112. package/lib/modules/components/toolbar/index.d.ts +29 -0
  113. package/lib/modules/components/toolbar/index.js +258 -0
  114. package/lib/modules/components/toolbar/style.css +85 -0
  115. package/lib/modules/components/toolbar/types.d.ts +13 -0
  116. package/lib/modules/components/toolbar/types.js +6 -0
  117. package/lib/modules/control-bar/components/more-actions/index.js +0 -6
  118. package/lib/modules/control-bar/components/share-state-nav/index.js +3 -2
  119. package/lib/modules/control-bar/index.js +2 -1
  120. package/lib/modules/control-bar/store.d.ts +7 -6
  121. package/lib/modules/control-bar/store.js +28 -21
  122. package/lib/modules/control-bar/view.js +7 -55
  123. package/lib/modules/dialog/dialogs/control-bar/index.d.ts +1 -0
  124. package/lib/modules/dialog/dialogs/control-bar/index.js +17 -3
  125. package/lib/modules/dialog/dialogs/participant/components/title.js +1 -1
  126. package/lib/modules/dialog/dialogs/sub-window/index.d.ts +2 -0
  127. package/lib/modules/dialog/dialogs/sub-window/index.js +98 -0
  128. package/lib/modules/dialog/dialogs/video-window/index.d.ts +1 -0
  129. package/lib/modules/dialog/dialogs/video-window/index.js +3 -2
  130. package/lib/modules/dialog/dialogs/whiteboard/index.js +0 -1
  131. package/lib/modules/dialog/hooks/use-popover-watcher.js +1 -2
  132. package/lib/modules/dialog/hooks/useElectron.d.ts +13 -0
  133. package/lib/modules/dialog/hooks/useElectron.js +62 -12
  134. package/lib/modules/dialog/index.d.ts +6 -3
  135. package/lib/modules/dialog/index.js +5 -3
  136. package/lib/modules/dialog/store.d.ts +21 -8
  137. package/lib/modules/dialog/store.js +79 -11
  138. package/lib/modules/dialog/type.d.ts +8 -0
  139. package/lib/modules/event-confirm/index.css +5 -2
  140. package/lib/modules/event-confirm/store.js +6 -7
  141. package/lib/modules/event-confirm/view.js +1 -1
  142. package/lib/modules/event-sound/index.d.ts +1 -0
  143. package/lib/modules/event-sound/index.js +11 -24
  144. package/lib/modules/invite/components/pstn-invite.js +0 -1
  145. package/lib/modules/layout/components/CommonVideoRenderer.js +21 -21
  146. package/lib/modules/layout/components/who-is-speaking.js +3 -6
  147. package/lib/modules/layout/index.d.ts +3 -1
  148. package/lib/modules/layout/index.js +2 -1
  149. package/lib/modules/layout/store.d.ts +7 -59
  150. package/lib/modules/layout/store.js +126 -24
  151. package/lib/modules/layout/type.d.ts +55 -0
  152. package/lib/modules/participant/components/can-moveable/index.js +0 -1
  153. package/lib/modules/participant/components/participants/components/participants/components/attendee/index.js +4 -2
  154. package/lib/modules/participant/components/participants/components/participants/components/participants-more/index.js +14 -2
  155. package/lib/modules/participant/components/participants/components/participants/components/user-row/index.d.ts +1 -1
  156. package/lib/modules/participant/components/participants/components/participants/components/user-row/index.js +3 -2
  157. package/lib/modules/participant/components/participants/components/participants/index.js +3 -2
  158. package/lib/modules/participant/components/participants/components/render-user/components/user-action/components/move-actions-popover/index.d.ts +1 -0
  159. package/lib/modules/participant/components/participants/components/render-user/components/user-action/components/move-actions-popover/index.js +3 -1
  160. package/lib/modules/participant/components/participants/components/render-user/components/user-action/index.js +4 -2
  161. package/lib/modules/participant/components/participants/components/render-user/index.d.ts +4 -2
  162. package/lib/modules/participant/components/participants/components/render-user/index.js +5 -3
  163. package/lib/modules/participant/components/participants/index.js +5 -2
  164. package/lib/modules/participant/components/participants/types.d.ts +3 -0
  165. package/lib/modules/participant/index.d.ts +2 -0
  166. package/lib/modules/participant/index.js +2 -1
  167. package/lib/modules/participant/store.d.ts +5 -1
  168. package/lib/modules/participant/store.js +8 -1
  169. package/lib/modules/secondary-window/index.d.ts +49 -0
  170. package/lib/modules/secondary-window/index.js +108 -0
  171. package/lib/modules/secondary-window/store.d.ts +76 -0
  172. package/lib/modules/secondary-window/store.js +407 -0
  173. package/lib/modules/secondary-window/type.d.ts +106 -0
  174. package/lib/modules/secondary-window/type.js +35 -0
  175. package/lib/modules/secondary-window/view.d.ts +6 -0
  176. package/lib/modules/secondary-window/view.js +257 -0
  177. package/lib/modules/setting/general-settings/general-settings.js +9 -0
  178. package/lib/modules/setting/state/index.js +0 -10
  179. package/lib/modules/setting/store.d.ts +1 -0
  180. package/lib/modules/setting/store.js +6 -3
  181. package/lib/modules/share-screen/components/control-bar/index.d.ts +14 -1
  182. package/lib/modules/share-screen/components/control-bar/index.js +17 -12
  183. package/lib/modules/share-screen/components/selection/index.js +10 -15
  184. package/lib/modules/share-screen/index.d.ts +4 -1
  185. package/lib/modules/share-screen/index.js +6 -3
  186. package/lib/modules/share-screen/store.d.ts +9 -9
  187. package/lib/modules/share-screen/store.js +39 -64
  188. package/lib/modules/state-bar/index.d.ts +2 -0
  189. package/lib/modules/state-bar/index.js +2 -1
  190. package/lib/modules/state-bar/live-streaming-state.js +0 -1
  191. package/lib/modules/state-bar/store.d.ts +5 -2
  192. package/lib/modules/state-bar/store.js +14 -7
  193. package/lib/modules/state-bar/view.js +3 -3
  194. package/lib/modules/video-window/components/members/index.js +7 -12
  195. package/lib/modules/video-window/store.d.ts +1 -0
  196. package/lib/modules/video-window/store.js +5 -0
  197. package/lib/modules/whiteboard/components/toolbar/store.d.ts +2 -2
  198. package/lib/modules/whiteboard/index.d.ts +10 -13
  199. package/lib/modules/whiteboard/index.js +12 -11
  200. package/lib/providers/ability-provider.js +2 -0
  201. package/lib/providers/device-provider.d.ts +6 -3
  202. package/lib/providers/device-provider.js +331 -333
  203. package/lib/providers/multi-display-provider.d.ts +85 -0
  204. package/lib/providers/multi-display-provider.js +581 -0
  205. package/lib/providers/privilege-provider.js +1 -7
  206. package/lib/providers/room-provider.js +7 -1
  207. package/lib/providers/screen-share-provider.d.ts +3 -1
  208. package/lib/providers/screen-share-provider.js +39 -40
  209. package/lib/providers/sharing-provider.d.ts +7 -1
  210. package/lib/providers/sharing-provider.js +32 -3
  211. package/lib/providers/whiteboard-provider.d.ts +24 -0
  212. package/lib/providers/whiteboard-provider.js +127 -0
  213. package/lib/runtime.d.ts +1 -0
  214. package/lib/scenes/main-scene.d.ts +6 -0
  215. package/lib/scenes/main-scene.js +38 -2
  216. package/lib/scenes/waiting-scene.d.ts +0 -2
  217. package/lib/scenes/waiting-scene.js +0 -6
  218. package/lib/shared-data-source/member-data.d.ts +2 -2
  219. package/lib/shared-data-source/screen-share-data.d.ts +6 -0
  220. package/lib/shared-data-source/screen-share-data.js +5 -0
  221. package/lib/shared-data-source/setting.js +2 -1
  222. package/lib/shared-data-source/video-window.js +1 -2
  223. package/lib/shared-data-source/whiteboard-data.d.ts +68 -0
  224. package/lib/shared-data-source/whiteboard-data.js +347 -0
  225. package/lib/translations/enUS.d.ts +1 -0
  226. package/lib/translations/enUS.js +2 -1
  227. package/lib/translations/zhCN.d.ts +1 -0
  228. package/lib/translations/zhCN.js +2 -1
  229. package/lib/ui-scene.d.ts +0 -1
  230. package/lib/ui-scene.js +0 -3
  231. package/lib/utilities/constant.d.ts +4 -2
  232. package/lib/utilities/constant.js +3 -1
  233. package/lib/utilities/debug.d.ts +4 -0
  234. package/lib/utilities/debug.js +40 -0
  235. package/lib/utilities/dialog-utils.js +26 -4
  236. package/lib/utilities/meeting-detail.js +4 -1
  237. package/lib/utilities/renderer-event.d.ts +4 -6
  238. package/lib/utilities/renderer-event.js +23 -43
  239. package/lib/utilities/renderer.d.ts +1 -1
  240. package/lib/utilities/renderer.js +44 -10
  241. package/lib/utilities/shared-storage.d.ts +18 -0
  242. package/lib/utilities/shared-storage.js +63 -0
  243. package/lib/utilities/tools.js +2 -1
  244. package/package.json +5 -6
  245. package/lib/electron/tools.d.ts +0 -5
  246. package/lib/electron/tools.js +0 -62
@@ -6,13 +6,16 @@ require("core-js/modules/es.symbol.to-primitive.js");
6
6
  require("core-js/modules/es.error.cause.js");
7
7
  require("core-js/modules/es.error.to-string.js");
8
8
  require("core-js/modules/es.array.is-array.js");
9
+ require("core-js/modules/es.array.iterator.js");
9
10
  require("core-js/modules/es.date.to-primitive.js");
11
+ require("core-js/modules/es.function.bind.js");
10
12
  require("core-js/modules/es.function.name.js");
11
13
  require("core-js/modules/es.map.js");
12
14
  require("core-js/modules/es.number.constructor.js");
13
15
  require("core-js/modules/es.object.create.js");
14
16
  require("core-js/modules/es.object.define-property.js");
15
17
  require("core-js/modules/es.object.get-own-property-descriptor.js");
18
+ require("core-js/modules/es.string.iterator.js");
16
19
  require("core-js/modules/esnext.function.metadata.js");
17
20
  require("core-js/modules/esnext.map.delete-all.js");
18
21
  require("core-js/modules/esnext.map.emplace.js");
@@ -29,6 +32,7 @@ require("core-js/modules/esnext.map.reduce.js");
29
32
  require("core-js/modules/esnext.map.some.js");
30
33
  require("core-js/modules/esnext.map.update.js");
31
34
  require("core-js/modules/esnext.symbol.metadata.js");
35
+ require("core-js/modules/web.dom-collections.iterator.js");
32
36
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
33
37
  var _typeof = require("@babel/runtime/helpers/typeof");
34
38
  Object.defineProperty(exports, "__esModule", {
@@ -41,32 +45,24 @@ require("core-js/modules/es.array.filter.js");
41
45
  require("core-js/modules/es.array.find.js");
42
46
  require("core-js/modules/es.array.for-each.js");
43
47
  require("core-js/modules/es.array.includes.js");
44
- require("core-js/modules/es.array.iterator.js");
45
48
  require("core-js/modules/es.array.map.js");
46
49
  require("core-js/modules/es.array.push.js");
47
50
  require("core-js/modules/es.date.to-json.js");
48
- require("core-js/modules/es.function.bind.js");
49
51
  require("core-js/modules/es.json.stringify.js");
50
52
  require("core-js/modules/es.object.keys.js");
51
53
  require("core-js/modules/es.object.to-string.js");
52
- require("core-js/modules/es.promise.js");
53
54
  require("core-js/modules/es.regexp.constructor.js");
54
55
  require("core-js/modules/es.regexp.dot-all.js");
55
56
  require("core-js/modules/es.regexp.exec.js");
56
57
  require("core-js/modules/es.regexp.sticky.js");
57
58
  require("core-js/modules/es.regexp.test.js");
58
59
  require("core-js/modules/es.regexp.to-string.js");
59
- require("core-js/modules/es.string.iterator.js");
60
- require("core-js/modules/es.weak-map.js");
61
60
  require("core-js/modules/esnext.iterator.constructor.js");
62
61
  require("core-js/modules/esnext.iterator.filter.js");
63
62
  require("core-js/modules/esnext.iterator.find.js");
64
63
  require("core-js/modules/esnext.iterator.for-each.js");
65
64
  require("core-js/modules/esnext.iterator.map.js");
66
- require("core-js/modules/esnext.weak-map.delete-all.js");
67
- require("core-js/modules/esnext.weak-map.emplace.js");
68
65
  require("core-js/modules/web.dom-collections.for-each.js");
69
- require("core-js/modules/web.dom-collections.iterator.js");
70
66
  require("core-js/modules/web.timers.js");
71
67
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
72
68
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
@@ -84,25 +80,19 @@ var _fcrCore = require("fcr-core");
84
80
  var _type2 = require("fcr-core/lib/room-control/sharing-control/type");
85
81
  var _i18n = require("agora-ui-foundation/lib/i18n");
86
82
  var _logger = require("../../utilities/logger");
87
- var _isNumber = _interopRequireDefault(require("lodash/isNumber"));
88
83
  var _env = require("agora-foundation/lib/utilities/env");
89
84
  var _type3 = require("../whiteboard/type");
90
85
  var _type4 = require("fcr-core/lib/type");
91
86
  var _annotationToolbarStore = require("./annotation-toolbar-store");
87
+ var _sharedStorage = require("../../utilities/shared-storage");
92
88
  var _AnnotationStore;
93
- var _initProto, _init_receiverAllOpenStateReady, _handleReceiverBoardDecs, _handleBoardDomLoadDecs, _handleBoardContainerDomLoadDecs, _annotationaEndEffectThenCloseBoardDecs, _mountDecs, _unmountDecs, _annotationStartTriggerEffectDecs, _ref;
94
- function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
95
- function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
96
- function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
97
- function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
98
- function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
89
+ var _initProto, _handleBoardDomLoadDecs, _closeAnnotationDecs, _mountDecs, _ref;
99
90
  function _applyDecs(e, t, r, n, o, a) { function i(e, t, r) { return function (n, o) { return r && r(n), e[t].call(n, o); }; } function c(e, t) { for (var r = 0; r < e.length; r++) e[r].call(t); return t; } function s(e, t, r, n) { if ("function" != typeof e && (n || void 0 !== e)) throw new TypeError(t + " must " + (r || "be") + " a function" + (n ? "" : " or undefined")); return e; } function applyDec(e, t, r, n, o, a, c, u, l, f, p, d, h) { function m(e) { if (!h(e)) throw new TypeError("Attempted to access private element on non-instance"); } var y, v = t[0], g = t[3], b = !u; if (!b) { r || Array.isArray(v) || (v = [v]); var w = {}, S = [], A = 3 === o ? "get" : 4 === o || d ? "set" : "value"; f ? (p || d ? w = { get: _setFunctionName(function () { return g(this); }, n, "get"), set: function set(e) { t[4](this, e); } } : w[A] = g, p || _setFunctionName(w[A], n, 2 === o ? "" : A)) : p || (w = Object.getOwnPropertyDescriptor(e, n)); } for (var P = e, j = v.length - 1; j >= 0; j -= r ? 2 : 1) { var D = v[j], E = r ? v[j - 1] : void 0, I = {}, O = { kind: ["field", "accessor", "method", "getter", "setter", "class"][o], name: n, metadata: a, addInitializer: function (e, t) { if (e.v) throw Error("attempted to call addInitializer after decoration was finished"); s(t, "An initializer", "be", !0), c.push(t); }.bind(null, I) }; try { if (b) (y = s(D.call(E, P, O), "class decorators", "return")) && (P = y);else { var k, F; O["static"] = l, O["private"] = f, f ? 2 === o ? k = function k(e) { return m(e), w.value; } : (o < 4 && (k = i(w, "get", m)), 3 !== o && (F = i(w, "set", m))) : (k = function k(e) { return e[n]; }, (o < 2 || 4 === o) && (F = function F(e, t) { e[n] = t; })); var N = O.access = { has: f ? h.bind() : function (e) { return n in e; } }; if (k && (N.get = k), F && (N.set = F), P = D.call(E, d ? { get: w.get, set: w.set } : w[A], O), d) { if ("object" == _typeof(P) && P) (y = s(P.get, "accessor.get")) && (w.get = y), (y = s(P.set, "accessor.set")) && (w.set = y), (y = s(P.init, "accessor.init")) && S.push(y);else if (void 0 !== P) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0"); } else s(P, (p ? "field" : "method") + " decorators", "return") && (p ? S.push(P) : w[A] = P); } } finally { I.v = !0; } } return (p || d) && u.push(function (e, t) { for (var r = S.length - 1; r >= 0; r--) t = S[r].call(e, t); return t; }), p || b || (f ? d ? u.push(i(w, "get"), i(w, "set")) : u.push(2 === o ? w[A] : i.call.bind(w[A])) : Object.defineProperty(e, n, w)), P; } function u(e, t) { return Object.defineProperty(e, Symbol.metadata || Symbol["for"]("Symbol.metadata"), { configurable: !0, enumerable: !0, value: t }); } if (arguments.length >= 6) var l = a[Symbol.metadata || Symbol["for"]("Symbol.metadata")]; var f = Object.create(null == l ? null : l), p = function (e, t, r, n) { var o, a, i = [], s = function s(t) { return _checkInRHS(t) === e; }, u = new Map(); function l(e) { e && i.push(c.bind(null, e)); } for (var f = 0; f < t.length; f++) { var p = t[f]; if (Array.isArray(p)) { var d = p[1], h = p[2], m = p.length > 3, y = 16 & d, v = !!(8 & d), g = 0 == (d &= 7), b = h + "/" + v; if (!g && !m) { var w = u.get(b); if (!0 === w || 3 === w && 4 !== d || 4 === w && 3 !== d) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h); u.set(b, !(d > 2) || d); } applyDec(v ? e : e.prototype, p, y, m ? "#" + h : _toPropertyKey(h), d, n, v ? a = a || [] : o = o || [], i, v, m, g, 1 === d, v && m ? s : r); } } return l(o), l(a), i; }(e, t, o, f); return r.length || u(e, f), { e: p, get c() { var t = []; return r.length && [u(applyDec(e, [r], n, e.name, 5, f, t), f), c.bind(null, t, e)]; } }; }
100
91
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
101
92
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
102
93
  function _setFunctionName(e, t, n) { "symbol" == _typeof(t) && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
103
94
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? _typeof(e) : "null")); return e; }
104
- var _A = /*#__PURE__*/new WeakMap();
105
- _ref = (_handleReceiverBoardDecs = [_mobx.action, _mobx.action.bound], _handleBoardDomLoadDecs = [_mobx.action, _mobx.action.bound], _handleBoardContainerDomLoadDecs = [_mobx.action, _mobx.action.bound], _annotationaEndEffectThenCloseBoardDecs = [_mobx.action, _mobx.action.bound], _mountDecs = [_mobx.action, _mobx.action.bound], _unmountDecs = [_mobx.action, _mobx.action.bound], _annotationStartTriggerEffectDecs = [_mobx.action, _mobx.action.bound], "logger");
95
+ _ref = (_handleBoardDomLoadDecs = [_mobx.action, _mobx.action.bound], _closeAnnotationDecs = [_mobx.action, _mobx.action.bound], _mountDecs = [_mobx.action, _mobx.action.bound], "logger");
106
96
  var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
107
97
  function AnnotationStore(_ref2) {
108
98
  var _this = this;
@@ -115,16 +105,15 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
115
105
  sharedScreenSharedDataSource = _ref2.sharedScreenSharedDataSource,
116
106
  privilegeProvider = _ref2.privilegeProvider,
117
107
  messageProvider = _ref2.messageProvider,
118
- localStorageProvider = _ref2.localStorageProvider,
119
108
  eventProvider = _ref2.eventProvider,
120
109
  abilityProvider = _ref2.abilityProvider,
121
- sharedAnnotationDataSource = _ref2.sharedAnnotationDataSource;
110
+ sharedAnnotationDataSource = _ref2.sharedAnnotationDataSource,
111
+ sharedConfigDataSource = _ref2.sharedConfigDataSource;
122
112
  (0, _classCallCheck2["default"])(this, AnnotationStore);
123
113
  (0, _defineProperty2["default"])(this, _ref, (_initProto(this), (0, _logger.createLogger)({
124
114
  prefix: 'AnnotationStore'
125
115
  })));
126
116
  (0, _defineProperty2["default"])(this, "_disposers", []);
127
- (0, _defineProperty2["default"])(this, "_annotationControl", undefined);
128
117
  (0, _defineProperty2["default"])(this, "_resizeWatcherTimer", null);
129
118
  (0, _defineProperty2["default"])(this, "_shareScreenOwnerId", '');
130
119
  (0, _defineProperty2["default"])(this, "_currentShareInfo", {
@@ -153,82 +142,52 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
153
142
  (0, _defineProperty2["default"])(this, "_annotationObserver", {
154
143
  onConnectionStateUpdated: this._handleOnAnnotationConnectionStateUpdated
155
144
  });
156
- // 接收端是否全部的前提工作都做完了,做完了,放出承载节点
157
- // 在承载节点的handleDomLoaded后,挂载白板
158
- _classPrivateFieldInitSpec(this, _A, _init_receiverAllOpenStateReady(this, false));
159
- (0, _defineProperty2["default"])(this, "_toolbarStore", undefined);
160
- (0, _defineProperty2["default"])(this, "_boardOriginWidth", 0);
161
145
  (0, _defineProperty2["default"])(this, "_prevSetLocalVideoSize", {
162
146
  width: 0,
163
147
  height: 0
164
148
  });
165
- (0, _defineProperty2["default"])(this, "_mounted", false);
166
149
  (0, _defineProperty2["default"])(this, "_streamObserver", {
167
- onLocalVideoStatsUpdated: this._handleOnLocalVideoStatsUpdated.bind(this)
150
+ onLocalVideoStatsUpdated: this._handleOnLocalVideoStatsUpdated
168
151
  });
169
- (0, _defineProperty2["default"])(this, "_annotationEndLock", null);
170
- localStorageProvider.write('annotation_nickname', memberDataSource.localUser.userName);
171
152
  this._dialogProvider = dialogProvider;
172
153
  this._annotationProvider = annotationProvider;
173
154
  this._sharingProvider = sharingProvider;
174
155
  this._memberDataSource = memberDataSource;
175
156
  this._roomControl = roomControl;
176
- this._streamControl = this._roomControl.getStreamControl();
177
- this._streamControl.addObserver(this._streamObserver);
178
157
  this._sharedSecuritySharedDataSource = sharedSecuritySharedDataSource;
179
158
  this._sharedScreenSharedDataSource = sharedScreenSharedDataSource;
180
- this._dialogProvider.addObserver(this._dialogObserver);
181
159
  this._privilegeProvider = privilegeProvider;
182
160
  this._messageProvider = messageProvider;
183
161
  this._eventProvider = eventProvider;
184
162
  this._abilityProvider = abilityProvider;
185
163
  this._sharedAnnotationDataSource = sharedAnnotationDataSource;
164
+ this._streamControl = this._roomControl.getStreamControl();
186
165
  this._sharingControl = this._sharingProvider.getSharingControl();
166
+ this._annotationControl = this._sharingProvider.getSharingControl().getAnnotationControl();
167
+ this._dialogProvider.addObserver(this._dialogObserver);
168
+ this._streamControl.addObserver(this._streamObserver);
187
169
  this._sharingControl.addObserver(this._sharingObserver);
188
- this._getCurrentAnnotationControl();
189
- var exitScreenShareOwner = this._sharedScreenSharedDataSource.screenSharingOwner;
190
- if (exitScreenShareOwner) {
191
- this._shareScreenOwnerId = exitScreenShareOwner.userId;
192
- if (this._sharingControl.getScreenSharingState() === _type2.FcrScreenSharingState.START_WHIT_ANNOTATION) {
193
- this._annotationReceiverMainStart();
170
+ this._annotationControl.addObserver(this._annotationObserver);
171
+ this._toolbarStore = new _annotationToolbarStore.AnnotationReceiverToolbarStore(this._annotationControl, this._roomControl, this._eventProvider, this._sharedAnnotationDataSource);
172
+ var screenSharingOwner = this._sharedScreenSharedDataSource.screenSharingOwner;
173
+ var screenShareOwnerExists = !!screenSharingOwner;
174
+ var isAnnotationActive = this._sharingControl.getScreenSharingState() === _type2.FcrScreenSharingState.START_WHIT_ANNOTATION;
175
+ if (screenShareOwnerExists) {
176
+ this._shareScreenOwnerId = screenSharingOwner.userId;
177
+ if (isAnnotationActive) {
178
+ this._openAnnotation();
194
179
  }
195
180
  }
196
- this._disposers.push(
197
- // reaction(
198
- // () => this.annotating,
199
- // (annotating) => {
200
- // if (this._isLocalUserSharingOwner) {
201
- // if (annotating) {
202
- // this._removeWindowResizeListenner();
203
- // } else {
204
- // this._addWindowResizeListenner();
205
- // }
206
- // }
207
- // },
208
- // ),
209
- // reaction(
210
- // () => this._sharedScreenSharedDataSource.screenShareVideoRatio,
211
- // (ratio) => {
212
- // if (ratio > 0) {
213
- // this.handleReceiverBoard(ratio);
214
- // }
215
- // },
216
- // ),
217
- (0, _mobx.reaction)(function () {
181
+ this._disposers.push((0, _mobx.reaction)(function () {
218
182
  return _this.sharingInReplace;
219
183
  }, function (sharingInReplace) {
220
184
  // web 被替换时不需要走这个逻辑
221
185
  if (sharingInReplace && (0, _env.isElectron)() && _this._isLocalUserSharingOwner) {
222
- // await new Promise((resolve) => {
223
- // // 延迟两秒,等待标注内容清理,清理方法在 sdk 中虽然看起来是同步的,但是实际上会有无法清理的情况出现
224
- // sendEvent({ action: ToolbarEvents.CLEAN, payload: null });
225
- // setTimeout(() => resolve(true), 1000);
226
- // });
227
186
  (0, _rendererEvent.sendEvent)({
228
187
  action: _type3.ToolbarEvents.CLEAN,
229
188
  payload: null
230
189
  });
231
- _this.logger.info("[Annotation]: sharingInReplace changed to ".concat(sharingInReplace, ", currentShareInfo is ").concat(JSON.stringify(_this._currentShareInfo)));
190
+ _this.logger.info("sharingInReplace changed to ".concat(sharingInReplace, ", currentShareInfo is ").concat(JSON.stringify(_this._currentShareInfo)));
232
191
  _this._removeWindowResizeListenner();
233
192
  _this._annotationProvider.hideAnnotationWindow();
234
193
  _this._annotationProvider.setBoundsToAnnotationWindow();
@@ -236,19 +195,11 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
236
195
  return _this.screenSharingStarted(true);
237
196
  }, 200);
238
197
  }
239
- }), (0, _mobx.reaction)(function () {
240
- return _this.annotationHasStart;
241
- }, function (hasStart) {
242
- if (hasStart && !_this._isLocalUserSharingOwner) {
243
- /** 不是发起端并且annotation白板变为了连接状态 */
244
- _this.logger.info('[Annotation] start step2 ===> annotation board has connected, then we trigger effect');
245
- _this._annotationStartTriggerEffect();
246
- }
247
198
  }), (0, _mobx.reaction)(function () {
248
199
  return _this._sharedScreenSharedDataSource.localUserScreenSharingState;
249
200
  }, function (state) {
250
201
  if (state === _fcrCore.FcrMediaSourceState.CLOSE && _this._isLocalUserSharingOwner) {
251
- _this.logger.info('[Annotation]: localUserScreenSharingState is close, isReplaceScreen is ', _this.sharingInReplace);
202
+ _this.logger.info('localUserScreenSharingState is close, isReplaceScreen is ', _this.sharingInReplace);
252
203
  if (!_this.sharingInReplace && (0, _env.isElectron)()) {
253
204
  _this._annotationProvider.closeAnnotationWindow();
254
205
  _this._removeWindowResizeListenner();
@@ -265,24 +216,16 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
265
216
  });
266
217
  }
267
218
  if (!canWrite) {
268
- _this._setIsShowToolbar(false);
219
+ _this._annotationProvider.setIsShowToolbar(false);
269
220
  }
270
- }), (0, _mobx.reaction)(function () {
271
- return _this.isShowToolbar;
272
- }, function (isShow) {
273
- var _this$_toolbarStore;
274
- (_this$_toolbarStore = _this._toolbarStore) === null || _this$_toolbarStore === void 0 || _this$_toolbarStore.resetToolbarVars();
275
221
  }));
222
+ (0, _sharedStorage.setAnnotationRtmAppId)(sharedConfigDataSource.creatorConfig.appId);
223
+ (0, _sharedStorage.setAnnotationNickName)(memberDataSource.localUser.userName);
224
+
225
+ // @ts-ignore
226
+ window._annotationStore = this;
276
227
  }
277
228
  return (0, _createClass2["default"])(AnnotationStore, [{
278
- key: "receiverAllOpenStateReady",
279
- get: function get() {
280
- return _classPrivateFieldGet(_A, this);
281
- },
282
- set: function set(v) {
283
- _classPrivateFieldSet(_A, this, v);
284
- }
285
- }, {
286
229
  key: "screenShareVideoRatio",
287
230
  get: function get() {
288
231
  return this._sharedScreenSharedDataSource.screenShareVideoRatio;
@@ -386,239 +329,127 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
386
329
  }, {
387
330
  key: "currentTool",
388
331
  get: function get() {
389
- var _this$_toolbarStore2;
390
- return (_this$_toolbarStore2 = this._toolbarStore) === null || _this$_toolbarStore2 === void 0 ? void 0 : _this$_toolbarStore2.observables.currentTool;
332
+ var _this$_toolbarStore;
333
+ return (_this$_toolbarStore = this._toolbarStore) === null || _this$_toolbarStore === void 0 ? void 0 : _this$_toolbarStore.observables.currentTool;
391
334
  }
392
335
  }, {
393
336
  key: "boardMainWindow",
394
337
  get: function get() {
395
338
  return this._sharedAnnotationDataSource.boardMainWindow;
396
339
  }
397
- }, {
398
- key: "handleReceiverBoard",
399
- value: function handleReceiverBoard(paramRatio) {
400
- if (this._boardContainerDom && this._boardDom) {
401
- var _this$boardMainWindow;
402
- var _this$_boardContainer = this._boardContainerDom.getBoundingClientRect(),
403
- height = _this$_boardContainer.height;
404
- var ratio = (0, _isNumber["default"])(paramRatio) ? paramRatio : this._sharedScreenSharedDataSource.screenShareVideoRatio;
405
- var newWidth = height * ratio;
406
- this._boardOriginWidth = newWidth;
407
- this._boardDom.style.width = "".concat(newWidth, "px");
408
- this._boardDom.style.height = "".concat(height, "px");
409
- (_this$boardMainWindow = this.boardMainWindow) === null || _this$boardMainWindow === void 0 || _this$boardMainWindow.updateWindowSize({
410
- width: newWidth,
411
- height: height
412
- });
413
- this.logger.info("[Annotation] [drawReceiverBoard] ratio: ".concat(ratio, ", width: ").concat(newWidth, " , height: ").concat(height));
414
- }
415
- }
416
340
  }, {
417
341
  key: "handleBoardDomLoad",
418
342
  value: function handleBoardDomLoad(ref) {
343
+ var isDomChanged = this._boardDom !== ref;
419
344
  this._boardDom = ref;
420
- if (this._boardDom) {
421
- // const { height } = this._boardDom.getBoundingClientRect();
422
- // const haveCanUseBackup = this._checkSharingwindowBackupSize();
423
- // if (this._boardOriginWidth === 0 && haveCanUseBackup) {
424
- // this._setBoardDomWithBackupWindowSize(height);
425
- // } else {
426
- // this._boardOriginWidth = height * this._sharedScreenSharedDataSource.screenShareVideoRatio;
427
- // }
428
- this._mount();
429
- } else {
430
- this._mounted = false;
431
- this._boardOriginWidth = 0;
432
- }
433
- }
434
- }, {
435
- key: "handleBoardContainerDomLoad",
436
- value: function handleBoardContainerDomLoad(ref) {
437
- if (ref) {
438
- this._boardContainerDom = ref;
345
+ if (isDomChanged) {
346
+ if (ref) {
347
+ this._mount();
348
+ } else {
349
+ this.logger.info("board dom unmount");
350
+ }
439
351
  }
440
352
  }
441
353
  }, {
442
354
  key: "screenSharingStarted",
443
355
  value: function screenSharingStarted(isReplaceScreen) {
444
356
  this._currentShareInfo = this._annotationProvider.currentShareInfo;
445
- this.logger.info("[Annotation]: screenSharingStarting with currentShareInfo: ".concat(JSON.stringify(this._currentShareInfo)));
357
+ this.logger.info("screenSharingStarting with currentShareInfo: ".concat(JSON.stringify(this._currentShareInfo)));
446
358
  this._annotationProvider.setBoundsToAnnotationWindow();
447
359
  this._removeWindowResizeListenner();
448
360
  if (isReplaceScreen) {
449
361
  this._annotationProvider.showAnnotationWindow();
450
362
  } else {
451
363
  this._annotationProvider.openAnnotationWindow();
452
- this.logger.info('[Annotation]: screenSharingStarted will add window resize listenner');
364
+ this.logger.info('screenSharingStarted will add window resize listenner');
453
365
  }
454
- this._addWindowResizeListenner();
366
+ this._addWindowResizeListener();
455
367
  }
456
368
  }, {
457
369
  key: "release",
458
370
  value: function release() {
459
- this._annotationaEndEffectThenCloseBoard();
371
+ this._closeAnnotation();
372
+ this._removeWindowResizeListenner();
460
373
  this._disposers.forEach(function (disposer) {
461
374
  return disposer();
462
375
  });
463
376
  this._dialogProvider.removeObserver(this._dialogObserver);
464
377
  this._streamControl.removeObserver(this._streamObserver);
465
378
  this._sharingControl.removeObserver(this._sharingObserver);
466
- this._clearCurrentAnnotationControl();
467
- this._removeWindowResizeListenner();
468
- }
469
- }, {
470
- key: "_clearCurrentAnnotationControl",
471
- value: function _clearCurrentAnnotationControl() {
472
- if (this._annotationControl) {
473
- this._annotationControl.removeObserver(this._annotationObserver);
474
- this._annotationControl = undefined;
475
- }
379
+ this._annotationControl.removeObserver(this._annotationObserver);
380
+ this._toolbarStore.release();
476
381
  }
477
382
  }, {
478
- key: "_getCurrentAnnotationControl",
479
- value: function _getCurrentAnnotationControl() {
480
- this._clearCurrentAnnotationControl();
481
- var newAnnotationControl = this._sharingProvider.getSharingControl().getAnnotationControl();
482
- this._annotationControl = newAnnotationControl;
483
- newAnnotationControl === null || newAnnotationControl === void 0 || newAnnotationControl.addObserver(this._annotationObserver);
484
- return this._annotationControl;
485
- }
486
-
487
- /**
488
- * 根据 发起屏幕共享状态,是startOnlyScreen,且自己本人是发起端
489
- * 则发起端: 同步bounds与updateViewPort并进行打开fragment
490
- */
491
- }, {
492
- key: "_annotationSenderMainStart",
493
- value: (function () {
494
- var _annotationSenderMainStart2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
383
+ key: "_startShareScreen",
384
+ value: function () {
385
+ var _startShareScreen2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
495
386
  return _regenerator["default"].wrap(function (_context) {
496
387
  while (1) switch (_context.prev = _context.next) {
497
388
  case 0:
498
389
  this.logger.info('annotation sender main start');
499
- if (!this._isLocalUserSharingOwner) {
500
- _context.next = 2;
501
- break;
502
- }
503
- if (!this._annotationEndLock) {
504
- _context.next = 1;
505
- break;
390
+ if (this._isLocalUserSharingOwner) {
391
+ this.logger.info('annotation sender main start in sender branch');
392
+ this.screenSharingStarted(false);
506
393
  }
507
- this.logger.info('annotation sender main start in await lock');
508
- _context.next = 1;
509
- return this._annotationEndLock;
510
394
  case 1:
511
- this.logger.info('annotation sender main start in sender branch');
512
- this.screenSharingStarted(false);
513
- case 2:
514
395
  case "end":
515
396
  return _context.stop();
516
397
  }
517
398
  }, _callee, this);
518
399
  }));
519
- function _annotationSenderMainStart() {
520
- return _annotationSenderMainStart2.apply(this, arguments);
400
+ function _startShareScreen() {
401
+ return _startShareScreen2.apply(this, arguments);
521
402
  }
522
- return _annotationSenderMainStart;
403
+ return _startShareScreen;
523
404
  }()
524
- /**
525
- * 根据 发起屏幕共享状态中包含startWithAnnotation,
526
- * 则接收端:1.去进行 step1 连接白板 2.在连接完成的状态后并拿到boardMainWindow后,进行 step2 后置的 工具栏初始化 + 白板尺寸修正(过期)
527
- */
528
- )
529
- }, {
530
- key: "_annotationReceiverMainStart",
531
- value: (function () {
532
- var _annotationReceiverMainStart2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
405
+ }, {
406
+ key: "_openAnnotation",
407
+ value: function () {
408
+ var _openAnnotation2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee2() {
409
+ var screenShareOwnerId, localUserId, canStartAnnotation;
533
410
  return _regenerator["default"].wrap(function (_context2) {
534
411
  while (1) switch (_context2.prev = _context2.next) {
535
412
  case 0:
536
- this.logger.info('[Annotation] receiver main start');
537
- if (this._isLocalUserSharingOwner) {
538
- _context2.next = 2;
539
- break;
540
- }
541
- if (!this._annotationEndLock) {
542
- _context2.next = 1;
543
- break;
413
+ if (!this._isLocalUserSharingOwner) {
414
+ screenShareOwnerId = this._shareScreenOwnerId;
415
+ localUserId = this._memberDataSource.localUser.userId;
416
+ canStartAnnotation = this._checkIfAnnotationCanStart();
417
+ this.logger.info("can start annotation: ".concat(canStartAnnotation));
418
+ if (canStartAnnotation && screenShareOwnerId !== localUserId) {
419
+ this._annotationControl.open();
420
+ }
544
421
  }
545
- this.logger.info('[Annotation] receiver main start in await lock');
546
- _context2.next = 1;
547
- return this._annotationEndLock;
548
422
  case 1:
549
- this.logger.info('[Annotation] receiver main start in receiver branch');
550
- this._connectAnnotaionBoard(this._shareScreenOwnerId);
551
- case 2:
552
423
  case "end":
553
424
  return _context2.stop();
554
425
  }
555
426
  }, _callee2, this);
556
427
  }));
557
- function _annotationReceiverMainStart() {
558
- return _annotationReceiverMainStart2.apply(this, arguments);
428
+ function _openAnnotation() {
429
+ return _openAnnotation2.apply(this, arguments);
559
430
  }
560
- return _annotationReceiverMainStart;
431
+ return _openAnnotation;
561
432
  }()
562
- /**
563
- * 根据 1.白板的连接状态变为未连接状态 2.屏幕共享结束后
564
- * 进行后置的 工具栏,画布清理和toast提示 + 关闭白板卸载节点的操作
565
- */
566
- )
567
- }, {
568
- key: "_annotationaEndEffectThenCloseBoard",
569
- value: function _annotationaEndEffectThenCloseBoard() {
570
- var _this2 = this;
571
- this._annotationEndLock = new Promise(function (resolve) {
572
- try {
573
- var _this2$_toolbarStore;
574
- (_this2$_toolbarStore = _this2._toolbarStore) === null || _this2$_toolbarStore === void 0 || _this2$_toolbarStore.resetToolbarVars();
575
- _this2._messageProvider.showToast({
576
- message: (0, _i18n.transI18n)('fmt_screenshare_toast_annotation_controls_screen_sharing_disabled'),
577
- type: 'info'
578
- });
579
- _this2._setIsShowToolbar(false);
580
- _this2._clearAnnotationWhiteboardToolbar();
581
- _this2._sharedAnnotationDataSource.setAnnotationState(_annotationProvider.FcrAnnotationState.END);
582
- _this2._unmount();
583
- } catch (e) {} finally {
584
- console.log('[Annotation]: annotation receiver end resolve');
585
- resolve();
586
- }
587
- });
588
- }
589
433
  }, {
590
- key: "_setIsShowToolbar",
591
- value: function _setIsShowToolbar(isShow) {
592
- this._annotationProvider.setIsShowToolbar(isShow);
434
+ key: "_closeAnnotation",
435
+ value: function _closeAnnotation() {
436
+ this._toolbarStore.resetToolbarVars();
437
+ this._annotationProvider.setIsShowToolbar(false);
438
+ this._sharedAnnotationDataSource.setAnnotationState(_annotationProvider.FcrAnnotationState.END);
439
+ this._annotationControl.close();
593
440
  }
594
441
  }, {
595
442
  key: "_mount",
596
443
  value: function _mount() {
597
- if (this.boardMainWindow && this._boardDom && !this._mounted) {
598
- var _this$_toolbarStore3;
599
- this._mounted = true;
444
+ this.logger.info("start mount, board main window exists: ".concat(!!this.boardMainWindow, ", dom exists: ").concat(!!this._boardDom));
445
+ if (this.boardMainWindow && this._boardDom) {
446
+ if (this._boardDom.hasChildNodes()) {
447
+ this.logger.warn('mount board main window while board dom is not empty, clear it');
448
+ this._boardDom.innerHTML = '';
449
+ }
600
450
  var view = this.boardMainWindow.getContentView();
601
451
  this._boardDom.appendChild(view);
602
- (_this$_toolbarStore3 = this._toolbarStore) === null || _this$_toolbarStore3 === void 0 || _this$_toolbarStore3.resetToolbarVars();
603
- }
604
- }
605
- }, {
606
- key: "_unmount",
607
- value: function _unmount() {
608
- this.logger.info('[Annotation] unmount ');
609
- if (this._mounted && this.boardMainWindow) {
610
- this._deleteBoardDomContent();
611
- this.logger.info('[Annotation] unmount remove mainWindow contentView');
612
- this._close();
613
- }
614
- this._mounted = false;
615
- }
616
- }, {
617
- key: "_close",
618
- value: function _close() {
619
- if (this._annotationControl) {
620
- this.logger.info('[Annotation] core close');
621
- this._annotationControl.close();
452
+ this.logger.info('finished mount mainWindow contentView');
622
453
  }
623
454
  }
624
455
  }, {
@@ -644,7 +475,7 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
644
475
  key: "_updateAnnotationBounds",
645
476
  value: function _updateAnnotationBounds(bounds) {
646
477
  if (bounds) this._currentShareInfo.bounds = bounds;
647
- this.logger.info("[Annotation][updateAnnotationBounds]: bounds: ".concat(JSON.stringify(bounds), ", currentShareInfo: ").concat(JSON.stringify(this._currentShareInfo)));
478
+ this.logger.info("update annotation bounds: ".concat(JSON.stringify(bounds), ", currentShareInfo: ").concat(JSON.stringify(this._currentShareInfo)));
648
479
  (0, _rendererEvent.sendEvent)({
649
480
  action: _constant.FcrUIRendererEventAction.SET_CURRENT_SHARE_SCREEN_BOUNDS,
650
481
  payload: bounds || this._annotationProvider.currentShareInfo.bounds
@@ -655,10 +486,10 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
655
486
  }, {
656
487
  key: "_updateBoundsByActiveWindow",
657
488
  value: function _updateBoundsByActiveWindow() {
658
- var _this3 = this;
489
+ var _this2 = this;
659
490
  var windows = window.runtime.getWindows();
660
491
  var activeWindow = windows.find(function (win) {
661
- return win.id === +_this3._currentShareInfo.id;
492
+ return win.id === +_this2._currentShareInfo.id;
662
493
  });
663
494
  var _this$_currentShareIn = this._currentShareInfo,
664
495
  id = _this$_currentShareIn.id,
@@ -675,30 +506,17 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
675
506
  ax = _ref3.x,
676
507
  ay = _ref3.y;
677
508
  var isNewBounds = aw !== width || ah !== height || ax !== x || ay !== y;
678
- // this.logger.info(
679
- // `updateBoundsByActiveWindow ${JSON.stringify({
680
- // activeBounds,
681
- // width,
682
- // height,
683
- // isSharingWindow,
684
- // isNewBounds,
685
- // activeWindow,
686
- // id,
687
- // })}`,
688
- // );
689
509
  if (isSharingWindow && isNewBounds) {
690
510
  this._updateAnnotationBounds(activeBounds);
691
- // this.logger.info('The window bounds is the different as the current share bounds');
692
511
  }
693
512
  }
694
513
  }, {
695
- key: "_addWindowResizeListenner",
696
- value: function _addWindowResizeListenner() {
697
- var _this4 = this;
514
+ key: "_addWindowResizeListener",
515
+ value: function _addWindowResizeListener() {
516
+ var _this3 = this;
698
517
  if (!this._resizeWatcherTimer && (0, _env.isElectron)()) {
699
518
  this._resizeWatcherTimer = setInterval(function () {
700
- // this.logger.info(`addWindowResizeListenner interval ${this._currentShareInfo}`);
701
- _this4._updateBoundsByActiveWindow();
519
+ _this3._updateBoundsByActiveWindow();
702
520
  }, 2000);
703
521
  }
704
522
  }
@@ -711,50 +529,10 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
711
529
  }
712
530
  }
713
531
  }, {
714
- key: "_checkSharingwindowBackupSize",
715
- value: function _checkSharingwindowBackupSize() {
716
- var size = this._sharingProvider.getSharingControl().getSharingWindowSize();
717
- this.logger.info('[Annotation][checkSharingwindowBackupSize] default size: ', size);
718
- return !!(size && size.width > 0 && size.height > 0);
719
- }
720
- }, {
721
- key: "_setBoardDomWithBackupWindowSize",
722
- value: function _setBoardDomWithBackupWindowSize(containerHeight) {
723
- var size = this._sharingProvider.getSharingControl().getSharingWindowSize();
724
- var getWidth = size.width;
725
- var getHeight = size.height;
726
- var ratio = getWidth / getHeight;
727
- var newWidth = containerHeight * ratio;
728
- this._boardOriginWidth = newWidth;
729
- if (this._boardDom) {
730
- var _this$boardMainWindow2;
731
- this._boardDom.style.width = "".concat(newWidth, "px");
732
- this._boardDom.style.height = "".concat(containerHeight, "px");
733
- (_this$boardMainWindow2 = this.boardMainWindow) === null || _this$boardMainWindow2 === void 0 || _this$boardMainWindow2.updateWindowSize({
734
- width: newWidth,
735
- height: containerHeight
736
- });
737
- }
738
- }
739
- }, {
740
- key: "_renewAnnotationWhiteboardToolbar",
741
- value: function _renewAnnotationWhiteboardToolbar() {
742
- this._toolbarStore = new _annotationToolbarStore.AnnotationReceiverToolbarStore(this._annotationControl, this._roomControl, this._annotationProvider, this._eventProvider, this._sharedAnnotationDataSource);
743
- this.logger.info('[Annotation][renewAnnotationWhiteboardToolbar] is done');
744
- this.receiverAllOpenStateReady = true;
745
- }
746
- }, {
747
- key: "_clearAnnotationWhiteboardToolbar",
748
- value: function _clearAnnotationWhiteboardToolbar() {
749
- this._toolbarStore = undefined;
750
- this.logger.info('[Annotation][clearAnnotationWhiteboardToolbar] is done');
751
- this.receiverAllOpenStateReady = false;
752
- }
753
- }, {
754
- key: "_participantShareCanWeAnnotation",
755
- value: function _participantShareCanWeAnnotation() {
532
+ key: "_checkIfAnnotationCanStart",
533
+ value: function _checkIfAnnotationCanStart() {
756
534
  var streams = this._streamControl.getStreams();
757
- var _notSupportPlatform = [_type4.FcrPlatform.WEB_DESKTOP, _type4.FcrPlatform.WEB_MOBILE, _type4.FcrPlatform.IOS];
535
+ var notSupportPlatform = [_type4.FcrPlatform.WEB_DESKTOP, _type4.FcrPlatform.WEB_MOBILE, _type4.FcrPlatform.IOS];
758
536
  var streamLists = Object.keys(streams).map(function (key) {
759
537
  return streams[key];
760
538
  });
@@ -765,9 +543,10 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
765
543
  }).filter(Boolean);
766
544
  if (screenShareStreams.length > 0) {
767
545
  var screenShareOwnerInfo = screenShareStreams[0];
768
- var _participantPlatform = screenShareOwnerInfo === null || screenShareOwnerInfo === void 0 ? void 0 : screenShareOwnerInfo.owner.platform;
769
- this.logger.info("[Annotation] current share participant platform: ".concat(_participantPlatform));
770
- if (typeof _participantPlatform !== 'undefined' && !_notSupportPlatform.includes(_participantPlatform)) {
546
+ var participantPlatform = screenShareOwnerInfo.owner.platform;
547
+ this.logger.info("current share participant platform: ".concat(participantPlatform));
548
+ notSupportPlatform.includes(participantPlatform);
549
+ if (!notSupportPlatform.includes(participantPlatform)) {
771
550
  return true;
772
551
  } else {
773
552
  return false;
@@ -775,90 +554,30 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
775
554
  }
776
555
  return false;
777
556
  }
778
-
779
- /**
780
- * 接收端step1
781
- * 判断状态,打开批注(core: 进入房间,初始化白板APP)
782
- */
783
- }, {
784
- key: "_connectAnnotaionBoard",
785
- value: function _connectAnnotaionBoard(screenShareOwnerId) {
786
- if (this._participantShareCanWeAnnotation()) {
787
- this.logger.info('[Annotation] we can receive annotation from share platform');
788
- this._getCurrentAnnotationControl();
789
- if (this._annotationControl) {
790
- if (screenShareOwnerId !== this._memberDataSource.localUser.userId) {
791
- this._deleteBoardDomContent();
792
- this.logger.info('[Annotation] start step1 == > receiver enter core open');
793
- this._annotationControl.open();
794
- }
795
- }
796
- }
797
- }
798
-
799
- /**
800
- * 接收端step2
801
- * 白板连接成功,进行后置副作用操作
802
- */
803
- }, {
804
- key: "_annotationStartTriggerEffect",
805
- value: (function () {
806
- var _annotationStartTriggerEffect2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee3() {
807
- return _regenerator["default"].wrap(function (_context3) {
808
- while (1) switch (_context3.prev = _context3.next) {
809
- case 0:
810
- if (!this._annotationEndLock) {
811
- _context3.next = 1;
812
- break;
813
- }
814
- this.logger.info('annotation start in await lock');
815
- _context3.next = 1;
816
- return this._annotationEndLock;
817
- case 1:
818
- this.logger.info('annotation start after await lock');
819
- this._renewAnnotationWhiteboardToolbar();
820
- case 2:
821
- case "end":
822
- return _context3.stop();
823
- }
824
- }, _callee3, this);
825
- }));
826
- function _annotationStartTriggerEffect() {
827
- return _annotationStartTriggerEffect2.apply(this, arguments);
828
- }
829
- return _annotationStartTriggerEffect;
830
- }())
831
557
  }, {
832
558
  key: "_handleOnScreenSharingUpdated",
833
559
  value: function _handleOnScreenSharingUpdated(ownerStream, state) {
834
560
  this._shareScreenOwnerId = (ownerStream === null || ownerStream === void 0 ? void 0 : ownerStream.owner.userId) || '';
835
- // if (state === FcrScreenSharingState.START_WHIT_ANNOTATION) {
836
- // this.logger.info('[Annotation] transaction main start');
837
- // this._annotationMainStart();
838
- // } else {
839
- // this.logger.info('[Annotation] main end , because current sharing not with annotation');
840
- // if (this._isLocalUserSharingOwner) {
841
- // /** 屏幕共享的状态没有包含批注,当前是发起者,则关闭fragment */
842
- // this._annotationProvider.closeAnnotationWindow();
843
- // } else {
844
- // /** 屏幕共享的状态没有包含批注,接收端进行总体的关闭 */
845
- // this._annotationaEndEffectThenCloseBoard();
846
- // }
847
- // }
848
561
  if (state === _type2.FcrScreenSharingState.START_ONLY_SCREEN) {
849
- this.logger.info('[Annotation] sender transaction main start');
850
- this._annotationSenderMainStart();
851
- } else if (state === _type2.FcrScreenSharingState.START_WHIT_ANNOTATION) {
852
- this.logger.info('[Annotation] receiver transaction main start');
853
- this._annotationReceiverMainStart();
854
- } else if (state === _type2.FcrScreenSharingState.END) {
855
- this.logger.info('[Annotation] main end , because current sharing not with annotation');
562
+ this._startShareScreen();
563
+ }
564
+ if (state === _type2.FcrScreenSharingState.START_WHIT_ANNOTATION) {
565
+ this._openAnnotation();
566
+ }
567
+ if (state === _type2.FcrScreenSharingState.END) {
568
+ this.logger.info("annotation state chagned to ends, is local user sharing owner: ".concat(this._isLocalUserSharingOwner));
856
569
  if (this._isLocalUserSharingOwner) {
857
570
  /** 屏幕共享的状态没有包含批注,当前是发起者,则关闭fragment */
858
571
  this._annotationProvider.closeAnnotationWindow();
859
572
  } else {
860
573
  /** 屏幕共享的状态没有包含批注,接收端进行总体的关闭 */
861
- this._annotationaEndEffectThenCloseBoard();
574
+ this._closeAnnotation();
575
+ if (state === _type2.FcrScreenSharingState.END) {
576
+ this._messageProvider.showToast({
577
+ message: (0, _i18n.transI18n)('fmt_screenshare_toast_annotation_controls_screen_sharing_disabled'),
578
+ type: 'info'
579
+ });
580
+ }
862
581
  }
863
582
  }
864
583
  }
@@ -866,40 +585,38 @@ var AnnotationStore = exports.AnnotationStore = /*#__PURE__*/function () {
866
585
  key: "_handleOnAnnotationConnectionStateUpdated",
867
586
  value: function _handleOnAnnotationConnectionStateUpdated(state) {
868
587
  if (state === _fcrCore.FcrConnectionState.CONNECTED) {
869
- var _this$_annotationCont;
870
- var mainWindow = (_this$_annotationCont = this._annotationControl) === null || _this$_annotationCont === void 0 ? void 0 : _this$_annotationCont.getMainWindow();
871
- this.logger.info("[Annotation] annotation board connected, we get boardMainWindow in callback!");
588
+ var mainWindow = this._annotationControl.getMainWindow();
589
+ if (!mainWindow) {
590
+ this.logger.error('main window is not available');
591
+ return;
592
+ }
872
593
  this._sharedAnnotationDataSource.setBoardMainWindow(mainWindow);
873
594
  this._sharedAnnotationDataSource.setAnnotationState(_annotationProvider.FcrAnnotationState.START);
595
+ this._mount();
596
+ this._resetAnnotationToolbarState();
874
597
  } else {
875
- if (state === _fcrCore.FcrConnectionState.DISCONNECTED || state === _fcrCore.FcrConnectionState.ABORTED) {
876
- this.logger.info('[Annotation] main end because annotation board not connected');
877
- /** 批注白板的连接状态没有连接成功,进行总体的关闭 */
878
- this._annotationaEndEffectThenCloseBoard();
879
- }
880
- this._sharedAnnotationDataSource.setAnnotationState(_annotationProvider.FcrAnnotationState.END);
881
- }
882
- }
883
- }, {
884
- key: "_deleteBoardDomContent",
885
- value: function _deleteBoardDomContent() {
886
- if (this._boardDom && this.boardMainWindow) {
887
- this.logger.info('[Annotation] delete old boardMainWindow');
888
- this._boardDom.removeChild(this.boardMainWindow.getContentView());
889
598
  this._sharedAnnotationDataSource.setBoardMainWindow(null);
599
+ this._sharedAnnotationDataSource.setAnnotationState(_annotationProvider.FcrAnnotationState.END);
890
600
  }
891
601
  }
892
602
  }, {
893
603
  key: "syncScreenShareOwnerOpenDone",
894
604
  value: function syncScreenShareOwnerOpenDone() {
895
- var _this$_annotationCont2;
896
- this.logger.info('[Annotation] syncScreenShareOwnerOpenDone');
897
- (_this$_annotationCont2 = this._annotationControl) === null || _this$_annotationCont2 === void 0 || _this$_annotationCont2.syncScreenShareOwnerAnnotationOpenDone();
605
+ this.logger.info('syncScreenShareOwnerOpenDone');
606
+ this._annotationControl.syncScreenShareOwnerAnnotationOpenDone();
607
+ }
608
+ }, {
609
+ key: "_resetAnnotationToolbarState",
610
+ value: function _resetAnnotationToolbarState() {
611
+ if (this._toolbarStore) {
612
+ this._toolbarStore.resetToolbarVars();
613
+ } else {
614
+ this.logger.error('resetAnnotationToolbarState failed, toolbarStore is undefined');
615
+ }
898
616
  }
899
617
  }]);
900
618
  }();
901
619
  _AnnotationStore = AnnotationStore;
902
- var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AnnotationStore, [[_mobx.observable, 1, "receiverAllOpenStateReady"], [_mobx.computed, 3, "scalcValue"], [_mobx.computed, 3, "annotating"], [_decorator.bound, 2, "isAnnotationSupported"], [_decorator.bound, 2, "getToolbarStore"], [_handleReceiverBoardDecs, 18, "handleReceiverBoard"], [_handleBoardDomLoadDecs, 18, "handleBoardDomLoad"], [_handleBoardContainerDomLoadDecs, 18, "handleBoardContainerDomLoad"], [_decorator.bound, 2, "screenSharingStarted"], [_decorator.bound, 2, "release"], [_decorator.bound, 2, "_clearCurrentAnnotationControl"], [_decorator.bound, 2, "_getCurrentAnnotationControl"], [_decorator.bound, 2, "_annotationSenderMainStart"], [_decorator.bound, 2, "_annotationReceiverMainStart"], [_annotationaEndEffectThenCloseBoardDecs, 18, "_annotationaEndEffectThenCloseBoard"], [_mountDecs, 18, "_mount"], [_unmountDecs, 18, "_unmount"], [_decorator.bound, 2, "_close"], [_decorator.bound, 2, "_handleOnLocalVideoStatsUpdated"], [_decorator.bound, 2, "_updateAnnotationBounds"], [_decorator.bound, 2, "_updateBoundsByActiveWindow"], [_decorator.bound, 2, "_addWindowResizeListenner"], [_decorator.bound, 2, "_removeWindowResizeListenner"], [_decorator.bound, 2, "_checkSharingwindowBackupSize"], [_decorator.bound, 2, "_setBoardDomWithBackupWindowSize"], [_decorator.bound, 2, "_renewAnnotationWhiteboardToolbar"], [_decorator.bound, 2, "_clearAnnotationWhiteboardToolbar"], [_decorator.bound, 2, "_participantShareCanWeAnnotation"], [_decorator.bound, 2, "_connectAnnotaionBoard"], [_annotationStartTriggerEffectDecs, 18, "_annotationStartTriggerEffect"], [_decorator.bound, 2, "_handleOnScreenSharingUpdated"], [_decorator.bound, 2, "_handleOnAnnotationConnectionStateUpdated"], [_decorator.bound, 2, "_deleteBoardDomContent"], [_decorator.bound, 2, "syncScreenShareOwnerOpenDone"]], []).e, 2);
903
- _init_receiverAllOpenStateReady = _applyDecs$e[0];
904
- _initProto = _applyDecs$e[1];
620
+ var _applyDecs$e = (0, _slicedToArray2["default"])(_applyDecs(_AnnotationStore, [[_mobx.computed, 3, "scalcValue"], [_mobx.computed, 3, "annotating"], [_decorator.bound, 2, "isAnnotationSupported"], [_decorator.bound, 2, "getToolbarStore"], [_handleBoardDomLoadDecs, 18, "handleBoardDomLoad"], [_decorator.bound, 2, "screenSharingStarted"], [_decorator.bound, 2, "release"], [_decorator.bound, 2, "_startShareScreen"], [_decorator.bound, 2, "_openAnnotation"], [_closeAnnotationDecs, 18, "_closeAnnotation"], [_mountDecs, 18, "_mount"], [_decorator.bound, 2, "_handleOnLocalVideoStatsUpdated"], [_decorator.bound, 2, "_updateAnnotationBounds"], [_decorator.bound, 2, "_updateBoundsByActiveWindow"], [_decorator.bound, 2, "_addWindowResizeListener"], [_decorator.bound, 2, "_removeWindowResizeListenner"], [_decorator.bound, 2, "_checkIfAnnotationCanStart"], [_decorator.bound, 2, "_handleOnScreenSharingUpdated"], [_decorator.bound, 2, "_handleOnAnnotationConnectionStateUpdated"], [_decorator.bound, 2, "syncScreenShareOwnerOpenDone"]], []).e, 1);
621
+ _initProto = _applyDecs$e[0];
905
622
  var AnnotationStoreContext = exports.AnnotationStoreContext = /*#__PURE__*/(0, _react.createContext)({});