Skip to content

Commit

Permalink
custom theme update comes from server side now
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanfbrito committed Aug 17, 2023
1 parent 336e511 commit 6cfae4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
18 changes: 6 additions & 12 deletions src/injected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,12 @@ const start = (): void => {
}
});

Tracker.autorun(() => {
const { url, defaultUrl } = settings.get('Assets_background') || {};
window.RocketChatDesktop.setBackground(url || defaultUrl);
});

Tracker.autorun(() => {
const meteorCustomTheme = Meteor.settings['theme-custom-css'] || '';
console.log('[Rocket.Chat Desktop] meteorCustomTheme', meteorCustomTheme);
if (meteorCustomTheme.length > 0) {
window.RocketChatDesktop.setSidebarCustomTheme(meteorCustomTheme);
}
});
if (!versionIsGreaterOrEqualsTo(serverInfo.version, '6.4.0')) {
Tracker.autorun(() => {
const { url, defaultUrl } = settings.get('Assets_background') || {};
window.RocketChatDesktop.setBackground(url || defaultUrl);
});
}

Tracker.autorun(() => {
const userToken = Meteor._localStorage.getItem('Meteor.loginToken');
Expand Down
2 changes: 1 addition & 1 deletion src/ui/components/SideBar/customTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface CustomThemeProps {

const CustomTheme: React.FC<CustomThemeProps> = ({ customTheme }) => {
useEffect(() => {
const styleElement = document.createElement('customTheme');
const styleElement = document.createElement('style');
styleElement.textContent = customTheme;

document.head.appendChild(styleElement);
Expand Down

0 comments on commit 6cfae4b

Please sign in to comment.