diff --git a/app/components/TextDiv.jsx b/app/components/TextDiv.jsx new file mode 100644 index 0000000..7e2d147 --- /dev/null +++ b/app/components/TextDiv.jsx @@ -0,0 +1,9 @@ +import styled from 'styled-components' + +export const Centered = styled.div` + text-align: center !important; +` + +export const LeftAligned = styled.div` + text-align: left !important; +` diff --git a/app/index.js b/app/index.js index b02970b..500bd3d 100644 --- a/app/index.js +++ b/app/index.js @@ -73,6 +73,34 @@ function askWhichNodeToUse (apiVersion) { return btnId === 1 } +/** + * startWelcome will open a new window and waint until the user closes it by + * ending the Welcome Flow. + * It checks if the user has already been through the Welcome page by validating + * it as a version. This will help Orion to show the welcome page if there are + * important changes to show. + * It returns a promise. + */ +function startWelcome () { + const welcomeVersion = Settings.getSync('welcomeVersion') + // To do, change this to a variable? + if (welcomeVersion <= 1) { + return Promise.resolve() + } + + return new Promise((resolve, reject) => { + // If the user did not accept our ToS, show the welcome window + const welcomeWindow = WelcomeWindow.create(app) + app.mainWindow = welcomeWindow + welcomeWindow.on('closed', () => { + if (Settings.getSync('welcomeVersion') === 1) { + return resolve() + } + app.quit() + }) + }) +} + /** * This method will: * 1. setup the tray icon (except on macOS) @@ -107,6 +135,7 @@ function startOrion () { const loadingWindow = LoadingWindow.create(app) loadingWindow.on('ready-to-show', () => { + app.mainWindow = loadingWindow console.log('Loading window ready to show') loadingWindow.webContents.send('set-progress', { text: 'Getting started...', @@ -252,25 +281,11 @@ function startOrion () { } app.on('start-orion', () => { - startOrion() + startWelcome().then(startOrion) }) app.on('ready', () => { - const userAgreement = Settings.getSync('userAgreement') - - if (userAgreement) { - startOrion() - } else { - // If the user did not accept our ToS, show the welcome window - const welcomeWindow = WelcomeWindow.create(app) - welcomeWindow.on('closed', () => { - // If the user did not accept ToS, but closed the welcome window, quit (don't run the the bg) - const userAgreement = Settings.getSync('userAgreement') - if (!userAgreement) { - app.quit() - } - }) - } + startWelcome().then(startOrion) }) app.on('activate', () => { diff --git a/app/stats.js b/app/stats.js index 20e20a8..3c0d4bd 100644 --- a/app/stats.js +++ b/app/stats.js @@ -2,7 +2,6 @@ import Mixpanel from 'mixpanel' import Settings from 'electron-settings' import uuidv4 from 'uuid/v4' import pjson from '../package.json' -import publicIp from 'public-ip' import { release, platform } from 'os' const SettingsUserIDKey = 'statsUserID' @@ -17,7 +16,7 @@ let UserID = Settings.getSync(SettingsUserIDKey) * setUpUser will configure the client in order to track errors, events and * follow users when debugging process. */ -export function setUpUser (ipAddress) { +export function setUpUser () { if (!Settings.getSync(SettingsUserIDKey)) { UserID = uuidv4() Settings.setSync(SettingsUserIDKey, UserID) @@ -29,8 +28,6 @@ export function setUpUser (ipAddress) { version: `${pjson.version}`, os_release: `${release()}`, os_platform: `${platform()}` - }, { - $ip: ipAddress }) } @@ -48,21 +45,18 @@ export function trackEvent (eventName, data) { return resolve() } - return publicIp.v4().then(ipAddress => { - setUpUser(ipAddress) + setUpUser() + if (!data) { + data = {} + } - if (!data) { - data = {} + data.distinct_id = UserID + data.version = `${pjson.version}` + client.track(eventName, data, (err) => { + if (err) { + return reject(err) } - - data.distinct_id = UserID - data.version = `${pjson.version}` - client.track(eventName, data, (err) => { - if (err) { - return reject(err) - } - return resolve() - }) + return resolve() }) }) } diff --git a/app/windows/Welcome/Components/ServicesPage.jsx b/app/windows/Welcome/Components/ServicesPage.jsx new file mode 100644 index 0000000..0f16bd6 --- /dev/null +++ b/app/windows/Welcome/Components/ServicesPage.jsx @@ -0,0 +1,50 @@ +import React from 'react' +import { Centered, LeftAligned } from '../../../components/TextDiv' + +import SiderusLogo from '../../../../docs/siderus-logo.svg' + +import { + Window, + Content, + Toolbar, + Actionbar, + Button +} from 'react-photonkit' + +class ServicesPage extends React.Component { + render () { + const { onNext } = this.props + return ( + + + + +

Siderus Services

+

Enable a better experience

+ + + Siderus offers a set of services designed to ease and improve the + user experience of IPFS. Orion will always connect to Siderus IPFS + Nodes and you can enable the services to gain some benefits, + including, but not limiting to: +
    +
  • Pre-fetching of the content on public Gateways
  • +
  • Siderus Mercury, ACL and Encryption
  • +
  • Siderus Hera, remote syncronization
  • +
  • Siderus Hera, remote pinning
  • +
+
+