Fix "blue navbar" for contact picker

- content flows behind navbar
- unify search bar style with rest of app

// FREEBIE
pull/1/head
Michael Kirk 7 years ago
parent 4d42fafdf9
commit 991848b364

@ -175,7 +175,6 @@
34B0796D1FCF46B100E248C2 /* MainAppContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B0796B1FCF46B000E248C2 /* MainAppContext.m */; };
34B3F8751E8DF1700035BE1A /* CallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F83B1E8DF1700035BE1A /* CallViewController.swift */; };
34B3F8771E8DF1700035BE1A /* ContactsPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F83E1E8DF1700035BE1A /* ContactsPicker.swift */; };
34B3F8781E8DF1700035BE1A /* ContactsPicker.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34B3F83F1E8DF1700035BE1A /* ContactsPicker.xib */; };
34B3F87B1E8DF1700035BE1A /* ExperienceUpgradesPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8441E8DF1700035BE1A /* ExperienceUpgradesPageViewController.swift */; };
34B3F8801E8DF1700035BE1A /* InviteFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F84C1E8DF1700035BE1A /* InviteFlow.swift */; };
34B3F8821E8DF1700035BE1A /* NewContactThreadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34B3F8501E8DF1700035BE1A /* NewContactThreadViewController.m */; };
@ -804,7 +803,6 @@
34B3F83A1E8DF1700035BE1A /* AttachmentSharing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AttachmentSharing.m; sourceTree = "<group>"; };
34B3F83B1E8DF1700035BE1A /* CallViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallViewController.swift; sourceTree = "<group>"; };
34B3F83E1E8DF1700035BE1A /* ContactsPicker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsPicker.swift; sourceTree = "<group>"; };
34B3F83F1E8DF1700035BE1A /* ContactsPicker.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ContactsPicker.xib; sourceTree = "<group>"; };
34B3F8441E8DF1700035BE1A /* ExperienceUpgradesPageViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExperienceUpgradesPageViewController.swift; sourceTree = "<group>"; };
34B3F84C1E8DF1700035BE1A /* InviteFlow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InviteFlow.swift; sourceTree = "<group>"; };
34B3F84F1E8DF1700035BE1A /* NewContactThreadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewContactThreadViewController.h; sourceTree = "<group>"; };
@ -1680,7 +1678,6 @@
34B3F83B1E8DF1700035BE1A /* CallViewController.swift */,
348BB25C20A0C5530047AEC2 /* ContactShareViewHelper.swift */,
34B3F83E1E8DF1700035BE1A /* ContactsPicker.swift */,
34B3F83F1E8DF1700035BE1A /* ContactsPicker.xib */,
34E88D252098C5AE00A608F4 /* ContactViewController.swift */,
3448BFC01EDF0EA7005B2D69 /* ConversationView */,
346B66301F4E29B200E5122F /* CropScaleImageViewController.swift */,
@ -2778,7 +2775,6 @@
AD83FF431A73426500B5C81A /* audio_play_button@2x.png in Resources */,
34661FB820C1C0D60056EDD6 /* message_sent.aiff in Resources */,
45CB2FA81CB7146C00E1B343 /* Launch Screen.storyboard in Resources */,
34B3F8781E8DF1700035BE1A /* ContactsPicker.xib in Resources */,
B633C5C31A1D190B0059AC12 /* mute_off@2x.png in Resources */,
AD83FF411A73426500B5C81A /* audio_play_button_blue@2x.png in Resources */,
34C3C78D20409F320000134C /* Opening.m4r in Resources */,

