parent
bedd1f55f6
commit
a1d3073705
|
@ -6,6 +6,7 @@
|
|||
#import "Signal-Swift.h"
|
||||
#import <SignalMessaging/Environment.h>
|
||||
#import <SignalMessaging/OWSProfileManager.h>
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalServiceKit/OWSIdentityManager.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
@ -178,9 +179,13 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return UIApplication.sharedApplication.keyWindow;
|
||||
}
|
||||
|
||||
- (void)openSystemSettings
|
||||
- (nullable UIAlertAction *)openSystemSettingsAction
|
||||
{
|
||||
[UIApplication.sharedApplication openSystemSettings];
|
||||
return [UIAlertAction actionWithTitle:CommonStrings.openSettingsButton
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
[UIApplication.sharedApplication openSystemSettings];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)doMultiDeviceUpdateWithProfileKey:(OWSAES256Key *)profileKey
|
||||
|
|
|
@ -282,11 +282,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
style:UIAlertActionStyleCancel
|
||||
handler:nil]];
|
||||
|
||||
[alertController addAction:[UIAlertAction actionWithTitle:CommonStrings.openSettingsButton
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction *_Nonnull action) {
|
||||
[CurrentAppContext() openSystemSettings];
|
||||
}]];
|
||||
UIAlertAction *_Nullable openSystemSettingsAction = CurrentAppContext().openSystemSettingsAction;
|
||||
if (openSystemSettingsAction) {
|
||||
[alertController addAction:openSystemSettingsAction];
|
||||
}
|
||||
|
||||
[viewController presentViewController:alertController animated:YES completion:nil];
|
||||
}
|
||||
|
|
|
@ -14,12 +14,11 @@ import Foundation
|
|||
let alertMessage = NSLocalizedString("CALL_AUDIO_PERMISSION_MESSAGE", comment:"Alert message when calling and permissions for microphone are missing")
|
||||
let alertController = UIAlertController(title: alertTitle, message: alertMessage, preferredStyle: .alert)
|
||||
let dismissAction = UIAlertAction(title: CommonStrings.dismissButton, style: .cancel)
|
||||
let settingsString = CommonStrings.openSettingsButton
|
||||
let settingsAction = UIAlertAction(title: settingsString, style: .default) { _ in
|
||||
CurrentAppContext().openSystemSettings()
|
||||
}
|
||||
|
||||
alertController.addAction(dismissAction)
|
||||
alertController.addAction(settingsAction)
|
||||
if let settingsAction = CurrentAppContext().openSystemSettingsAction {
|
||||
alertController.addAction(settingsAction)
|
||||
}
|
||||
CurrentAppContext().frontmostViewController()?.present(alertController, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
|
|
|
@ -61,8 +61,8 @@ typedef void (^BackgroundTaskExpirationHandler)(void);
|
|||
// Returns the VC that should be used to present alerts, modals, etc.
|
||||
- (nullable UIViewController *)frontmostViewController;
|
||||
|
||||
// Should only be called if isMainApp is YES.
|
||||
- (void)openSystemSettings;
|
||||
// Returns nil if isMainApp is NO
|
||||
@property (nullable, nonatomic, readonly) UIAlertAction *openSystemSettingsAction;
|
||||
|
||||
// Should only be called if isMainApp is YES,
|
||||
// but should only be necessary to call if isMainApp is YES.
|
||||
|
|
|
@ -177,9 +177,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
return self.rootViewController.view;
|
||||
}
|
||||
|
||||
- (void)openSystemSettings
|
||||
- (nullable UIAlertAction *)openSystemSettingsAction
|
||||
{
|
||||
OWSFail(@"%@ called %s.", self.logTag, __PRETTY_FUNCTION__);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)doMultiDeviceUpdateWithProfileKey:(OWSAES256Key *)profileKey
|
||||
|
|
Loading…
Reference in New Issue