Skip to content

Commit

Permalink
Bugfix/hw 67819 insights cocoapod integration issue (#244)
Browse files Browse the repository at this point in the history
* made UINavigationBar theme customization optional

* 1.0.0-beta08 release

* reverted version due to failing uI tests for iOS 13.7

* reverted changes in travis.yaml
  • Loading branch information
jsaini-hw authored Sep 25, 2020
1 parent a6c3605 commit b5096f4
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 55 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

[1.0.0-beta08](https://github.com/hyperwallet/hyperwallet-ios-ui-sdk/releases/tag/1.0.0-beta08)
-------------------
- Fixed Cocoapod Insights Integration issue
- Made UINavigationBar Theme customization optional

[1.0.0-beta07](https://github.com/hyperwallet/hyperwallet-ios-ui-sdk/releases/tag/1.0.0-beta07)
-------------------
- Fixed Cocoapod issue
Expand Down
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta08"
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta03"
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta04"
2 changes: 1 addition & 1 deletion Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "JanGorman/Hippolyte" "0.8.0"
github "JanGorman/Hippolyte" "1.2.2"
github "httpswift/swifter" "1.4.7"
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "JanGorman/Hippolyte" "0.8.0"
github "JanGorman/Hippolyte" "1.2.2"
github "httpswift/swifter" "1.4.7"
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta03"
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta04"
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta08"
10 changes: 3 additions & 7 deletions Common/Sources/Helper/ThemeManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ import UIKit
public class ThemeManager: NSObject {
/// Applies default visual styles to the Hyperwallet user interface components.
public static func applyTheme() {
applyToUINavigationBar()
applyToProcessingView()
applyToSpinnerView()
registerFonts
}

/// Applies White Theme visual styles to the Hyperwallet user interface components.
public static func applyWhiteTheme() {
Theme.themeColor = .white
Theme.tintColor = UIColor(red: 0, green: 0.48, blue: 1, alpha: 1)
Theme.Button.color = Theme.tintColor
Theme.Button.linkColor = Theme.tintColor
Theme.Icon.primaryColor = Theme.tintColor
Theme.SpinnerView.activityIndicatorViewColor = Theme.tintColor
Theme.NavigationBar.shadowColor = UIColor(rgb: 0xe3e3e5)
ThemeManager.applyTheme()
}

private static func applyToUINavigationBar() {
/// Applies Custom Theme visual styles to the `UINavigationBar` interface component.
public static func applyToUINavigationBar() {
let proxy = UINavigationBar.appearance()
if #available(iOS 11.0, *) {
proxy.largeTitleTextAttributes =
Expand Down Expand Up @@ -89,8 +89,4 @@ public class ThemeManager: NSObject {
proxy.activityIndicatorBackgroundColor = Theme.SpinnerView.backgroundColor
proxy.viewBackgroundColor = Theme.SpinnerView.backgroundColor
}

private static let registerFonts: Void = {
UIFont.register("hw_mobile_ui_sdk_icons", type: "ttf")
}()
}
2 changes: 2 additions & 0 deletions Common/Sources/HyperwalletUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public final class HyperwalletUI: NSObject {
}

private init(_ provider: HyperwalletAuthenticationTokenProvider) {
//Register custom fonts
UIFont.register("hw_mobile_ui_sdk_icons", type: "ttf")
Hyperwallet.setup(provider)
HyperwalletInsights.setup()
}
Expand Down
6 changes: 4 additions & 2 deletions Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.

// ThemeManager.applyWhiteTheme()
window?.tintColor = .systemBlue
window?.backgroundColor = Theme.UITableViewController.backgroundColor
// ThemeManager.applyWhiteTheme()
ThemeManager.applyTheme()
ThemeManager.applyToUINavigationBar()
// Set the default tint color
window?.tintColor = .systemBlue

return true
}
Expand Down
44 changes: 20 additions & 24 deletions Demo/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,33 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="wCK-zt-ysg">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="wCK-zt-ysg">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.70"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<customFonts key="customFonts">
<array key="hw_mobile_ui_sdk_icons.ttf">
<string>hw_mobile_ui_sdk_icons</string>
</array>
</customFonts>
<scenes>
<!--Account Settings-->
<scene sceneID="90C-vr-vjd">
<objects>
<tableViewController id="h5h-EX-xDl" customClass="ViewController" customModule="HyperwalletExampleApp" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="Krd-9H-To6">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<tableViewController id="h5h-EX-xDl" customClass="ViewController" customModule="Demo" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="Krd-9H-To6">
<rect key="frame" x="0.0" y="0.0" width="414" height="808"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TopCell" rowHeight="120" id="mqC-LT-GSO" customClass="TopCell" customModule="HyperwalletExampleApp" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="600" height="120"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="TopCell" rowHeight="120" id="mqC-LT-GSO" customClass="TopCell" customModule="Demo" customModuleProvider="target">
<rect key="frame" x="0.0" y="28" width="414" height="120"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="mqC-LT-GSO" id="obu-O4-ovs">
<rect key="frame" x="0.0" y="0.0" width="600" height="119.5"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="120"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="svg-8N-6bE">
<rect key="frame" x="137" y="29" width="432" height="21"/>
<rect key="frame" x="137" y="29" width="246" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="NX4-BJ-HlD"/>
</constraints>
Expand All @@ -36,7 +33,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3tB-Dy-Uuo">
<rect key="frame" x="137" y="48" width="432" height="21"/>
<rect key="frame" x="137" y="48" width="246" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="IMf-Ps-lhQ"/>
</constraints>
Expand All @@ -45,7 +42,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nuD-M0-zEI">
<rect key="frame" x="137" y="67" width="432" height="21"/>
<rect key="frame" x="137" y="67" width="246" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="LF0-kB-nFq"/>
</constraints>
Expand Down Expand Up @@ -85,15 +82,15 @@
<outlet property="phoneLabel" destination="3tB-Dy-Uuo" id="eHe-ve-mBq"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="LabelCell" rowHeight="80" id="gTh-zb-JIg" customClass="HeadlineCell" customModule="HyperwalletExampleApp" customModuleProvider="target">
<rect key="frame" x="0.0" y="148" width="600" height="80"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="LabelCell" rowHeight="80" id="gTh-zb-JIg" customClass="HeadlineCell" customModule="Demo" customModuleProvider="target">
<rect key="frame" x="0.0" y="148" width="414" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="gTh-zb-JIg" id="zy6-Dy-o7Q">
<rect key="frame" x="0.0" y="0.0" width="600" height="79.5"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="80"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uFo-O2-ca8">
<rect key="frame" x="20" y="45" width="560" height="17"/>
<rect key="frame" x="20" y="45" width="374" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="3i0-r0-gDm"/>
</constraints>
Expand All @@ -102,7 +99,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YKf-MB-uhb">
<rect key="frame" x="20" y="13" width="560" height="20.5"/>
<rect key="frame" x="20" y="13" width="374" height="20.5"/>
<constraints>
<constraint firstAttribute="height" constant="20.5" id="vvk-O7-uBH"/>
</constraints>
Expand Down Expand Up @@ -142,10 +139,9 @@
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="wCK-zt-ysg" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" barStyle="black" translucent="NO" id="VZ2-Ya-dU8">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translucent="NO" id="VZ2-Ya-dU8">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<color key="barTintColor" red="0.10552009179999999" green="0.8118787274" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
Expand Down
4 changes: 2 additions & 2 deletions HyperwalletUISDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'HyperwalletUISDK'
spec.version = '1.0.0-beta07'
spec.version = '1.0.0-beta08'
spec.summary = 'Hyperwallet UI SDK for iOS to integrate with Hyperwallet Platform'
spec.homepage = 'https://github.com/hyperwallet/hyperwallet-ios-ui-sdk'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
Expand All @@ -17,7 +17,7 @@ Pod::Spec.new do |spec|
spec.subspec "Common" do |common|
common.resources = ['Common/**/*.xcassets', 'Common/**/*.ttf', 'Common/**/*.xib', 'Common/**/*.strings']
common.source_files = "Common/Sources/**/*.{swift,h}"
common.dependency 'Insights', '1.0.0-beta03'
common.dependency 'Insights', '1.0.0-beta04'
end

spec.subspec "TransferMethodRepository" do |transferMethodRepository|
Expand Down
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ Adding one or more of these frameworks allows users to explore the particular fu
### Carthage
Specify it in your Cartfile:
```ogdl
github "hyperwallet/hyperwallet-ios-ui-sdk" "1.0.0-beta07"
github "hyperwallet/hyperwallet-ios-ui-sdk" "1.0.0-beta08"
```
Add desired modules using the `Linked Frameworks and Libraries` option to make them available in the app.
Use `import <module-name>` to add the dependency within a file

### CocoaPods
- Install a specific framework (install one or more frameworks based on your requirement)
```ruby
pod "HyperwalletUISDK/TransferMethod", "1.0.0-beta07"
pod "HyperwalletUISDK/Transfer", "1.0.0-beta07"
pod "HyperwalletUISDK/Receipt", "1.0.0-beta07"
pod "HyperwalletUISDK/TransferMethod", "1.0.0-beta08"
pod "HyperwalletUISDK/Transfer", "1.0.0-beta08"
pod "HyperwalletUISDK/Receipt", "1.0.0-beta08"
```
- To install all available modules (TransferMethod, Transfer, Receipt)
```ruby
pod 'HyperwalletUISDK', '~> 1.0.0-beta07'
pod 'HyperwalletUISDK', '~> 1.0.0-beta08'
```
Use `import HyperwalletUISDK` to add the dependency within a file.

Expand All @@ -57,8 +57,7 @@ After you're done installing the SDK, you need to initialize an instance in orde

### Setup the UI Style
HyperwalletUISDK provides default themes for all the modules(e.g. TransferMethod, Receipt). If you import HyperwalletUISDK, in order to
apply all the default themes, firstly you will have to call ThemeManager.applyTheme which will apply the basic theme. Secondly, you need to apply
the themes for all the modules in HyperwalletUISDK.
apply the default theme, you will have to call `ThemeManager.applyTheme()` which will apply the basic theme to ProcessingView and SpinnerView. If you want Hyperwallet custom theme for UINavigationBar then add `ThemeManager.applyToUINavigationBar()`
For example:
```swift
...
Expand All @@ -72,16 +71,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Optional - Define the HyperwalletUISDK on the `Theme` object. See the section `Customize the visual style`.

// Set the default tint color
window?.tintColor = Theme.tintColor
window?.tintColor = .systemBlue
// Avoid to display a black area during the view transaction in the UINavigationBar.
window?.backgroundColor = Theme.ViewController.backgroundColor
window?.backgroundColor = Theme.UITableViewController.backgroundColor

// Apply basic theme
ThemeManager.applyTheme()
// Apply TransferMethod theme
ThemeManager.applyTransferMethodTheme()
// Apply Receipt theme
ThemeManager.applyReceiptTheme()
return true
}
}
Expand Down Expand Up @@ -414,9 +409,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

ThemeManager.applyWhiteTheme()
// Set the default tint color
window?.tintColor = Theme.tintColor
window?.tintColor = .systemBlue
// Avoid to display a black area during the view transaction in the UINavigationBar.
window?.backgroundColor = Theme.ViewController.backgroundColor
window?.backgroundColor = Theme.UITableViewController.backgroundColor

return true
}
Expand All @@ -433,6 +428,8 @@ Theme.Label.textColor = UIColor(red: 0 / 255, green: 45 / 255, blue: 67 / 255, a
Theme.Label.errorColor = .red
```

Note: If you do not use `ThemeManager.applyToUINavigationBar()`, then any changes done to Theme.NavigationBar.xxx will not be reflected.

## Error Handling
In Hyperwallet UI SDK, we categorized HyperwalletException into three groups, which are input errors (business errors), network errors and unexpected errors.

Expand Down
2 changes: 1 addition & 1 deletion Transfer/Sources/TransferButtonCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ extension TransferButtonCell {

@objc dynamic var buttonTitleLabelColor: UIColor! {
get { return button.titleLabel?.textColor }
set { button.titleLabel?.textColor = newValue }
set { button.setTitleColor(newValue, for: .normal) }
}

@objc dynamic var buttonBackgroundColor: UIColor! {
Expand Down

0 comments on commit b5096f4

Please sign in to comment.