diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index e210442c50..70971e2299 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -24,7 +24,7 @@ import sdk from '../../../index'; import dis from '../../../dispatcher'; import RoomViewStore from '../../../stores/RoomViewStore'; import SettingsStore, {SettingLevel} from "../../../settings/SettingsStore"; -import Stickerpack from './Stickerpack'; +import Stickerpicker from './Stickerpicker'; export default class MessageComposer extends React.Component { constructor(props, context) { @@ -344,7 +344,7 @@ export default class MessageComposer extends React.Component { hangupButton, callButton, videoCallButton, - , + , ); } else { controls.push( diff --git a/src/components/views/rooms/Stickerpack.js b/src/components/views/rooms/Stickerpicker.js similarity index 87% rename from src/components/views/rooms/Stickerpack.js rename to src/components/views/rooms/Stickerpicker.js index f20c581171..780a48d848 100644 --- a/src/components/views/rooms/Stickerpack.js +++ b/src/components/views/rooms/Stickerpicker.js @@ -26,14 +26,14 @@ import SdkConfig from '../../../SdkConfig'; import ScalarAuthClient from '../../../ScalarAuthClient'; import dis from '../../../dispatcher'; -export default class Stickerpack extends React.Component { +export default class Stickerpicker extends React.Component { constructor(props) { super(props); this.onShowStickersClick = this.onShowStickersClick.bind(this); this.onHideStickersClick = this.onHideStickersClick.bind(this); this.onFinished = this.onFinished.bind(this); this._launchManageIntegrations = this._launchManageIntegrations.bind(this); - this._removeStickerpackWidgets = this._removeStickerpackWidgets.bind(this); + this._removeStickerpickerWidgets = this._removeStickerpickerWidgets.bind(this); this._onWidgetAction = this._onWidgetAction.bind(this); this.defaultStickersContent = ( @@ -53,8 +53,8 @@ export default class Stickerpack extends React.Component { }; } - _removeStickerpackWidgets() { - console.warn('Removing stickerpack widgets'); + _removeStickerpickerWidgets() { + console.warn('Removing Stickerpicker widgets'); if (this.widgetId) { this.scalarClient.disableWidgetAssets('stickerpack', this.widgetId).then(() => { console.warn('Assets disabled'); @@ -64,7 +64,7 @@ export default class Stickerpack extends React.Component { } else { console.warn('No widget ID specified, not disabling assets'); } - Widgets.removeStickerpackWidgets(); + Widgets.removeStickerpickerWidgets(); this._getStickerPickerWidget(); this.stickersMenu.close(); } @@ -109,16 +109,16 @@ export default class Stickerpack extends React.Component { _getStickerPickerWidget() { // Stickers - // TODO - Add support for stickerpacks from multiple app stores. - // Render content from multiple stickerpack sources, each within their own iframe, within the stickerpack UI element. - const stickerpackWidget = Widgets.getStickerpackWidgets()[0]; + // TODO - Add support for Stickerpickers from multiple app stores. + // Render content from multiple stickerpack sources, each within their own iframe, within the stickerpicker UI element. + const stickerpickerWidget = Widgets.getStickerpickerWidgets()[0]; let stickersContent; // Load stickerpack content - if (stickerpackWidget && stickerpackWidget.content && stickerpackWidget.content.url) { + if (stickerpickerWidget && stickerpickerWidget.content && stickerpickerWidget.content.url) { // Set default name - stickerpackWidget.content.name = stickerpackWidget.name || "Stickerpack"; - this.widgetId = stickerpackWidget.id; + stickerpickerWidget.content.name = stickerpickerWidget.name || "Stickerpack"; + this.widgetId = stickerpickerWidget.id; stickersContent = (
@@ -157,7 +157,7 @@ export default class Stickerpack extends React.Component {
); } else { - // Default content to show if stickerpack widget not added + // Default content to show if stickerpicker widget not added console.warn("No available sticker picker widgets"); stickersContent = this.defaultStickersContent; this.widgetId = null; diff --git a/src/utils/widgets.js b/src/utils/widgets.js index a70a4f0406..da68abb4a9 100644 --- a/src/utils/widgets.js +++ b/src/utils/widgets.js @@ -45,26 +45,26 @@ function getUserWidgets() { } /** - * Get active stickerpack widgets (stickerpacks are user widgets by nature) - * @return {[object]} Array containing current / active stickerpack widgets + * Get active stickerpicker widgets (stickerpickers are user widgets by nature) + * @return {[object]} Array containing current / active stickerpicker widgets */ -function getStickerpackWidgets() { +function getStickerpickerWidgets() { const widgets = getUserWidgets(); - const stickerpackWidgets = widgets.filter((widget) => widget.type='stickerpack'); - return stickerpackWidgets; + const stickerpickerWidgets = widgets.filter((widget) => widget.type='m.stickerpicker'); + return stickerpickerWidgets; } /** - * Remove all stickerpack widgets (stickerpacks are user widgets by nature) + * Remove all stickerpicker widgets (stickerpickers are user widgets by nature) */ -function removeStickerpackWidgets() { +function removeStickerpickerWidgets() { const client = MatrixClientPeg.get(); if (!client) { throw new Error('User not logged in'); } const userWidgets = client.getAccountData('m.widgets').getContent() || {}; Object.entries(userWidgets).forEach(([key, widget]) => { - if (widget.type === 'stickerpack') { + if (widget.type === 'm.stickerpicker') { delete userWidgets[key]; } }); @@ -76,6 +76,6 @@ export default { getWidgets, getRoomWidgets, getUserWidgets, - getStickerpackWidgets, - removeStickerpackWidgets, + getStickerpickerWidgets, + removeStickerpickerWidgets, };