From bf502e66a9f336eec1baf1adea19876bf2e554b1 Mon Sep 17 00:00:00 2001 From: Mike Dabrowski Date: Mon, 4 Feb 2019 10:01:23 +0100 Subject: [PATCH] fix(App): Remove gaEvent and fix theme not loading on start --- package.json | 2 +- src/containers/auth/ImportScreen.js | 1 - src/containers/auth/InviteScreen.js | 1 - src/containers/auth/PasswordScreen.js | 1 - src/containers/auth/WelcomeScreen.js | 1 - src/containers/settings/AccountScreen.js | 1 - src/containers/settings/InviteScreen.js | 1 - src/containers/settings/ServicesScreen.js | 1 - src/webview/lib/RecipeWebview.js | 47 ++++++++++++++++------- 9 files changed, 35 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index e0181c1b7..0450561e2 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "franz", "productName": "Franz", "appId": "com.meetfranz.franz", - "version": "5.0.0-omega.24", + "version": "5.0.0-omega.25", "description": "Messaging app for WhatsApp, Slack, Telegram, HipChat, Hangouts and many many more.", "copyright": "adlk x franz - Stefan Malzner", "main": "index.js", diff --git a/src/containers/auth/ImportScreen.js b/src/containers/auth/ImportScreen.js index b18c57059..bf7d26568 100644 --- a/src/containers/auth/ImportScreen.js +++ b/src/containers/auth/ImportScreen.js @@ -6,7 +6,6 @@ import UserStore from '../../stores/UserStore'; export default @inject('stores', 'actions') @observer class ImportScreen extends Component { componentDidMount() { - gaPage('Auth/Import'); } render() { diff --git a/src/containers/auth/InviteScreen.js b/src/containers/auth/InviteScreen.js index 114330852..f1af822be 100644 --- a/src/containers/auth/InviteScreen.js +++ b/src/containers/auth/InviteScreen.js @@ -5,7 +5,6 @@ import Invite from '../../components/auth/Invite'; export default @inject('stores', 'actions') @observer class InviteScreen extends Component { componentDidMount() { - gaPage('Auth/Invite'); } render() { diff --git a/src/containers/auth/PasswordScreen.js b/src/containers/auth/PasswordScreen.js index a0285b2f8..65c5a75d7 100644 --- a/src/containers/auth/PasswordScreen.js +++ b/src/containers/auth/PasswordScreen.js @@ -6,7 +6,6 @@ import UserStore from '../../stores/UserStore'; export default @inject('stores', 'actions') @observer class PasswordScreen extends Component { componentDidMount() { - gaPage('Auth/Password Retrieve'); } render() { diff --git a/src/containers/auth/WelcomeScreen.js b/src/containers/auth/WelcomeScreen.js index 1ac490785..1ada768ba 100644 --- a/src/containers/auth/WelcomeScreen.js +++ b/src/containers/auth/WelcomeScreen.js @@ -8,7 +8,6 @@ import RecipePreviewsStore from '../../stores/RecipePreviewsStore'; export default @inject('stores', 'actions') @observer class LoginScreen extends Component { componentDidMount() { - gaPage('Auth/Welcome'); } render() { diff --git a/src/containers/settings/AccountScreen.js b/src/containers/settings/AccountScreen.js index 7519f3ae2..2efad5824 100644 --- a/src/containers/settings/AccountScreen.js +++ b/src/containers/settings/AccountScreen.js @@ -14,7 +14,6 @@ const { BrowserWindow } = remote; export default @inject('stores', 'actions') @observer class AccountScreen extends Component { componentDidMount() { - gaPage('Settings/Account Dashboard'); } onCloseWindow() { diff --git a/src/containers/settings/InviteScreen.js b/src/containers/settings/InviteScreen.js index 3a573bc91..11df12998 100644 --- a/src/containers/settings/InviteScreen.js +++ b/src/containers/settings/InviteScreen.js @@ -7,7 +7,6 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; export default @inject('stores', 'actions') @observer class InviteScreen extends Component { componentDidMount() { - gaPage('Settings/Invite'); } componentWillUnmount() { diff --git a/src/containers/settings/ServicesScreen.js b/src/containers/settings/ServicesScreen.js index eac158ac3..a6040f544 100644 --- a/src/containers/settings/ServicesScreen.js +++ b/src/containers/settings/ServicesScreen.js @@ -12,7 +12,6 @@ import ErrorBoundary from '../../components/util/ErrorBoundary'; export default @inject('stores', 'actions') @observer class ServicesScreen extends Component { componentDidMount() { - gaPage('Settings/Service Dashboard'); } componentWillUnmount() { diff --git a/src/webview/lib/RecipeWebview.js b/src/webview/lib/RecipeWebview.js index 8ed5588c0..3e3ad11a1 100644 --- a/src/webview/lib/RecipeWebview.js +++ b/src/webview/lib/RecipeWebview.js @@ -23,21 +23,42 @@ class RecipeWebview { } changeTheme = (themeName) => { - const currentClassList = document.body.classList; - if (themeName && !currentClassList.contains(themeName)) { - let name = themeName; - if (!themeName.startsWith('theme-')) { - name = `theme-${themeName}`; - } - [...currentClassList].forEach((c) => { - if (c && c.startsWith('theme-')) { - document.body.classList.remove(c); + if(document.body && document.body.classList) { + const currentClassList = document.body.classList; + if (themeName && !currentClassList.contains(themeName)) { + let name = themeName; + if (!themeName.startsWith('theme-')) { + name = `theme-${themeName}`; + } + [...currentClassList].forEach((c) => { + if (c && c.startsWith('theme-')) { + document.body.classList.remove(c); + } + }); + if (name === 'theme-regular') { + return; } - }); - if (name === 'theme-regular') { - return; + document.body.classList.add(name); } - document.body.classList.add(name); + } else { + window.addEventListener('load', () => { + const currentClassList = document.body.classList; + if (themeName && !currentClassList.contains(themeName)) { + let name = themeName; + if (!themeName.startsWith('theme-')) { + name = `theme-${themeName}`; + } + [...currentClassList].forEach((c) => { + if (c && c.startsWith('theme-')) { + document.body.classList.remove(c); + } + }); + if (name === 'theme-regular') { + return; + } + document.body.classList.add(name); + } + }) } };