Skip to content

Commit

Permalink
release version 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Takeichi Kanzaki Cabrera committed Oct 14, 2019
1 parent f360a15 commit a4dbfc2
Show file tree
Hide file tree
Showing 44 changed files with 311 additions and 216 deletions.
4 changes: 2 additions & 2 deletions AptoUISDK.podspec
Expand Up @@ -8,15 +8,15 @@

Pod::Spec.new do |s|
s.name = "AptoUISDK"
s.version = "2.1.1"
s.version = "2.2.0"
s.summary = "The Apto UI platform iOS SDK."
s.description = <<-DESC
Apto iOS UI SDK
DESC
s.homepage = "https://github.com/ShiftFinancial/apto-ui-sdk-ios.git"
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.authors = { "Ivan Oliver" => "ivan@aptopayments.com", "Takeichi Kanzaki" => "takeichi@aptopayments.com" }
s.source = { :git => "https://github.com/ShiftFinancial/apto-ui-sdk-ios.git", :tag => "2.1.1" }
s.source = { :git => "https://github.com/ShiftFinancial/apto-ui-sdk-ios.git", :tag => "2.2.0" }

s.platform = :ios
s.ios.deployment_target = '10.0'
Expand Down
2 changes: 1 addition & 1 deletion Example/Demo/Info.plist
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildDate</key>
<date>2019-10-10T15:05:23Z</date>
<date>2019-10-14T10:49:35Z</date>
<key>BuildType</key>
<string>Local</string>
<key>CFBundleDevelopmentRegion</key>
Expand Down
4 changes: 4 additions & 0 deletions Example/ShiftSDK.xcodeproj/project.pbxproj
Expand Up @@ -59,6 +59,7 @@
3C03E9072338F36C00C565F1 /* MonthlyStatementsListTestDoubles.swift in Sources */ = {isa = PBXBuildFile; fileRef = D99BDF362267784FD59F03DB /* MonthlyStatementsListTestDoubles.swift */; };
3C1074192265C89F0050F8D1 /* PhoneHelperTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D99BDDAA9712890A02CB79BC /* PhoneHelperTest.swift */; };
3C1ECAB122D8E33400DBC484 /* TransactionDeclineCodeTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C1ECAB022D8E33400DBC484 /* TransactionDeclineCodeTest.swift */; };
3C3D1F8A2350D6C6007D39AB /* SystemServicesLocatorFake.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C3D1F892350D6C6007D39AB /* SystemServicesLocatorFake.swift */; };
3C533F7F22EB0A80008B23BE /* CustodianSerializerTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = D99BD60A22D2072B3066FE37 /* CustodianSerializerTest.swift */; };
3C65E0BA217E10BB000207B1 /* PhysicalCardActivationSucceedTestDoubles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C65E0B9217E10BB000207B1 /* PhysicalCardActivationSucceedTestDoubles.swift */; };
3C92D20E2343903F00C48D90 /* MonthTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C92D20D2343903F00C48D90 /* MonthTest.swift */; };
Expand Down Expand Up @@ -298,6 +299,7 @@
2CFD384D1FA8BA1500ADD20E /* InputPhoneScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputPhoneScreen.swift; sourceTree = "<group>"; };
2FD9B79683F0323F267BEC7B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
3C1ECAB022D8E33400DBC484 /* TransactionDeclineCodeTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionDeclineCodeTest.swift; sourceTree = "<group>"; };
3C3D1F892350D6C6007D39AB /* SystemServicesLocatorFake.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemServicesLocatorFake.swift; sourceTree = "<group>"; };
3C65E0B9217E10BB000207B1 /* PhysicalCardActivationSucceedTestDoubles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhysicalCardActivationSucceedTestDoubles.swift; sourceTree = "<group>"; };
3C92D20D2343903F00C48D90 /* MonthTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonthTest.swift; sourceTree = "<group>"; };
3C92D20F2343964A00C48D90 /* MonthlyStatementsPeriodTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MonthlyStatementsPeriodTest.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -846,6 +848,7 @@
D99BDC2FDC2845B7677B51D6 /* NetworkLocatorFake.swift */,
D99BD2444FD3D4A30DF44712 /* StorageLocatorFake.swift */,
D99BD6317D88070D88438911 /* CoreServiceLocatorFake.swift */,
3C3D1F892350D6C6007D39AB /* SystemServicesLocatorFake.swift */,
);
path = ServiceLocator;
sourceTree = "<group>";
Expand Down Expand Up @@ -1680,6 +1683,7 @@
D99BD3FC46EB7E2860BE7B34 /* WaitListInteractorTest.swift in Sources */,
D99BDD962605FDC27E887E36 /* WaitListPresenterTest.swift in Sources */,
D99BDEF95E697662D1BEE92F /* WaitListTestDoubles.swift in Sources */,
3C3D1F8A2350D6C6007D39AB /* SystemServicesLocatorFake.swift in Sources */,
D99BD7D9DFC6501E146260CE /* WaitListModuleTest.swift in Sources */,
D99BDC35F7F3035D0C7C71F0 /* CardWaitListInteractorTest.swift in Sources */,
D99BD5648E64479ACA8F7BAF /* CardWaitListPresenterTest.swift in Sources */,
Expand Down
Expand Up @@ -131,9 +131,9 @@ class InteractorLocatorFake: InteractorLocatorProtocol {
}

