@abrarmehraj/permission-kit 0.1.0

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 (170) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -0
  3. package/android/build/.transforms/3c361e3bc775e7d34547424688ff1c77/results.bin +1 -0
  4. package/android/build/.transforms/3c361e3bc775e7d34547424688ff1c77/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/BuildConfig.dex +0 -0
  5. package/android/build/.transforms/3c361e3bc775e7d34547424688ff1c77/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$1.dex +0 -0
  6. package/android/build/.transforms/3c361e3bc775e7d34547424688ff1c77/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$2.dex +0 -0
  7. package/android/build/.transforms/3c361e3bc775e7d34547424688ff1c77/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/ExpoPermissionKitModule.dex +0 -0
  8. package/android/build/.transforms/3c361e3bc775e7d34547424688ff1c77/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  9. package/android/build/.transforms/61a81db1043cb114cc6c946ab145548f/results.bin +1 -0
  10. package/android/build/.transforms/61a81db1043cb114cc6c946ab145548f/transformed/classes/classes_dex/classes.dex +0 -0
  11. package/android/build/.transforms/89e4d01fa013a5f232b92431ae151ffc/results.bin +1 -0
  12. package/android/build/.transforms/89e4d01fa013a5f232b92431ae151ffc/transformed/classes/classes_dex/classes.dex +0 -0
  13. package/android/build/.transforms/9fa24db55b8bf43f3fc0f8d12a30cf44/results.bin +1 -0
  14. package/android/build/.transforms/9fa24db55b8bf43f3fc0f8d12a30cf44/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/BuildConfig.dex +0 -0
  15. package/android/build/.transforms/9fa24db55b8bf43f3fc0f8d12a30cf44/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$1.dex +0 -0
  16. package/android/build/.transforms/9fa24db55b8bf43f3fc0f8d12a30cf44/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$2.dex +0 -0
  17. package/android/build/.transforms/9fa24db55b8bf43f3fc0f8d12a30cf44/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/expo/modules/permissionkit/ExpoPermissionKitModule.dex +0 -0
  18. package/android/build/.transforms/9fa24db55b8bf43f3fc0f8d12a30cf44/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  19. package/android/build/generated/source/buildConfig/debug/expo/modules/permissionkit/BuildConfig.java +10 -0
  20. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
  21. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  22. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  23. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  24. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  25. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  26. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  27. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  28. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  29. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +2 -0
  30. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  31. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  32. package/android/build/intermediates/java_res/debug/processDebugJavaRes/out/META-INF/abrar-permission-kit_debug.kotlin_module +0 -0
  33. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/expo/modules/permissionkit/BuildConfig.class +0 -0
  34. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  35. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
  36. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
  37. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  38. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  39. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/META-INF/abrar-permission-kit_debug.kotlin_module +0 -0
  40. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/expo/modules/permissionkit/BuildConfig.class +0 -0
  41. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$1.class +0 -0
  42. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$2.class +0 -0
  43. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/expo/modules/permissionkit/ExpoPermissionKitModule.class +0 -0
  44. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  45. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.keystream.len +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.len +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab_i.len +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i.len +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i.len +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i.len +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i.len +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream +0 -0
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.keystream.len +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.len +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab_i.len +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.len +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.keystream.len +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.len +0 -0
  99. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  100. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i +0 -0
  101. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab_i.len +0 -0
  102. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +2 -0
  103. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  104. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream +0 -0
  105. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.keystream.len +0 -0
  106. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.len +0 -0
  107. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  108. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i +0 -0
  109. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab_i.len +0 -0
  110. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  111. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  112. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  113. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  114. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  115. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i.len +0 -0
  116. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  117. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  118. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  119. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  120. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  121. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  122. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i.len +0 -0
  123. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  124. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  125. package/android/build/kotlin/compileDebugKotlin/local-state/build-history.bin +0 -0
  126. package/android/build/outputs/logs/manifest-merger-debug-report.txt +14 -0
  127. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  128. package/android/build/tmp/kotlin-classes/debug/META-INF/abrar-permission-kit_debug.kotlin_module +0 -0
  129. package/android/build/tmp/kotlin-classes/debug/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$1.class +0 -0
  130. package/android/build/tmp/kotlin-classes/debug/expo/modules/permissionkit/ExpoPermissionKitModule$definition$lambda$2$$inlined$AsyncFunctionWithoutArgs$2.class +0 -0
  131. package/android/build/tmp/kotlin-classes/debug/expo/modules/permissionkit/ExpoPermissionKitModule.class +0 -0
  132. package/android/build.gradle +18 -0
  133. package/android/src/main/AndroidManifest.xml +2 -0
  134. package/android/src/main/java/expo/modules/permissionkit/ExpoPermissionKitModule.kt +49 -0
  135. package/app.plugin.js +1 -0
  136. package/build/ExpoPermissionKit.types.d.ts +1 -0
  137. package/build/ExpoPermissionKit.types.d.ts.map +1 -0
  138. package/build/ExpoPermissionKit.types.js +3 -0
  139. package/build/ExpoPermissionKit.types.js.map +1 -0
  140. package/build/ExpoPermissionKitModule.d.ts +7 -0
  141. package/build/ExpoPermissionKitModule.d.ts.map +1 -0
  142. package/build/ExpoPermissionKitModule.js +12 -0
  143. package/build/ExpoPermissionKitModule.js.map +1 -0
  144. package/build/ExpoPermissionKitModule.web.d.ts +6 -0
  145. package/build/ExpoPermissionKitModule.web.d.ts.map +1 -0
  146. package/build/ExpoPermissionKitModule.web.js +8 -0
  147. package/build/ExpoPermissionKitModule.web.js.map +1 -0
  148. package/build/PermissionKit.d.ts +15 -0
  149. package/build/PermissionKit.d.ts.map +1 -0
  150. package/build/PermissionKit.js +47 -0
  151. package/build/PermissionKit.js.map +1 -0
  152. package/build/index.d.ts +3 -0
  153. package/build/index.d.ts.map +1 -0
  154. package/build/index.js +21 -0
  155. package/build/index.js.map +1 -0
  156. package/build/types.d.ts +5 -0
  157. package/build/types.d.ts.map +1 -0
  158. package/build/types.js +3 -0
  159. package/build/types.js.map +1 -0
  160. package/expo-module.config.json +9 -0
  161. package/ios/ExpoPermissionKit.podspec +23 -0
  162. package/ios/ExpoPermissionKitModule.swift +18 -0
  163. package/package.json +46 -0
  164. package/plugin/build/index.js +25 -0
  165. package/src/ExpoPermissionKit.types.ts +1 -0
  166. package/src/ExpoPermissionKitModule.ts +15 -0
  167. package/src/ExpoPermissionKitModule.web.ts +6 -0
  168. package/src/PermissionKit.ts +50 -0
  169. package/src/index.ts +2 -0
  170. package/src/types.ts +9 -0
