Skip to content

Commit

Permalink
fix(ui): onboarding: restored bluetooth and notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
glouvigny committed Sep 5, 2019
1 parent 19e59ce commit b594b74
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 26 deletions.
32 changes: 16 additions & 16 deletions client/packages/navigation/OnboardingNavigator.js
@@ -1,8 +1,8 @@
import { tabNavigatorOptions } from '@berty/common/constants/styling'
// import Bluetooth from '@berty/screen/Accounts/Onboarding/Bluetooth'
import Bluetooth from '@berty/screen/Accounts/Onboarding/Bluetooth'
import Contacts from '@berty/screen/Accounts/Onboarding/Contacts'
import I18n from '@berty/common/locale'
// import Notifications from '@berty/screen/Accounts/Onboarding/Notifications'
import Notifications from '@berty/screen/Accounts/Onboarding/Notifications'
import Ready from '@berty/screen/Accounts/Onboarding/Ready'
import Welcome from '@berty/screen/Accounts/Onboarding/Welcome'
import { withProps, asFunctional } from '@berty/common/helpers/views'
Expand All @@ -19,20 +19,20 @@ export default createMaterialTopTabNavigator(
title: I18n.t('onboarding.welcome.tab'),
}),
},
// 'onboarding/notifications': {
// screen: Notifications,
// navigationOptions: () => ({
// tabBarIcon: asFunctional(withProps({ name: 'bell' })(TabIcon)),
// title: I18n.t('onboarding.notifications.tab'),
// }),
// },
// 'onboarding/bluetooth': {
// screen: Bluetooth,
// navigationOptions: () => ({
// tabBarIcon: asFunctional(withProps({ name: 'bluetooth' })(TabIcon)),
// title: I18n.t('onboarding.bluetooth.tab'),
// }),
// },
'onboarding/notifications': {
screen: Notifications,
navigationOptions: () => ({
tabBarIcon: asFunctional(withProps({ name: 'bell' })(TabIcon)),
title: I18n.t('onboarding.notifications.tab'),
}),
},
'onboarding/bluetooth': {
screen: Bluetooth,
navigationOptions: () => ({
tabBarIcon: asFunctional(withProps({ name: 'bluetooth' })(TabIcon)),
title: I18n.t('onboarding.bluetooth.tab'),
}),
},
'onboarding/contacts': {
screen: Contacts,
navigationOptions: () => ({
Expand Down
12 changes: 5 additions & 7 deletions client/packages/screen/Accounts/Onboarding/Bluetooth.js
Expand Up @@ -34,13 +34,11 @@ const Bluetooth = ({ bridge, navigation, t }) => (
Platform.OS === 'ios' ||
(await requestBLEAndroidPermission())
) {
const config = await bridge.daemon.getNetworkConfig({})

let currentConfig = JSON.parse(config.json)
currentConfig.BLE = true
await bridge.daemon.updateNetworkConfig({
json: JSON.stringify(currentConfig),
})
let config = await bridge.daemon.getNetworkConfig({})
config.bindP2P = config.bindP2P.concat(
'/ble/00000000-0000-0000-0000-000000000000'
)
await bridge.daemon.updateNetworkConfig(config)
}
navigation.navigate('onboarding/contacts')
}}
Expand Down
5 changes: 3 additions & 2 deletions client/packages/screen/Accounts/Onboarding/Notifications.js
Expand Up @@ -4,7 +4,7 @@ import { Flex } from '@berty/component'
import { withNavigation } from 'react-navigation'
import * as onboardingStyle from './style'
import { NextButton, SkipButton } from './Button'
// import { enableNativeNotifications } from '@berty/common/helpers/notifications'
import { enableNativeNotifications } from '@berty/common/helpers/notifications'
import { withNamespaces } from 'react-i18next'
import colors from '@berty/common/constants/colors'
import { withStoreContext } from '@berty/store/context'
Expand Down Expand Up @@ -34,10 +34,11 @@ const Notifications = ({ context, navigation, t, config }) => (
<NextButton
onPress={async () => {
// @FIXME: destroyed by refactor
// await enableNativeNotifications({ context })
await enableNativeNotifications({ context })
await context.node.service.configUpdate({
...config,
notificationsEnabled: true,
notificationsPreviews: true,
})
navigation.navigate('onboarding/bluetooth')
}}
Expand Down
2 changes: 1 addition & 1 deletion client/packages/screen/Accounts/Onboarding/Welcome.js
Expand Up @@ -34,7 +34,7 @@ class Welcome extends React.Component {
{t('onboarding.welcome.skip-everything')}
</SkipButton>
<NextButton
onPress={() => navigation.navigate('onboarding/contacts')}
onPress={() => navigation.navigate('onboarding/notifications')}
style={onboardingStyle.nextButton}
>
{t('next')}
Expand Down

0 comments on commit b594b74

Please sign in to comment.