Fix QA issues in theme.

pull/1/head
Matthew Chen 6 years ago
parent 22dda476bb
commit a76d488e8b

@ -55,6 +55,12 @@
3421981C21061D2E00C57195 /* ByteParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3421981B21061D2E00C57195 /* ByteParserTest.swift */; };
34277A5E20751BDC006049F2 /* OWSQuotedMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34277A5C20751BDC006049F2 /* OWSQuotedMessageView.m */; };
3427C64320F500E000EEC730 /* OWSMessageTimerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3427C64220F500DF00EEC730 /* OWSMessageTimerView.m */; };
342950822124C9750000B063 /* OWSTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 3429507E2124C9740000B063 /* OWSTextField.m */; };
342950832124C9750000B063 /* OWSTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3429507F2124C9740000B063 /* OWSTextView.m */; };
342950842124C9750000B063 /* OWSTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 342950802124C9740000B063 /* OWSTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
342950852124C9750000B063 /* OWSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 342950812124C9750000B063 /* OWSTextField.h */; settings = {ATTRIBUTES = (Public, ); }; };
342950882124CB0A0000B063 /* OWSSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 342950862124CB0A0000B063 /* OWSSearchBar.m */; };
342950892124CB0A0000B063 /* OWSSearchBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 342950872124CB0A0000B063 /* OWSSearchBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430FE171F7751D4000EC51B /* GiphyAPI.swift */; };
34330A5A1E7875FB00DF2FB9 /* fontawesome-webfont.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */; };
34330A5C1E787A9800DF2FB9 /* dripicons-v2.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */; };
@ -670,6 +676,12 @@
34277A5D20751BDC006049F2 /* OWSQuotedMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSQuotedMessageView.h; sourceTree = "<group>"; };
3427C64120F500DE00EEC730 /* OWSMessageTimerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMessageTimerView.h; sourceTree = "<group>"; };
3427C64220F500DF00EEC730 /* OWSMessageTimerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSMessageTimerView.m; sourceTree = "<group>"; };
3429507E2124C9740000B063 /* OWSTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSTextField.m; sourceTree = "<group>"; };
3429507F2124C9740000B063 /* OWSTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSTextView.m; sourceTree = "<group>"; };
342950802124C9740000B063 /* OWSTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSTextView.h; sourceTree = "<group>"; };
342950812124C9750000B063 /* OWSTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSTextField.h; sourceTree = "<group>"; };
342950862124CB0A0000B063 /* OWSSearchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSSearchBar.m; sourceTree = "<group>"; };
342950872124CB0A0000B063 /* OWSSearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSSearchBar.h; sourceTree = "<group>"; };
3430FE171F7751D4000EC51B /* GiphyAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GiphyAPI.swift; sourceTree = "<group>"; };
34330A591E7875FB00DF2FB9 /* fontawesome-webfont.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "fontawesome-webfont.ttf"; sourceTree = "<group>"; };
34330A5B1E787A9800DF2FB9 /* dripicons-v2.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "dripicons-v2.ttf"; sourceTree = "<group>"; };
@ -1698,6 +1710,12 @@
34AC0A09211B39E900997B47 /* OWSFlatButton.swift */,
34AC09FE211B39E700997B47 /* OWSLayerView.swift */,
34AC0A03211B39E800997B47 /* OWSNavigationBar.swift */,
342950872124CB0A0000B063 /* OWSSearchBar.h */,
342950862124CB0A0000B063 /* OWSSearchBar.m */,
342950812124C9750000B063 /* OWSTextField.h */,
3429507E2124C9740000B063 /* OWSTextField.m */,
342950802124C9740000B063 /* OWSTextView.h */,
3429507F2124C9740000B063 /* OWSTextView.m */,
34AC0A05211B39E900997B47 /* TappableStackView.swift */,
34AC09FD211B39E700997B47 /* TappableView.swift */,
34AC0A0D211B39EA00997B47 /* ThreadViewHelper.h */,
@ -2520,6 +2538,7 @@
34AC09F1211B39B100997B47 /* LockInteractionController.h in Headers */,
346129B41FD1F7E800532771 /* OWSProfileManager.h in Headers */,
3421981521061A0700C57195 /* UIColor+JSQMessages.h in Headers */,
342950892124CB0A0000B063 /* OWSSearchBar.h in Headers */,
346129FA1FD5F31400532771 /* OWS100RemoveTSRecipientsMigration.h in Headers */,
346129E21FD5C0BE00532771 /* VersionMigrations.h in Headers */,
34AC09E8211B39B100997B47 /* NewNonContactConversationViewController.h in Headers */,
@ -2542,12 +2561,14 @@
451F8A4A1FD715D9005CB9DA /* OWSContactAvatarBuilder.h in Headers */,
34480B5B1FD0A7E300BC14EF /* SignalMessaging-Prefix.pch in Headers */,
45194F921FD7215600333B2C /* OWSContactOffersInteraction.h in Headers */,
342950842124C9750000B063 /* OWSTextView.h in Headers */,
3478506A1FD9B78A007B8332 /* AppSetup.h in Headers */,
346129A51FD1F09100532771 /* OWSContactsManager.h in Headers */,
34480B681FD0AA9400BC14EF /* UIFont+OWS.h in Headers */,
45194F941FD7216000333B2C /* TSUnreadIndicatorInteraction.h in Headers */,
34AC09F5211B39B100997B47 /* SharingThreadPickerViewController.h in Headers */,
34AC09E0211B39B100997B47 /* SelectRecipientViewController.h in Headers */,
342950852124C9750000B063 /* OWSTextField.h in Headers */,
45194F901FD7200000333B2C /* ThreadUtil.h in Headers */,
346129CC1FD2072E00532771 /* NSAttributedString+OWS.h in Headers */,
346129FD1FD5F31400532771 /* OWS102MoveLoggingPreferenceToUserDefaults.h in Headers */,
@ -3159,8 +3180,11 @@
34074F61203D0CBE004596AE /* OWSSounds.m in Sources */,
346129B51FD1F7E800532771 /* OWSProfileManager.m in Sources */,
346129701FD1D74C00532771 /* Release.m in Sources */,
342950832124C9750000B063 /* OWSTextView.m in Sources */,
3421981321061A0700C57195 /* JSQMessagesAvatarImageFactory.m in Sources */,
452EC6E1205FF5DC000E787C /* Bench.swift in Sources */,
342950882124CB0A0000B063 /* OWSSearchBar.m in Sources */,
342950822124C9750000B063 /* OWSTextField.m in Sources */,
34AC0A13211B39EA00997B47 /* DisappearingTimerConfigurationView.swift in Sources */,
3478506C1FD9B78A007B8332 /* NoopNotificationsManager.swift in Sources */,
34480B621FD0A98800BC14EF /* UIColor+OWS.m in Sources */,

