Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
/ Orion Public archive

Commit

Permalink
Merge pull request #122 from Siderus/feature/143-Optional-ToS
Browse files Browse the repository at this point in the history
Optional ToS (143)
  • Loading branch information
koalalorenzo authored Jun 2, 2018
2 parents a2b7e2d + d62c535 commit e356b59
Show file tree
Hide file tree
Showing 12 changed files with 201 additions and 389 deletions.
9 changes: 9 additions & 0 deletions app/components/TextDiv.jsx
Original file line number Diff line number Diff line change
@@ -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;
`
47 changes: 31 additions & 16 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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...',
Expand Down Expand Up @@ -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', () => {
Expand Down
28 changes: 11 additions & 17 deletions app/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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)
Expand All @@ -29,8 +28,6 @@ export function setUpUser (ipAddress) {
version: `${pjson.version}`,
os_release: `${release()}`,
os_platform: `${platform()}`
}, {
$ip: ipAddress
})
}

Expand All @@ -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()
})
})
}
50 changes: 50 additions & 0 deletions app/windows/Welcome/Components/ServicesPage.jsx
Original file line number Diff line number Diff line change
@@ -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 (
<Window>
<Content>
<Centered>
<SiderusLogo width='150px' height='150px'/>
<h1>Siderus Services</h1>
<h3>Enable a better experience</h3>
<LeftAligned>

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:
<ul>
<li>Pre-fetching of the content on public Gateways</li>
<li>Siderus Mercury, ACL and Encryption</li>
<li>Siderus Hera, remote syncronization</li>
<li>Siderus Hera, remote pinning</li>
</ul>
</LeftAligned>
<Button text="Enable Siderus Services" ptStyle="positive" ptSize="large"/>
</Centered>
</Content>
<Toolbar ptType="footer">
<Actionbar>
<Button text="Next" ptStyle="primary" onClick={onNext} pullRight />
</Actionbar>
</Toolbar>
</Window>
)
}
}

export default ServicesPage
75 changes: 75 additions & 0 deletions app/windows/Welcome/Components/StatsPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react'
import styled from 'styled-components'
import { shell } from 'electron'
import Settings from 'electron-settings'

import {
Window,
Content,
Toolbar,
Actionbar,
Button
} from 'react-photonkit'

const StyledContent = styled.div`
h1:first-child {
margin-top: 0px;
}
`

const PrivacyLink = <a onClick={() => shell.openExternal('https://siderus.io/privacy')} href='#'>Privacy policy</a>

class StatsPage extends React.Component {
enableStats = () => {
Settings.setSync('allowUserTracking', true)
this.props.onNext()
}

disableStats = () => {
Settings.setSync('allowUserTracking', false)
this.props.onNext()
}

render () {
return (
<Window>
<Content>
<StyledContent>
<h1>Support Orion development</h1>
<p>
Siderus Orion is integrated with Mixpanel and Sentry to help us
debugging errors, understanding how to improve the
application and your <b>user experience with IPFS</b>. <br />
<br />
Both the integrations are using anonymized information, and
focusing on only the important details. Some of them are:
<ul>
<li>An unique random ID generated on the first usage</li>
<li>Features used (Windows, Screens and Sessions)</li>
<li>Operative System and release/version</li>
<li>Amount of files shared, NOT the hashes</li>
</ul>
You can opt-in as well as opt out at any time from the Settings.<br />
<br />
By enabling this feature, you will provide extra valuable metrics
and data useful for improving your user experience, the
services and fixing bugs <b>on top of the default Sentry anonymous
errors reporting</b> always enabled.<br />
<br />
You can validate these information by reading and checking the
source code on GitHub. You can also read Siderus {PrivacyLink}.
</p>
</StyledContent>
</Content>
<Toolbar ptType="footer">
<Actionbar>
<Button text="Enable Tracking" ptStyle="primary" onClick={this.enableStats} pullRight />
<Button text="Disable" onClick={this.disableStats} pullRight />
</Actionbar>
</Toolbar>
</Window>
)
}
}

export default StatsPage
103 changes: 0 additions & 103 deletions app/windows/Welcome/Components/TermsOfServicePage.jsx

This file was deleted.

Loading

0 comments on commit e356b59

Please sign in to comment.