@@ -0,0 +1,49 @@
1
+ package expo.modules.permissionkit
2
+
3
+ import android.content.Intent
4
+ import android.net.Uri
5
+ import android.os.Build
6
+ import android.os.PowerManager
7
+ import android.provider.Settings
8
+
9
+ import expo.modules.kotlin.modules.Module
10
+ import expo.modules.kotlin.modules.ModuleDefinition
11
+
12
+ class ExpoPermissionKitModule : Module() {
13
+ override fun definition() = ModuleDefinition {
14
+ Name("ExpoPermissionKit")
15
+
16
+ AsyncFunction("isBatteryOptimizationEnabled") {
17
+ val context = appContext.reactContext
18
+ ?: throw Exception("Context unavailable")
19
+
20
+ val powerManager =
21
+ context.getSystemService(android.content.Context.POWER_SERVICE)
22
+ as PowerManager
23
+
24
+ val packageName = context.packageName
25
+
26
+ val ignoring =
27
+ powerManager.isIgnoringBatteryOptimizations(packageName)
28
+
29
+ return@AsyncFunction ignoring
30
+ }
31
+
32
+ AsyncFunction("openBatteryOptimizationSettings") {
33
+ val context = appContext.reactContext
34
+ ?: throw Exception("Context unavailable")
35
+
36
+ val packageName = context.packageName
37
+
38
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
39
+ val intent = Intent(
40
+ Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS,
41
+ Uri.parse("package:$packageName")
42
+ )
43
+
44
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
45
+ context.startActivity(intent)
46
+ }
47
+ }
48
+ }
49
+ }
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/build');
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ExpoPermissionKit.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoPermissionKit.types.d.ts","sourceRoot":"","sources":["../src/ExpoPermissionKit.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // Define your exported module types here.
3
+ //# sourceMappingURL=ExpoPermissionKit.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoPermissionKit.types.js","sourceRoot":"","sources":["../src/ExpoPermissionKit.types.ts"],"names":[],"mappings":";AAAA,0CAA0C"}
@@ -0,0 +1,7 @@
1
+ export interface PermissionKitNativeModule {
2
+ isBatteryOptimizationEnabled(): Promise<boolean>;
3
+ openBatteryOptimizationSettings(): Promise<void>;
4
+ }
5
+ declare let _nativeModule: PermissionKitNativeModule | null;
6
+ export default _nativeModule;
7
+ //# sourceMappingURL=ExpoPermissionKitModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoPermissionKitModule.d.ts","sourceRoot":"","sources":["../src/ExpoPermissionKitModule.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,yBAAyB;IACxC,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED,QAAA,IAAI,aAAa,EAAE,yBAAyB,GAAG,IAAW,CAAC;AAO3D,eAAe,aAAa,CAAC"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const expo_1 = require("expo");
4
+ let _nativeModule = null;
5
+ try {
6
+ _nativeModule = (0, expo_1.requireNativeModule)('ExpoPermissionKit');
7
+ }
8
+ catch (_a) {
9
+ // Native module not available on this platform (e.g., iOS simulator, web)
10
+ }
11
+ exports.default = _nativeModule;
12
+ //# sourceMappingURL=ExpoPermissionKitModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoPermissionKitModule.js","sourceRoot":"","sources":["../src/ExpoPermissionKitModule.ts"],"names":[],"mappings":";;AAAA,+BAA2C;AAO3C,IAAI,aAAa,GAAqC,IAAI,CAAC;AAC3D,IAAI,CAAC;IACH,aAAa,GAAG,IAAA,0BAAmB,EAA4B,mBAAmB,CAAC,CAAC;AACtF,CAAC;AAAC,WAAM,CAAC;IACP,0EAA0E;AAC5E,CAAC;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { NativeModule } from 'expo';
2
+ declare class ExpoPermissionKitModule extends NativeModule<{}> {
3
+ }
4
+ declare const _default: typeof ExpoPermissionKitModule;
5
+ export default _default;
6
+ //# sourceMappingURL=ExpoPermissionKitModule.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoPermissionKitModule.web.d.ts","sourceRoot":"","sources":["../src/ExpoPermissionKitModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,YAAY,EAAE,MAAM,MAAM,CAAC;AAGvD,cAAM,uBAAwB,SAAQ,YAAY,CAAC,EAAE,CAAC;CAAG;;AAEzD,wBAAqF"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const expo_1 = require("expo");
4
+ // ExpoPermissionKitModule is not available on the web platform.
5
+ class ExpoPermissionKitModule extends expo_1.NativeModule {
6
+ }
7
+ exports.default = (0, expo_1.registerWebModule)(ExpoPermissionKitModule, 'ExpoPermissionKitModule');
8
+ //# sourceMappingURL=ExpoPermissionKitModule.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoPermissionKitModule.web.js","sourceRoot":"","sources":["../src/ExpoPermissionKitModule.web.ts"],"names":[],"mappings":";;AAAA,+BAAuD;AAEvD,gEAAgE;AAChE,MAAM,uBAAwB,SAAQ,mBAAgB;CAAG;AAEzD,kBAAe,IAAA,wBAAiB,EAAC,uBAAuB,EAAE,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare function checkBatteryOptimization(): Promise<{
2
+ status: "unavailable";
3
+ } | {
4
+ status: "granted" | "denied";
5
+ }>;
6
+ export declare function batteryOptimization(): Promise<{
7
+ status: "unavailable";
8
+ } | {
9
+ status: "granted" | "denied";
10
+ }>;
11
+ export declare const PermissionKit: {
12
+ batteryOptimization: typeof batteryOptimization;
13
+ checkBatteryOptimization: typeof checkBatteryOptimization;
14
+ };
15
+ //# sourceMappingURL=PermissionKit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermissionKit.d.ts","sourceRoot":"","sources":["../src/PermissionKit.ts"],"names":[],"mappings":"AAGA,wBAAsB,wBAAwB;;;YAME,SAAS,GAAG,QAAQ;GAEnE;AAED,wBAAsB,mBAAmB;;;YAJO,SAAS,GAAG,QAAQ;GAoBnE;AAiBD,eAAO,MAAM,aAAa;;;CAGzB,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PermissionKit = void 0;
7
+ exports.checkBatteryOptimization = checkBatteryOptimization;
8
+ exports.batteryOptimization = batteryOptimization;
9
+ const react_native_1 = require("react-native");
10
+ const ExpoPermissionKitModule_1 = __importDefault(require("./ExpoPermissionKitModule"));
11
+ async function checkBatteryOptimization() {
12
+ if (react_native_1.Platform.OS === 'ios' || !ExpoPermissionKitModule_1.default) {
13
+ return { status: 'unavailable' };
14
+ }
15
+ const enabled = await ExpoPermissionKitModule_1.default.isBatteryOptimizationEnabled();
16
+ return {
17
+ status: (enabled ? 'granted' : 'denied'),
18
+ };
19
+ }
20
+ async function batteryOptimization() {
21
+ if (react_native_1.Platform.OS === 'ios' || !ExpoPermissionKitModule_1.default) {
22
+ return { status: 'unavailable' };
23
+ }
24
+ const check = await checkBatteryOptimization();
25
+ if (check.status === 'granted') {
26
+ return check;
27
+ }
28
+ await ExpoPermissionKitModule_1.default.openBatteryOptimizationSettings();
29
+ await waitForResume();
30
+ return await checkBatteryOptimization();
31
+ }
32
+ function waitForResume() {
33
+ return new Promise(resolve => {
34
+ const sub = react_native_1.AppState.addEventListener('change', (state) => {
35
+ if (state === 'active') {
36
+ sub.remove();
37
+ // Add a short delay to allow native settings to propagate
38
+ setTimeout(resolve, 500);
39
+ }
40
+ });
41
+ });
42
+ }
43
+ exports.PermissionKit = {
44
+ batteryOptimization,
45
+ checkBatteryOptimization,
46
+ };
47
+ //# sourceMappingURL=PermissionKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PermissionKit.js","sourceRoot":"","sources":["../src/PermissionKit.ts"],"names":[],"mappings":";;;;;;AAGA,4DAQC;AAED,kDAgBC;AA7BD,+CAAkD;AAClD,wFAAqD;AAE9C,KAAK,UAAU,wBAAwB;IAC5C,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,iCAAY,EAAE,CAAC;QAC3C,OAAO,EAAE,MAAM,EAAE,aAAsB,EAAE,CAAC;IAC5C,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,iCAAY,CAAC,4BAA4B,EAAE,CAAC;IAClE,OAAO;QACL,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAyB;KACjE,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,mBAAmB;IACvC,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,iCAAY,EAAE,CAAC;QAC3C,OAAO,EAAE,MAAM,EAAE,aAAsB,EAAE,CAAC;IAC5C,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,wBAAwB,EAAE,CAAC;IAE/C,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,iCAAY,CAAC,+BAA+B,EAAE,CAAC;IAErD,MAAM,aAAa,EAAE,CAAC;IAEtB,OAAO,MAAM,wBAAwB,EAAE,CAAC;AAC1C,CAAC;AAED,SAAS,aAAa;IACpB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,MAAM,GAAG,GAAG,uBAAQ,CAAC,gBAAgB,CACnC,QAAQ,EACR,CAAC,KAAK,EAAE,EAAE;YACR,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;gBACvB,GAAG,CAAC,MAAM,EAAE,CAAC;gBACb,0DAA0D;gBAC1D,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAEY,QAAA,aAAa,GAAG;IAC3B,mBAAmB;IACnB,wBAAwB;CACzB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './types';
2
+ export { PermissionKit } from './PermissionKit';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
package/build/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.PermissionKit = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ var PermissionKit_1 = require("./PermissionKit");
20
+ Object.defineProperty(exports, "PermissionKit", { enumerable: true, get: function () { return PermissionKit_1.PermissionKit; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA"}
@@ -0,0 +1,5 @@
1
+ export type PermissionStatus = 'granted' | 'denied' | 'blocked' | 'unavailable';
2
+ export interface PermissionResult {
3
+ status: PermissionStatus;
4
+ }
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,QAAQ,GACR,SAAS,GACT,aAAa,CAAC;AAElB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,gBAAgB,CAAC;CAC1B"}
package/build/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,9 @@
1
+ {
2
+ "platforms": ["apple", "android"],
3
+ "apple": {
4
+ "modules": ["ExpoPermissionKitModule"]
5
+ },
6
+ "android": {
7
+ "modules": ["expo.modules.permissionkit.ExpoPermissionKitModule"]
8
+ }
9
+ }
@@ -0,0 +1,23 @@
1
+ Pod::Spec.new do |s|
2
+ s.name = 'ExpoPermissionKit'
3
+ s.version = '0.1.0'
4
+ s.summary = 'A developer-friendly permissions library for Expo and React Native.'
5
+ s.description = 'One call handles the full workflow — check, request, wait for app resume, return final status.'
6
+ s.author = { 'Abrar Mehraj' => '' }
7
+ s.homepage = 'https://github.com/AbrarMehraj/plugins-playground'
8
+ s.platforms = {
9
+ :ios => '16.4',
10
+ :tvos => '16.4'
11
+ }
12
+ s.source = { git: 'https://github.com/AbrarMehraj/plugins-playground.git', tag: s.version.to_s }
13
+ s.static_framework = true
14
+
15
+ s.dependency 'ExpoModulesCore'
16
+
17
+ # Swift/Objective-C compatibility
18
+ s.pod_target_xcconfig = {
19
+ 'DEFINES_MODULE' => 'YES',
20
+ }
21
+
22
+ s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
23
+ end
@@ -0,0 +1,18 @@
1
+ import ExpoModulesCore
2
+
3
+ public class ExpoPermissionKitModule: Module {
4
+ public func definition() -> ModuleDefinition {
5
+ Name("ExpoPermissionKit")
6
+
7
+ // iOS does not have Android-style battery optimization.
8
+ // Low Power Mode is read-only and cannot be requested programmatically.
9
+ // We return false to let the JS layer produce { status: 'unavailable' }.
10
+ AsyncFunction("isBatteryOptimizationEnabled") { () -> Bool in
11
+ return false
12
+ }
13
+
14
+ AsyncFunction("openBatteryOptimizationSettings") { () -> Void in
15
+ // No-op on iOS — there is no equivalent settings screen.
16
+ }
17
+ }
18
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@abrarmehraj/permission-kit",
3
+ "version": "0.1.0",
4
+ "description": "A developer-friendly permissions library for Expo and React Native. One call handles the full workflow — check, request, wait for app resume, return final status.",
5
+ "main": "build/index.js",
6
+ "module": "build/index.js",
7
+ "types": "build/index.d.ts",
8
+ "files": [
9
+ "build",
10
+ "plugin/build",
11
+ "app.plugin.js",
12
+ "src",
13
+ "android",
14
+ "ios",
15
+ "expo-module.config.json",
16
+ "LICENSE",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "../../node_modules/.bin/tsc -p tsconfig.json && ../../node_modules/.bin/tsc -p plugin/tsconfig.json",
21
+ "clean": "rm -rf build plugin/build"
22
+ },
23
+ "keywords": [
24
+ "expo",
25
+ "react-native",
26
+ "permissions",
27
+ "android",
28
+ "battery",
29
+ "battery-optimization",
30
+ "expo-module"
31
+ ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/AbrarMehraj/plugins-playground"
35
+ },
36
+ "license": "MIT",
37
+ "peerDependencies": {
38
+ "expo": ">=50.0.0",
39
+ "react": "*",
40
+ "react-native": "*"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "~6.0.3",
44
+ "@types/react": "~19.2.2"
45
+ }
46
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const config_plugins_1 = require("expo/config-plugins");
4
+ const withPermissionKit = (config, props) => {
5
+ const permissions = (props === null || props === void 0 ? void 0 : props.permissions) || [];
6
+ if (permissions.includes('batteryOptimization')) {
7
+ config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
8
+ const androidManifest = config.modResults;
9
+ if (!androidManifest.manifest['uses-permission']) {
10
+ androidManifest.manifest['uses-permission'] = [];
11
+ }
12
+ const existingPermissions = androidManifest.manifest['uses-permission'].map((p) => p.$['android:name']);
13
+ if (!existingPermissions.includes('android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS')) {
14
+ androidManifest.manifest['uses-permission'].push({
15
+ $: {
16
+ 'android:name': 'android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS',
17
+ },
18
+ });
19
+ }
20
+ return config;
21
+ });
22
+ }
23
+ return config;
24
+ };
25
+ exports.default = withPermissionKit;
@@ -0,0 +1 @@
1
+ // Define your exported module types here.
@@ -0,0 +1,15 @@
1
+ import { requireNativeModule } from 'expo';
2
+
3
+ export interface PermissionKitNativeModule {
4
+ isBatteryOptimizationEnabled(): Promise<boolean>;
5
+ openBatteryOptimizationSettings(): Promise<void>;
6
+ }
7
+
8
+ let _nativeModule: PermissionKitNativeModule | null = null;
9
+ try {
10
+ _nativeModule = requireNativeModule<PermissionKitNativeModule>('ExpoPermissionKit');
11
+ } catch {
12
+ // Native module not available on this platform (e.g., iOS simulator, web)
13
+ }
14
+
15
+ export default _nativeModule;
@@ -0,0 +1,6 @@
1
+ import { registerWebModule, NativeModule } from 'expo';
2
+
3
+ // ExpoPermissionKitModule is not available on the web platform.
4
+ class ExpoPermissionKitModule extends NativeModule<{}> {}
5
+
6
+ export default registerWebModule(ExpoPermissionKitModule, 'ExpoPermissionKitModule');
@@ -0,0 +1,50 @@
1
+ import { AppState, Platform } from 'react-native';
2
+ import NativeModule from './ExpoPermissionKitModule';
3
+
4
+ export async function checkBatteryOptimization() {
5
+ if (Platform.OS === 'ios' || !NativeModule) {
6
+ return { status: 'unavailable' as const };
7
+ }
8
+ const enabled = await NativeModule.isBatteryOptimizationEnabled();
9
+ return {
10
+ status: (enabled ? 'granted' : 'denied') as 'granted' | 'denied',
11
+ };
12
+ }
13
+
14
+ export async function batteryOptimization() {
15
+ if (Platform.OS === 'ios' || !NativeModule) {
16
+ return { status: 'unavailable' as const };
17
+ }
18
+
19
+ const check = await checkBatteryOptimization();
20
+
21
+ if (check.status === 'granted') {
22
+ return check;
23
+ }
24
+
25
+ await NativeModule.openBatteryOptimizationSettings();
26
+
27
+ await waitForResume();
28
+
29
+ return await checkBatteryOptimization();
30
+ }
31
+
32
+ function waitForResume(): Promise<void> {
33
+ return new Promise(resolve => {
34
+ const sub = AppState.addEventListener(
35
+ 'change',
36
+ (state) => {
37
+ if (state === 'active') {
38
+ sub.remove();
39
+ // Add a short delay to allow native settings to propagate
40
+ setTimeout(resolve, 500);
41
+ }
42
+ }
43
+ );
44
+ });
45
+ }
46
+
47
+ export const PermissionKit = {
48
+ batteryOptimization,
49
+ checkBatteryOptimization,
50
+ };
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export { PermissionKit } from './PermissionKit';
package/src/types.ts ADDED
@@ -0,0 +1,9 @@
1
+ export type PermissionStatus =
2
+ | 'granted'
3
+ | 'denied'
4
+ | 'blocked'
5
+ | 'unavailable';
6
+
7
+ export interface PermissionResult {
8
+ status: PermissionStatus;
9
+ }