@ -102,9 +102,8 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
tableView.delegate = self
tableView.dataSource = self
let searchBar = UISearchBar()
let searchBar = OWSSearchBar()
self.searchBar = searchBar
searchBar.searchBarStyle = .minimal
searchBar.delegate = self
searchBar.sizeToFit()
@ -117,10 +116,6 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
self.view.backgroundColor = Theme.backgroundColor
self.tableView.backgroundColor = Theme.backgroundColor
self.searchBar.backgroundColor = Theme.searchBarBackgroundColor
self.searchBar.barStyle = Theme.barStyle
self.searchBar.searchBarStyle = Theme.searchBarStyle
self.searchBar.barTintColor = Theme.backgroundColor
searchBar.placeholder = NSLocalizedString("INVITE_FRIENDS_PICKER_SEARCHBAR_PLACEHOLDER", comment: "Search")
// Auto size cells for dynamic type

@ -2,9 +2,11 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <SignalMessaging/OWSTextView.h>
NS_ASSUME_NONNULL_BEGIN
@interface OWSMessageTextView : UITextView
@interface OWSMessageTextView : OWSTextView
@property (nonatomic) BOOL shouldIgnoreEvents;

@ -2,6 +2,8 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <SignalMessaging/OWSTextView.h>
NS_ASSUME_NONNULL_BEGIN
@class SignalAttachment;
@ -24,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark -
@interface ConversationInputTextView : UITextView
@interface ConversationInputTextView : OWSTextView
@property (weak, nonatomic) id<ConversationInputTextViewDelegate> inputTextViewDelegate;