@ -28,12 +28,11 @@ public enum SubtitleCellValue: Int {
@objc
public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate {
@IBOutlet var tableView: UITableView!
@IBOutlet var searchBar: UISearchBar!
var tableView: UITableView!
var searchBar: UISearchBar!
// MARK: - Properties
private let TAG = "[ContactsPicker]"
private let contactCellReuseIdentifier = "contactCellReuseIdentifier"
private var contactsManager: OWSContactsManager {
@ -84,7 +83,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
required public init(allowsMultipleSelection: Bool, subtitleCellType: SubtitleCellValue) {
self.allowsMultipleSelection = allowsMultipleSelection
self.subtitleCellType = subtitleCellType
super.init(nibName: "ContactsPicker", bundle: nil)
super.init(nibName: nil, bundle: nil)
}
required public init?(coder aDecoder: NSCoder) {
@ -93,12 +92,30 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
// MARK: - Lifecycle Methods
override public func loadView() {
self.view = UIView()
let tableView = UITableView()
self.tableView = tableView
view.addSubview(tableView)
tableView.autoPinEdgesToSuperviewEdges()
tableView.delegate = self
tableView.dataSource = self
let searchBar = UISearchBar()
self.searchBar = searchBar
searchBar.searchBarStyle = .minimal
searchBar.delegate = self
searchBar.backgroundColor = .white
searchBar.sizeToFit()
tableView.tableHeaderView = searchBar
}
override open func viewDidLoad() {
super.viewDidLoad()
searchBar.placeholder = NSLocalizedString("INVITE_FRIENDS_PICKER_SEARCHBAR_PLACEHOLDER", comment: "Search")
// Prevent content from going under the navigation bar
self.edgesForExtendedLayout = []
// Auto size cells for dynamic type
tableView.estimatedRowHeight = 60.0
@ -140,7 +157,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
private func reloadContacts() {
getContacts( onError: { error in
Logger.error("\(self.TAG) failed to reload contacts with error:\(error)")
Logger.error("\(self.logTag) failed to reload contacts with error:\(error)")
})
}
@ -192,7 +209,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
}
self.sections = collatedContacts(contacts)
} catch let error as NSError {
Logger.error("\(self.TAG) Failed to fetch contacts with error:\(error)")
Logger.error("\(self.logTag) Failed to fetch contacts with error:\(error)")
}
}
}
@ -331,7 +348,7 @@ public class ContactsPicker: OWSViewController, UITableViewDelegate, UITableView
let filteredContacts = try contactStore.unifiedContacts(matching: predicate, keysToFetch: allowedContactKeys)
filteredSections = collatedContacts(filteredContacts)
} catch let error as NSError {
Logger.error("\(self.TAG) updating search results failed with error: \(error)")
Logger.error("\(self.logTag) updating search results failed with error: \(error)")
}
}
self.tableView.reloadData()

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ContactsPicker" customModule="Signal" customModuleProvider="target">
<connections>
<outlet property="searchBar" destination="4gV-1B-8Mf" id="QBY-fF-wiP"/>
<outlet property="tableView" destination="oaw-nZ-Bd3" id="ovH-CY-TEZ"/>
<outlet property="view" destination="iN0-l3-epB" id="SV2-9h-0H0"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="375" height="603"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="oaw-nZ-Bd3">
<rect key="frame" x="0.0" y="44" width="375" height="559"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<connections>
<outlet property="dataSource" destination="-1" id="2Ke-sU-HF0"/>
<outlet property="delegate" destination="-1" id="yc6-lh-qbW"/>
</connections>
</tableView>
<searchBar contentMode="redraw" translatesAutoresizingMaskIntoConstraints="NO" id="4gV-1B-8Mf">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="fOA-ib-HG5"/>
</constraints>
<textInputTraits key="textInputTraits"/>
<connections>
<outlet property="delegate" destination="-1" id="xC3-pC-pNH"/>
</connections>
</searchBar>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="oaw-nZ-Bd3" firstAttribute="top" secondItem="4gV-1B-8Mf" secondAttribute="bottom" id="6xt-kc-7P8"/>
<constraint firstItem="4gV-1B-8Mf" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="topMargin" id="EXL-NQ-glZ"/>
<constraint firstItem="4gV-1B-8Mf" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Yep-bF-mvk"/>
<constraint firstItem="oaw-nZ-Bd3" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="oKu-gT-NC6"/>
<constraint firstAttribute="bottom" secondItem="oaw-nZ-Bd3" secondAttribute="bottom" id="ptG-2s-ieJ"/>
<constraint firstAttribute="trailing" secondItem="oaw-nZ-Bd3" secondAttribute="trailing" id="sB4-4w-vGM"/>
<constraint firstAttribute="trailing" secondItem="4gV-1B-8Mf" secondAttribute="trailing" id="w2q-bS-FII"/>
</constraints>
<simulatedStatusBarMetrics key="simulatedStatusBarMetrics"/>
<simulatedNavigationBarMetrics key="simulatedTopBarMetrics" translucent="NO" prompted="NO"/>
<point key="canvasLocation" x="-209.5" y="88.5"/>
</view>
</objects>
</document>
Loading…
Cancel
Save