Форк Rambox
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

37 lines
1.0 KiB

/**
* Singleton class to handle the custom icons for special services.
*/
Ext.define('Rambox.util.IconLoader', {
singleton: true,
constructor: function(config) {
config = config || {};
/**
* Sets the icon for a specific service.
*
* @param {*} service Id of the service
* @param {*} webview Webview component of the service
*/
this.loadServiceIconUrl = function (service, webview) {
switch (service.type) {
case 'slack':
webview.executeJavaScript(
"(a=>window.slackDebug.activeTeam.redux.getState().teams[a].icon.image_44)(window.slackDebug.activeTeamId);",
false,
function (backgroundImage) {
if (backgroundImage) {
service.setTitle('<img src="'+service.icon+'" width="" style="background-color: white;border-radius: 50%;position: absolute;left: 18px;top: 17px;width: 12px;">'+service.title);
service.fireEvent('iconchange', service, backgroundImage, service.icon);
}
}
);
break;
default:
break;
}
};
}
});