vn-verdnaturachat/patches/expo-av+6.0.0.patch

48 lines
2.0 KiB
Diff
Raw Normal View History

diff --git a/node_modules/expo-av/android/build.gradle b/node_modules/expo-av/android/build.gradle
index 2d3568e..b093959 100644
--- a/node_modules/expo-av/android/build.gradle
+++ b/node_modules/expo-av/android/build.gradle
@@ -71,6 +71,7 @@ dependencies {
unimodule "unimodules-permissions-interface"
// Newer version introduces dependency versions conflict
// on 'com.android.support:support-annotations'
+ implementation 'androidx.annotation:annotation:1.1.0'
api 'com.google.android.exoplayer:exoplayer:2.9.2'
api 'com.google.android.exoplayer:extension-okhttp:2.9.2'
diff --git a/node_modules/expo-av/android/src/main/java/expo/modules/av/AVManager.java b/node_modules/expo-av/android/src/main/java/expo/modules/av/AVManager.java
index 048afaf..1ef9728 100644
--- a/node_modules/expo-av/android/src/main/java/expo/modules/av/AVManager.java
+++ b/node_modules/expo-av/android/src/main/java/expo/modules/av/AVManager.java
@@ -89,6 +89,7 @@ public class AVManager implements LifecycleEventListener, AudioManager.OnAudioFo
private long mAudioRecorderDurationAlreadyRecorded = 0L;
private boolean mAudioRecorderIsRecording = false;
private boolean mAudioRecorderIsPaused = false;
+ private boolean isRegistered = false;
private ModuleRegistry mModuleRegistry;
@@ -108,6 +109,7 @@ public class AVManager implements LifecycleEventListener, AudioManager.OnAudioFo
};
mContext.registerReceiver(mNoisyAudioStreamReceiver,
new IntentFilter(AudioManager.ACTION_AUDIO_BECOMING_NOISY));
+ isRegistered = true;
}
@Override
@@ -181,7 +183,14 @@ public class AVManager implements LifecycleEventListener, AudioManager.OnAudioFo
@Override
public void onHostDestroy() {
- mContext.unregisterReceiver(mNoisyAudioStreamReceiver);
+ try {
+ if (isRegistered) {
+ mContext.unregisterReceiver(mNoisyAudioStreamReceiver);
+ isRegistered = false;
+ }
+ } catch (final Exception exception) {
+ // Do nothing
+ }
for (final Integer key : mSoundMap.keySet()) {
removeSoundForKey(key);
}