lazy var monthlyStatementsReportInteractorFake = MonthlyStatementsReportInteractorFake()
func monthlyStatementsReportInteractor(report: MonthlyStatementReport,
downloader: FileDownloader) -> MonthlyStatementsReportInteractorProtocol {
return monthlyStatementsReportInteractorFake
func monthlyStatementsReportInteractor(month: Month, downloaderProvider: FileDownloaderProvider)
-> MonthlyStatementsReportInteractorProtocol {
return monthlyStatementsReportInteractorFake
}

// MARK: - Physical card activation
Expand Down
Expand Up @@ -207,7 +207,7 @@ class ModuleLocatorFake: ModuleLocatorProtocol {
lazy var monthlyStatementsReportModuleSpy: MonthlyStatementsReportModuleSpy = {
return MonthlyStatementsReportModuleSpy(serviceLocator: serviceLocator)
}()
func monthlyStatementsReportModule(statementReport: MonthlyStatementReport) -> MonthlyStatementsReportModuleProtocol {
func monthlyStatementsReportModule(month: Month) -> MonthlyStatementsReportModuleProtocol {
return monthlyStatementsReportModuleSpy
}

Expand Down
Expand Up @@ -21,6 +21,9 @@ class ServiceLocatorFake: AptoUISDK.ServiceLocatorProtocol {

lazy var viewLocator: ViewLocatorProtocol = ViewLocatorFake()

lazy var systemServicesLocator: SystemServicesLocatorProtocol = systemServicesLocatorFake
lazy var systemServicesLocatorFake = SystemServicesLocatorFake()

private(set) var platformFake = AptoPlatformFake()
var platform: AptoPlatformProtocol {
return platformFake
Expand Down
@@ -0,0 +1,16 @@
//
// SystemServicesLocatorFake.swift
// AptoSDK
//
// Created by Takeichi Kanzaki on 11/10/2019.
//

import Foundation
@testable import AptoUISDK

class SystemServicesLocatorFake: SystemServicesLocatorProtocol {
lazy var fileDownloaderFake = FileDownloaderFake()
func fileDownloader(url: URL, localFilename: String) -> FileDownloader {
return fileDownloaderFake
}
}
Expand Up @@ -56,4 +56,18 @@ class CardMonthlyStatsModuleTest: XCTestCase {
// Then
XCTAssertTrue(transactionListModule.initializeCalled)
}

func testShowStatementReportShowMonthlyStatementsReportModule() {
// Given
let month = ModelDataProvider.provider.month
let moduleLocator = serviceLocator.moduleLocatorFake
let monthlyStatementsReportModule = moduleLocator.monthlyStatementsReportModuleSpy

// When
sut.showStatementReport(month: month)

// Then
XCTAssertTrue(monthlyStatementsReportModule.initializeCalled)
XCTAssertNotNil(monthlyStatementsReportModule.onClose)
}
}
Expand Up @@ -217,4 +217,17 @@ class CardMonthlyStatsPresenterTest: XCTestCase {
XCTAssertTrue(analyticsManager.trackCalled)
XCTAssertEqual(analyticsManager.lastEvent, Event.monthlySpending)
}

// MARK: - Monthly statements
func testMonthlyStatementsTappedCallInteractor() {
// Given
let date = Date()

// When
sut.monthlyStatementsTapped(date: date)

// Then
XCTAssertTrue(router.showStatementReportCalled)
XCTAssertEqual(Month(from: date), router.lastShowStatementReportMonth)
}
}
Expand Up @@ -19,6 +19,13 @@ class CardMonthlyStatsModuleSpy: UIModuleSpy, CardMonthlyStatsModuleProtocol {
lastCategorySpendingStartDate = startDate
lastCategorySpendingEndDate = endDate
}

private(set) var showStatementReportCalled = false
private(set) var lastShowStatementReportMonth: Month?
func showStatementReport(month: Month) {
showStatementReportCalled = true
lastShowStatementReportMonth = month
}
}

class CardMonthlyStatsInteractorSpy: CardMonthlyStatsInteractorProtocol {
Expand Down Expand Up @@ -74,4 +81,11 @@ class CardMonthlyStatsPresenterSpy: CardMonthlyStatsPresenterProtocol {
lastCategorySpendingSelected = categorySpending
lastCategorySpendingSelectedDate = date
}

private(set) var monthlyStatementsTappedCalled = false
private(set) var lastMonthlyStatementsTappedDate: Date?
func monthlyStatementsTapped(date: Date) {
monthlyStatementsTappedCalled = true
lastMonthlyStatementsTappedDate = date
}
}
Expand Up @@ -50,34 +50,4 @@ class MonthlyStatementsListInteractorTest: XCTestCase {
XCTAssertTrue(result.isFailure)
}
}

func testStatementCallPlatform() {
// When
sut.fetchStatement(month: 2, year: 2019) { _ in }

// Then
XCTAssertTrue(platform.fetchMonthlyStatementReportCalled)
}

func testFetchStatementReportSucceedCallSuccess() {
// Given
platform.nextFetchMonthlyStatementReportResult = .success(dataProvider.monthlyStatementReport)

// When
sut.fetchStatement(month: 2, year: 2019) { result in
// Then
XCTAssertTrue(result.isSuccess)
}
}

func testFetchStatementReportFailsCallbackFailure() {
// Given
platform.nextFetchMonthlyStatementReportResult = .failure(BackendError(code: .other))

// When
sut.fetchStatement(month: 2, year: 2019) { result in
// Then
XCTAssertTrue(result.isFailure)
}
}
}
Expand Up @@ -49,12 +49,12 @@ class MonthlyStatementsListModuleTest: XCTestCase {

func testShowStatementReportShowMonthlyStatementsReportModule() {
// Given
let report = dataProvider.monthlyStatementReport
let month = dataProvider.month
let moduleLocator = serviceLocator.moduleLocatorFake
let monthlyStatementsReportModule = moduleLocator.monthlyStatementsReportModuleSpy

// When
sut.showStatementReport(report)
sut.showStatementReport(month: month)

// Then
XCTAssertTrue(monthlyStatementsReportModule.initializeCalled)
Expand Down
Expand Up @@ -105,47 +105,6 @@ class MonthlyStatementsListPresenterTest: XCTestCase {
sut.monthSelected(month)

// Then
XCTAssertTrue(router.showLoadingViewCalled)
XCTAssertTrue(interactor.fetchStatementCalled)
}

func testFetchStatementFailsUpdateError() {
// Given
let error = BackendError(code: .other)
interactor.nextFetchStatementResult = .failure(error)
let month = dataProvider.month

// When
sut.monthSelected(month)

// Then
XCTAssertTrue(router.hideLoadingViewCalled)
XCTAssertEqual(error, sut.viewModel.error.value)
}

func testFetchStatementSucceedWithoutUrlUpdateError() {
// Given
interactor.nextFetchStatementResult = .success(dataProvider.monthlyStatementReportWithoutUrl)
let month = dataProvider.month

// When
sut.monthSelected(month)

// Then
XCTAssertTrue(router.hideLoadingViewCalled)
XCTAssertTrue(sut.viewModel.error.value is FetchStatementReportError)
}

func testFetchStatementSucceedCallRouterToShowReport() {
// Given
interactor.nextFetchStatementResult = .success(dataProvider.monthlyStatementReport)
let month = dataProvider.month

// When
sut.monthSelected(month)

// Then
XCTAssertTrue(router.hideLoadingViewCalled)
XCTAssertTrue(router.showStatementReportCalled)
}
}
Expand Up @@ -10,10 +10,10 @@

class MonthlyStatementsListModuleSpy: UIModuleSpy, MonthlyStatementsListModuleProtocol {
private(set) var showStatementReportCalled = false
private(set) var lastShowStatementReport: MonthlyStatementReport?
func showStatementReport(_ report: MonthlyStatementReport) {
private(set) var lastShowStatementReportMonth: Month?
func showStatementReport(month: Month) {
showStatementReportCalled = true
lastShowStatementReport = report
lastShowStatementReportMonth = month
}
}

Expand All @@ -22,15 +22,6 @@ class MonthlyStatementsListInteractorSpy: MonthlyStatementsListInteractorProtoco
func fetchStatementsPeriod(callback: @escaping Result<MonthlyStatementsPeriod, NSError>.Callback) {
fetchStatementsPeriodCalled = true
}

private(set) var fetchStatementCalled = false
private(set) var lastFetchStatementMonth: Int?
private(set) var lastFetchStatementYear: Int?
func fetchStatement(month: Int, year: Int, callback: @escaping Result<MonthlyStatementReport, NSError>.Callback) {
fetchStatementCalled = true
lastFetchStatementMonth = month
lastFetchStatementYear = year
}
}

class MonthlyStatementsListInteractorFake: MonthlyStatementsListInteractorSpy {
Expand All @@ -41,15 +32,6 @@ class MonthlyStatementsListInteractorFake: MonthlyStatementsListInteractorSpy {
callback(result)
}
}

var nextFetchStatementResult: Result<MonthlyStatementReport, NSError>?
override func fetchStatement(month: Int, year: Int,
callback: @escaping Result<MonthlyStatementReport, NSError>.Callback) {
super.fetchStatement(month: month, year: year, callback: callback)
if let result = nextFetchStatementResult {
callback(result)
}
}
}

class MonthlyStatementsListPresenterSpy: MonthlyStatementsListPresenterProtocol {
Expand Down

0 comments on commit a4dbfc2

Please sign in to comment.