@ -63,7 +63,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
self.thread = thread
self.messageSender = messageSender
self.searchBar = UISearchBar()
self.searchBar = OWSSearchBar()
self.layout = GifPickerLayout()
self.collectionView = UICollectionView(frame: CGRect.zero, collectionViewLayout: self.layout)
@ -157,14 +157,9 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect
self.automaticallyAdjustsScrollViewInsets = false
// Search
searchBar.searchBarStyle = .minimal
searchBar.delegate = self
searchBar.placeholder = NSLocalizedString("GIF_VIEW_SEARCH_PLACEHOLDER_TEXT",
comment: "Placeholder text for the search field in GIF view")
searchBar.backgroundColor = Theme.searchBarBackgroundColor
searchBar.barStyle = Theme.barStyle
searchBar.searchBarStyle = Theme.searchBarStyle
searchBar.barTintColor = Theme.backgroundColor
self.view.addSubview(searchBar)
searchBar.autoPinWidthToSuperview()

@ -257,10 +257,6 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
self.view.backgroundColor = Theme.backgroundColor;
self.tableView.backgroundColor = Theme.backgroundColor;
self.searchBar.backgroundColor = Theme.searchBarBackgroundColor;
self.searchBar.barTintColor = Theme.backgroundColor;
self.searchBar.barStyle = Theme.barStyle;
self.searchBar.searchBarStyle = Theme.searchBarStyle;
}
#pragma mark - View Life Cycle
@ -401,7 +397,7 @@ NSString *const kArchivedConversationsReuseIdentifier = @"kArchivedConversations
// Search
UISearchBar *searchBar = [UISearchBar new];
UISearchBar *searchBar = [OWSSearchBar new];
_searchBar = searchBar;
searchBar.placeholder = NSLocalizedString(@"HOME_VIEW_CONVERSATION_SEARCHBAR_PLACEHOLDER",
@"Placeholder text for search bar which filters conversations.");

