Skip to content

Commit 0442602

Browse files
author
Peter Joseph Olamit
authored
Tag/1.0.0 beta06 (#239)
* Security fixes * Bug fixes * UI and usability enhancements
1 parent 7fd000a commit 0442602

File tree

135 files changed

+3307
-2586
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+3307
-2586
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,13 @@ Carthage/
6363
# Fastlane
6464
fastlane/README.md
6565
fastlane/report.xml
66+
/.idea/.name
67+
/.idea/runConfigurations/Demo.xml
68+
/.idea/hyperwallet-ios-ui-sdk.iml
69+
/.idea/runConfigurations/HyperwalletUISDK.xml
70+
/.idea/modules.xml
71+
/.idea/vcs.xml
72+
/.idea/workspace.xml
73+
/.idea/xcode.xml
74+
/.idea/shelf/local-config/shelved.patch
75+
/.idea/shelf/local-config.xml

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
[1.0.0-beta06](https://github.com/hyperwallet/hyperwallet-ios-ui-sdk/releases/tag/1.0.0-beta06)
5+
-------------------
6+
- Security fixes
7+
- Bug fixes
8+
- UI and usability enhancements
9+
410
[1.0.0-beta05](https://github.com/hyperwallet/hyperwallet-ios-ui-sdk/releases/tag/1.0.0-beta05)
511
-------------------
612
- Added Analytics to Transfer Method Module

Cartfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta06"
2-
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta02"
1+
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta07"
2+
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta03"

Cartfile.resolved

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
github "JanGorman/Hippolyte" "0.8.0"
22
github "httpswift/swifter" "1.4.7"
3-
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta02"
4-
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta06"
3+
github "hyperwallet/hyperwallet-ios-insight" "1.0.0-beta03"
4+
github "hyperwallet/hyperwallet-ios-sdk" "1.0.0-beta07"

Common/Sources/Extensions/HyperwalletFee.swift

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ public extension HyperwalletFee {
6565
private func flatFeeDescription(_ flatFee: HyperwalletFee) -> String {
6666
var description = ""
6767
let feeFormat = "fee_flat_formatter".localized()
68-
69-
if let currency = flatFee.currency, let flatValue = flatFee.value {
70-
description = String(format: feeFormat.localized(), currency, flatValue)
68+
if let currencySymbol = currencySymbol(currency: flatFee.currency), let flatValue = flatFee.value {
69+
description = String(format: feeFormat.localized(), currencySymbol, flatValue)
7170
}
7271
return description
7372
}
@@ -80,15 +79,18 @@ public extension HyperwalletFee {
8079
let max = percentFee.maximum
8180
let currency = percentFee.currency
8281

83-
if let min = min, let max = max, let value = value, let currency = currency {
82+
if let min = min, let max = max, let value = value,
83+
let currencySymbol = currencySymbol(currency: currency) {
8484
feeFormat = "fee_percent_formatter".localized()
85-
description = String(format: feeFormat, value, currency, min, max)
86-
} else if let min = min, max == nil, let value = value, let currency = currency {
85+
description = String(format: feeFormat, value, currencySymbol, min, max)
86+
} else if let min = min, max == nil, let value = value,
87+
let currencySymbol = currencySymbol(currency: currency) {
8788
feeFormat = "fee_percent_only_min_formatter".localized()
88-
description = String(format: feeFormat, value, currency, min)
89-
} else if min == nil, let max = max, let value = value, let currency = currency {
89+
description = String(format: feeFormat, value, currencySymbol, min)
90+
} else if min == nil, let max = max, let value = value,
91+
let currencySymbol = currencySymbol(currency: currency) {
9092
feeFormat = "fee_percent_only_max_formatter".localized()
91-
description = String(format: feeFormat, value, currency, max)
93+
description = String(format: feeFormat, value, currencySymbol, max)
9294
} else {
9395
if let value = value {
9496
feeFormat = "fee_percent_no_min_and_max_formatter".localized()
@@ -108,28 +110,37 @@ public extension HyperwalletFee {
108110
let currency = flatFee.currency
109111

110112
if let min = min, let max = max, let flatValue = flatValue,
111-
let percentValue = percentValue, let currency = currency {
113+
let percentValue = percentValue, let currencySymbol = currencySymbol(currency: currency) {
112114
feeFormat = "fee_mix_formatter".localized()
113115
description = String(
114-
format: feeFormat, currency, flatValue, percentValue, min, max)
116+
format: feeFormat, currencySymbol, flatValue, percentValue, min, max)
115117
} else if let min = min, max == nil, let flatValue = flatValue,
116-
let percentValue = percentValue, let currency = currency {
118+
let percentValue = percentValue, let currencySymbol = currencySymbol(currency: currency) {
117119
feeFormat = "fee_mix_only_min_formatter".localized()
118120
description = String(
119-
format: feeFormat, currency, flatValue, percentValue, min)
121+
format: feeFormat, currencySymbol, flatValue, percentValue, min)
120122
} else if min == nil, let max = max, let flatValue = flatValue,
121-
let percentValue = percentValue, let currency = currency {
123+
let percentValue = percentValue, let currencySymbol = currencySymbol(currency: currency) {
122124
feeFormat = "fee_mix_only_max_formatter".localized()
123125
description = String(
124-
format: feeFormat, currency, flatValue, percentValue, max)
126+
format: feeFormat, currencySymbol, flatValue, percentValue, max)
125127
} else {
126-
if let flatValue = flatValue, let percentValue = percentValue, let currency = currency {
128+
if let flatValue = flatValue, let percentValue = percentValue,
129+
let currencySymbol = currencySymbol(currency: currency) {
127130
feeFormat = "fee_mix_no_min_and_max_formatter".localized()
128131
description = String(
129-
format: feeFormat, currency, flatValue, percentValue)
132+
format: feeFormat, currencySymbol, flatValue, percentValue)
130133
}
131134
}
132135
return description
133136
}
137+
138+
private func currencySymbol(currency: String?) -> String? {
139+
if let currency = currency {
140+
let locale = NSLocale(localeIdentifier: currency)
141+
return locale.displayName(forKey: .currencySymbol, value: currency)
142+
}
143+
return nil
144+
}
134145
}
135146
}

Common/Sources/Extensions/HyperwalletTransferMethod.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ extension HyperwalletTransferMethod: GenericCellConfiguration {
3333
switch type {
3434
case "BANK_CARD", "PREPAID_CARD":
3535
return String(format: "%@%@",
36-
"transfer_method_list_item_description".localized(),
36+
"endingIn".localized(),
3737
getField(TransferMethodField.cardNumber.rawValue)?
3838
.suffix(startAt: 4) ?? "" )
3939

4040
case "PAYPAL_ACCOUNT":
41-
return getField(TransferMethodField.email.rawValue)
41+
return String(format: "%@%@",
42+
"to".localized(),
43+
getField(TransferMethodField.email.rawValue) ?? "")
4244

4345
default:
4446
return String(format: "%@%@",
45-
"transfer_method_list_item_description".localized(),
47+
"endingIn".localized(),
4648
getField(TransferMethodField.bankAccountId.rawValue)?
4749
.suffix(startAt: 4) ?? "")
4850
}

Common/Sources/Extensions/HyperwalletTransferMethodType.swift

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,15 @@ public extension HyperwalletTransferMethodType {
3131
let attributedText = NSMutableAttributedString()
3232
// Fees
3333
if let fees = self.fees?.nodes {
34-
let feeLabel = "add_transfer_method_fee_label".localized()
35-
36-
attributedText.append(value: feeLabel, font: font, color: color)
37-
attributedText.append(value: HyperwalletFee.format(fees: fees),
38-
font: font,
39-
color: color)
34+
attributedText.append(value: HyperwalletFee.format(fees: fees), font: font, color: color)
4035
}
4136

4237
// Processing Time
4338
if let processingTimeValue = self.processingTimes?.nodes?.first?.value, !processingTimeValue.isEmpty {
44-
var processingTimeLabel = ""
45-
4639
if attributedText.length > 0 {
47-
processingTimeLabel = "\n"
40+
let bulletSymbol = " \u{2022} "
41+
attributedText.append(value: bulletSymbol, font: font, color: color)
4842
}
49-
processingTimeLabel = String(format: "%@%@",
50-
processingTimeLabel,
51-
"add_transfer_method_processing_time_label".localized())
52-
53-
attributedText.append(value: processingTimeLabel, font: font, color: color)
5443
attributedText.append(value: processingTimeValue, font: font, color: color)
5544
}
5645

Common/Sources/Extensions/UIAlertAction.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ import UIKit
2121
/// The UIAlertAction extension
2222
public extension UIAlertAction {
2323
/// The default cancel button label
24-
static let cancel = "cancel_button_label".localized()
24+
static let cancel = "cancelButtonLabel".localized()
2525
/// The default retry button label
2626
static let retry = "try_again_button_label".localized()
2727
/// The default close button label
28-
static let close = "ok_button_label".localized()
28+
static let close = "doneButtonLabel".localized()
2929
/// The default remove button label
30-
static let remove = "remove_button_label".localized()
30+
static let remove = "remove".localized()
3131

3232
/// Initialize a cancel alert action
3333
///

Common/Sources/Extensions/UIImage.swift

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ public extension UIImage {
2727
/// - iconSize: The image size
2828
/// - fontSize: The font size of the icon
2929
/// - textColor: The text color (optional).
30-
/// - backgroundColor: The background color (optional).
3130
/// - returns: A string that will appear as icon
3231
static func fontIcon(_ name: String,
3332
_ iconSize: CGSize,
@@ -37,7 +36,7 @@ public extension UIImage {
3736
paragraph.alignment = NSTextAlignment.center
3837
let fontSize = fontSize
3938
let attributedString = NSAttributedString(string: name, attributes: [
40-
NSAttributedString.Key.font: UIFont(name: "icomoon", size: fontSize)!,
39+
NSAttributedString.Key.font: UIFont(name: "hw_mobile_ui_sdk_icons", size: fontSize)!,
4140
NSAttributedString.Key.foregroundColor: textColor,
4241
NSAttributedString.Key.paragraphStyle: paragraph
4342
])
@@ -52,13 +51,25 @@ public extension UIImage {
5251
return image!
5352
}
5453

54+
/// Create Background Pattern
55+
///
56+
/// - Parameters:
57+
/// - color: UIColor
58+
/// - size: CGSize
59+
/// - cornerRadius: Int
60+
/// - Returns: UIImage
61+
static func createBackgroundPattern(color: UIColor, size: CGSize, cornerRadius: Int) -> UIImage {
62+
let image = imageWithColor(color: color, size: size)
63+
return roundedImage(image: image, cornerRadius: cornerRadius)
64+
}
65+
5566
/// Get an image with specified colors
5667
///
5768
/// - Parameters:
5869
/// - color: color of the image
5970
/// - size: size for the image
6071
/// - Returns: image
61-
static func imageWithColor(color: UIColor, size: CGSize) -> UIImage {
72+
private static func imageWithColor(color: UIColor, size: CGSize) -> UIImage {
6273
let rect = CGRect(x: 0, y: 0, width: size.width, height: size.height)
6374
UIGraphicsBeginImageContextWithOptions(size, false, 0)
6475
color.setFill()
@@ -77,7 +88,7 @@ public extension UIImage {
7788
/// - image: image to be formatted
7889
/// - cornerRadius: cornerRadius
7990
/// - Returns: image with rounded corners
80-
static func roundedImage(image: UIImage, cornerRadius: Int) -> UIImage {
91+
private static func roundedImage(image: UIImage, cornerRadius: Int) -> UIImage {
8192
let rect = CGRect(origin: CGPoint(x: 0, y: 0), size: image.size)
8293
UIGraphicsBeginImageContextWithOptions(image.size, false, 1)
8394
UIBezierPath(
@@ -87,16 +98,4 @@ public extension UIImage {
8798
image.draw(in: rect)
8899
return UIGraphicsGetImageFromCurrentImageContext()!
89100
}
90-
91-
/// Create Background Pattern
92-
///
93-
/// - Parameters:
94-
/// - color: UIColor
95-
/// - size: CGSize
96-
/// - cornerRadius: Int
97-
/// - Returns: UIImage
98-
static func createBackgroundPattern(color: UIColor, size: CGSize, cornerRadius: Int) -> UIImage {
99-
let image = imageWithColor(color: color, size: size)
100-
return roundedImage(image: image, cornerRadius: cornerRadius)
101-
}
102101
}

Common/Sources/Extensions/UIToolbar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public extension UIToolbar {
3232
toolbar.tintColor = Theme.themeColor
3333
toolbar.sizeToFit()
3434

35-
let doneButton = UIBarButtonItem(title: "done_button_label".localized(),
35+
let doneButton = UIBarButtonItem(title: "doneButtonLabel".localized(),
3636
style: .plain,
3737
target: target,
3838
action: action)

0 commit comments

Comments
 (0)