Commit 3a3e0ac54766595cc6a9614997bbf324f7b2d366
dx: [ios] remove everything Bluetooth related
Andre Staltz committed on 1/4/2020, 2:37:13 PMParent: 005463227a5ccddff19c47b81fe93d641b10fefc
Files changed
src/frontend/drivers/network.ts | ||
---|---|---|
@@ -16,8 +16,14 @@ | ||
16 | 16 | |
17 | 17 | public bluetoothIsEnabled(): Stream<boolean> { |
18 | 18 | return xs.create({ |
19 | 19 | async start(listener: Listener<boolean>) { |
20 | + if (Platform.OS === 'ios') { | |
21 | + listener.next(false); | |
22 | + listener.complete(); | |
23 | + return; | |
24 | + } | |
25 | + | |
20 | 26 | try { |
21 | 27 | listener.next(await BluetoothStatus.state()); |
22 | 28 | listener.complete(); |
23 | 29 | } catch (e) { |
src/frontend/drivers/ssb.ts | ||
---|---|---|
@@ -15,8 +15,9 @@ | ||
15 | 15 | AboutContent, |
16 | 16 | BlobId, |
17 | 17 | } from 'ssb-typescript'; |
18 | 18 | const nodejs = require('nodejs-mobile-react-native'); |
19 | +import {Platform} from 'react-native'; | |
19 | 20 | import {isMsg, isRootPostMsg, isReplyPostMsg} from 'ssb-typescript/utils'; |
20 | 21 | import {Thread as ThreadData} from 'ssb-threads/types'; |
21 | 22 | import xsFromCallback from 'xstream-from-callback'; |
22 | 23 | import runAsync = require('promisify-tuple'); |
@@ -301,12 +302,15 @@ | ||
301 | 302 | return peersArr$; |
302 | 303 | }) |
303 | 304 | .flatten(); |
304 | 305 | |
305 | - this.bluetoothScanState$ = this.ssb$ | |
306 | - .map(ssb => ssb.bluetooth.bluetoothScanState()) | |
307 | - .map(xsFromPullStream) | |
308 | - .flatten(); | |
306 | + this.bluetoothScanState$ = | |
307 | + Platform.OS === 'ios' | |
308 | + ? xs.empty() | |
309 | + : this.ssb$ | |
310 | + .map(ssb => ssb.bluetooth.bluetoothScanState()) | |
311 | + .map(xsFromPullStream) | |
312 | + .flatten(); | |
309 | 313 | } |
310 | 314 | |
311 | 315 | public thread$(rootMsgId: MsgId): Stream<ThreadAndExtras> { |
312 | 316 | const ssbToThread = (ssb: any, cb: any) => { |
@@ -726,11 +730,13 @@ | ||
726 | 730 | return; |
727 | 731 | } |
728 | 732 | |
729 | 733 | if (req.type === 'bluetooth.search') { |
730 | - ssb.bluetooth.makeDeviceDiscoverable(req.interval, (err: any) => { | |
731 | - if (err) return console.error(err.message || err); | |
732 | - }); | |
734 | + if (Platform.OS !== 'ios') { | |
735 | + ssb.bluetooth.makeDeviceDiscoverable(req.interval, (err: any) => { | |
736 | + if (err) return console.error(err.message || err); | |
737 | + }); | |
738 | + } | |
733 | 739 | return; |
734 | 740 | } |
735 | 741 | |
736 | 742 | if (req.type === 'dhtInvite.accept') { |
src/frontend/screens/central/connections-tab/model.ts | ||
---|---|---|
@@ -6,17 +6,18 @@ | ||
6 | 6 | |
7 | 7 | import xs, {Stream} from 'xstream'; |
8 | 8 | import {FeedId} from 'ssb-typescript'; |
9 | 9 | import {Reducer} from '@cycle/state'; |
10 | +import {AsyncStorageSource} from 'cycle-native-asyncstorage'; | |
11 | +import {Platform} from 'react-native'; | |
10 | 12 | import {SSBSource} from '../../../drivers/ssb'; |
11 | 13 | import { |
12 | 14 | PeerKV, |
13 | 15 | StagedPeerKV, |
14 | 16 | StagedPeerMetadata as StagedPeer, |
15 | 17 | } from '../../../ssb/types'; |
16 | 18 | import {NetworkSource} from '../../../drivers/network'; |
17 | 19 | import {noteStorageKeyFor} from './asyncstorage'; |
18 | -import {AsyncStorageSource} from 'cycle-native-asyncstorage'; | |
19 | 20 | |
20 | 21 | export type State = { |
21 | 22 | selfFeedId: FeedId; |
22 | 23 | bluetoothEnabled: boolean; |
@@ -88,17 +89,20 @@ | ||
88 | 89 | return {...prev, isSyncing}; |
89 | 90 | }, |
90 | 91 | ); |
91 | 92 | |
92 | - const updateBluetoothEnabled$ = actions.pingConnectivityModes$ | |
93 | - .map(() => networkSource.bluetoothIsEnabled()) | |
94 | - .flatten() | |
95 | - .map( | |
96 | - bluetoothEnabled => | |
97 | - function updateBluetoothEnabled(prev: State): State { | |
98 | - return {...prev, bluetoothEnabled}; | |
99 | - }, | |
100 | - ); | |
93 | + const updateBluetoothEnabled$ = | |
94 | + Platform.OS === 'ios' | |
95 | + ? xs.empty() | |
96 | + : actions.pingConnectivityModes$ | |
97 | + .map(() => networkSource.bluetoothIsEnabled()) | |
98 | + .flatten() | |
99 | + .map( | |
100 | + bluetoothEnabled => | |
101 | + function updateBluetoothEnabled(prev: State): State { | |
102 | + return {...prev, bluetoothEnabled}; | |
103 | + }, | |
104 | + ); | |
101 | 105 | |
102 | 106 | const updateLanEnabled$ = actions.pingConnectivityModes$ |
103 | 107 | .map(() => networkSource.wifiIsEnabled()) |
104 | 108 | .flatten() |
src/frontend/screens/central/connections-tab/view/index.ts | ||
---|---|---|
@@ -12,8 +12,9 @@ | ||
12 | 12 | TouchableHighlight, |
13 | 13 | Animated, |
14 | 14 | Easing, |
15 | 15 | ActivityIndicator, |
16 | + Platform, | |
16 | 17 | } from 'react-native'; |
17 | 18 | import * as React from 'react'; |
18 | 19 | import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; |
19 | 20 | import {styles} from './styles'; |
@@ -105,15 +106,17 @@ | ||
105 | 106 | } |
106 | 107 | |
107 | 108 | function ConnectivityModes(state: State) { |
108 | 109 | return h(View, {style: styles.modesContainer}, [ |
109 | - h(ConnectivityMode, { | |
110 | - sel: 'bluetooth-mode', | |
111 | - active: state.bluetoothEnabled, | |
112 | - icon: 'bluetooth', | |
113 | - label: 'Bluetooth Mode', | |
114 | - lastScanned: state.bluetoothLastScanned, | |
115 | - }), | |
110 | + Platform.OS === 'ios' | |
111 | + ? null | |
112 | + : h(ConnectivityMode, { | |
113 | + sel: 'bluetooth-mode', | |
114 | + active: state.bluetoothEnabled, | |
115 | + icon: 'bluetooth', | |
116 | + label: 'Bluetooth Mode', | |
117 | + lastScanned: state.bluetoothLastScanned, | |
118 | + }), | |
116 | 119 | |
117 | 120 | h(ConnectivityMode, { |
118 | 121 | sel: 'lan-mode', |
119 | 122 | active: state.lanEnabled, |
src/frontend/screens/welcome/view.ts | ||
---|---|---|
@@ -7,9 +7,9 @@ | ||
7 | 7 | import {Stream} from 'xstream'; |
8 | 8 | import {h} from '@cycle/react'; |
9 | 9 | import {Palette} from '../../global-styles/palette'; |
10 | 10 | import {Dimensions} from '../../global-styles/dimens'; |
11 | -import {StyleSheet, Text, View, Image} from 'react-native'; | |
11 | +import {StyleSheet, Text, View, Image, Platform} from 'react-native'; | |
12 | 12 | import tutorialSlide from '../../components/tutorial-slide'; |
13 | 13 | import tutorialPresentation from '../../components/tutorial-presentation'; |
14 | 14 | import Button from '../../components/Button'; |
15 | 15 | import {State} from './model'; |
@@ -139,11 +139,16 @@ | ||
139 | 139 | renderDescription: () => [ |
140 | 140 | 'To connect with friends and synchronize content, you can ' + |
141 | 141 | 'either: join the same ', |
142 | 142 | h(Text, {style: styles.bold}, 'Wi-Fi'), |
143 | - ', use ', | |
144 | - h(Text, {style: styles.bold}, 'Bluetooth sync'), | |
145 | - ', or exchange ', | |
143 | + ...Platform.select({ | |
144 | + ios: [' or exchange '], | |
145 | + default: [ | |
146 | + ', use ', | |
147 | + h(Text, {style: styles.bold}, 'Bluetooth sync'), | |
148 | + ', or exchange ', | |
149 | + ], | |
150 | + }), | |
146 | 151 | h(Text, {style: styles.bold}, 'P2P invites'), |
147 | 152 | '. To find new people on the internet, look for an invite code ' + |
148 | 153 | 'to a ', |
149 | 154 | h(Text, {style: styles.bold}, 'pub server'), |
Built with git-ssb-web