@ -60,7 +60,7 @@ public class LongTextViewController: OWSViewController {
private func createViews() {
view.backgroundColor = Theme.backgroundColor
let messageTextView = UITextView()
let messageTextView = OWSTextView()
self.messageTextView = messageTextView
messageTextView.font = UIFont.ows_dynamicTypeBody
messageTextView.backgroundColor = Theme.backgroundColor

@ -96,15 +96,10 @@ NS_ASSUME_NONNULL_BEGIN
self.navigationItem.rightBarButtonItem = newGroupButton;
// Search
UISearchBar *searchBar = [UISearchBar new];
UISearchBar *searchBar = [OWSSearchBar new];
_searchBar = searchBar;
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = Theme.searchBarBackgroundColor;
searchBar.barStyle = Theme.barStyle;
searchBar.searchBarStyle = Theme.searchBarStyle;
searchBar.barTintColor = Theme.backgroundColor;
[searchBar sizeToFit];
_tableViewController = [OWSTableViewController new];

@ -155,7 +155,7 @@ const NSUInteger kNewGroupViewControllerAvatarWidth = 68;
[avatarView autoSetDimension:ALDimensionHeight toSize:kNewGroupViewControllerAvatarWidth];
[self updateAvatarView];
UITextField *groupNameTextField = [UITextField new];
UITextField *groupNameTextField = [OWSTextField new];
_groupNameTextField = groupNameTextField;
groupNameTextField.textColor = Theme.primaryColor;
groupNameTextField.font = [UIFont ows_dynamicTypeTitle2Font];

@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)createPinTextfield
{
self.pinTextfield = [UITextField new];
self.pinTextfield = [OWSTextField new];
self.pinTextfield.textColor = [Theme primaryColor];
self.pinTextfield.font = [UIFont ows_mediumFontWithSize:ScaleFromIPhone5To7Plus(30.f, 36.f)];
self.pinTextfield.textAlignment = NSTextAlignmentCenter;

@ -121,7 +121,7 @@ NSString *const kProfileView_LastPresentedDate = @"kProfileView_LastPresentedDat
if (UIDevice.currentDevice.isShorterThanIPhone5) {
nameTextField = [DismissableTextField new];
} else {
nameTextField = [UITextField new];
nameTextField = [OWSTextField new];
}
_nameTextField = nameTextField;
nameTextField.font = [UIFont ows_mediumFontWithSize:18.f];

@ -152,7 +152,7 @@ NS_ASSUME_NONNULL_BEGIN
if (UIDevice.currentDevice.isShorterThanIPhone5) {
_challengeTextField = [DismissableTextField new];
} else {
_challengeTextField = [UITextField new];
_challengeTextField = [OWSTextField new];
}
_challengeTextField.textColor = [UIColor blackColor];

@ -195,7 +195,7 @@ NSString *const kKeychainKey_LastRegisteredPhoneNumber = @"kKeychainKey_LastRegi
if (UIDevice.currentDevice.isShorterThanIPhone5) {
phoneNumberTextField = [DismissableTextField new];
} else {
phoneNumberTextField = [UITextField new];
phoneNumberTextField = [OWSTextField new];
}
phoneNumberTextField.textAlignment = NSTextAlignmentRight;

@ -191,7 +191,7 @@ NS_ASSUME_NONNULL_BEGIN
_groupAvatar = self.thread.groupModel.groupImage;
[self updateAvatarView];
UITextField *groupNameTextField = [UITextField new];
UITextField *groupNameTextField = [OWSTextField new];
_groupNameTextField = groupNameTextField;
self.groupNameTextField.text = [self.thread.groupModel.groupName ows_stripped];
groupNameTextField.textColor = [Theme primaryColor];

@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN
if (UIDevice.currentDevice.isShorterThanIPhone5) {
self.pinTextfield = [DismissableTextField new];
} else {
self.pinTextfield = [UITextField new];
self.pinTextfield = [OWSTextField new];
}
self.pinTextfield.textColor = [Theme primaryColor];

@ -14,12 +14,16 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/AppSetup.h>
#import <SignalMessaging/AttachmentSharing.h>
#import <SignalMessaging/BlockListUIUtils.h>
#import <SignalMessaging/ContactCellView.h>
#import <SignalMessaging/ContactTableViewCell.h>
#import <SignalMessaging/ContactsViewHelper.h>
#import <SignalMessaging/CountryCodeViewController.h>
#import <SignalMessaging/DebugLogger.h>
#import <SignalMessaging/Environment.h>
#import <SignalMessaging/LockInteractionController.h>
#import <SignalMessaging/NSAttributedString+OWS.h>
#import <SignalMessaging/NSString+OWS.h>
#import <SignalMessaging/NewNonContactConversationViewController.h>
#import <SignalMessaging/OWSAudioPlayer.h>
#import <SignalMessaging/OWSContactAvatarBuilder.h>
#import <SignalMessaging/OWSContactOffersInteraction.h>
@ -32,13 +36,17 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/OWSNavigationController.h>
#import <SignalMessaging/OWSProfileManager.h>
#import <SignalMessaging/OWSQuotedReplyModel.h>
#import <SignalMessaging/OWSSearchBar.h>
#import <SignalMessaging/OWSSounds.h>
#import <SignalMessaging/OWSTableViewController.h>
#import <SignalMessaging/OWSTextField.h>
#import <SignalMessaging/OWSTextView.h>
#import <SignalMessaging/OWSUnreadIndicator.h>
#import <SignalMessaging/OWSUserProfile.h>
#import <SignalMessaging/OWSWindowManager.h>
#import <SignalMessaging/Release.h>
#import <SignalMessaging/ScreenLockViewController.h>
#import <SignalMessaging/SelectRecipientViewController.h>
#import <SignalMessaging/SharingThreadPickerViewController.h>
#import <SignalMessaging/SignalKeyingStorage.h>
#import <SignalMessaging/TSUnreadIndicatorInteraction.h>
@ -50,11 +58,6 @@ FOUNDATION_EXPORT const unsigned char SignalMessagingVersionString[];
#import <SignalMessaging/UIUtil.h>
#import <SignalMessaging/UIView+OWS.h>
#import <SignalMessaging/UIViewController+OWS.h>
#import <SignalMessaging/ContactCellView.h>
#import <SignalMessaging/CountryCodeViewController.h>
#import <SignalMessaging/LockInteractionController.h>
#import <SignalMessaging/SelectRecipientViewController.h>
#import <SignalMessaging/NewNonContactConversationViewController.h>
#import <SignalMessaging/VersionMigrations.h>
#import <SignalMessaging/ViewControllerUtils.h>
#import <SignalServiceKit/UIImage+OWS.h>

@ -3,6 +3,7 @@
//
#import "CountryCodeViewController.h"
#import "OWSSearchBar.h"
#import "PhoneNumberUtil.h"
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
@ -45,15 +46,10 @@
- (void)createViews
{
// Search
UISearchBar *searchBar = [UISearchBar new];
UISearchBar *searchBar = [OWSSearchBar new];
_searchBar = searchBar;
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = Theme.searchBarBackgroundColor;
searchBar.barStyle = Theme.barStyle;
searchBar.searchBarStyle = Theme.searchBarStyle;
searchBar.barTintColor = Theme.backgroundColor;
[searchBar sizeToFit];
self.tableView.tableHeaderView = searchBar;

@ -82,7 +82,7 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat
recipientRow.autoPin(toTopLayoutGuideOf: self, withInset: 0)
// Text View
textView = UITextView()
textView = OWSTextView()
textView.delegate = self
textView.backgroundColor = Theme.backgroundColor
textView.textColor = Theme.primaryColor

@ -158,7 +158,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien
- (UITextField *)phoneNumberTextField
{
if (!_phoneNumberTextField) {
_phoneNumberTextField = [UITextField new];
_phoneNumberTextField = [OWSTextField new];
_phoneNumberTextField.font = [UIFont ows_mediumFontWithSize:18.f];
_phoneNumberTextField.textAlignment = _phoneNumberTextField.textAlignmentUnnatural;
_phoneNumberTextField.textColor = [UIColor ows_materialBlueColor];

@ -10,6 +10,7 @@
#import "NSString+OWS.h"
#import "NewNonContactConversationViewController.h"
#import "OWSContactsManager.h"
#import "OWSSearchBar.h"
#import "OWSTableViewController.h"
#import "ThreadViewHelper.h"
#import "UIColor+OWS.h"
@ -86,15 +87,10 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.selectThreadViewDelegate);
// Search
UISearchBar *searchBar = [UISearchBar new];
UISearchBar *searchBar = [OWSSearchBar new];
_searchBar = searchBar;
searchBar.searchBarStyle = UISearchBarStyleMinimal;
searchBar.delegate = self;
searchBar.placeholder = NSLocalizedString(@"SEARCH_BYNAMEORNUMBER_PLACEHOLDER_TEXT", @"");
searchBar.backgroundColor = Theme.searchBarBackgroundColor;
searchBar.barStyle = Theme.barStyle;
searchBar.searchBarStyle = Theme.searchBarStyle;
searchBar.barTintColor = Theme.backgroundColor;
[searchBar sizeToFit];
UIView *header = [self.selectThreadViewDelegate createHeaderWithSearchBar:searchBar];

@ -0,0 +1,11 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@interface OWSSearchBar : UISearchBar
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,83 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSSearchBar.h"
#import "Theme.h"
#import "UIView+OWS.h"
NS_ASSUME_NONNULL_BEGIN
@implementation OWSSearchBar
- (instancetype)init
{
if (self = [super init]) {
[self ows_configure];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self ows_configure];
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
if (self = [super initWithCoder:aDecoder]) {
[self ows_configure];
}
return self;
}
- (void)ows_configure
{
[self ows_applyTheme];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(themeDidChange:)
name:ThemeDidChangeNotification
object:nil];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)ows_applyTheme
{
OWSAssertIsOnMainThread();
self.searchBarStyle = UISearchBarStyleMinimal;
self.backgroundColor = Theme.searchBarBackgroundColor;
self.barTintColor = Theme.backgroundColor;
self.barStyle = Theme.barStyle;
self.searchBarStyle = Theme.searchBarStyle;
[self traverseViewHierarchyWithVisitor:^(UIView *view) {
if ([view isKindOfClass:[UITextField class]]) {
UITextField *textField = (UITextField *)view;
textField.keyboardAppearance
= (Theme.isDarkThemeEnabled ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault);
}
}];
}
- (void)themeDidChange:(NSNotification *)notification
{
OWSAssertIsOnMainThread();
[self ows_applyTheme];
}
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,11 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@interface OWSTextField : UITextField
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,37 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSTextField.h"
#import "Theme.h"
NS_ASSUME_NONNULL_BEGIN
@implementation OWSTextField
- (instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self ows_applyTheme];
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
if (self = [super initWithCoder:aDecoder]) {
[self ows_applyTheme];
}
return self;
}
- (void)ows_applyTheme
{
self.keyboardAppearance = (Theme.isDarkThemeEnabled ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault);
}
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,11 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@interface OWSTextView : UITextView
@end
NS_ASSUME_NONNULL_END

@ -0,0 +1,37 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "OWSTextView.h"
#import "Theme.h"
NS_ASSUME_NONNULL_BEGIN
@implementation OWSTextView
- (instancetype)initWithFrame:(CGRect)frame textContainer:(nullable NSTextContainer *)textContainer
{
if (self = [super initWithFrame:frame textContainer:textContainer]) {
[self ows_applyTheme];
}
return self;
}
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
if (self = [super initWithCoder:aDecoder]) {
[self ows_applyTheme];
}
return self;
}
- (void)ows_applyTheme
{
self.keyboardAppearance = (Theme.isDarkThemeEnabled ? UIKeyboardAppearanceDark : UIKeyboardAppearanceDefault);
}
@end
NS_ASSUME_NONNULL_END

@ -7,6 +7,8 @@
NS_ASSUME_NONNULL_BEGIN
typedef void (^UIViewVisitorBlock)(UIView *view);
// A convenience method for doing responsive layout. Scales between two
// reference values (for iPhone 5 and iPhone 7 Plus) to the current device
// based on screen width, linearly interpolating.
@ -106,6 +108,8 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value);
- (NSArray<NSLayoutConstraint *> *)autoPinToEdgesOfView:(UIView *)view;
- (void)traverseViewHierarchyWithVisitor:(UIViewVisitorBlock)visitor;
#pragma mark - Containers
+ (UIView *)containerView;

@ -512,6 +512,18 @@ CGFloat ScaleFromIPhone5(CGFloat iPhone5Value)
}
}
- (void)traverseViewHierarchyWithVisitor:(UIViewVisitorBlock)visitor
{
OWSAssertIsOnMainThread();
OWSAssert(visitor);
visitor(self);
for (UIView *subview in self.subviews) {
[subview traverseViewHierarchyWithVisitor:visitor];
}
}
@end
#pragma mark -

@ -33,6 +33,14 @@
UIBarButtonItem.appearance.tintColor = Theme.navbarIconColor;
// Using the keyboardAppearance causes crashes due to a bug in UIKit.
// UITextField.appearance.keyboardAppearance = (Theme.isDarkThemeEnabled
// ? UIKeyboardAppearanceDark
// : UIKeyboardAppearanceDefault);
// UITextView.appearance.keyboardAppearance = (Theme.isDarkThemeEnabled
// ? UIKeyboardAppearanceDark
// : UIKeyboardAppearanceDefault);
// [[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTintColor:[UIColor
// ows_materialBlueColor]];

Loading…
Cancel
Save