Skip to content

Commit

Permalink
Merge pull request #44 from wordpress-mobile/release/1.4
Browse files Browse the repository at this point in the history
Merge Release/1.4 into Master
  • Loading branch information
loremattei authored Oct 21, 2019
2 parents 30e9e3d + 215848d commit 057fd2a
Show file tree
Hide file tree
Showing 8 changed files with 156 additions and 44 deletions.
16 changes: 14 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 2.1

orbs:
# This uses the iOS Orb located at https://github.com/wordpress-mobile/circleci-orbs
ios: wordpress-mobile/ios@0.0.25
# Using 1.0 of our Orbs means it will use the latest 1.0.x version from https://github.com/wordpress-mobile/circleci-orbs
ios: wordpress-mobile/ios@1.0

workflows:
test_and_validate:
Expand All @@ -29,3 +29,15 @@ workflows:
name: Validate Podspec
xcode-version: "10.2.0"
podspec-path: WordPressUI.podspec
bundle-install: true
- ios/publish-podspec:
name: Publish to Trunk
xcode-version: "10.2.0"
podspec-path: WordPressUI.podspec
bundle-install: true
post-to-slack: true
filters:
tags:
only: /.*/
branches:
ignore: /.*/
100 changes: 93 additions & 7 deletions Example/Example/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="PbN-Bb-478">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="PbN-Bb-478">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14824"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand All @@ -18,7 +18,7 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="CellIdentifier" id="3ZQ-84-wjW">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<rect key="frame" x="0.0" y="28" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="3ZQ-84-wjW" id="38G-WI-5mN">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
Expand All @@ -32,17 +32,103 @@
</connections>
</tableView>
<navigationItem key="navigationItem" title="Root View Controller" id="ua7-K6-ibe"/>
<connections>
<segue destination="sFZ-hP-s6g" kind="show" identifier="FancyButtonsSegue" id="avn-Um-QAq"/>
</connections>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="ePj-1F-MpD" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="566" y="-244"/>
</scene>
<!--Fancy Buttons View Controller-->
<scene sceneID="dk3-6b-6yt">
<objects>
<viewController id="sFZ-hP-s6g" customClass="FancyButtonsViewController" customModule="Example" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="ITQ-Ah-oIp">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="40" translatesAutoresizingMaskIntoConstraints="NO" id="4IX-T0-GRU">
<rect key="frame" x="96.5" y="79.5" width="182" height="552"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="DLq-Jr-68H" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="0.0" width="182" height="34"/>
<state key="normal" title="Primary enabled"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="99W-Sf-T4r" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="74" width="182" height="34"/>
<state key="normal" title="Primary selected"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" highlighted="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="V1C-qw-HGz" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="148" width="182" height="34"/>
<state key="normal" title="Primary highlighted"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rse-9O-SFu" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="222" width="182" height="34"/>
<state key="normal" title="Primary disabled"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UAb-pT-sYQ" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="296" width="182" height="34"/>
<state key="normal" title="Secondary enabled"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="NO"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" selected="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="raJ-LB-lIj" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="370" width="182" height="34"/>
<state key="normal" title="Secondary selected"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="NO"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" highlighted="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Cb-gy-BQF" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="444" width="182" height="34"/>
<state key="normal" title="Secondary highlighted"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="NO"/>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jbE-un-BvP" customClass="FancyButton" customModule="WordPressUI">
<rect key="frame" x="0.0" y="518" width="182" height="34"/>
<state key="normal" title="Secondary disabled"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isPrimary" value="YES"/>
</userDefinedRuntimeAttributes>
</button>
</subviews>
</stackView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="4IX-T0-GRU" firstAttribute="centerX" secondItem="O2a-cZ-0ji" secondAttribute="centerX" id="cF8-1m-2mC"/>
<constraint firstItem="4IX-T0-GRU" firstAttribute="centerY" secondItem="O2a-cZ-0ji" secondAttribute="centerY" id="mrV-bV-4yf"/>
</constraints>
<viewLayoutGuide key="safeArea" id="O2a-cZ-0ji"/>
</view>
<navigationItem key="navigationItem" id="QQQ-hf-TLL"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="VM9-7T-6w0" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="566" y="445"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="wp4-lm-2pf">
<objects>
<navigationController id="PbN-Bb-478" sceneMemberID="viewController">
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="Wjr-vl-1MQ">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<connections>
Expand Down
14 changes: 13 additions & 1 deletion Example/Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class ViewController: UITableViewController
self.showFancyAlertWithSwitch()
})]
),
DemoSection(title: "Misc UI Elements", rows: []),
DemoSection(title: "Misc UI Elements", rows: [
DemoRow(title: "Fancy Buttons", action: {
self.showFancyButtons()
})
]),
]
}

