app/html/app.jsView |
---|
14 | 14 | 'history.sync.back': true, |
15 | 15 | }) |
16 | 16 | |
17 | 17 | exports.needs = nest({ |
| 18 | + 'about.async.suggest': 'first', |
18 | 19 | 'app.html.header': 'first', |
19 | 20 | 'app.async.catchLinkClick': 'first', |
| 21 | + 'channel.async.suggest': 'first', |
| 22 | + 'keys.sync.id': 'first', |
20 | 23 | 'router.sync.router': 'first', |
| 24 | + 'settings.sync.get': 'first', |
| 25 | + 'settings.sync.set': 'first', |
21 | 26 | 'styles.css': 'reduce', |
22 | | - 'about.async.suggest': 'first', |
23 | | - 'channel.async.suggest': 'first', |
24 | 27 | }) |
25 | 28 | |
26 | 29 | exports.create = (api) => { |
27 | 30 | var nav = null |
45 | 48 | api.router.sync.router, |
46 | 49 | api.app.html.header |
47 | 50 | ) |
48 | 51 | |
49 | | - nav.push({page: 'home'}) |
| 52 | + const isOnboarded = api.settings.sync.get('onboarded') |
| 53 | + if (isOnboarded) |
| 54 | + nav.push({page: 'home'}) |
| 55 | + else { |
| 56 | + nav.push({ |
| 57 | + page:'userEdit', |
| 58 | + feed: api.keys.sync.id(), |
| 59 | + callback: (err, didEdit) => { |
| 60 | + if (err) throw new Error ('Error editing profile', err) |
| 61 | + |
| 62 | + if (didEdit) |
| 63 | + api.settings.sync.set({ onboarded: true }) |
| 64 | + |
| 65 | + nav.push({ page: 'home' }) |
| 66 | + } |
| 67 | + }) |
| 68 | + } |
| 69 | + |
50 | 70 | return nav |
51 | 71 | }, |
52 | 72 | 'history.sync.push': (location) => nav.push(location), |
53 | 73 | 'history.sync.back': () => nav.back(), |