iOS web browser with a focus on security and privacy
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add a setting to adjust mute switch behavior

The previous behavior was to honor the mute switch to mute audio
played through web pages and video, so that a web page could never
play audio through the speakers unless you wanted it to by adjusting
the mute switch.

Since this behavior might be confusing to people (like the person
that left a 1-star review because the app didn't play sound), add an
option to disable this behavior and always play audio regardless of
the mute switch.

+27 -3
+1
Endless/AppDelegate.h
··· 32 32 @property (strong, atomic) NSURL *urlToOpenAtLaunch; 33 33 34 34 - (BOOL)areTesting; 35 + - (void)adjustMuteSwitchBehavior; 35 36 36 37 @end 37 38
+14 -3
Endless/AppDelegate.m
··· 57 57 self.window.rootViewController = [[WebViewController alloc] init]; 58 58 self.window.rootViewController.restorationIdentifier = @"WebViewController"; 59 59 60 - /* setting AVAudioSessionCategoryAmbient will prevent audio from UIWebView from pausing already-playing audio from other apps */ 61 - [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil]; 62 - [[AVAudioSession sharedInstance] setActive:NO error:nil]; 60 + [self adjustMuteSwitchBehavior]; 63 61 64 62 return YES; 65 63 } ··· 386 384 [[self cookieJar] clearAllNonWhitelistedData]; 387 385 } else { 388 386 NSLog(@"[AppDelegate] need to handle action %@", [shortcutItem type]); 387 + } 388 + } 389 + 390 + - (void)adjustMuteSwitchBehavior 391 + { 392 + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 393 + 394 + if ([userDefaults boolForKey:@"mute_with_switch"]) { 395 + /* setting AVAudioSessionCategoryAmbient will prevent audio from UIWebView from pausing already-playing audio from other apps */ 396 + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil]; 397 + [[AVAudioSession sharedInstance] setActive:NO error:nil]; 398 + } else { 399 + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; 389 400 } 390 401 } 391 402
+10
Endless/InAppSettings.bundle/Root.inApp.plist
··· 44 44 </dict> 45 45 <dict> 46 46 <key>Title</key> 47 + <string>Mute audio with mute switch</string> 48 + <key>Key</key> 49 + <string>mute_with_switch</string> 50 + <key>Type</key> 51 + <string>PSToggleSwitchSpecifier</string> 52 + <key>DefaultValue</key> 53 + <true/> 54 + </dict> 55 + <dict> 56 + <key>Title</key> 47 57 <string>Custom home page</string> 48 58 <key>Key</key> 49 59 <string>homepage</string>
+2
Endless/WebViewController.m
··· 1073 1073 } else { 1074 1074 [[UIApplication sharedApplication] setAlternateIconName:nil completionHandler:nil]; 1075 1075 } 1076 + } else if ([prop isEqualToString:@"mute_with_switch"]) { 1077 + [appDelegate adjustMuteSwitchBehavior]; 1076 1078 } 1077 1079 } 1078 1080