react-native-flic2 0.3.21 → 0.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,6 +20,7 @@ This plugin is supported by the Flic2 SDKs
20
20
  import Flic2 from 'react-native-flic2';
21
21
 
22
22
  // Flic2 Module
23
+ Flic.start(); // Starts the module, fixes auto bluetooth permission question
23
24
  Flic2.isInitialized(); // returns a boolean if the manager is initialized or not
24
25
  Flic2.startScan(); // start a scan
25
26
  Flic2.stopScan(); // stop a scan
@@ -182,6 +183,9 @@ export default class App extends Component {
182
183
 
183
184
  componentDidMount() {
184
185
 
186
+ // start module
187
+ Flic2.start();
188
+
185
189
  if (typeof Flic2.isInitialized === 'function' && Flic2.isInitialized() === true) {
186
190
  this.onInitialized();
187
191
  } else {
package/android/.project CHANGED
@@ -22,12 +22,12 @@
22
22
  </natures>
23
23
  <filteredResources>
24
24
  <filter>
25
- <id>1659599870811</id>
25
+ <id>1672997242985</id>
26
26
  <name></name>
27
27
  <type>30</type>
28
28
  <matcher>
29
29
  <id>org.eclipse.core.resources.regexFilterMatcher</id>
30
- <arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
30
+ <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31
31
  </matcher>
32
32
  </filter>
33
33
  </filteredResources>
@@ -1,4 +1,4 @@
1
- arguments=
1
+ arguments=--init-script /var/folders/6m/z8r_cr313y9_r9ylszfy4tnm0000gn/T/d146c9752a26f79b52047fb6dc6ed385d064e120494f96f08ca63a317c41f94c.gradle --init-script /var/folders/6m/z8r_cr313y9_r9ylszfy4tnm0000gn/T/52cde0cfcf3e28b8b7510e992210d9614505e0911af0c190bd590d7158574963.gradle
2
2
  auto.sync=false
3
3
  build.scans.enabled=false
4
4
  connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
@@ -35,6 +35,7 @@ buildscript {
35
35
  }
36
36
 
37
37
  apply plugin: 'com.android.library'
38
+ apply plugin: 'maven-publish'
38
39
 
39
40
  android {
40
41
  compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
@@ -68,7 +69,7 @@ repositories {
68
69
  dependencies {
69
70
  //noinspection GradleDynamicVersion
70
71
  implementation 'com.facebook.react:react-native:+' // From node_modules
71
- implementation 'com.github.50ButtonsEach:flic2lib-android:1.1.0'
72
+ implementation 'com.github.50ButtonsEach:flic2lib-android:1.3.1'
72
73
 
73
74
  implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
74
75
  implementation 'io.reactivex.rxjava2:rxjava:2.2.13'
@@ -108,7 +109,8 @@ afterEvaluate { project ->
108
109
  task androidJavadoc(type: Javadoc) {
109
110
  source = android.sourceSets.main.java.srcDirs
110
111
  classpath += files(android.bootClasspath)
111
- classpath += files(project.getConfigurations().getByName('compile').asList())
112
+ project.getConfigurations().getByName('implementation').setCanBeResolved(true)
113
+ classpath += files(project.getConfigurations().getByName('implementation').asList())
112
114
  include '**/*.java'
113
115
  }
114
116
 
@@ -137,12 +139,11 @@ afterEvaluate { project ->
137
139
  archives androidJavadocJar
138
140
  }
139
141
 
140
- task installArchives(type: Upload) {
141
- configuration = configurations.archives
142
- repositories.mavenDeployer {
143
- // Deploy to react-native-event-bridge/maven, ready to publish to npm
144
- repository url: "file://${projectDir}/../android/maven"
145
- configureReactNativePom pom
142
+ publishing {
143
+ repositories {
144
+ maven {
145
+ url = uri("${rootProject.projectDir}/maven-repo")
146
+ }
146
147
  }
147
- }
148
+ }
148
149
  }
@@ -82,7 +82,11 @@ public class Flic2 extends ReactContextBaseJavaModule implements LifecycleEventL
82
82
  boolean isRunning = isServiceRunning(context, Flic2Service.class);
83
83
  if (!isRunning) {
84
84
  Intent intent = new Intent(context, Flic2Service.class);
85
- startForegroundService(context, intent);
85
+ try {
86
+ startForegroundService(context, intent);
87
+ } catch (Exception e) {
88
+ Log.d(TAG, "startService() exception " + e);
89
+ }
86
90
  }
87
91
  }
88
92
 
@@ -177,8 +181,12 @@ public class Flic2 extends ReactContextBaseJavaModule implements LifecycleEventL
177
181
  Context context = getReactApplicationContext();
178
182
  boolean isRunning = isServiceRunning(context, Flic2Service.class);
179
183
  if (isRunning) {
180
- Intent intent = new Intent(context, Flic2Service.class);
181
- getReactApplicationContext().bindService(intent, mFlic2ServiceConnection, BIND_AUTO_CREATE);
184
+ try {
185
+ Intent intent = new Intent(context, Flic2Service.class);
186
+ getReactApplicationContext().bindService(intent, mFlic2ServiceConnection, BIND_AUTO_CREATE);
187
+ } catch ( Exception e) {
188
+ Log.w(TAG, "onHostResume(), Exception ", e);
189
+ }
182
190
  }
183
191
  }
184
192
 
@@ -191,7 +199,7 @@ public class Flic2 extends ReactContextBaseJavaModule implements LifecycleEventL
191
199
  context.unbindService(mFlic2ServiceConnection);
192
200
  }
193
201
  } catch (Exception e) {
194
- Log.w(TAG, "onHostPause() , unbindService", e);
202
+ Log.w(TAG, "onHostPause() , Exception", e);
195
203
  }
196
204
  }
197
205
 
@@ -95,7 +95,7 @@ public class Flic2Service extends Service implements IFlic2Service {
95
95
  setFlic2Init();
96
96
 
97
97
  Intent notificationIntent = new Intent(this, Flic2Service.class);
98
- PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
98
+ PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
99
99
 
100
100
  if (VERSION.SDK_INT >= VERSION_CODES.O) {
101
101
  NotificationChannel mChannel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_LOW);
@@ -180,7 +180,11 @@ public class Flic2Service extends Service implements IFlic2Service {
180
180
  public void startForegroundService() {
181
181
  if (isServiceStarted == false && notification != null) {
182
182
  this.isServiceStarted = true;
183
- startForeground(SERVICE_NOTIFICATION_ID, notification);
183
+ try {
184
+ startForeground(SERVICE_NOTIFICATION_ID, notification);
185
+ } catch (Exception e) {
186
+ Log.w(TAG, "startForegroundService() exception ", e);
187
+ }
184
188
  }
185
189
  }
186
190
 
package/index.js CHANGED
@@ -104,12 +104,18 @@ class Flic2 extends EventEmitter {
104
104
 
105
105
  this.registerInitializedCallback();
106
106
 
107
- // start the native context
108
- Flic2Module.startup();
109
107
 
110
108
  // known buttons
111
109
  this.knownButtons = {};
112
110
  }
111
+
112
+ /**
113
+ * Start up the flic module
114
+ */
115
+ start() {
116
+ // start the native context
117
+ Flic2Module.startup();
118
+ }
113
119
 
114
120
  registerInitializedCallback(){
115
121
  if(Platform.OS === 'android') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-flic2",
3
- "version": "0.3.21",
3
+ "version": "0.3.23",
4
4
  "description": "React Native Flic plugin made with the Flic2 SDK (unofficial)",
5
5
  "main": "index.js",
6
6
  "scripts": {},