Skip to content

Commit

Permalink
Make unfinished features disableable
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Apr 5, 2019
1 parent 8feccde commit 6944e73
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 23 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VUE_APP_MIGRATION_STATUS_URL=https://api.backendless.com/CBD0589C-4114-2D15-FF41-6FC7F3EE8800/39EBBD6D-5A94-0739-FF27-B17F3957B700/data/TokenBurnings?pageSize=100&where=pubKey%20%3D%20%27ADDRESS%27
VUE_APP_MIGRATION_PHASE=0
UNFINISHED_FEATURES=true
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
UNFINISHED_FEATURES=false
2 changes: 1 addition & 1 deletion src/AppDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
components: {
HeaderDesktop,
SidebarDesktop,
FooterDesktop,
FooterDesktop: process.env.UNFINISHED_FEATURES ? FooterDesktop : () => {},
},
computed: mapGetters('modals', ['component', 'hidePage', 'props']),
};
Expand Down
10 changes: 7 additions & 3 deletions src/components/desktop/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
<div class="details">
{{ account ? account.name : 'Connect an account' }}
<div class="balance">
{{ account ? `${prefixedAmount(account.balance)} AE` : 'With Base æpp or Ledger' }}
{{
account
? `${prefixedAmount(account.balance)} AE`
: `With ${$globals.UNFINISHED_FEATURES ? 'Base æpp or ' : ''}Ledger`
}}
</div>
</div>
<AeIdenticon :address="account ? account.address : ''" />
Expand Down Expand Up @@ -59,11 +63,11 @@ export default {
name: 'Receive',
routeName: 'receive',
iconName: 'receive',
}, {
}, ...process.env.UNFINISHED_FEATURES ? [{
name: 'Contacts',
routeName: 'address-book',
iconName: 'contacts',
}, {
}] : [], {
name: 'Settings',
routeName: 'settings',
iconName: 'settings',
Expand Down
7 changes: 5 additions & 2 deletions src/components/desktop/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
</ButtonPlain>
</h1>

<div class="tabs">
<div
v-if="$globals.UNFINISHED_FEATURES"
class="tabs"
>
<ButtonPlain
:class="{ active: !ledgerTab }"
@click="ledgerTab = false"
Expand Down Expand Up @@ -53,7 +56,7 @@ export default {
AeIcon, SidebarModal, ConnectGuide, AccountSwitcher, ButtonPlain,
},
data: () => ({
ledgerTab: false,
ledgerTab: !process.env.UNFINISHED_FEATURES,
}),
computed: mapState({
showSidebar: ({ desktop }) => desktop.showSidebar,
Expand Down
1 change: 1 addition & 0 deletions src/components/mobile/AccountSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</ListItem>

<ListItem
v-if="$globals.UNFINISHED_FEATURES"
title="Create a vault for AirGap"
@click="toggleAccountSwitcher"
>
Expand Down
9 changes: 8 additions & 1 deletion src/components/mobile/TabBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
<AeIdenticon :address="activeIdentity.address" />
</ButtonPlain>

<ButtonPlain :to="{ name: 'address-book' }">
<ButtonPlain
:to="{ name: 'address-book' }"
:disabled="!$globals.UNFINISHED_FEATURES"
>
<AeIcon name="contacts" />
Contacts
</ButtonPlain>
Expand Down Expand Up @@ -82,6 +85,10 @@ export default {
color: $color-neutral-negative-1;
text-align: center;
&:disabled {
color: $color-neutral-negative-3;
}
.ae-icon {
font-size: 20px;
display: block;
Expand Down
1 change: 1 addition & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Vue.config.productionTip = false;
Vue.prototype.$globals = {
IS_MOBILE_DEVICE: process.env.IS_MOBILE_DEVICE,
IS_IOS: process.env.IS_IOS,
UNFINISHED_FEATURES: process.env.UNFINISHED_FEATURES,
};

new Vue({
Expand Down
1 change: 1 addition & 0 deletions src/pages/mobile/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
/>
</ListItem>
<ListItem
v-if="$globals.UNFINISHED_FEATURES"
:to="{ name: 'settings-remote-connection' }"
:subtitle="
`${remoteConnectionsCount} device${remoteConnectionsCount === 1 ? '' : 's'} connected`"
Expand Down
16 changes: 8 additions & 8 deletions src/router/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ describe('router/index.js', () => {
);

it(
'pushes INTRO path if current route is APPS and no keystore is present',
createRedirectTest({}, 'apps', 'intro'),
'pushes INTRO path if current route is TRANSFER and no keystore is present',
createRedirectTest({}, 'transfer', 'intro'),
);

it(
Expand All @@ -52,10 +52,10 @@ describe('router/index.js', () => {
);

it(
'pushes LOGIN path if current route is APPS and keystore is present but not derivedKey',
'pushes LOGIN path if current route is TRANSFER and keystore is present but not derivedKey',
createRedirectTest({
mobile: { keystore: {}, derivedKey: false },
}, 'apps', 'login'),
}, 'transfer', 'login'),
);

it(
Expand All @@ -66,10 +66,10 @@ describe('router/index.js', () => {
);

it(
'pushes APPS path if current route is LOGIN and keystore is present and derivedKey',
'pushes TRANSFER path if current route is LOGIN and keystore is present and derivedKey',
createRedirectTest({
mobile: { keystore: {}, derivedKey: true },
}, 'login', 'apps'),
}, 'login', 'transfer'),
);

it(
Expand All @@ -80,10 +80,10 @@ describe('router/index.js', () => {
);

it(
'does not interfere when current route is APPS and keystore is present and derivedKey',
'does not interfere when current route is TRANSFER and keystore is present and derivedKey',
createNoRedirectTest({
mobile: { keystore: {}, derivedKey: true },
}, 'apps'),
}, 'transfer'),
);

it(
Expand Down
4 changes: 2 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ store.watch(
(loggedIn) => {
if (loggedIn) {
if (process.env.IS_MOBILE_DEVICE || store.state.loginTarget) {
router.push(store.state.loginTarget || { name: 'apps' });
router.push(store.state.loginTarget || { name: 'transfer' });
store.commit('setLoginTarget');
}
} else {
store.commit('setLoginTarget', router.currentRoute.fullPath);
router.push({ name: process.env.IS_MOBILE_DEVICE ? 'intro' : 'apps' });
router.push({ name: process.env.IS_MOBILE_DEVICE ? 'intro' : 'transfer' });
}
},
);
Expand Down
4 changes: 2 additions & 2 deletions src/router/routes/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AddressBook from '../../pages/AddressBook.vue';
import AddressBookNew from '../../pages/AddressBookNew.vue';
import AddressBookChoose from '../../pages/AddressBookChoose.vue';

export default [{
export default process.env.UNFINISHED_FEATURES ? [{
name: 'address-book',
path: '/addresses',
component: AddressBook,
Expand All @@ -20,4 +20,4 @@ export default [{
component: AddressBookChoose,
beforeEnter: checkLoggedIn(true),
props: true,
}].map(route => merge(route, { meta: { displayFooter: true } }));
}].map(route => merge(route, { meta: { displayFooter: true } })) : [];
6 changes: 3 additions & 3 deletions src/router/routes/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default [{
return;
}
if (store.getters.loggedIn) {
next({ name: 'apps' });
next({ name: 'transfer' });
return;
}
next();
Expand Down Expand Up @@ -193,7 +193,7 @@ export default [{
meta: {
displayFooter: true,
},
}, {
}, ...process.env.UNFINISHED_FEATURES ? [{
name: 'settings-remote-connection',
path: '/settings/remote-connection',
component: SettingsRemoteConnection,
Expand All @@ -206,4 +206,4 @@ export default [{
path: '/settings/remote-connection/new',
component: SettingsRemoteConnectionNew,
beforeEnter: checkLoggedIn(true),
}];
}] : []];
2 changes: 1 addition & 1 deletion tests/e2e/specs/migrations/fix-aes-ctr-counter-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('Migration: Fix AES-CTR counter issue', () => {
.contains('Log in')
.click()
.url()
.should('contain', '/browser')
.should('contain', '/transfer')
.then(() => {
const state = JSON.parse(localStorage.vuex);
expect(state.migrations[0]).equal(true);
Expand Down
2 changes: 2 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const parseBool = val => (val ? JSON.parse(val) : false);
// eslint-disable-next-line camelcase
const { IS_MOBILE_DEVICE, IS_PWA, npm_package_version } = process.env;
const IS_CORDOVA = parseBool(process.env.IS_CORDOVA);
const UNFINISHED_FEATURES = parseBool(process.env.UNFINISHED_FEATURES);

module.exports = {
publicPath: IS_CORDOVA ? './' : '/',
Expand All @@ -16,6 +17,7 @@ module.exports = {
delete definitions['process.env'];

definitions['process.env.IS_CORDOVA'] = IS_CORDOVA;
definitions['process.env.UNFINISHED_FEATURES'] = UNFINISHED_FEATURES;

if (IS_CORDOVA || IS_MOBILE_DEVICE) {
definitions['process.env.IS_MOBILE_DEVICE'] = IS_CORDOVA || parseBool(process.env.IS_MOBILE_DEVICE);
Expand Down

0 comments on commit 6944e73

Please sign in to comment.