Skip to content

Commit

Permalink
fix(FEV-1344): remove icon duplication on media switch (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
semarche-kaltura authored Aug 16, 2022
1 parent 996e1dd commit 7e84046
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/qna-plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class QnaPlugin extends KalturaPlayer.core.BasePlugin {
});
// register to kitchenSink updated qnaMessages array
this._kitchenSinkMessages.on(KitchenSinkPluginEventTypes.MessagesUpdatedEvent, this._onQnaMessage);
this._initPluginManagers();
this._delayedGiveUpLoading();
}

get sidePanelsManager() {
Expand Down Expand Up @@ -142,13 +142,15 @@ export class QnaPlugin extends KalturaPlayer.core.BasePlugin {
this.cuePointManager.CuepointType.USER_QNA,
this.cuePointManager.CuepointType.CODE_QNA
]);

this._loading = true;
this._hasError = false;
this._createQnAPlugin();
this._chatMessagesAdapter.onMediaLoad(sources.id);
}

private _handleCloseClick = () => {
this.sidePanelsManager.deactivateItem(this._pluginPanel);
this._pluginState = PluginStates.CLOSED;
};

private _createQnAPlugin = () => {
if (this._pluginPanel) {
return;
Expand All @@ -163,9 +165,7 @@ export class QnaPlugin extends KalturaPlayer.core.BasePlugin {
const theme = this._getTheme();
return (
<KitchenSink
onClose={() => {
this.sidePanelsManager.deactivateItem(this._pluginPanel);
}}
onClose={this._handleCloseClick}
dateFormat={this.config.dateFormat}
threads={this._threads}
hasError={this._hasError}
Expand All @@ -189,8 +189,7 @@ export class QnaPlugin extends KalturaPlayer.core.BasePlugin {
isActive={isActive}
onClick={() => {
if (this.sidePanelsManager.isItemActive(this._pluginPanel)) {
this._pluginState = PluginStates.CLOSED;
this.sidePanelsManager.deactivateItem(this._pluginPanel);
this._handleCloseClick();
} else {
this.sidePanelsManager.activateItem(this._pluginPanel);
}
Expand Down Expand Up @@ -225,15 +224,16 @@ export class QnaPlugin extends KalturaPlayer.core.BasePlugin {
//reset managers
this._kitchenSinkMessages.reset();
this._chatMessagesAdapter.reset();
this._pluginPanel = null;
if (this._pluginPanel) {
this.sidePanelsManager.removeItem(this._pluginPanel);
this._pluginPanel = null;
}
this.eventManager.removeAll();
this._contribServices.reset();
}

destroy(): void {
this._hasError = false;
this._loading = true;
this._threads = [];
this.reset();
// destroy managers
this._kitchenSinkMessages.destroy();
// remove kitchenSink listener
Expand All @@ -251,10 +251,6 @@ export class QnaPlugin extends KalturaPlayer.core.BasePlugin {
});
}

private _initPluginManagers(): void {
this._delayedGiveUpLoading();
}

private _delayedGiveUpLoading() {
setTimeout(() => {
this._loading = false;
Expand Down

0 comments on commit 7e84046

Please sign in to comment.