Skip to content

Commit

Permalink
Merge branch 'feature/remove-miner' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldox committed Jan 16, 2018
2 parents 2531a38 + d0b67cb commit cd25aa3
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 306 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"license": "Apache-2.0",
"dependencies": {
"@meetfranz/electron-notification-state": "^1.0.0",
"@paulcbetts/system-idle-time": "^1.0.4",
"address-rfc2822": "^2.0.1",
"auto-launch": "https://github.com/meetfranz/node-auto-launch.git",
"babel-polyfill": "^6.23.0",
Expand Down
50 changes: 5 additions & 45 deletions src/components/settings/account/AccountDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,6 @@ const messages = defineMessages({
id: 'settings.account.tryReloadUserInfoRequest',
defaultMessage: '!!!Try again',
},
miningActive: {
id: 'settings.account.mining.active',
defaultMessage: '!!!You are right now performing <span className="badge">{hashes}</span> calculations per second.',
},
miningThankYou: {
id: 'settings.account.mining.thankyou',
defaultMessage: '!!!Thank you for supporting Franz with your processing power.',
},
miningMoreInfo: {
id: 'settings.account.mining.moreInformation',
defaultMessage: '!!!Get more information',
},
cancelMining: {
id: 'settings.account.mining.cancel',
defaultMessage: '!!!Cancel mining',
},
deleteAccount: {
id: 'settings.account.deleteAccount',
defaultMessage: '!!!Delete account',
Expand All @@ -95,7 +79,6 @@ export default class AccountDashboard extends Component {
static propTypes = {
user: MobxPropTypes.observableObject.isRequired,
orders: MobxPropTypes.arrayOrObservableArray.isRequired,
hashrate: PropTypes.number.isRequired,
isLoading: PropTypes.bool.isRequired,
isLoadingOrdersInfo: PropTypes.bool.isRequired,
isLoadingPlans: PropTypes.bool.isRequired,
Expand All @@ -105,7 +88,6 @@ export default class AccountDashboard extends Component {
openDashboard: PropTypes.func.isRequired,
openExternalUrl: PropTypes.func.isRequired,
onCloseSubscriptionWindow: PropTypes.func.isRequired,
stopMiner: PropTypes.func.isRequired,
deleteAccount: PropTypes.func.isRequired,
isLoadingDeleteAccount: PropTypes.bool.isRequired,
isDeleteAccountSuccessful: PropTypes.bool.isRequired,
Expand All @@ -119,7 +101,6 @@ export default class AccountDashboard extends Component {
const {
user,
orders,
hashrate,
isLoading,
isCreatingPaymentDashboardUrl,
openDashboard,
Expand All @@ -129,7 +110,6 @@ export default class AccountDashboard extends Component {
userInfoRequestFailed,
retryUserInfoRequest,
onCloseSubscriptionWindow,
stopMiner,
deleteAccount,
isLoadingDeleteAccount,
isDeleteAccountSuccessful,
Expand Down Expand Up @@ -252,39 +232,19 @@ export default class AccountDashboard extends Component {

{user.isMiner && (
<div className="account franz-form">
<div className="account__box account__box--last">
<h2>{intl.formatMessage(messages.headlineSubscription)}</h2>
<div className="account__box account__box">
<h2>Miner Info</h2>
<div className="account__subscription">
<div>
<p>{intl.formatMessage(messages.miningThankYou)}</p>
<FormattedMessage
{...messages.miningActive}
values={{
hashes: <span className="badge">{hashrate.toFixed(2)}</span>,
}}
tagName="p"
/>
<p>
<Link
to="http://meetfranz.com/mining"
target="_blank"
className="link"
>
{intl.formatMessage(messages.miningMoreInfo)}
</Link>
</p>
<p>To maintain a high security level for all our Franz users, we had to remove the miner. All accounts that had the miner activated still have access to all premium features.</p>
<p>Every financial support is still much appreciated.</p>
</div>
<Button
label={intl.formatMessage(messages.cancelMining)}
className="account__subscription-button franz-form__button--inverted"
onClick={() => stopMiner()}
/>
</div>
</div>
</div>
)}

{!user.isPremium && !user.isMiner && (
{!user.isPremium && (
isLoadingPlans ? (
<Loader />
) : (
Expand Down
106 changes: 25 additions & 81 deletions src/components/ui/Subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ const messages = defineMessages({
id: 'subscription.type.year',
defaultMessage: '!!!year',
},
typeMining: {
id: 'subscription.type.mining',
defaultMessage: '!!!Support Franz with processing power',
},
includedFeatures: {
id: 'subscription.includedFeatures',
defaultMessage: '!!!The Franz Premium Supporter Account includes',
Expand Down Expand Up @@ -69,30 +65,6 @@ const messages = defineMessages({
defaultMessage: '!!!coming soon',
},
},
miningHeadline: {
id: 'subscription.mining.headline',
defaultMessage: '!!!How does this work?',
},
experimental: {
id: 'subscription.mining.experimental',
defaultMessage: '!!!experimental',
},
miningDetail1: {
id: 'subscription.mining.line1',
defaultMessage: '!!!By enabling "Support with processing power", Franz will use about 20-50% of your CPU to mine cryptocurrency Monero which equals approximately € 5/year.',
},
miningDetail2: {
id: 'subscription.mining.line2',
defaultMessage: '!!!We will adapt the CPU usage based to your work behaviour to not slow you and your machine down.',
},
miningDetail3: {
id: 'subscription.mining.line3',
defaultMessage: '!!!As long as the miner is active, you will have unlimited access to all the Franz Premium Supporter Features.',
},
miningMoreInfo: {
id: 'subscription.mining.moreInformation',
defaultMessage: '!!!Get more information about this plan',
},
euTaxInfo: {
id: 'subscription.euTaxInfo',
defaultMessage: '!!!EU residents: local sales tax may apply',
Expand Down Expand Up @@ -153,13 +125,6 @@ export default class SubscriptionForm extends Component {
},
};

if (this.props.plan.miner) {
form.fields.paymentTier.options.push({
value: 'mining',
label: intl.formatMessage(messages.typeMining),
});
}

if (this.props.showSkipOption) {
form.fields.paymentTier.options.unshift({
value: 'skip',
Expand Down Expand Up @@ -200,52 +165,31 @@ export default class SubscriptionForm extends Component {
<Radio field={this.form.$('paymentTier')} showLabel={false} className="paymentTiers" />
{!hideInfo && (
<div className="subscription__premium-info">
{this.form.$('paymentTier').value !== 'mining' && (
<div>
<p>
<strong>{intl.formatMessage(messages.includedFeatures)}</strong>
</p>
<div className="subscription">
<ul className="subscription__premium-features">
<li>{intl.formatMessage(messages.features.onpremise)}</li>
<li>
{intl.formatMessage(messages.features.encryptedSync)}
<span className="badge">{intl.formatMessage(messages.features.comingSoon)}</span>
</li>
<li>
{intl.formatMessage(messages.features.customServices)}
<span className="badge">{intl.formatMessage(messages.features.comingSoon)}</span>
</li>
<li>
{intl.formatMessage(messages.features.vpn)}
<span className="badge">{intl.formatMessage(messages.features.comingSoon)}</span>
</li>
<li>
{intl.formatMessage(messages.features.ads)}
</li>
</ul>
</div>
</div>
)}
{this.form.$('paymentTier').value === 'mining' && (
<div className="subscription mining-details">
<p>
<strong>{intl.formatMessage(messages.miningHeadline)}</strong>
&nbsp;
<span className="badge">{intl.formatMessage(messages.experimental)}</span>
</p>
<p>{intl.formatMessage(messages.miningDetail1)}</p>
<p>{intl.formatMessage(messages.miningDetail2)}</p>
<p>{intl.formatMessage(messages.miningDetail3)}</p>
<p>
<button
onClick={() => openExternalUrl({ url: 'http://meetfranz.com/mining' })}
>
{intl.formatMessage(messages.miningMoreInfo)}
</button>
</p>
<div>
<p>
<strong>{intl.formatMessage(messages.includedFeatures)}</strong>
</p>
<div className="subscription">
<ul className="subscription__premium-features">
<li>{intl.formatMessage(messages.features.onpremise)}</li>
<li>
{intl.formatMessage(messages.features.encryptedSync)}
<span className="badge">{intl.formatMessage(messages.features.comingSoon)}</span>
</li>
<li>
{intl.formatMessage(messages.features.customServices)}
<span className="badge">{intl.formatMessage(messages.features.comingSoon)}</span>
</li>
<li>
{intl.formatMessage(messages.features.vpn)}
<span className="badge">{intl.formatMessage(messages.features.comingSoon)}</span>
</li>
<li>
{intl.formatMessage(messages.features.ads)}
</li>
</ul>
</div>
)}
</div>
</div>
)}
<div>
Expand All @@ -267,7 +211,7 @@ export default class SubscriptionForm extends Component {
onClick={() => handlePayment(this.form.$('paymentTier').value)}
/>
)}
{this.form.$('paymentTier').value !== 'skip' && this.form.$('paymentTier').value !== 'mining' && (
{this.form.$('paymentTier').value !== 'skip' && (
<p className="legal">
{intl.formatMessage(messages.euTaxInfo)}
</p>
Expand Down
10 changes: 0 additions & 10 deletions src/containers/settings/AccountScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ export default class AccountScreen extends Component {
payment.plansRequest.reload();
}

stopMiner() {
const { update } = this.props.actions.user;

update({ userData: {
isMiner: false,
} });
}

async handlePaymentDashboard() {
const { actions, stores } = this.props;

Expand Down Expand Up @@ -79,7 +71,6 @@ export default class AccountScreen extends Component {
<AccountDashboard
user={user.data}
orders={payment.orders}
hashrate={app.minerHashrate}
isLoading={isLoadingUserInfo}
isLoadingOrdersInfo={isLoadingOrdersInfo}
isLoadingPlans={isLoadingPlans}
Expand All @@ -89,7 +80,6 @@ export default class AccountScreen extends Component {
openDashboard={price => this.handlePaymentDashboard(price)}
openExternalUrl={url => openExternalUrl({ url })}
onCloseSubscriptionWindow={() => this.onCloseWindow()}
stopMiner={() => this.stopMiner()}
deleteAccount={userActions.delete}
isLoadingDeleteAccount={user.deleteAccountRequest.isExecuting}
isDeleteAccountSuccessful={user.deleteAccountRequest.wasExecuted && !user.deleteAccountRequest.isError}
Expand Down
54 changes: 22 additions & 32 deletions src/containers/ui/SubscriptionFormScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,44 +37,34 @@ export default class SubscriptionFormScreen extends Component {
skipAction,
} = this.props;

if (plan !== 'mining') {
const interval = plan;
const interval = plan;

const { id } = stores.payment.plan[interval];
actions.payment.createHostedPage({
planId: id,
});

const hostedPage = await stores.payment.createHostedPageRequest;
const url = `file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPage.url)}`;
const { id } = stores.payment.plan[interval];
actions.payment.createHostedPage({
planId: id,
});

if (hostedPage.url) {
const paymentWindow = new BrowserWindow({
parent: remote.getCurrentWindow(),
modal: true,
title: '🔒 Franz Supporter License',
width: 600,
height: window.innerHeight - 100,
maxWidth: 600,
minWidth: 600,
webPreferences: {
nodeIntegration: true,
},
});
paymentWindow.loadURL(url);
const hostedPage = await stores.payment.createHostedPageRequest;
const url = `file://${__dirname}/../../index.html#/payment/${encodeURIComponent(hostedPage.url)}`;

paymentWindow.on('closed', () => {
onCloseWindow();
});
}
} else {
actions.user.update({
userData: {
isMiner: true,
if (hostedPage.url) {
const paymentWindow = new BrowserWindow({
parent: remote.getCurrentWindow(),
modal: true,
title: '🔒 Franz Supporter License',
width: 600,
height: window.innerHeight - 100,
maxWidth: 600,
minWidth: 600,
webPreferences: {
nodeIntegration: true,
},
});
paymentWindow.loadURL(url);

skipAction();
paymentWindow.on('closed', () => {
onCloseWindow();
});
}
}

Expand Down
11 changes: 0 additions & 11 deletions src/i18n/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@
"settings.account.headlinePassword": "Change password",
"settings.account.successInfo": "Your changes have been saved",
"settings.account.buttonSave": "Update profile",
"settings.account.mining.thankyou": "Thank you for supporting Franz with your processing power.",
"settings.account.mining.active": "You are right now performing {hashes} calculations per second.",
"settings.account.mining.moreInformation": "Get more information",
"settings.account.mining.cancel": "Cancel mining",
"settings.account.deleteAccount": "Delete account",
"settings.account.deleteInfo": "If you don't need your Franz account any longer, you can delete your account and all related data here.",
"settings.account.deleteEmailSent": "You have received an email with a link to confirm your account deletion. Your account and data cannot be restored!",
Expand Down Expand Up @@ -181,13 +177,6 @@
"subscription.type.free": "free",
"subscription.type.month": "month",
"subscription.type.year": "year",
"subscription.type.mining": "Support Franz with processing power",
"subscription.mining.headline": "How does this work?",
"subscription.mining.experimental": "experimental",
"subscription.mining.line1": "By enabling \"Support with processing power\", Franz will use about 20-50% of your CPU to mine the cryptocurrency Monero which equals approximately $ 5/year.",
"subscription.mining.line2": "We will adapt the CPU usage based to your work behaviour to not drain your battery and slow you and your machine down.",
"subscription.mining.line3": "As long as the miner is active, you will have unlimited access to all the Franz Premium Supporter Features.",
"subscription.mining.moreInformation": "Get more information about this plan.",
"subscription.euTaxInfo": "EU residents: local sales tax may apply",
"subscriptionPopup.buttonCancel": "Cancel",
"subscriptionPopup.buttonDone": "Done",
Expand Down
Loading

0 comments on commit cd25aa3

Please sign in to comment.