react-native-flic2 0.3.26 → 2.0.0-alpha.39

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.
Files changed (243) hide show
  1. package/Flic2.podspec +22 -0
  2. package/{LICENSE.md → LICENSE} +1 -1
  3. package/README.md +17 -523
  4. package/android/build.gradle +64 -132
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +17 -29
  7. package/android/src/main/java/com/flic2/Flic2ButtonListener.kt +132 -0
  8. package/android/src/main/java/com/flic2/Flic2Converter.kt +103 -0
  9. package/android/src/main/java/com/flic2/Flic2Module.kt +480 -0
  10. package/android/src/main/java/com/flic2/Flic2Package.kt +33 -0
  11. package/android/src/main/java/com/flic2/Flic2Service.kt +112 -0
  12. package/ios/Flic2.h +9 -4
  13. package/ios/Flic2.mm +610 -0
  14. package/ios/flic2lib.framework/Headers/FLICButton.h +1 -1
  15. package/ios/flic2lib.framework/Headers/FLICManager.h +1 -1
  16. package/ios/flic2lib.framework/Info.plist +0 -0
  17. package/ios/flic2lib.framework/Modules/module.modulemap +1 -1
  18. package/ios/flic2lib.framework/flic2lib +0 -0
  19. package/lib/module/NativeFlic2.js +14 -0
  20. package/lib/module/NativeFlic2.js.map +1 -0
  21. package/lib/module/index.js +91 -0
  22. package/lib/module/index.js.map +1 -0
  23. package/lib/module/package.json +1 -0
  24. package/lib/typescript/package.json +1 -0
  25. package/lib/typescript/src/NativeFlic2.d.ts +119 -0
  26. package/lib/typescript/src/NativeFlic2.d.ts.map +1 -0
  27. package/lib/typescript/src/index.d.ts +81 -0
  28. package/lib/typescript/src/index.d.ts.map +1 -0
  29. package/package.json +132 -19
  30. package/src/NativeFlic2.ts +157 -0
  31. package/src/index.tsx +159 -0
  32. package/.editorconfig +0 -7
  33. package/.gitattributes +0 -1
  34. package/.idea/codeStyles/Project.xml +0 -116
  35. package/.idea/modules.xml +0 -8
  36. package/.idea/react-native-flic2.iml +0 -9
  37. package/.idea/vcs.xml +0 -6
  38. package/.idea/workspace.xml +0 -140
  39. package/android/.classpath +0 -6
  40. package/android/.gradle/5.4.1/executionHistory/executionHistory.bin +0 -0
  41. package/android/.gradle/5.4.1/executionHistory/executionHistory.lock +0 -0
  42. package/android/.gradle/5.4.1/fileChanges/last-build.bin +0 -0
  43. package/android/.gradle/5.4.1/fileContent/fileContent.lock +0 -0
  44. package/android/.gradle/5.4.1/fileHashes/fileHashes.bin +0 -0
  45. package/android/.gradle/5.4.1/fileHashes/fileHashes.lock +0 -0
  46. package/android/.gradle/5.4.1/fileHashes/resourceHashesCache.bin +0 -0
  47. package/android/.gradle/5.4.1/gc.properties +0 -0
  48. package/android/.gradle/5.4.1/javaCompile/classAnalysis.bin +0 -0
  49. package/android/.gradle/5.4.1/javaCompile/jarAnalysis.bin +0 -0
  50. package/android/.gradle/5.4.1/javaCompile/javaCompile.lock +0 -0
  51. package/android/.gradle/5.4.1/javaCompile/taskHistory.bin +0 -0
  52. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  53. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  54. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  55. package/android/.gradle/vcs-1/gc.properties +0 -0
  56. package/android/.idea/caches/build_file_checksums.ser +0 -0
  57. package/android/.idea/codeStyles/Project.xml +0 -116
  58. package/android/.idea/gradle.xml +0 -18
  59. package/android/.idea/libraries/Gradle__android_arch_core_common_1_1_1_jar.xml +0 -11
  60. package/android/.idea/libraries/Gradle__android_arch_core_runtime_1_1_1_aar.xml +0 -12
  61. package/android/.idea/libraries/Gradle__android_arch_lifecycle_common_1_1_1_jar.xml +0 -11
  62. package/android/.idea/libraries/Gradle__android_arch_lifecycle_livedata_1_1_1_aar.xml +0 -12
  63. package/android/.idea/libraries/Gradle__android_arch_lifecycle_livedata_core_1_1_1_aar.xml +0 -12
  64. package/android/.idea/libraries/Gradle__android_arch_lifecycle_runtime_1_1_1_aar.xml +0 -12
  65. package/android/.idea/libraries/Gradle__android_arch_lifecycle_viewmodel_1_1_1_aar.xml +0 -12
  66. package/android/.idea/libraries/Gradle__com_android_support_animated_vector_drawable_28_0_0_aar.xml +0 -10
  67. package/android/.idea/libraries/Gradle__com_android_support_appcompat_v7_28_0_0_aar.xml +0 -13
  68. package/android/.idea/libraries/Gradle__com_android_support_asynclayoutinflater_28_0_0_aar.xml +0 -10
  69. package/android/.idea/libraries/Gradle__com_android_support_collections_28_0_0_jar.xml +0 -9
  70. package/android/.idea/libraries/Gradle__com_android_support_coordinatorlayout_28_0_0_aar.xml +0 -13
  71. package/android/.idea/libraries/Gradle__com_android_support_cursoradapter_28_0_0_aar.xml +0 -10
  72. package/android/.idea/libraries/Gradle__com_android_support_customview_28_0_0_aar.xml +0 -10
  73. package/android/.idea/libraries/Gradle__com_android_support_documentfile_28_0_0_aar.xml +0 -10
  74. package/android/.idea/libraries/Gradle__com_android_support_drawerlayout_28_0_0_aar.xml +0 -13
  75. package/android/.idea/libraries/Gradle__com_android_support_interpolator_28_0_0_aar.xml +0 -10
  76. package/android/.idea/libraries/Gradle__com_android_support_loader_28_0_0_aar.xml +0 -10
  77. package/android/.idea/libraries/Gradle__com_android_support_localbroadcastmanager_28_0_0_aar.xml +0 -10
  78. package/android/.idea/libraries/Gradle__com_android_support_print_28_0_0_aar.xml +0 -13
  79. package/android/.idea/libraries/Gradle__com_android_support_slidingpanelayout_28_0_0_aar.xml +0 -10
  80. package/android/.idea/libraries/Gradle__com_android_support_support_annotations_28_0_0_jar.xml +0 -9
  81. package/android/.idea/libraries/Gradle__com_android_support_support_compat_28_0_0_aar.xml +0 -13
  82. package/android/.idea/libraries/Gradle__com_android_support_support_core_ui_28_0_0_aar.xml +0 -10
  83. package/android/.idea/libraries/Gradle__com_android_support_support_core_utils_28_0_0_aar.xml +0 -10
  84. package/android/.idea/libraries/Gradle__com_android_support_support_fragment_28_0_0_aar.xml +0 -13
  85. package/android/.idea/libraries/Gradle__com_android_support_support_vector_drawable_28_0_0_aar.xml +0 -10
  86. package/android/.idea/libraries/Gradle__com_android_support_swiperefreshlayout_28_0_0_aar.xml +0 -13
  87. package/android/.idea/libraries/Gradle__com_android_support_versionedparcelable_28_0_0_aar.xml +0 -10
  88. package/android/.idea/libraries/Gradle__com_android_support_viewpager_28_0_0_aar.xml +0 -10
  89. package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_1_10_0_aar.xml +0 -12
  90. package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_1_10_0_aar.xml +0 -15
  91. package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_1_10_0_aar.xml +0 -15
  92. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_1_10_0_aar.xml +0 -15
  93. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_1_10_0_aar.xml +0 -15
  94. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp3_1_10_0_aar.xml +0 -12
  95. package/android/.idea/libraries/Gradle__com_facebook_infer_annotation_infer_annotation_0_11_2_jar.xml +0 -13
  96. package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_59_10_aar.xml +0 -17
  97. package/android/.idea/libraries/Gradle__com_facebook_soloader_soloader_0_6_0_aar.xml +0 -14
  98. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_2_jar.xml +0 -13
  99. package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_12_1_jar.xml +0 -13
  100. package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_urlconnection_3_12_1_jar.xml +0 -13
  101. package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_15_0_jar.xml +0 -13
  102. package/android/.idea/libraries/Gradle__io_flic_flic2lib_android_1_1_0_aar.xml +0 -14
  103. package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1_jar.xml +0 -13
  104. package/android/.idea/misc.xml +0 -14
  105. package/android/.idea/modules.xml +0 -8
  106. package/android/.idea/runConfigurations.xml +0 -12
  107. package/android/.idea/vcs.xml +0 -6
  108. package/android/.idea/workspace.xml +0 -348
  109. package/android/.project +0 -34
  110. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  111. package/android/README.md +0 -14
  112. package/android/android.iml +0 -139
  113. package/android/build/generated/source/buildConfig/debug/nl/xguard/flic2/BuildConfig.java +0 -13
  114. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -46
  115. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
  116. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  117. package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  118. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -15
  119. package/android/build/intermediates/incremental/packageDebugResources/merged.dir/values/values.xml +0 -4
  120. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
  121. package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -46
  122. package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
  123. package/android/build/intermediates/packaged_res/debug/drawable/ic_launcher_background.xml +0 -74
  124. package/android/build/intermediates/packaged_res/debug/drawable-v24/ic_launcher_foreground.xml +0 -34
  125. package/android/build/intermediates/packaged_res/debug/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  126. package/android/build/intermediates/packaged_res/debug/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  127. package/android/build/intermediates/packaged_res/debug/mipmap-hdpi-v4/ic_launcher.png +0 -0
  128. package/android/build/intermediates/packaged_res/debug/mipmap-hdpi-v4/ic_launcher_round.png +0 -0
  129. package/android/build/intermediates/packaged_res/debug/mipmap-mdpi-v4/ic_launcher.png +0 -0
  130. package/android/build/intermediates/packaged_res/debug/mipmap-mdpi-v4/ic_launcher_round.png +0 -0
  131. package/android/build/intermediates/packaged_res/debug/mipmap-xhdpi-v4/ic_launcher.png +0 -0
  132. package/android/build/intermediates/packaged_res/debug/mipmap-xhdpi-v4/ic_launcher_round.png +0 -0
  133. package/android/build/intermediates/packaged_res/debug/mipmap-xxhdpi-v4/ic_launcher.png +0 -0
  134. package/android/build/intermediates/packaged_res/debug/mipmap-xxhdpi-v4/ic_launcher_round.png +0 -0
  135. package/android/build/intermediates/packaged_res/debug/mipmap-xxxhdpi-v4/ic_launcher.png +0 -0
  136. package/android/build/intermediates/packaged_res/debug/mipmap-xxxhdpi-v4/ic_launcher_round.png +0 -0
  137. package/android/build/intermediates/packaged_res/debug/values/values.xml +0 -4
  138. package/android/build/intermediates/res/symbol-table-with-package/debug/package-aware-r.txt +0 -989
  139. package/android/build/intermediates/symbols/debug/R.txt +0 -1302
  140. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -95
  141. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  142. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  143. package/android/gradlew +0 -172
  144. package/android/gradlew.bat +0 -84
  145. package/android/local.properties +0 -8
  146. package/android/src/main/ic_launcher-web.png +0 -0
  147. package/android/src/main/java/nl/xguard/flic2/Flic2.java +0 -213
  148. package/android/src/main/java/nl/xguard/flic2/Flic2Package.java +0 -28
  149. package/android/src/main/java/nl/xguard/flic2/communication/IReactEvent.java +0 -15
  150. package/android/src/main/java/nl/xguard/flic2/communication/NullReactEvent.java +0 -47
  151. package/android/src/main/java/nl/xguard/flic2/communication/ReactEvent.java +0 -230
  152. package/android/src/main/java/nl/xguard/flic2/model/IReactFlic2Manager.java +0 -27
  153. package/android/src/main/java/nl/xguard/flic2/model/NullReactFlic2Manager.java +0 -70
  154. package/android/src/main/java/nl/xguard/flic2/model/ReactAndroidHandler.java +0 -33
  155. package/android/src/main/java/nl/xguard/flic2/model/ReactFlic2ButtonListener.java +0 -106
  156. package/android/src/main/java/nl/xguard/flic2/model/ReactFlic2Manager.java +0 -168
  157. package/android/src/main/java/nl/xguard/flic2/model/ReactFlic2ScanCallback.java +0 -48
  158. package/android/src/main/java/nl/xguard/flic2/model/ReactLogger.java +0 -14
  159. package/android/src/main/java/nl/xguard/flic2/service/Flic2Service.java +0 -200
  160. package/android/src/main/java/nl/xguard/flic2/service/Flic2ServiceConnection.java +0 -41
  161. package/android/src/main/java/nl/xguard/flic2/service/IFlic2Service.java +0 -13
  162. package/android/src/main/java/nl/xguard/flic2/sharedpreferences/flic2SharedPreferences.java +0 -35
  163. package/android/src/main/java/nl/xguard/flic2/util/ActivityUtil.java +0 -29
  164. package/android/src/main/java/nl/xguard/flic2/util/Consumer.java +0 -12
  165. package/android/src/main/res/drawable/ic_launcher_background.xml +0 -74
  166. package/android/src/main/res/drawable-v24/ic_launcher_foreground.xml +0 -34
  167. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  168. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  169. package/android/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  170. package/android/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  171. package/android/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  172. package/android/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  173. package/android/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  174. package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  175. package/android/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  176. package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  177. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  178. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  179. package/android/src/main/res/values/ids.xml +0 -5
  180. package/build/generated/source/buildConfig/debug/com/flic2/BuildConfig.java +0 -13
  181. package/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +0 -46
  182. package/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output.json +0 -1
  183. package/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  184. package/build/intermediates/annotations_typedef_file/debug/extractDebugAnnotations/typedefs.txt +0 -0
  185. package/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  186. package/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  187. package/build/intermediates/incremental/debug-mergeJniLibs/merge-state +0 -0
  188. package/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  189. package/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  190. package/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  191. package/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +0 -15
  192. package/build/intermediates/incremental/packageDebugResources/merger.xml +0 -2
  193. package/build/intermediates/intermediate-jars/debug/classes.jar +0 -0
  194. package/build/intermediates/intermediate-jars/debug/res.jar +0 -0
  195. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/BuildConfig.class +0 -0
  196. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/Flic2Module$1.class +0 -0
  197. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/Flic2Module.class +0 -0
  198. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/Flic2Package.class +0 -0
  199. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/callback/flic2ButtonCallback.class +0 -0
  200. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/communication/ReactEvent.class +0 -0
  201. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/service/Flic2Service$BootUpReceiver.class +0 -0
  202. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/service/Flic2Service$UpdateReceiver.class +0 -0
  203. package/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/flic2/service/Flic2Service.class +0 -0
  204. package/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -46
  205. package/build/intermediates/merged_manifests/debug/output.json +0 -1
  206. package/build/intermediates/packaged-classes/debug/classes.jar +0 -0
  207. package/build/intermediates/packaged_res/debug/drawable/ic_launcher_background.xml +0 -74
  208. package/build/intermediates/packaged_res/debug/drawable-v24/ic_launcher_foreground.xml +0 -34
  209. package/build/intermediates/packaged_res/debug/mipmap-anydpi-v26/ic_launcher.xml +0 -5
  210. package/build/intermediates/packaged_res/debug/mipmap-anydpi-v26/ic_launcher_round.xml +0 -5
  211. package/build/intermediates/packaged_res/debug/mipmap-hdpi-v4/ic_launcher.png +0 -0
  212. package/build/intermediates/packaged_res/debug/mipmap-hdpi-v4/ic_launcher_round.png +0 -0
  213. package/build/intermediates/packaged_res/debug/mipmap-mdpi-v4/ic_launcher.png +0 -0
  214. package/build/intermediates/packaged_res/debug/mipmap-mdpi-v4/ic_launcher_round.png +0 -0
  215. package/build/intermediates/packaged_res/debug/mipmap-xhdpi-v4/ic_launcher.png +0 -0
  216. package/build/intermediates/packaged_res/debug/mipmap-xhdpi-v4/ic_launcher_round.png +0 -0
  217. package/build/intermediates/packaged_res/debug/mipmap-xxhdpi-v4/ic_launcher.png +0 -0
  218. package/build/intermediates/packaged_res/debug/mipmap-xxhdpi-v4/ic_launcher_round.png +0 -0
  219. package/build/intermediates/packaged_res/debug/mipmap-xxxhdpi-v4/ic_launcher.png +0 -0
  220. package/build/intermediates/packaged_res/debug/mipmap-xxxhdpi-v4/ic_launcher_round.png +0 -0
  221. package/build/intermediates/res/symbol-table-with-package/debug/package-aware-r.txt +0 -1290
  222. package/build/intermediates/symbols/debug/R.txt +0 -1764
  223. package/build/intermediates/transforms/mergeJavaRes/debug/0.jar +0 -0
  224. package/build/intermediates/transforms/mergeJavaRes/debug/__content__.json +0 -1
  225. package/build/intermediates/transforms/mergeJniLibs/debug/__content__.json +0 -1
  226. package/build/intermediates/transforms/stripDebugSymbol/debug/__content__.json +0 -1
  227. package/build/outputs/aar/react-native-flic2-debug.aar +0 -0
  228. package/build/outputs/logs/manifest-merger-debug-report.txt +0 -95
  229. package/flic2Button.js +0 -170
  230. package/index.js +0 -430
  231. package/ios/Flic2.m +0 -611
  232. package/ios/Flic2.xcodeproj/project.pbxproj +0 -320
  233. package/ios/Flic2.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
  234. package/ios/Flic2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  235. package/ios/Flic2.xcodeproj/project.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  236. package/ios/Flic2.xcodeproj/xcshareddata/xcschemes/Flic2.xcscheme +0 -66
  237. package/ios/Flic2.xcodeproj/xcuserdata/wesdewitte.xcuserdatad/xcschemes/xcschememanagement.plist +0 -22
  238. package/ios/Flic2.xcworkspace/contents.xcworkspacedata +0 -7
  239. package/ios/Flic2.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  240. package/ios/Flic2.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +0 -5
  241. package/ios/Flic2.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  242. package/ios/Flic2.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/WorkspaceSettings.xcsettings +0 -14
  243. package/react-native-flic2.podspec +0 -26
