Skip to content

Commit

Permalink
Major: IOS build and fixes for Wifi, BLE communication
Browse files Browse the repository at this point in the history
  • Loading branch information
QuangNguyen1412 committed Apr 25, 2020
1 parent ade34de commit e6ace3a
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 8 deletions.
3 changes: 3 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ android {
}

dependencies {
implementation project(':@react-native-community_geolocation')
implementation project(':react-native-ble-manager')
implementation project(':react-native-wifi-reborn')
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.reactnativecommunity.geolocation.GeolocationPackage;
import it.innove.BleManagerPackage;
import com.reactlibrary.rnwifi.RNWifiPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
Expand Down
6 changes: 6 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
rootProject.name = 'rn_air_monitor'
include ':@react-native-community_geolocation'
project(':@react-native-community_geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/geolocation/android')
include ':react-native-ble-manager'
project(':react-native-ble-manager').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-ble-manager/android')
include ':react-native-wifi-reborn'
project(':react-native-wifi-reborn').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-wifi-reborn/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
include ':react-native-camera'
Expand Down
6 changes: 6 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs
pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"


pod 'RNWifi', :path => '../node_modules/react-native-wifi-reborn'

pod 'react-native-ble-manager', :path => '../node_modules/react-native-ble-manager'

pod 'react-native-geolocation', :path => '../node_modules/@react-native-community/geolocation'

target 'rn_air_monitorTests' do
inherit! :search_paths
# Pods for testing
Expand Down
26 changes: 25 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ PODS:
- React-cxxreact (= 0.60.5)
- React-jsi (= 0.60.5)
- React-jsinspector (0.60.5)
- react-native-ble-manager (7.1.1):
- React
- react-native-camera (3.13.1):
- React
- react-native-camera/RCT (= 3.13.1)
Expand All @@ -395,6 +397,10 @@ PODS:
- React
- react-native-camera/RN (3.13.1):
- React
- react-native-geolocation (2.0.2):
- React
- react-native-spinkit (1.4.1):
- React
- React-RCTActionSheet (0.60.5):
- React-Core (= 0.60.5)
- React-RCTAnimation (0.60.5):
Expand Down Expand Up @@ -435,6 +441,8 @@ PODS:
- React
- RNScreens (1.0.0-alpha.23):
- React
- RNWifi (2.2.0):
- React
- yoga (0.60.5.React)

DEPENDENCIES:
Expand All @@ -452,8 +460,11 @@ DEPENDENCIES:
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-ble-manager (from `../node_modules/react-native-ble-manager`)
- react-native-camera (from `../node_modules/react-native-camera`)
- react-native-camera/BarcodeDetectorMLKit (from `../node_modules/react-native-camera`)
- "react-native-geolocation (from `../node_modules/@react-native-community/geolocation`)"
- react-native-spinkit (from `../node_modules/react-native-spinkit`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
Expand All @@ -469,6 +480,7 @@ DEPENDENCIES:
- RNPermissions (from `../node_modules/react-native-permissions`)
- RNReanimated (from `../node_modules/react-native-reanimated`)
- RNScreens (from `../node_modules/react-native-screens`)
- RNWifi (from `../node_modules/react-native-wifi-reborn`)
- yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -526,8 +538,14 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-ble-manager:
:path: "../node_modules/react-native-ble-manager"
react-native-camera:
:path: "../node_modules/react-native-camera"
react-native-geolocation:
:path: "../node_modules/@react-native-community/geolocation"
react-native-spinkit:
:path: "../node_modules/react-native-spinkit"
React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation:
Expand Down Expand Up @@ -558,6 +576,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-reanimated"
RNScreens:
:path: "../node_modules/react-native-screens"
RNWifi:
:path: "../node_modules/react-native-wifi-reborn"
yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -602,7 +622,10 @@ SPEC CHECKSUMS:
React-jsi: 4d8c9efb6312a9725b18d6fc818ffc103f60fec2
React-jsiexecutor: 90ad2f9db09513fc763bc757fdc3c4ff8bde2a30
React-jsinspector: e08662d1bf5b129a3d556eb9ea343a3f40353ae4
react-native-ble-manager: 68833265de44288e0de78d26a069a3b8aa476a09
react-native-camera: 0a8d6bb1c1c8bcdf1d6d9105b418ac8b0fe35af9
react-native-geolocation: cbd9d6bd06bac411eed2671810f454d4908484a8
react-native-spinkit: da294fd828216ad211fe36a5c14c1e09f09e62db
React-RCTActionSheet: b0f1ea83f4bf75fb966eae9bfc47b78c8d3efd90
React-RCTAnimation: 359ba1b5690b1e87cc173558a78e82d35919333e
React-RCTBlob: 5e2b55f76e9a1c7ae52b826923502ddc3238df24
Expand All @@ -618,8 +641,9 @@ SPEC CHECKSUMS:
RNPermissions: 332fd0d0c33ba71d83a22f584fce7b2270488ae0
RNReanimated: b2ab0b693dddd2339bd2f300e770f6302d2e960c
RNScreens: f28b48b8345f2f5f39ed6195518291515032a788
RNWifi: d493fe077608b0f3ce3fb3789976beffcc753d8c
yoga: 312528f5bbbba37b4dcea5ef00e8b4033fdd9411

PODFILE CHECKSUM: 5799970f64160053fd79b84ded539bf6b59ef4ba
PODFILE CHECKSUM: ac2fb7260e82ef7108979e918188e70f4a935feb

COCOAPODS: 1.8.4
2 changes: 1 addition & 1 deletion ios/rn_air_monitor/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<key>NSCameraUsageDescription</key>
<string>Need permission to access camera to scan QR code</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<string>Need permission to access Location data</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
1 change: 1 addition & 0 deletions src/components/Constants/globalConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export default class GlobalConstants {
static SERVER_DOMAIN_NAME = 'https://scottgale.appspot.com/';
static SAVE_WEAR_DATA = 'save_wear_data';
static WEARABLE_NAME_PREFIX = 'WAIRU';
static WEARABLE_NAME_PREFIX_IOS = 'WAiru-';
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ const bleManagerEmitter = new NativeEventEmitter(BleManagerModule);
* These UUIDs base on the configuration on the device side
* @Note: Once we change these UUIDs, the same changes need to be made on the firmware side and vice versa
*/
const pms_service = '000000ff-0000-1000-8000-00805f9b34fb';
const pms_service_read_noti = '0000ff01-0000-1000-8000-00805f9b34fb';
const pms_service_write = '0000ff03-0000-1000-8000-00805f9b34fb';
const wifi_addr_service_read = '0000ff04-0000-1000-8000-00805f9b34fb';
pms_service = '000000ff-0000-1000-8000-00805f9b34fb';
pms_service_read_noti = '0000ff01-0000-1000-8000-00805f9b34fb';
pms_service_write = '0000ff03-0000-1000-8000-00805f9b34fb';
wifi_addr_service_read = '0000ff04-0000-1000-8000-00805f9b34fb';
if (Platform.OS === 'ios') {
pms_service = '00FF';
pms_service_read_noti = 'FF01';
pms_service_write = 'FF03';
wifi_addr_service_read = 'FF04';
}

// @todo: Add mac address to firebase corresponding to the user
export default class BleDeviceRegistration extends Component {
Expand Down Expand Up @@ -322,7 +328,7 @@ export default class BleDeviceRegistration extends Component {
});*/
BleManager.retrieveServices(peripheral.id).then(
peripheralInfo => {
// console.log(peripheralInfo);
console.log(peripheralInfo);
setTimeout(() => {
this.readWiFiMacAddress(peripheral.id)
.then(data => {
Expand Down Expand Up @@ -402,7 +408,8 @@ export default class BleDeviceRegistration extends Component {
*/
if (
item.name &&
item.name.includes(GlobalConstants.WEARABLE_NAME_PREFIX) > 0
(item.name.includes(GlobalConstants.WEARABLE_NAME_PREFIX) > 0 ||
item.name.includes(GlobalConstants.WEARABLE_NAME_PREFIX_IOS))
) {
return (
<TouchableOpacity
Expand Down

0 comments on commit e6ace3a

Please sign in to comment.