Skip to content

Commit 4646d5c

Browse files
authored
Merge pull request #8 from bringg/MOBILE-5146-add-apis-for-initializing-sdk-without-motion-and-bluetooth
MOBILE-5146 add apis for initializing sdk without motion and bluetooth
2 parents cdcb250 + db57455 commit 4646d5c

File tree

14 files changed

+71
-25
lines changed

14 files changed

+71
-25
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,13 @@ yarn android
9999

100100
Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
101101
[More details](https://creativecommons.org/licenses/by-nc-sa/4.0/)
102+
103+
## Running with xcode 11.3.1 (iOS)
104+
The Native iOS SDK is precompiled - when using a swift version that is not the latest, you will need to do another step in order to use a native SDK that was compiled with the same Swift version that you are using.
105+
106+
In podfile add to your application target the following pods:
107+
```ruby
108+
pod 'BringgDriverSDK', :git => 'https://github.com/bringg/Bringg-iOS-DriverSDK.git', :branch => '1.10.0-xcode-11.3.1'
109+
pod 'BringgDriverSDKObjc', :git => 'https://github.com/bringg/Bringg-iOS-DriverSDK.git', :branch => '1.10.0-xcode-11.3.1'
110+
```
111+
You can see an example of this in `/Example/ios/Podfile`

example/ios/BringgDriverSdkIosExample.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@
204204
"${PODS_ROOT}/BringgDriverSDK/BringgDriverSDK.framework",
205205
"${BUILT_PRODUCTS_DIR}/BringgDriverSDKObjc/BringgDriverSDKObjc.framework",
206206
"${BUILT_PRODUCTS_DIR}/CryptoSwift/CryptoSwift.framework",
207+
"${BUILT_PRODUCTS_DIR}/DeviceKit/DeviceKit.framework",
207208
"${BUILT_PRODUCTS_DIR}/DoubleConversion/DoubleConversion.framework",
208209
"${BUILT_PRODUCTS_DIR}/FBReactNativeSpec/FBReactNativeSpec.framework",
209210
"${BUILT_PRODUCTS_DIR}/Flipper-DoubleConversion/DoubleConversion.framework",
@@ -247,6 +248,7 @@
247248
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BringgDriverSDK.framework",
248249
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/BringgDriverSDKObjc.framework",
249250
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CryptoSwift.framework",
251+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DeviceKit.framework",
250252
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DoubleConversion.framework",
251253
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/FBReactNativeSpec.framework",
252254
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/glog.framework",

example/ios/Podfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ target 'BringgDriverSdkIosExample' do
5757
pod 'glog', podspec: '../node_modules/react-native/third-party-podspecs/glog.podspec'
5858
pod 'Folly', podspec: '../node_modules/react-native/third-party-podspecs/Folly.podspec'
5959

60+
# For using Xcode 11.3.1, uncomment the following two lines
61+
# pod 'BringgDriverSDK', :git => 'https://github.com/bringg/Bringg-iOS-DriverSDK.git', :branch => '1.10.0-xcode-11.3.1'
62+
# pod 'BringgDriverSDKObjc', :git => 'https://github.com/bringg/Bringg-iOS-DriverSDK.git', :branch => '1.10.0-xcode-11.3.1'
63+
6064
use_native_modules!
6165

6266
# Enables Flipper.

example/ios/Podfile.lock

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
PODS:
22
- Alamofire (4.9.0)
33
- boost-for-react-native (1.63.0)
4-
- BringgDriverSDK (1.9.0):
4+
- BringgDriverSDK (1.10.0):
55
- Alamofire (= 4.9.0)
66
- CryptoSwift (= 1.0.0)
7+
- DeviceKit (= 3.2.0)
78
- GzipSwift (= 5.0.0)
89
- KeychainAccess (= 3.2.0)
910
- Kingfisher (= 5.7.1)
@@ -13,11 +14,12 @@ PODS:
1314
- Socket.IO-Client-Swift (= 15.1.0)
1415
- Starscream (= 3.1.0)
1516
- XCGLogger (= 7.0.0)
16-
- BringgDriverSDKObjc (1.9.0):
17-
- BringgDriverSDK (= 1.9.0)
17+
- BringgDriverSDKObjc (1.10.0):
18+
- BringgDriverSDK (= 1.10.0)
1819
- CocoaAsyncSocket (7.6.4)
1920
- CocoaLibEvent (1.0.0)
2021
- CryptoSwift (1.0.0)
22+
- DeviceKit (3.2.0)
2123
- DoubleConversion (1.1.6)
2224
- FBLazyVector (0.61.5)
2325
- FBReactNativeSpec (0.61.5):
@@ -256,9 +258,9 @@ PODS:
256258
- React-cxxreact (= 0.61.5)
257259
- React-jsi (= 0.61.5)
258260
- React-jsinspector (0.61.5)
259-
- react-native-bringg-driver-sdk (1.9.2):
260-
- BringgDriverSDK (= 1.9.0)
261-
- BringgDriverSDKObjc (= 1.9.0)
261+
- react-native-bringg-driver-sdk (1.10.0):
262+
- BringgDriverSDK (= 1.10.0)
263+
- BringgDriverSDKObjc (= 1.10.0)
262264
- React
263265
- React-RCTActionSheet (0.61.5):
264266
- React-Core/RCTActionSheetHeaders (= 0.61.5)
@@ -300,7 +302,7 @@ PODS:
300302
- Realm/Headers (4.4.1)
301303
- RealmSwift (4.4.1):
302304
- Realm (= 4.4.1)
303-
- RNDateTimePicker (2.4.0):
305+
- RNDateTimePicker (2.6.0):
304306
- React
305307
- Socket.IO-Client-Swift (15.1.0):
306308
- Starscream (~> 3.1)
@@ -358,6 +360,7 @@ SPEC REPOS:
358360
- CocoaAsyncSocket
359361
- CocoaLibEvent
360362
- CryptoSwift
363+
- DeviceKit
361364
- Flipper
362365
- Flipper-DoubleConversion
363366
- Flipper-Folly
@@ -442,6 +445,7 @@ SPEC CHECKSUMS:
442445
CocoaAsyncSocket: 694058e7c0ed05a9e217d1b3c7ded962f4180845
443446
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
444447
CryptoSwift: d81eeaa59dc5a8d03720fe919a6fd07b51f7439f
448+
DeviceKit: d081659419cce07c0b5239dbc9fb39ed7413c7fe
445449
DoubleConversion: 5805e889d232975c086db112ece9ed034df7a0b2
446450
FBLazyVector: aaeaf388755e4f29cd74acbc9e3b8da6d807c37f
447451
FBReactNativeSpec: 118d0d177724c2d67f08a59136eb29ef5943ec75
@@ -469,7 +473,7 @@ SPEC CHECKSUMS:
469473
React-jsi: cb2cd74d7ccf4cffb071a46833613edc79cdf8f7
470474
React-jsiexecutor: d5525f9ed5f782fdbacb64b9b01a43a9323d2386
471475
React-jsinspector: fa0ecc501688c3c4c34f28834a76302233e29dc0
472-
react-native-bringg-driver-sdk: de761478eaf1c79b3895d01be7f2194b15a19dbb
476+
react-native-bringg-driver-sdk: 8042b37cff867e53fb69676613af2d2e06dd25bc
473477
React-RCTActionSheet: 600b4d10e3aea0913b5a92256d2719c0cdd26d76
474478
React-RCTAnimation: 791a87558389c80908ed06cc5dfc5e7920dfa360
475479
React-RCTBlob: d89293cc0236d9cb0933d85e430b0bbe81ad1d72
@@ -482,13 +486,13 @@ SPEC CHECKSUMS:
482486
ReactCommon: 198c7c8d3591f975e5431bec1b0b3b581aa1c5dd
483487
Realm: 4eb04d7487bd43c0581256f40b424eafb711deff
484488
RealmSwift: 3eb8924ff7100df5928c7602f71d0fec51e7c9c5
485-
RNDateTimePicker: c4285bfdd87430f1e575b81a4742b7586a09d53e
489+
RNDateTimePicker: 8784fb27ddd12a9f0eaf6d994bfe3892f0f319cf
486490
Socket.IO-Client-Swift: 7cb44c0ffb86e158cee32d0642d30ec5fdcf8f61
487491
Starscream: 08172b481e145289c4930cb567230fb55897cfa4
488492
XCGLogger: 0434f15e3909cdc450bb63faf638b8792ab782ab
489493
Yoga: f2a7cd4280bfe2cca5a7aed98ba0eb3d1310f18b
490494
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
491495

492-
PODFILE CHECKSUM: ab4800b35191462fe2ed6f27347c9fdbec71d199
496+
PODFILE CHECKSUM: bff3406fd5576c5081204396d3b22c68f17d5608
493497

494498
COCOAPODS: 1.9.1

example/src/hooks/initBringgDriverSDKIfNeeded.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { initBringgDriverSDK } from '@bringg/react-native-bringg-driver-sdk';
1+
import {
2+
initBringgDriverSDK,
3+
SDKInitializeFlag,
4+
} from '@bringg/react-native-bringg-driver-sdk';
25

36
const state: {
47
didInitialize: boolean;
@@ -18,7 +21,13 @@ export function initBringgDriverSDKIfNeeded(): Promise<void> {
1821
}
1922

2023
console.log('initializing sdk');
21-
const initializingPromise = initBringgDriverSDK();
24+
25+
// Passing initialzation flags allows you to disable SDK features such as using bluetooth and motion
26+
// this allows you to show less permission prompts to the user.
27+
const initializingPromise = initBringgDriverSDK([
28+
SDKInitializeFlag.AvoidUsingBluetooth,
29+
SDKInitializeFlag.AvoidUsingMotion,
30+
]);
2231
state.initializingPromise = initializingPromise;
2332
return initializingPromise;
2433
}

ios/BringgDriverSdk.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#import "BringgDriverSdk.h"
22

3+
@import BringgDriverSDK;
34
@import BringgDriverSDKObjc;
45

56
@implementation BringgDriverSdk
@@ -11,9 +12,11 @@ - (dispatch_queue_t)methodQueue {
1112
}
1213

1314
RCT_REMAP_METHOD(initBringgDriverSDK,
14-
initBringgDriverSDKWithResolver:(RCTPromiseResolveBlock)resolve
15+
initBringgDriverSDKWithFlags:(nullable NSArray<NSString *> *)flags
16+
resolver:(RCTPromiseResolveBlock)resolve
1517
rejecter:(RCTResponseErrorBlock)reject) {
16-
NSError *initError = [BringgObjc initializeSDKWithLogger:nil];
18+
BringgSDKInitOptions *options = [BringgSDKInitOptions fromFlagsWithFlags:flags];
19+
NSError *initError = [BringgObjc initializeSDKWithLogger:nil bringgSDKInitOptions:options];
1720
if (initError) {
1821
reject(initError);
1922
} else {

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bringg/react-native-bringg-driver-sdk",
3-
"version": "1.9.3",
3+
"version": "1.10.0",
44
"description": "A React Native wrapper for the native (iOS and Android) Bringg driver SDKs (currently supporting the active customer use case)",
55
"main": "lib/commonjs/index.js",
66
"module": "lib/module/index.js",

react-native-bringg-driver-sdk.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ Pod::Spec.new do |s|
1919

2020
s.dependency 'React'
2121

22-
s.dependency 'BringgDriverSDK', '1.9.0'
23-
s.dependency 'BringgDriverSDKObjc', '1.9.0'
22+
s.dependency 'BringgDriverSDK', '1.10.0'
23+
s.dependency 'BringgDriverSDKObjc', '1.10.0'
2424
end

src/android-api-to-public-api-transform.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { BringgDriverSDKType, ActiveCustomerManagerType } from './index';
22
import { Task } from './models/task';
33
import { BehaviorSubject } from 'rxjs';
44
import { BringgDriverSdkAndroidType } from './android';
5+
import { SDKInitializeFlag } from './consts/SDKInitializeFlag';
56

67
// Maps the Android api to the public api (BringgDriverSdkAndroidType -> BringgDriverSDKType)
78
export function androidAPIToPublicAPITransform(
@@ -22,7 +23,9 @@ export function androidAPIToPublicAPITransform(
2223
const isLoggedInSubject = new BehaviorSubject<boolean>(false);
2324
const activeTaskSubject = new BehaviorSubject<Task | null>(null);
2425

25-
const initBringgDriverSDK = async (): Promise<void> => {
26+
const initBringgDriverSDK = async (
27+
_?: SDKInitializeFlag[]
28+
): Promise<void> => {
2629
await bringgDriverSdkAndroidType.init();
2730
await addListenerToActiveTask((activeTask) =>
2831
activeTaskSubject.next(activeTask)

0 commit comments

Comments
 (0)