diff options
author | beatrix <beatrix.bitrot@gmail.com> | 2017-12-06 17:44:07 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-06 17:44:07 -0500 |
commit | 81b01457598459c42a7b14d9aa14f91ba60dcae1 (patch) | |
tree | 7d3e6dadb75f3be95e5a5ed8b7ecfe90e7711831 /app/javascript/themes/glitch/containers/mastodon.js | |
parent | f1cbea77a4a52929244198dcbde26d63d837489a (diff) | |
parent | 017fc81caf8f265e5c5543186877437485625795 (diff) |
Merge pull request #229 from glitch-soc/glitch-theme
Advanced Next-Level Flavours And Skins For Mastodon™
Diffstat (limited to 'app/javascript/themes/glitch/containers/mastodon.js')
-rw-r--r-- | app/javascript/themes/glitch/containers/mastodon.js | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/app/javascript/themes/glitch/containers/mastodon.js b/app/javascript/themes/glitch/containers/mastodon.js deleted file mode 100644 index 348470637..000000000 --- a/app/javascript/themes/glitch/containers/mastodon.js +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react'; -import { Provider } from 'react-redux'; -import PropTypes from 'prop-types'; -import configureStore from 'themes/glitch/store/configureStore'; -import { showOnboardingOnce } from 'themes/glitch/actions/onboarding'; -import { BrowserRouter, Route } from 'react-router-dom'; -import { ScrollContext } from 'react-router-scroll-4'; -import UI from 'themes/glitch/features/ui'; -import { hydrateStore } from 'themes/glitch/actions/store'; -import { connectUserStream } from 'themes/glitch/actions/streaming'; -import { IntlProvider, addLocaleData } from 'react-intl'; -import { getLocale } from 'mastodon/locales'; -import initialState from 'themes/glitch/util/initial_state'; - -const { localeData, messages } = getLocale(); -addLocaleData(localeData); - -export const store = configureStore(); -const hydrateAction = hydrateStore(initialState); -store.dispatch(hydrateAction); - -export default class Mastodon extends React.PureComponent { - - static propTypes = { - locale: PropTypes.string.isRequired, - }; - - componentDidMount() { - this.disconnect = store.dispatch(connectUserStream()); - - // Desktop notifications - // Ask after 1 minute - if (typeof window.Notification !== 'undefined' && Notification.permission === 'default') { - window.setTimeout(() => Notification.requestPermission(), 60 * 1000); - } - - // Protocol handler - // Ask after 5 minutes - if (typeof navigator.registerProtocolHandler !== 'undefined') { - const handlerUrl = window.location.protocol + '//' + window.location.host + '/intent?uri=%s'; - window.setTimeout(() => navigator.registerProtocolHandler('web+mastodon', handlerUrl, 'Mastodon'), 5 * 60 * 1000); - } - - store.dispatch(showOnboardingOnce()); - } - - componentWillUnmount () { - if (this.disconnect) { - this.disconnect(); - this.disconnect = null; - } - } - - render () { - const { locale } = this.props; - - return ( - <IntlProvider locale={locale} messages={messages}> - <Provider store={store}> - <BrowserRouter basename='/web'> - <ScrollContext> - <Route path='/' component={UI} /> - </ScrollContext> - </BrowserRouter> - </Provider> - </IntlProvider> - ); - } - -} |