Skip to content

Commit

Permalink
Release 1.0.0-beta10 (#104)
Browse files Browse the repository at this point in the history
- Added Venmo as a Transfer method
- Added support for List Prepaid Card Balances
- Enhancements
  • Loading branch information
jsaini-hw authored Nov 24, 2020
1 parent c7ec0c0 commit a97c2ce
Show file tree
Hide file tree
Showing 52 changed files with 1,564 additions and 329 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: swift
osx_image: xcode11.1
osx_image: xcode11.7
os: osx
branches:
only:
Expand All @@ -15,7 +15,7 @@ env:
- IOS_FRAMEWORK_SCHEME="HyperwalletSDK"

matrix:
- ios_version='13.1' ios_device='iPhone 11' scheme="$IOS_FRAMEWORK_SCHEME" platform='iOS Simulator'
- ios_version='13.7' ios_device='iPhone 11' scheme="$IOS_FRAMEWORK_SCHEME" platform='iOS Simulator'
before_install:
# Boot the emulator by ID
- |
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

[1.0.0-beta10](https://github.com/hyperwallet/hyperwallet-ios-sdk/releases/tag/1.0.0-beta10)
-------------------
- Added Venmo as a Transfer method
- Added support for List Prepaid Card Balances
- Enhancements


[1.0.0-beta09](https://github.com/hyperwallet/hyperwallet-ios-sdk/releases/tag/1.0.0-beta09)
-------------------
- Increased API response timeout
Expand Down
2 changes: 1 addition & 1 deletion HyperwalletSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'HyperwalletSDK'
spec.version = '1.0.0-beta09'
spec.version = '1.0.0-beta10'
spec.summary = 'Hyperwallet Core SDK for iOS to integrate with Hyperwallet Platform'
spec.homepage = 'https://github.com/hyperwallet/hyperwallet-ios-sdk'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
Expand Down
54 changes: 54 additions & 0 deletions HyperwalletSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

166 changes: 130 additions & 36 deletions README.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Sources/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public struct Configuration: Codable {
public let issuer: String
/// The user token
public let userToken: String
/// The program model
public let programModel: String?
var authorization: String!
private static let stalePeriod = 30.0 // 30 seconds
private let createOnBootTime = ProcessInfo.processInfo.systemUptime
Expand All @@ -47,6 +49,7 @@ public struct Configuration: Codable {
case restUrl = "rest-uri"
case insightsUrl = "insights-uri"
case environment = "environment"
case programModel = "program-model"
}

func isTokenStale() -> Bool {
Expand Down
35 changes: 25 additions & 10 deletions Sources/HTTPTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import os.log
import UIKit

/// Builds and performs the HTTP request
final class HTTPTransaction {
Expand Down Expand Up @@ -142,8 +143,7 @@ final class HTTPTransaction {
@escaping (_ response: Response?,
_ error: HyperwalletErrorType?) -> Void)
-> (GraphQlResult<Response>?, HyperwalletErrorType?) -> Void
where Response: Decodable {
{ (result, error) in
where Response: Decodable { { (result, error) in
if let error = error {
completionHandler(nil, error)
}
Expand All @@ -159,8 +159,7 @@ final class HTTPTransaction {
/// Handles the callback has been performed by HTTPClient
static func requestHandler<Response>( _ completionHandler: @escaping (_ response: Response?,
_ error: HyperwalletErrorType?) -> Void)
-> HTTPClientProtocol.ResultHandler where Response: Decodable {
return { (data, response, error) in
-> HTTPClientProtocol.ResultHandler where Response: Decodable { { (data, response, error) in
// Check the transport error has occurred;
guard error == nil, let httpResponse = response as? HTTPURLResponse else {
completionHandler(nil, ErrorTypeHelper.connectionError(for: error))
Expand Down Expand Up @@ -214,8 +213,8 @@ final class HTTPTransaction {
_ payload: Request?,
_ completionHandler: @escaping ((_ response: Response?,
_ error: HyperwalletErrorType?) -> Void)
) -> HyperwalletAuthenticationTokenProvider.CompletionHandler where Request: Encodable, Response: Decodable {
return { [weak self] (authenticationToken, error) in
) -> HyperwalletAuthenticationTokenProvider.CompletionHandler
where Request: Encodable, Response: Decodable { { [weak self] (authenticationToken, error) in
guard let strongSelf = self else {
completionHandler(nil, ErrorTypeHelper.transactionAborted())
return
Expand Down Expand Up @@ -245,6 +244,10 @@ final class HTTPTransaction {
}
}

private static let sdkVersion: String = {
Bundle(for: Hyperwallet.self).infoDictionary?["TAG_VERSION"] as? String ?? "Unknown"
}()

/// Returns the `User-Agent` header.
/// Returns the Hyperwallet SDK `User-Agent` header.
///
Expand All @@ -255,11 +258,15 @@ final class HTTPTransaction {

let version = ProcessInfo.processInfo.operatingSystemVersion
let osVersion = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown"
let sdkVersion = info["CFBundleShortVersionString"] as? String ?? "Unknown"
var displayName = info["CFBundleDisplayName"] as? String ?? "Unknown"
if let appInfo = Bundle.main.infoDictionary as NSDictionary?,
let appDisplayName = appInfo["CFBundleDisplayName"] as? String {
displayName = appDisplayName
}
let sdkBuild = info[kCFBundleVersionKey as String] as? String ?? "Unknown"
let sdkBuildVersion = "\(sdkVersion).\(sdkBuild)"
return "HyperwalletSDK/iOS/\(sdkBuildVersion); App: \(executable); iOS: \(osVersion)"
let deviceName = UIDevice.current.model

return "HyperwalletSDK/iOS/\(sdkVersion); App: \(displayName); iOS: \(osVersion); \(deviceName)"
}()

/// Returns the accept content type.
Expand All @@ -277,13 +284,21 @@ final class HTTPTransaction {
Locale.preferredLanguages.prefix(6).first ?? "en-US"
}()

/// Returns the sdk type.
private static let sdkType: String = {
"ios"
}()

/// Builds the HTTP header configuration
static let urlSessionConfiguration: URLSessionConfiguration = {
let configuration = URLSessionConfiguration.ephemeral
configuration.timeoutIntervalForResource = HTTPTransaction.defaultTimeout
configuration.timeoutIntervalForRequest = HTTPTransaction.defaultTimeout
configuration.httpAdditionalHeaders = [
"User-Agent": userAgent,
"x-sdk-version": sdkVersion,
"x-sdk-type": sdkType,
"x-sdk-contextId": UUID().uuidString,
"Accept-Language": acceptLanguage,
"Accept": contentType,
"Content-Type": contentType
Expand Down
Loading

0 comments on commit a97c2ce

Please sign in to comment.