From b594b74f382e9c3156f86ee36a3af8e054e187fb Mon Sep 17 00:00:00 2001 From: Guillaume Louvigny Date: Thu, 5 Sep 2019 11:18:23 +0200 Subject: [PATCH] fix(ui): onboarding: restored bluetooth and notifications --- .../navigation/OnboardingNavigator.js | 32 +++++++++---------- .../screen/Accounts/Onboarding/Bluetooth.js | 12 +++---- .../Accounts/Onboarding/Notifications.js | 5 +-- .../screen/Accounts/Onboarding/Welcome.js | 2 +- 4 files changed, 25 insertions(+), 26 deletions(-) diff --git a/client/packages/navigation/OnboardingNavigator.js b/client/packages/navigation/OnboardingNavigator.js index 784642842a..fd3f8e2be2 100644 --- a/client/packages/navigation/OnboardingNavigator.js +++ b/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' @@ -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: () => ({ diff --git a/client/packages/screen/Accounts/Onboarding/Bluetooth.js b/client/packages/screen/Accounts/Onboarding/Bluetooth.js index 6a24a46534..cde39aa979 100644 --- a/client/packages/screen/Accounts/Onboarding/Bluetooth.js +++ b/client/packages/screen/Accounts/Onboarding/Bluetooth.js @@ -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') }} diff --git a/client/packages/screen/Accounts/Onboarding/Notifications.js b/client/packages/screen/Accounts/Onboarding/Notifications.js index ab051d81d2..f465d7d20b 100644 --- a/client/packages/screen/Accounts/Onboarding/Notifications.js +++ b/client/packages/screen/Accounts/Onboarding/Notifications.js @@ -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' @@ -34,10 +34,11 @@ const Notifications = ({ context, navigation, t, config }) => ( { // @FIXME: destroyed by refactor - // await enableNativeNotifications({ context }) + await enableNativeNotifications({ context }) await context.node.service.configUpdate({ ...config, notificationsEnabled: true, + notificationsPreviews: true, }) navigation.navigate('onboarding/bluetooth') }} diff --git a/client/packages/screen/Accounts/Onboarding/Welcome.js b/client/packages/screen/Accounts/Onboarding/Welcome.js index dae63acae3..2024a74ea3 100644 --- a/client/packages/screen/Accounts/Onboarding/Welcome.js +++ b/client/packages/screen/Accounts/Onboarding/Welcome.js @@ -34,7 +34,7 @@ class Welcome extends React.Component { {t('onboarding.welcome.skip-everything')} navigation.navigate('onboarding/contacts')} + onPress={() => navigation.navigate('onboarding/notifications')} style={onboardingStyle.nextButton} > {t('next')}