Browse Source

fix(iOS): Adds missing silent hardware declaration to header file (#1319)

* Fixes Issue #1140

Fixes https://github.com/react-native-community/react-native-webview/issues/1140
Based on a solution found at: https://stackoverflow.com/questions/56460362/how-to-force-wkwebview-to-ignore-hardware-silent-switch-on-ios
I changed the code found in the linked source from Swift to Objective-C, as required by this project. WARNING: I haven't used Swift before and very limited experience with Objective-C.

- For me this seems to work, but it is not the cleanest solution in my opinion.
- It might also be possible to play generated sound (i.e. using oscillator) instead of hardcoding the silent base64 mp3 data.
- Maybe ignoring silence switch should only be done if a parameter is supplied

* fixes import path

* adds documentation for ignoreSilentHardwareSwitch

* adds ignoreSilentHardwareSwitch parameter

* reverting back to old import path

* Update Guide.md

* adds missing variable

Co-authored-by: Dominik Beste <dominik.beste@gmail.com>
RedPandaTronics 4 years ago
parent
commit
2b4d752c32
No account linked to committer's email address
1 changed files with 1 additions and 0 deletions
  1. 1
    0
      ios/RNCWebView.h

+ 1
- 0
ios/RNCWebView.h View File

@@ -59,6 +59,7 @@
59 59
 @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator;
60 60
 @property (nonatomic, assign) BOOL showsVerticalScrollIndicator;
61 61
 @property (nonatomic, assign) BOOL directionalLockEnabled;
62
+@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch;
62 63
 @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL;
63 64
 
64 65
 + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;