Skip to content

Commit

Permalink
Merge pull request #1225 from dotintent/release/3.2.1
Browse files Browse the repository at this point in the history
Release/3.2.1
  • Loading branch information
intent-kacper-cyranowski committed Jul 9, 2024
2 parents 8893a5e + 210faeb commit 2682749
Show file tree
Hide file tree
Showing 143 changed files with 28,279 additions and 27,970 deletions.
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ node_modules/warning/.*

; Example app
<PROJECT_ROOT>/example/.*
<PROJECT_ROOT>/example-expo/.*


; Node modules errors
<PROJECT_ROOT>/node_modules/.*
Expand Down
20 changes: 1 addition & 19 deletions .github/actions/setup_test_project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ runs:
NODE_VERSION: ${{ inputs.NODE_VERSION }}
IS_EXPO: ${{ inputs.IS_EXPO }}

- name: Initialize project default template
if: inputs.IS_EXPO != 'true'
run: npx react-native@latest init BlePlxExample --version ${{ inputs.REACT_NATIVE_VERSION }} --directory test_project --skip-install --verbose
shell: bash

- name: Initialize project expo template
if: inputs.IS_EXPO == 'true'
run: npx create-expo-app test_project -t expo-template-blank-typescript --no-install
shell: bash

- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v3
Expand All @@ -49,17 +39,9 @@ runs:
${{ runner.os }}-${{ inputs.REACT_NATIVE_VERSION }}-yarn-${{ hashFiles('**/yarn.lock') }}
${{ runner.os }}-${{ inputs.REACT_NATIVE_VERSION }}-yarn-
- name: Copy project files
run: node ./scripts/copyExampleProjectFiles.js
shell: bash
env:
REACT_NATIVE_VERSION: ${{ inputs.REACT_NATIVE_VERSION }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
IS_EXPO: ${{ inputs.IS_EXPO || 'false'}}

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: |
yarn install --cwd test_project
yarn install --cwd example --no-immutable
yarn install
shell: bash
27 changes: 11 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ jobs:
configurations:
[
{ react_native_version: '0.72.6', node_version: 18 },
{ react_native_version: '0.71.14', node_version: 16 },
{ react_native_version: '0.70.13', node_version: 16 }
{ react_native_version: '0.71.14', node_version: 18 },
{ react_native_version: '0.70.13', node_version: 18 }
]
env:
TURBO_CACHE_DIR: .turbo/android
Expand Down Expand Up @@ -92,12 +92,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
run: |
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
java-version: '17'

- name: Cache Gradle
if: env.turbo_cache_hit != 1
Expand All @@ -106,7 +101,7 @@ jobs:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-${{ hashFiles('test_project/android/gradle/wrapper/gradle-wrapper.properties') }}
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-
Expand All @@ -122,8 +117,8 @@ jobs:
configurations:
[
{ react_native_version: '0.72.6', node_version: 18 },
{ react_native_version: '0.71.14', node_version: 16 },
{ react_native_version: '0.70.13', node_version: 16 }
{ react_native_version: '0.71.14', node_version: 18 },
{ react_native_version: '0.70.13', node_version: 18 }
]
env:
TURBO_CACHE_DIR: .turbo/ios
Expand Down Expand Up @@ -161,19 +156,19 @@ jobs:
with:
path: |
**/ios/Pods
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-${{ hashFiles('test_project/ios/Podfile.lock') }}
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-cocoapods-
- name: Install cocoapods
if: env.turbo_cache_hit != 1
run: |
cd test_project/ios
cd example/ios
pod install --verbose
env:
NO_FLIPPER: 1

- name: Build test_project for iOS
- name: Build example for iOS
if: env.turbo_cache_hit != 1
run: |
yarn turbo run test:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
Expand Down Expand Up @@ -218,7 +213,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Finalize Android SDK
if: env.turbo_cache_hit != 1
Expand All @@ -232,7 +227,7 @@ jobs:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-${{ hashFiles('test_project/android/gradle/wrapper/gradle-wrapper.properties') }}
key: ${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-${{ matrix.configurations.react_native_version }}-gradle-
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ DerivedData
*.ipa
*.xcuserstate
project.xcworkspace
.xcode.env.local

Pods/

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## [3.2.1] - 2024-07-9

### Changed

- reverted methods from arrow functions to regular functions to avoid issues with `this` context
- improved react native fast refresh support on android

### Fixed

- Example app xcode node path issue

## [3.2.0] - 2024-05-31

### Added
Expand Down
31 changes: 24 additions & 7 deletions android/src/main/java/com/bleplx/adapter/BleModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import com.bleplx.adapter.utils.UUIDConverter;
import com.bleplx.adapter.utils.mapper.RxBleDeviceToDeviceMapper;
import com.bleplx.adapter.utils.mapper.RxScanResultToScanResultMapper;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.polidea.rxandroidble2.NotificationSetupMode;
import com.polidea.rxandroidble2.RxBleAdapterStateObservable;
import com.polidea.rxandroidble2.RxBleClient;
Expand All @@ -56,7 +57,8 @@
import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers;

public class BleModule implements BleAdapter {
public class BleModule extends ReactContextBaseJavaModule implements BleAdapter {
public static final String NAME = "Ble";

private final ErrorConverter errorConverter = new ErrorConverter();

Expand Down Expand Up @@ -99,6 +101,12 @@ public class BleModule implements BleAdapter {

private int currentLogLevel = RxBleLog.NONE;

@Override
@NonNull
public String getName() {
return NAME;
}

public BleModule(Context context) {
this.context = context;
bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE);
Expand All @@ -118,6 +126,15 @@ public void createClient(String restoreStateIdentifier,
}
}

private void clearActiveConnections() {
pendingTransactions.removeAllSubscriptions();
connectingDevices.removeAllSubscriptions();
connectedDevices.clear();
activeConnections.clear();
discoveredDevices.clear();

}

@Override
public void destroyClient() {
if (adapterStateChangesSubscription != null) {
Expand All @@ -128,15 +145,10 @@ public void destroyClient() {
scanSubscription.dispose();
scanSubscription = null;
}
pendingTransactions.removeAllSubscriptions();
connectingDevices.removeAllSubscriptions();

clearActiveConnections();
discoveredServices.clear();
discoveredCharacteristics.clear();
discoveredDescriptors.clear();
connectedDevices.clear();
activeConnections.clear();
discoveredDevices.clear();

rxBleClient = null;
IdGenerator.clear();
Expand Down Expand Up @@ -1566,4 +1578,9 @@ private void cleanServicesAndCharacteristicsForDevice(@NonNull Device device) {
}
}
}

@Override
public void invalidate() {
clearActiveConnections();
}
}
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset='utf-8'>
<title>react-native-ble-plx 3.2.0 | Documentation</title>
<title>react-native-ble-plx 3.2.1 | Documentation</title>
<meta name='description' content='React Native Bluetooth Low Energy library'>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' rel='stylesheet'>
Expand All @@ -15,7 +15,7 @@
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
<div class='py1 px2'>
<h3 class='mb0 no-anchor'>react-native-ble-plx</h3>
<div class='mb1'><code>3.2.0</code></div>
<div class='mb1'><code>3.2.1</code></div>
<input
placeholder='Filter'
id='filter-input'
Expand Down
35 changes: 35 additions & 0 deletions example-expo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files

# dependencies
node_modules/

# Expo
.expo/
dist/
web-build/

# Native
*.orig.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision

# Metro
.metro-health-check*

# debug
npm-debug.*
yarn-debug.*
yarn-error.*

# macOS
.DS_Store
*.pem

# local env files
.env*.local

# typescript
*.tsbuildinfo
6 changes: 6 additions & 0 deletions example-expo/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import { AppComponent } from './src/AppComponent'

export function App() {
return <AppComponent />
}
16 changes: 16 additions & 0 deletions example-expo/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# OSX
#
.DS_Store

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/

# Bundle artifacts
*.jsbundle
Loading

0 comments on commit 2682749

Please sign in to comment.