Expand Down Expand Up @@ -101,6 +105,12 @@ class ViewController: UITableViewController

showFancyAlert(switchConfig: switchConfig)
}

// MARK: - Fancy Buttons

func showFancyButtons() {
performSegue(withIdentifier: "FancyButtonsSegue", sender: self)
}

// MARK: - Test Messages for the User

Expand Down Expand Up @@ -184,3 +194,5 @@ struct DemoRow {
var title: String
var action: RowAction
}

class FancyButtonsViewController: UIViewController {}
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org' do
gem 'cocoapods', '1.6.1'
gem 'cocoapods', '~> 1.8.0'
end
37 changes: 22 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
CFPropertyList (3.0.1)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
algoliasearch (1.27.1)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.6.1)
claide (1.0.3)
cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.6.1)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-core (= 1.8.4)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.2.0, < 3.0)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
xcodeproj (>= 1.11.1, < 2.0)
cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
Expand All @@ -38,19 +43,21 @@ GEM
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-trunk (1.4.1)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
escape (0.0.4)
fourflusher (2.2.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
json (2.2.0)
minitest (5.12.2)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
Expand All @@ -59,7 +66,7 @@ GEM
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
xcodeproj (1.9.0)
xcodeproj (1.13.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
Expand All @@ -70,7 +77,7 @@ PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.6.1)!
cocoapods (~> 1.8.0)!

BUNDLED WITH
2.0.1
2.0.2
2 changes: 1 addition & 1 deletion WordPressUI.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "WordPressUI"
s.version = "1.3.5"
s.version = "1.4"
s.summary = "Home of reusable WordPress UI components."

s.description = <<-DESC
Expand Down
23 changes: 10 additions & 13 deletions WordPressUI/Extensions/UIImage+Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@ extension UIImage {
return Bundle.wordPressUIBundle
}

/// Renders the Background Image with the specified Background + Size + Radius + Insets parameters.
/// Renders the Background Image with the specified Background + Size + Insets parameters.
///
public class func renderBackgroundImage(fill: UIColor,
border: UIColor,
border: UIColor? = nil,
size: CGSize = DefaultRenderMetrics.backgroundImageSize,
cornerRadius: CGFloat = DefaultRenderMetrics.backgroundCornerRadius,
capInsets: UIEdgeInsets = DefaultRenderMetrics.backgroundCapInsets,
shadowOffset: CGSize = DefaultRenderMetrics.backgroundShadowOffset,
shadowBlurRadius: CGFloat = DefaultRenderMetrics.backgroundShadowBlurRadius) -> UIImage {
capInsets: UIEdgeInsets = DefaultRenderMetrics.backgroundCapInsets) -> UIImage {

let renderer = UIGraphicsImageRenderer(size: size)
let image = renderer.image { context in
Expand All @@ -54,23 +52,24 @@ extension UIImage {
var bounds = renderer.format.bounds
bounds.origin.x += lineWidthInPixels
bounds.origin.y += lineWidthInPixels
bounds.size.height -= lineWidthInPixels * 2 + shadowOffset.height
bounds.size.width -= lineWidthInPixels * 2 + shadowOffset.width
bounds.size.height -= lineWidthInPixels * 2
bounds.size.width -= lineWidthInPixels * 2

let path = UIBezierPath(roundedRect: bounds, cornerRadius: cornerRadius)

/// Draw: Background + Shadow
cgContext.saveGState()
cgContext.setShadow(offset: shadowOffset, blur: shadowBlurRadius, color: border.cgColor)

fill.setFill()

path.fill()

cgContext.restoreGState()

/// Draw: Border!
border.setStroke()
path.stroke()
if let border = border {
border.setStroke()
path.stroke()
}
}

return image.resizableImage(withCapInsets: capInsets)
Expand All @@ -82,8 +81,6 @@ extension UIImage {
public static let backgroundImageSize = CGSize(width: 44, height: 44)
public static let backgroundCornerRadius = CGFloat(8)
public static let backgroundCapInsets = UIEdgeInsets(top: 18, left: 18, bottom: 18, right: 18)
public static let backgroundShadowOffset = CGSize(width: 0, height: 2)
public static let backgroundShadowBlurRadius = CGFloat(0)
public static let contentInsets = UIEdgeInsets(top: 12, left: 20, bottom: 12, right: 20)
}
}
Loading

0 comments on commit 057fd2a

Please sign in to comment.