On iOS11 doc picker requires system appearance.

Otherwise nav items are illegible.

// FREEBIE
This commit is contained in:
Michael Kirk 2017-09-25 21:51:41 -04:00
parent b6c9a2a67f
commit 0cd56d4bcc
2 changed files with 13 additions and 4 deletions

View File

@ -737,7 +737,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
[super viewWillAppear:animated];
// In case we're dismissing a CNContactViewController which requires default system appearance
// In case we're dismissing a CNContactViewController, or DocumentPicker which requires default system appearance
[UIUtil applySignalAppearence];
[self addVisibleListeners];
@ -3199,7 +3199,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
#pragma mark - Attachment Picking: Documents
- (void)showAttachmentDocumentPicker
- (void)showAttachmentDocumentPickerMenu
{
NSString *allItems = (__bridge NSString *)kUTTypeItem;
NSArray<NSString *> *documentTypes = @[ allItems ];
@ -3209,6 +3209,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
UIDocumentMenuViewController *menuController =
[[UIDocumentMenuViewController alloc] initWithDocumentTypes:documentTypes inMode:pickerMode];
menuController.delegate = self;
[self presentViewController:menuController animated:YES completion:nil];
}
@ -3257,6 +3258,10 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
didPickDocumentPicker:(UIDocumentPickerViewController *)documentPicker
{
documentPicker.delegate = self;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
// post iOS11, document picker has no blue header.
[UIUtil applyDefaultSystemAppearence];
}
[self presentViewController:documentPicker animated:YES completion:nil];
}
@ -3266,6 +3271,11 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
{
DDLogDebug(@"%@ Picked document at url: %@", self.tag, url);
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(11, 0)) {
// post iOS11, document picker has no blue header.
[UIUtil applySignalAppearence];
}
NSString *type;
NSError *typeError;
[url getResourceValue:&type forKey:NSURLTypeIdentifierKey error:&typeError];
@ -4086,7 +4096,7 @@ typedef NS_ENUM(NSInteger, MessagesRangeSizeMode) {
@"action sheet button title when choosing attachment type")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *_Nonnull action) {
[self showAttachmentDocumentPicker];
[self showAttachmentDocumentPickerMenu];
}];
UIImage *chooseDocumentImage = [UIImage imageNamed:@"actionsheet_document_black"];
OWSAssert(chooseDocumentImage);

View File

@ -80,7 +80,6 @@ NS_ASSUME_NONNULL_BEGIN
} else if ([phoneNumberField.label isEqualToString:CNLabelPhoneNumberiPhone]) {
phoneNumberNameMap[phoneNumber.stringValue]
= NSLocalizedString(@"PHONE_NUMBER_TYPE_IPHONE", @"Label for 'IPhone' phone numbers.");
;
} else if ([phoneNumberField.label isEqualToString:CNLabelPhoneNumberMobile]) {
phoneNumberNameMap[phoneNumber.stringValue]
= NSLocalizedString(@"PHONE_NUMBER_TYPE_MOBILE", @"Label for 'Mobile' phone numbers.");