package/Flic2.podspec ADDED
@@ -0,0 +1,22 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "Flic2"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/X-Guard/react-native-flic2.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+ s.ios.vendored_frameworks = 'ios/flic2lib.framework'
20
+
21
+ install_modules_dependencies(s)
22
+ end
@@ -3,7 +3,7 @@
3
3
  ## License for React Native Flic 2 module
4
4
  MIT License
5
5
 
6
- Copyright (c) 2019 X-Guard B.V.
6
+ Copyright (c) 2019 - 2025 X-Guard B.V.
7
7
 
8
8
  Permission is hereby granted, free of charge, to any person obtaining a copy
9
9
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,545 +1,39 @@
1
1
  # react-native-flic2
2
- [![npm version](https://img.shields.io/npm/v/react-native-flic2)](https://www.npmjs.com/package/react-native-flic2) ![NPM](https://img.shields.io/npm/l/react-native-flic2) ![npm](https://img.shields.io/npm/dm/react-native-flic2) ![GitHub issues](https://img.shields.io/github/issues-raw/X-Guard/react-native-flic2)
3
2
 
4
- This plugin enables you to connect to a Flic2 button made by Shortcut Labs.
3
+ React Native Flic plugin made with the Flic2 SDK (unofficial)
5
4
 
6
- This plugin is supported by the Flic2 SDKs
7
- - Android: https://github.com/50ButtonsEach/flic2lib-android
8
- - iOS: https://github.com/50ButtonsEach/flic2lib-ios
5
+ ## Installation
9
6
 
10
- ## Getting started
11
7
 
12
- `$ npm install react-native-flic2 --save`
8
+ ```sh
9
+ npm install react-native-flic2
13
10
 
14
- ### Mostly automatic installation
11
+ ```
15
12
 
16
- `$ react-native link react-native-flic2`
17
13
 
18
14
  ## Usage
19
- ```javascript
20
- import Flic2 from 'react-native-flic2';
21
-
22
- // Flic2 Module
23
- Flic.start(); // Starts the module, fixes auto bluetooth permission question
24
- Flic2.isInitialized(); // returns a boolean if the manager is initialized or not
25
- Flic2.startScan(); // start a scan
26
- Flic2.stopScan(); // stop a scan
27
- Flic2.startService(); // enable background capabilities through a service on Android, ignored by iOS
28
- Flic2.addEventListener(event, fn); // listen for events (manager & all buttons). Possible events are: managerInitialized, didReceiveButtonDown, didReceiveButtonUp, didReceiveButtonClick, didReceiveButtonDoubleClick, didReceiveButtonHold
29
- Flic2.connectAllKnownButtons(); // connect to known buttons
30
- Flic2.buttonConnect(uuid); // connect to a button with this uuid
31
- Flic2.buttonForget(uuid); // disconnect and forget the button
32
- Flic2.forgetAllButtons(); // disconnect and forget all known buttons
33
- Flic2.buttonDisconnect(uuid); // disconnect a button with this uuid
34
- Flic2.disconnectAllKnownButtons(); // disconnect all known buttons
35
- Flic2.getButtons(); // array of Flic2Button instances
36
- Flic2.getButton(uuid); // get a button by uuid, returns a Flic2Button instance
37
- Flic2.buttonSetMode(uuid, mode); // change the button trigger mode by uuid. Use the constants to change the mode (see example below).
38
- Flic2.buttonSetName(uuid, name); // change the nickname by uuid
39
-
40
- // Flic2Button instance definition
41
- Flic2Button.addEventListener(event, fn); // listen for button events for this particular button. Possible events are: didReceiveButtonDown, didReceiveButtonUp, didReceiveButtonClick, didReceiveButtonDoubleClick, didReceiveButtonHold
42
- Flic2Button.connect() // connect this button
43
- Flic2Button.disconnect(); // disconnect this button
44
- Flic2Button.forget(); // removes the button completely
45
- Flic2Button.getUuid(); // get the button uuid
46
- Flic2Button.getBluetoothAddress(); // get the button bluetooth address
47
- Flic2Button.getName(); // get the button nickname
48
- Flic2Button.getBatteryLevelIsOk(); // get the battery state (true, false), True = battery is ok, False = battery should be changed soon
49
- Flic2Button.getVoltage(); // get the estimated battery voltage
50
- Flic2Button.getPressCount(); // get button count since last reset
51
- Flic2Button.getFirmwareRevision(); // get current hardware version
52
- Flic2Button.getSerialNumber(); // get the serial number of the button
53
- Flic2Button.getIsReady(); // get the ready state of the button
54
- Flic2Button.getIsUnpaired(); // get the unpaired state of the button
55
- Flic2Button.setMode(mode); // change the button trigger for this particular button. Use the constants to change the mode (see example below).
56
- Flic2Button.setName(name); // sets the nickname of the button
57
-
58
-
59
- // Constants
60
- //
61
- // These are the possible result codes for the variable 'result' in the
62
- // event 'scanResult' (see example below)
63
- //
64
- // These constants are available through Flic2.constants
65
- SCAN_RESULT_SUCCESS = 0;
66
- SCAN_RESULT_ERROR_ALREADY_RUNNING = 1;
67
- SCAN_RESULT_ERROR_BLUETOOTH_NOT_ACTIVATED = 2;
68
- SCAN_RESULT_ERROR_UNKNOWN = 3;
69
- SCAN_RESULT_ERROR_NO_PUBLIC_BUTTON_DISCOVERED = 4;
70
- SCAN_RESULT_ERROR_ALREADY_CONNECTED_TO_ANOTHER_DEVICE = 5;
71
- SCAN_RESULT_ERROR_CONNECTION_TIMEOUT = 6;
72
- SCAN_RESULT_ERROR_INVALID_VERIFIER = 7;
73
- SCAN_RESULT_ERROR_BLE_PAIRING_FAILED_PREVIOUS_PAIRING_ALREADY_EXISTING = 8;
74
- SCAN_RESULT_ERROR_BLE_PAIRING_FAILED_USER_CANCELED = 9;
75
- SCAN_RESULT_ERROR_BLE_PAIRING_FAILED_UNKNOWN_REASON = 10;
76
- SCAN_RESULT_ERROR_APP_CREDENTIALS_DONT_MATCH = 11;
77
- SCAN_RESULT_ERROR_USER_CANCELED = 12;
78
- SCAN_RESULT_ERROR_INVALID_BLUETOOTH_ADDRESS = 13;
79
- SCAN_RESULT_ERROR_GENUINE_CHECK_FAILED = 14;
80
- SCAN_RESULT_ERROR_TOO_MANY_APPS = 15;
81
- SCAN_RESULT_ERROR_COULD_NOT_SET_BLUETOOTH_NOTIFY = 16;
82
- SCAN_RESULT_ERROR_COULD_NOT_DISCOVER_BLUETOOTH_SERVICES = 17;
83
- SCAN_RESULT_ERROR_BUTTON_DISCONNECTED_DURING_VERIFICATION = 18;
84
- SCAN_RESULT_ERROR_FAILED_TO_ESTABLISH = 19;
85
- SCAN_RESULT_ERROR_CONNECTION_LIMIT_REACHED = 20;
86
- SCAN_RESULT_ERROR_NOT_IN_PUBLIC_MODE = 21;
87
-
88
- // These constants can be used to change the mode of the buttons
89
- // These constants are available through Flic2.constants
90
- BUTTON_TRIGGER_MODE_CLICK_AND_HOLD = 0;
91
- BUTTON_TRIGGER_MODE_CLICK_AND_DOUBLE_CLICK = 1;
92
- BUTTON_TRIGGER_MODE_CLICK_AND_DOUBLE_CLICK_AND_HOLD = 2;
93
- BUTTON_TRIGGER_MODE_CLICK = 3;
94
-
95
- // Scan result:
96
- Flic2.addEventListener('scanResult', ((int) result, (Flic2Button) button) => {
97
-
98
- if (result === Flic2.constants.SCAN_RESULT_SUCCESS) {
99
-
100
- doSomethingWithButton(button);
101
-
102
- } else
103
- if(result === Flic2.constants.SCAN_RESULT_ERROR_ALREADY_CONNECTED_TO_ANOTHER_DEVICE) {
104
-
105
- alert('This button is already connected to another device');
106
-
107
- }
108
- // ... etc
109
-
110
- });
111
-
112
- // Button events:
113
- //
114
- // didReceiveButtonDown
115
- // didReceiveButtonUp
116
- // didReceiveButtonClick
117
- // didReceiveButtonDoubleClick
118
- // didReceiveButtonHold
119
- Flic2.addEventListener('didReceiveButtonHold', ((object) eventData) => {
120
-
121
- // eventData:
122
- // { int age, bool queued, Flic2Button button }
123
15
 
124
- });
125
16
 
126
- ```
17
+ ```js
18
+ import { multiply } from 'react-native-flic2';
127
19
 
128
- ## Android only
129
- Changing the title, text and icon of the service,
130
- Or the notification channel name and description.
131
- Place the following meta-data's inside the application tag of your manifest
20
+ // ...
132
21
 
133
- ```javascript
134
- <application>
135
- <meta-data android:name="nl.xguard.flic2.notification_title" android:value="Flic 2 Button"/>
136
- <meta-data android:name="nl.xguard.flic2.notification_text" android:value="Service active"/>
137
- <meta-data android:name="nl.xguard.flic2.notification_icon" android:resource="@mipmap/xguard_adaptive_launcher"/>
138
- <meta-data android:name="nl.xguard.flic2.notification_channel_name" android:value="Flic 2 Channel Name"/>
139
- <meta-data android:name="nl.xguard.flic2.notification_channel_description" android:value="Flic 2 Channel Description"/>
140
- </application>
22
+ const result = multiply(3, 7);
141
23
  ```
142
24
 
143
- # Example component
144
- You can install and test this example at https://github.com/X-Guard/react-native-flic2-example
145
-
146
- ```javascript
147
- // react and react native imports
148
- import React, { Component } from 'react';
149
- import { View, FlatList, TouchableOpacity, Text, StyleSheet, StatusBar, Platform, Vibration } from 'react-native';
150
-
151
- // the Flic2 module
152
- import Flic2 from 'react-native-flic2';
153
-
154
- // icons
155
- import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
156
- import { faPause, faPlay, faTrash, faEdit, faBatteryQuarter, faBatteryFull } from '@fortawesome/free-solid-svg-icons';
157
-
158
- // plugins to make it more fancy
159
- import prompt from 'react-native-prompt-android';
160
- import { request as requestPermission, PERMISSIONS } from 'react-native-permissions';
161
- import * as Animatable from 'react-native-animatable';
162
- import Toast from 'react-native-root-toast';
163
-
164
- export default class App extends Component {
165
-
166
- constructor(props) {
167
-
168
- // man
169
- super(props);
170
-
171
- // init state
172
- this.state = {
173
- buttons: [],
174
- scanning: false,
175
- };
176
-
177
- // bindings
178
- this.didReceiveButtonClickFunction = this.didReceiveButtonClick.bind(this);
179
- this.onScanResultFunction = this.onScanResult.bind(this);
180
- this.onInitializedFunction = this.onInitialized.bind(this);
181
-
182
- }
183
-
184
- componentDidMount() {
185
-
186
- // start module
187
- Flic2.start();
188
-
189
- if (typeof Flic2.isInitialized === 'function' && Flic2.isInitialized() === true) {
190
- this.onInitialized();
191
- } else {
192
- Flic2.addListener('managerInitialized', this.onInitializedFunction);
193
- }
194
-
195
- // listen bindings
196
- Flic2.addListener('didReceiveButtonClick', this.didReceiveButtonClickFunction);
197
- Flic2.addListener('scanResult', this.onScanResultFunction);
198
-
199
- }
200
-
201
- componentWillUnmount() {
202
-
203
- // remove bindings
204
- Flic2.removeListener('buttonEvent', this.handleButtonEventFunction);
205
- Flic2.removeListener('scanResult', this.onScanResultFunction);
206
-
207
- }
208
-
209
- onInitialized() {
210
-
211
- // connect to all known buttons
212
- Flic2.connectAllKnownButtons();
213
-
214
- // get the buttons
215
- this.getButtons();
216
- }
217
-
218
- async getButtons() {
219
-
220
- // async calls for init
221
- this.setState({
222
- buttons: await Flic2.getButtons(),
223
- });
224
-
225
- }
226
-
227
- async forgetAllButtons() {
228
-
229
- await Flic2.forgetAllButtons();
230
- this.getButtons();
231
-
232
- }
233
-
234
- async startScan() {
235
-
236
- // check os
237
- if (Platform.OS === 'android') {
238
-
239
- // on android we need the permission ACCESS_FINE_LOCATION first
240
- // we are just going to assume the permission is granted after calling this
241
- // in your real application, please create an actual permission check here
242
- await requestPermission(PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION);
243
-
244
- }
245
-
246
- // set to scanning
247
- this.setState({
248
- scanning: true,
249
- });
250
-
251
- // go!
252
- Flic2.startScan();
253
-
254
- }
255
-
256
- stopScan() {
257
-
258
- this.setState({
259
- scanning: false,
260
- });
261
-
262
- Flic2.stopScan();
263
-
264
- }
265
-
266
- connectButton(button) {
267
-
268
- // connect it
269
- button.connect(button);
270
-
271
- // update our button list
272
- this.getButtons();
273
-
274
- }
275
-
276
- disconnectButton(button) {
277
25
 
278
- // disconnect it
279
- button.disconnect(button);
26
+ ## Contributing
280
27
 
281
- // update our button list
282
- this.getButtons();
28
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
29
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
30
+ - [Code of conduct](CODE_OF_CONDUCT.md)
283
31
 
284
- }
32
+ ## License
285
33
 
286
- forgetButton(button) {
34
+ MIT
287
35
 
288
- // forget it
289
- button.forget();
36
+ ---
290
37
 
291
- // update our button list
292
- this.getButtons();
293
-
294
- }
295
-
296
- editButtonName(button) {
297
-
298
- // use the prompt to change the name
299
- prompt(
300
- 'Edit Flic nickname',
301
- 'Choose a name you will recognize',
302
- [
303
- { text: 'Cancel', style: 'cancel' },
304
- {
305
- text: 'OK',
306
- onPress: value => {
307
-
308
- // save
309
- button.setName(value);
310
-
311
- // get new buttons
312
- this.getButtons();
313
-
314
- },
315
- },
316
- ],
317
- {
318
- type: 'plain-text',
319
- cancelable: true,
320
- defaultValue: button.getName(),
321
- }
322
- );
323
-
324
- }
325
-
326
- onScanResult(data) {
327
-
328
- if (data.event === 'completion') {
329
-
330
- this.setState({
331
- scanning: false,
332
- });
333
-
334
- // check
335
- if (data.error === false) {
336
-
337
- alert('The button has been added');
338
- this.getButtons();
339
-
340
- } else {
341
-
342
- if (data.result === Flic2.constants.SCAN_RESULT_ERROR_ALREADY_CONNECTED_TO_ANOTHER_DEVICE) {
343
-
344
- alert('This button is already connected to another device');
345
-
346
- } else
347
- if (data.result === Flic2.constants.SCAN_RESULT_ERROR_NO_PUBLIC_BUTTON_DISCOVERED) {
348
-
349
- alert('No buttons found');
350
-
351
- } else {
352
-
353
- alert(`Could not connect\n\nError code: ${data.result}`);
354
-
355
- }
356
- }
357
- }
358
- }
359
-
360
- didReceiveButtonClick(eventData) {
361
-
362
- console.log('Received click event', eventData);
363
-
364
- // update list
365
- this.getButtons();
366
-
367
- // do something with the click like showing a notification
368
- Toast.show(`Button ${eventData.button.getName()} has been pressed ${eventData.button.getPressCount()} times`);
369
-
370
- // wobble
371
- // we do this extensive check because when you develop the app with live reload, the _logoRef will break.
372
- if (typeof this._logoRef !== 'undefined' && this._logoRef !== null && typeof this._logoRef.wobble === 'function') {
373
-
374
- // wobble wobble
375
- this._logoRef.wobble();
376
-
377
- }
378
-
379
- // vibrate
380
- Vibration.vibrate(200);
381
-
382
- }
383
-
384
- getBatteryIcon(batteryPercentage) {
385
-
386
- if (batteryPercentage === true) {
387
- return faBatteryFull;
388
- } else {
389
- return faBatteryQuarter;
390
- }
391
-
392
- }
393
-
394
-
395
- render() {
396
-
397
- return (
398
- <View style={style.container}>
399
- <StatusBar barStyle="light-content" />
400
-
401
- {/* eslint-disable-next-line */}
402
- <Animatable.Image ref={ image => this._logoRef = image } style={style.logo} useNativeDriver={true} source={require('./images/flic-logo.png')} />
403
-
404
- {/* Scan button */}
405
- {this.state.scanning === false ?
406
- <TouchableOpacity onPress={this.startScan.bind(this)}>
407
- <View style={style.button}><Text style={style.buttonText}>Start scan</Text></View>
408
- </TouchableOpacity>
409
- :
410
- <TouchableOpacity onPress={this.stopScan.bind(this)}>
411
- <View style={style.button}><Text style={style.buttonText}>Scanning... (click to cancel)</Text></View>
412
- </TouchableOpacity> }
413
-
414
- <TouchableOpacity onPress={this.forgetAllButtons.bind(this)}>
415
- <View style={style.button}><Text style={style.buttonText}>Forget all buttons</Text></View>
416
- </TouchableOpacity>
417
-
418
- <View style={style.buttonContainer}>
419
-
420
- <Text style={style.heading}>Button list:</Text>
421
-
422
- {this.state.buttons.length > 0 ?
423
- <FlatList
424
- data={this.state.buttons}
425
- keyExtractor={item => item.uuid}
426
- renderItem={row => {
427
-
428
- // define button
429
- const button = row.item;
430
-
431
- // eslint-disable-next-line react-native/no-inline-styles
432
- return <View style={[style.listItem, { borderColor: button.getIsReady() ? '#006e1a' : '#b00000'}]}>
433
- <FontAwesomeIcon style={style.icon} icon={this.getBatteryIcon(button.getBatteryLevelIsOk())} size={16} />
434
- <Text style={style.pressCount}>{button.getPressCount()}</Text>
435
- <Text style={style.listItemText}>{button.getName()}</Text>
436
- <View style={style.icons}>
437
- {button.getIsReady() === true ?
438
- <TouchableOpacity onPress={this.disconnectButton.bind(this, button)}><FontAwesomeIcon icon={faPause} size={16} /></TouchableOpacity>
439
- :
440
- <TouchableOpacity onPress={this.connectButton.bind(this, button)}><FontAwesomeIcon icon={faPlay} size={16} /></TouchableOpacity>
441
- }
442
- <TouchableOpacity onPress={this.forgetButton.bind(this, button)}><FontAwesomeIcon icon={faTrash} size={16} /></TouchableOpacity>
443
- <TouchableOpacity onPress={this.editButtonName.bind(this, button)}><FontAwesomeIcon icon={faEdit} size={16} /></TouchableOpacity>
444
- </View>
445
- </View>;
446
-
447
- }}
448
- /> : <Text>There are no buttons paired to this app. Click 'start scan' and hold your flic button to add a new button.</Text>}
449
-
450
- </View>
451
-
452
- </View>
453
- );
454
- }
455
- }
456
-
457
-
458
- // define stylesheet
459
- const style = StyleSheet.create({
460
-
461
- // container
462
- container: {
463
- paddingTop: 20,
464
- padding: 10,
465
- backgroundColor: '#45454d',
466
- flex: 1,
467
- },
468
-
469
- // logo
470
- logo: {
471
- width: 100,
472
- alignSelf: 'center',
473
- resizeMode: 'contain',
474
- },
475
-
476
- // button
477
- button: {
478
- padding: 10,
479
- borderRadius: 10,
480
- backgroundColor: '#ff0089',
481
- marginTop: 15,
482
- },
483
- buttonText: {
484
- color: 'white',
485
- textAlign: 'center',
486
- fontSize: 20,
487
- },
488
-
489
- // button container
490
- buttonContainer: {
491
- padding: 10,
492
- backgroundColor: 'rgba(255, 255, 255, 1)',
493
- borderRadius: 10,
494
- marginTop: 20,
495
- },
496
-
497
- // heading
498
- heading: {
499
- fontSize: 20,
500
- fontWeight: 'bold',
501
- marginBottom: 10,
502
- },
503
-
504
- // list item
505
- listItem: {
506
- padding: 20,
507
- paddingLeft: 15,
508
- paddingRight: 15,
509
- flex: 1,
510
- flexDirection: 'row',
511
- justifyContent: 'flex-start',
512
- alignItems: 'center',
513
- borderRadius: 10,
514
- marginBottom: 10,
515
- backgroundColor: '#f3f9ff',
516
- borderWidth: 2,
517
- },
518
- listItemText: {
519
- flex: 1,
520
- },
521
- pressCount: {
522
- width: 25,
523
- color: 'rgba(40, 40, 40, 0.5)',
524
- fontSize: 10,
525
- },
526
-
527
- // icons
528
- icons: {
529
- width: 70,
530
- flexDirection: 'row',
531
- justifyContent: 'space-between',
532
- alignItems: 'center',
533
- alignSelf: 'flex-end',
534
- },
535
- icon: {
536
- marginRight: 7,
537
- },
538
-
539
- });
540
-
541
-
542
- ```
38
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
543
39
 
544
- ## Collaborating
545
- We are happy to receive PRs! We have not published an NPM package before and are eager to learn!