Skip to content

Commit

Permalink
Merge pull request dotintent#679 from Polidea/fix/dotintent#663-no-on…
Browse files Browse the repository at this point in the history
…-device-disconnected-event

Send event when device is disconnected
  • Loading branch information
dariuszseweryn authored Jun 5, 2020
2 parents 10d3be8 + c767b13 commit 2ea88aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableType;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.polidea.multiplatformbleadapter.BleAdapter;
import com.polidea.multiplatformbleadapter.BleModule;
Expand Down Expand Up @@ -338,7 +339,14 @@ public void onSuccess(Device data) {
new OnEventCallback<ConnectionState>() {
@Override
public void onEvent(ConnectionState connectionState) {

if (connectionState == ConnectionState.DISCONNECTED) {
WritableArray event = Arguments.createArray();
event.pushNull();
WritableMap device = Arguments.createMap();
device.putString("id", deviceId);
event.pushMap(device);
sendEvent(Event.DisconnectionEvent, event);
}
}
},
new OnErrorCallback() {
Expand Down
7 changes: 4 additions & 3 deletions integration-tests/scripts/build-ios-project
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ set -eo pipefail

PROJECT_PATH=$1

pushd $PROJECT_PATH
pushd "$PROJECT_PATH"
SIMULATOR_PARAMS='platform=iOS Simulator,name=iPhone 11,OS=13.4.1'
npx flow check
npm start &
sleep 5
curl -s http://localhost:8081/index.bundle\?platform\=ios\&dev\=true\&minify\=false > /dev/null
if [ -d ios/Setup.xcworkspace ]; then
echo "Building XCode workspace..."
xcodebuild test -scheme Setup -workspace ios/Setup.xcworkspace -quiet -UseModernBuildSystem=YES -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.4' > /dev/null
xcodebuild test -scheme Setup -workspace ios/Setup.xcworkspace -quiet -UseModernBuildSystem=YES -destination "$SIMULATOR_PARAMS" > /dev/null
else
echo "Building XCode project..."
xcodebuild test -scheme Setup -project ios/Setup.xcodeproj -quiet -UseModernBuildSystem=YES -destination 'platform=iOS Simulator,name=iPhone 11,OS=13.4' > /dev/null
xcodebuild test -scheme Setup -project ios/Setup.xcodeproj -quiet -UseModernBuildSystem=YES -destination "$SIMULATOR_PARAMS" > /dev/null
fi
popd

0 comments on commit 2ea88aa

Please sign in to comment.