From 2b4d752c32a01524328ff011488438a925b08c32 Mon Sep 17 00:00:00 2001 From: RedPandaTronics Date: Wed, 15 Apr 2020 00:24:26 +0200 Subject: [PATCH] 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 --- ios/RNCWebView.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ios/RNCWebView.h b/ios/RNCWebView.h index e74aab5..4e94bed 100644 --- a/ios/RNCWebView.h +++ b/ios/RNCWebView.h @@ -59,6 +59,7 @@ @property (nonatomic, assign) BOOL showsHorizontalScrollIndicator; @property (nonatomic, assign) BOOL showsVerticalScrollIndicator; @property (nonatomic, assign) BOOL directionalLockEnabled; +@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch; @property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL; + (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential;