Skip to content

Commit

Permalink
Merge branch 'develop' into gutenberg/embed-block-jetpack-variants
Browse files Browse the repository at this point in the history
# Conflicts:
#	Podfile.lock
  • Loading branch information
fluiddot committed Oct 6, 2021
2 parents 52d2546 + 6bbedf9 commit 76d0501
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 79 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ abstract_target 'Apps' do

pod 'Gridicons', '~> 1.1.0'

pod 'WordPressAuthenticator', '~> 1.42.1-beta.1'
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => 'feature/nuxbuttoncontroller-button-states'
pod 'WordPressAuthenticator', '~> 1.42.1-beta.2'
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => ''
# pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => ''
# pod 'WordPressAuthenticator', :path => '../WordPressAuthenticator-iOS'

Expand Down
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ PODS:
- WordPress-Aztec-iOS (1.19.4)
- WordPress-Editor-iOS (1.19.4):
- WordPress-Aztec-iOS (= 1.19.4)
- WordPressAuthenticator (1.42.1-beta.1):
- WordPressAuthenticator (1.42.1-beta.2):
- 1PasswordExtension (~> 1.8.6)
- Alamofire (~> 4.8)
- CocoaLumberjack (~> 3.5)
Expand All @@ -460,7 +460,7 @@ PODS:
- WordPressShared (~> 1.15-beta)
- wpxmlrpc (~> 0.9)
- WordPressMocks (0.0.15)
- WordPressShared (1.16.1):
- WordPressShared (1.16.2-beta.1):
- CocoaLumberjack (~> 3.4)
- FormatterKit/TimeIntervalFormatter (~> 1.8)
- WordPressUI (1.12.2)
Expand Down Expand Up @@ -552,7 +552,7 @@ DEPENDENCIES:
- Starscream (= 3.0.6)
- SVProgressHUD (= 2.2.5)
- WordPress-Editor-iOS (~> 1.19.4)
- WordPressAuthenticator (~> 1.42.1-beta.1)
- WordPressAuthenticator (~> 1.42.1-beta.2)
- WordPressKit (~> 4.42.0)
- WordPressMocks (~> 0.0.15)
- WordPressShared (~> 1.16.0)
Expand Down Expand Up @@ -809,10 +809,10 @@ SPEC CHECKSUMS:
UIDeviceIdentifier: f4bf3b343581a1beacdbf5fb1a8825bd5f05a4a4
WordPress-Aztec-iOS: 870c93297849072aadfc2223e284094e73023e82
WordPress-Editor-iOS: 068b32d02870464ff3cb9e3172e74234e13ed88c
WordPressAuthenticator: b625de2d764aab87768e5f42f369d521151e15f8
WordPressAuthenticator: 828a4c2560e27443b5d7935a1b788aefe4f56792
WordPressKit: 0c8e1a1becfeffc882f06f55eb09cd485826c268
WordPressMocks: 6b52b0764d9939408151367dd9c6e8a910877f4d
WordPressShared: 5477f179c7fe03b5d574f91adda66f67d131827e
WordPressShared: 3660920b90d44ca8cf6b4c9984aade433cdad50f
WordPressUI: c573f4b5c2e5d0ffcebe69ecf86ae75ab7b6ff4d
WPMediaPicker: d5ae9a83cd5cc0e4de46bfc1c59120aa86658bc3
wpxmlrpc: bf55a43a7e710bd2a4fb8c02dfe83b1246f14f13
Expand All @@ -826,6 +826,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: e27423c004a5a1410c15933407747374e7c6cb6e

PODFILE CHECKSUM: 95b40dcceeb522504c97e1cede83e902e0692aae
PODFILE CHECKSUM: d280ea1ed3491c36a0362a8950dd227acbf57e36

COCOAPODS: 1.10.1
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand All @@ -14,39 +12,39 @@
<scene sceneID="Ott-OI-M1X">
<objects>
<viewController storyboardIdentifier="RegisterDomainSuggestionsViewController" id="czc-f5-zC7" customClass="RegisterDomainSuggestionsViewController" customModule="WordPress" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="hr1-AR-Kcc">
<view key="view" autoresizesSubviews="NO" contentMode="scaleToFill" id="hr1-AR-Kcc">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qRW-a0-uEt" userLabel="Table Container View">
<rect key="frame" x="0.0" y="20" width="375" height="563"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="583"/>
<connections>
<segue destination="CFb-K0-jrQ" kind="embed" id="v6Z-QC-UcC"/>
</connections>
</containerView>
<containerView opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N47-hP-xDu" userLabel="Button Container View">
<containerView autoresizesSubviews="NO" opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N47-hP-xDu" userLabel="Button Container View">
<rect key="frame" x="0.0" y="583" width="375" height="84"/>
<viewLayoutGuide key="safeArea" id="0hA-Vo-wWt"/>
<constraints>
<constraint firstAttribute="height" constant="84" placeholder="YES" id="ATd-iH-oJG"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="84" id="j00-iE-vY5"/>
</constraints>
<viewLayoutGuide key="safeArea" id="0hA-Vo-wWt"/>
</containerView>
</subviews>
<viewLayoutGuide key="safeArea" id="qDC-aT-Sfz"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="N47-hP-xDu" firstAttribute="trailing" secondItem="hr1-AR-Kcc" secondAttribute="trailing" id="00z-KU-gma"/>
<constraint firstItem="N47-hP-xDu" firstAttribute="bottom" secondItem="hr1-AR-Kcc" secondAttribute="bottom" id="CbP-Yl-3OZ"/>
<constraint firstItem="N47-hP-xDu" firstAttribute="bottom" secondItem="hr1-AR-Kcc" secondAttribute="bottom" id="CbP-Yl-3OZ" userLabel="Button Container View Bottom Constraint"/>
<constraint firstAttribute="trailing" secondItem="qRW-a0-uEt" secondAttribute="trailing" id="NvV-4f-UXu"/>
<constraint firstItem="qRW-a0-uEt" firstAttribute="leading" secondItem="hr1-AR-Kcc" secondAttribute="leading" id="Owz-yP-dfr"/>
<constraint firstItem="N47-hP-xDu" firstAttribute="leading" secondItem="hr1-AR-Kcc" secondAttribute="leading" id="aq0-ab-Svm"/>
<constraint firstItem="qRW-a0-uEt" firstAttribute="top" secondItem="qDC-aT-Sfz" secondAttribute="top" id="g17-8h-gCH"/>
<constraint firstItem="N47-hP-xDu" firstAttribute="top" secondItem="qRW-a0-uEt" secondAttribute="bottom" id="kYJ-aF-Uio"/>
</constraints>
<viewLayoutGuide key="safeArea" id="qDC-aT-Sfz"/>
</view>
<connections>
<outlet property="buttonContainerViewBottomConstraint" destination="CbP-Yl-3OZ" id="SgM-zd-bS0"/>
<outlet property="buttonContainerBottomConstraint" destination="CbP-Yl-3OZ" id="HZV-8k-dVw"/>
<outlet property="buttonContainerViewHeightConstraint" destination="j00-iE-vY5" id="TES-Ic-0gY"/>
<outlet property="buttonViewContainer" destination="N47-hP-xDu" id="wQG-3m-IgK"/>
</connections>
Expand All @@ -60,7 +58,7 @@
<objects>
<viewController id="CFb-K0-jrQ" customClass="RegisterDomainSuggestionsTableViewController" customModule="WordPress" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="UYc-Bx-TlF">
<rect key="frame" x="0.0" y="0.0" width="375" height="563"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="583"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import WebKit
import WordPressAuthenticator
import WordPressFlux

class RegisterDomainSuggestionsViewController: UIViewController, DomainSuggestionsButtonViewPresenter {

@IBOutlet weak var buttonContainerViewBottomConstraint: NSLayoutConstraint!
class RegisterDomainSuggestionsViewController: UIViewController {
@IBOutlet weak var buttonContainerBottomConstraint: NSLayoutConstraint!
@IBOutlet weak var buttonContainerViewHeightConstraint: NSLayoutConstraint!

private var constraintsInitialized = false

private var site: JetpackSiteRef!
private var domainPurchasedCallback: ((String) -> Void)!

Expand All @@ -23,11 +24,7 @@ class RegisterDomainSuggestionsViewController: UIViewController, DomainSuggestio
override func viewDidLoad() {
super.viewDidLoad()
configure()
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
showButtonView(show: false, withAnimation: false)
hideButton()
}

@IBOutlet private var buttonViewContainer: UIView! {
Expand Down Expand Up @@ -96,6 +93,64 @@ class RegisterDomainSuggestionsViewController: UIViewController, DomainSuggestio
navigationItem.rightBarButtonItem = supportButton
}

// MARK: - Bottom Hideable Button

/// Shows the domain picking button
///
private func showButton() {
buttonContainerBottomConstraint.constant = 0
}

/// Shows the domain picking button
///
/// - Parameters:
/// - animated: whether the transition is animated.
///
private func showButton(animated: Bool) {
guard animated else {
showButton()
return
}

UIView.animate(withDuration: WPAnimationDurationDefault, animations: { [weak self] in
guard let self = self else {
return
}

self.showButton()

// Since the Button View uses auto layout, need to call this so the animation works properly.
self.view.layoutIfNeeded()
}, completion: nil)
}

private func hideButton() {
buttonContainerBottomConstraint.constant = buttonViewContainer.frame.height
}

/// Hides the domain picking button
///
/// - Parameters:
/// - animated: whether the transition is animated.
///
func hideButton(animated: Bool) {
guard animated else {
hideButton()
return
}

UIView.animate(withDuration: WPAnimationDurationDefault, animations: { [weak self] in
guard let self = self else {
return
}

self.hideButton()

// Since the Button View uses auto layout, need to call this so the animation works properly.
self.view.layoutIfNeeded()
}, completion: nil)
}

// MARK: - Navigation

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
Expand Down Expand Up @@ -132,12 +187,12 @@ extension RegisterDomainSuggestionsViewController: DomainSuggestionsTableViewCon
func domainSelected(_ domain: DomainSuggestion) {
WPAnalytics.track(.automatedTransferCustomDomainSuggestionSelected)
self.domain = domain
showButtonView(show: true, withAnimation: true)
showButton(animated: true)
}

func newSearchStarted() {
WPAnalytics.track(.automatedTransferCustomDomainSuggestionQueried)
showButtonView(show: false, withAnimation: true)
hideButton(animated: true)
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class DomainSuggestionsTableViewController: UITableViewController {
return useFadedColorForParentDomains ? .neutral(.shade30) : .neutral(.shade70)
}

private let searchDebouncer = Debouncer(delay: 0.5)

// MARK: - Init

required init?(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -122,6 +124,8 @@ class DomainSuggestionsTableViewController: UITableViewController {
let api = accountService.defaultWordPressComAccount()?.wordPressComRestApi ?? WordPressComRestApi.defaultApi(oAuthToken: "")

let service = DomainsService(managedObjectContext: ContextManager.sharedInstance().mainContext, remote: DomainsServiceRemote(wordPressComRestApi: api))

SVProgressHUD.setContainerView(tableView)
SVProgressHUD.show(withStatus: NSLocalizedString("Loading domains", comment: "Shown while the app waits for the domain suggestions web service to return during the site creation process."))

service.getDomainSuggestions(base: searchTerm,
Expand All @@ -131,8 +135,6 @@ class DomainSuggestionsTableViewController: UITableViewController {
self?.noSuggestions = false
SVProgressHUD.dismiss()
self?.tableView.separatorStyle = .singleLine
// Dismiss the keyboard so the full results list can be seen.
self?.view.endEditing(true)
addSuggestions(suggestions)
}) { [weak self] (error) in
DDLogError("Error getting Domain Suggestions: \(error.localizedDescription)")
Expand Down Expand Up @@ -262,6 +264,8 @@ extension DomainSuggestionsTableViewController {
fatalError()
}

cell.allowSpaces = false
cell.liveSearch = true
cell.placeholder = searchFieldPlaceholder
cell.reloadTextfieldStyle()
cell.delegate = self
Expand Down Expand Up @@ -372,7 +376,12 @@ extension DomainSuggestionsTableViewController {

extension DomainSuggestionsTableViewController: SearchTableViewCellDelegate {
func startSearch(for searchTerm: String) {
searchDebouncer.call { [weak self] in
self?.search(for: searchTerm)
}
}

private func search(for searchTerm: String) {
removeNoResultsFromView()
delegate?.newSearchStarted()

Expand Down
Loading

0 comments on commit 76d0501

Please sign in to comment.