@capgo/capacitor-audio-recorder 8.0.6 → 8.0.7

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.
@@ -24,7 +24,7 @@ import java.util.Locale;
24
24
  )
25
25
  public class CapacitorAudioRecorderPlugin extends com.getcapacitor.Plugin {
26
26
 
27
- private final String pluginVersion = "8.0.6";
27
+ private final String pluginVersion = "8.0.7";
28
28
 
29
29
  private enum RecordingStatus {
30
30
  INACTIVE,
@@ -165,7 +165,8 @@ public class CapacitorAudioRecorderPlugin extends com.getcapacitor.Plugin {
165
165
 
166
166
  @PluginMethod
167
167
  public void requestPermissions(PluginCall call) {
168
- if (getPermissionState("microphone") == PermissionState.GRANTED) {
168
+ PermissionState state = getPermissionState("microphone");
169
+ if (state != null && state == PermissionState.GRANTED) {
169
170
  JSObject result = new JSObject();
170
171
  result.put("recordAudio", "granted");
171
172
  call.resolve(result);
@@ -195,7 +196,7 @@ public class CapacitorAudioRecorderPlugin extends com.getcapacitor.Plugin {
195
196
 
196
197
  private boolean ensurePermission(PluginCall call) {
197
198
  PermissionState state = getPermissionState("microphone");
198
- if (state == PermissionState.GRANTED) {
199
+ if (state != null && state == PermissionState.GRANTED) {
199
200
  return true;
200
201
  }
201
202
  requestPermissionForAlias("microphone", call, "microphonePermissionStartCallback");
@@ -204,7 +205,8 @@ public class CapacitorAudioRecorderPlugin extends com.getcapacitor.Plugin {
204
205
 
205
206
  @PermissionCallback
206
207
  public void microphonePermissionStartCallback(PluginCall call) {
207
- if (getPermissionState("microphone") != PermissionState.GRANTED) {
208
+ PermissionState state = getPermissionState("microphone");
209
+ if (state == null || state != PermissionState.GRANTED) {
208
210
  call.reject("Microphone permission not granted.");
209
211
  return;
210
212
  }
@@ -262,6 +264,9 @@ public class CapacitorAudioRecorderPlugin extends com.getcapacitor.Plugin {
262
264
  }
263
265
 
264
266
  private String toPermissionString(PermissionState state) {
267
+ if (state == null) {
268
+ return "prompt";
269
+ }
265
270
  switch (state) {
266
271
  case GRANTED:
267
272
  return "granted";
@@ -4,7 +4,7 @@ import Foundation
4
4
 
5
5
  @objc(CapacitorAudioRecorderPlugin)
6
6
  public class CapacitorAudioRecorderPlugin: CAPPlugin, CAPBridgedPlugin, AVAudioRecorderDelegate {
7
- private let pluginVersion: String = "8.0.6"
7
+ private let pluginVersion: String = "8.0.7"
8
8
  public let identifier = "CapacitorAudioRecorderPlugin"
9
9
  public let jsName = "CapacitorAudioRecorder"
10
10
  public let pluginMethods: [CAPPluginMethod] = [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-audio-recorder",
3
- "version": "8.0.6",
3
+ "version": "8.0.7",
4
4
  "description": "Record audio on iOS, Android, and Web with Capacitor",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",