Merge branch 'master' into rename-func-intention-revealing

pull/249/head
James Sangalli 7 years ago committed by GitHub
commit 0f5fc28178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      Trust.xcodeproj/project.pbxproj
  2. 14
      Trust/Market/UniversalLinkHandler.swift
  3. 1
      Trust/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewController.swift
  4. 19
      TrustTests/Transfer/ViewControllers/TransferTicketsQuantitySelectionViewControllerTests.swift

@ -371,6 +371,7 @@
5E7C7E4B4054AAD41C5BE3EC /* SettingsAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7564AF453BAB0BDAAA57 /* SettingsAction.swift */; }; 5E7C7E4B4054AAD41C5BE3EC /* SettingsAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7564AF453BAB0BDAAA57 /* SettingsAction.swift */; };
5E7C7E5C30EFDC70DF1E00C1 /* TicketsViewControllerHeaderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C77316522DF2B256F1F92 /* TicketsViewControllerHeaderViewModel.swift */; }; 5E7C7E5C30EFDC70DF1E00C1 /* TicketsViewControllerHeaderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C77316522DF2B256F1F92 /* TicketsViewControllerHeaderViewModel.swift */; };
5E7C7EAEBB435F3909DA36FB /* TransferTicketsViaWalletAddressViewControllerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C76D3CFA12C2236E73E10 /* TransferTicketsViaWalletAddressViewControllerViewModel.swift */; }; 5E7C7EAEBB435F3909DA36FB /* TransferTicketsViaWalletAddressViewControllerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C76D3CFA12C2236E73E10 /* TransferTicketsViaWalletAddressViewControllerViewModel.swift */; };
5E7C7EAED92E4AE8B99217AB /* TransferTicketsQuantitySelectionViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7021EE19C4B81CAAF3C0 /* TransferTicketsQuantitySelectionViewControllerTests.swift */; };
5E7C7EEE563D81793CB96FA0 /* TransferTicketsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C755132D9B6F95080A1BE /* TransferTicketsCoordinator.swift */; }; 5E7C7EEE563D81793CB96FA0 /* TransferTicketsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C755132D9B6F95080A1BE /* TransferTicketsCoordinator.swift */; };
5E7C7FAF2A07E7AE21BF09AF /* AlphaWalletSettingsTextRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C71684B93F60206992E10 /* AlphaWalletSettingsTextRow.swift */; }; 5E7C7FAF2A07E7AE21BF09AF /* AlphaWalletSettingsTextRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C71684B93F60206992E10 /* AlphaWalletSettingsTextRow.swift */; };
5E7C7FC0770A411DB09F8C09 /* TokenViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7C077372C3F2A4349FA1 /* TokenViewCell.swift */; }; 5E7C7FC0770A411DB09F8C09 /* TokenViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7C077372C3F2A4349FA1 /* TokenViewCell.swift */; };
@ -800,6 +801,7 @@
5E7C70088832B2D161EB4AAB /* SendViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendViewController.swift; sourceTree = "<group>"; }; 5E7C70088832B2D161EB4AAB /* SendViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendViewController.swift; sourceTree = "<group>"; };
5E7C700CD3E43689E88FBE9B /* SetSellTicketsExpiryDateViewControllerViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetSellTicketsExpiryDateViewControllerViewModel.swift; sourceTree = "<group>"; }; 5E7C700CD3E43689E88FBE9B /* SetSellTicketsExpiryDateViewControllerViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetSellTicketsExpiryDateViewControllerViewModel.swift; sourceTree = "<group>"; };
5E7C7011D8E5C9FFE0E59D55 /* TransferTicketsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsViewController.swift; sourceTree = "<group>"; }; 5E7C7011D8E5C9FFE0E59D55 /* TransferTicketsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsViewController.swift; sourceTree = "<group>"; };
5E7C7021EE19C4B81CAAF3C0 /* TransferTicketsQuantitySelectionViewControllerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsQuantitySelectionViewControllerTests.swift; sourceTree = "<group>"; };
5E7C703BA1D0E9ACB7399155 /* TransferTicketsQuantitySelectionViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsQuantitySelectionViewModel.swift; sourceTree = "<group>"; }; 5E7C703BA1D0E9ACB7399155 /* TransferTicketsQuantitySelectionViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTicketsQuantitySelectionViewModel.swift; sourceTree = "<group>"; };
5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportWalletHelpBubbleView.swift; sourceTree = "<group>"; }; 5E7C70CC85B337061151724E /* ImportWalletHelpBubbleView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImportWalletHelpBubbleView.swift; sourceTree = "<group>"; };
5E7C70FB40612BB02594EC00 /* ChooseTicketTransferModeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChooseTicketTransferModeViewController.swift; sourceTree = "<group>"; }; 5E7C70FB40612BB02594EC00 /* ChooseTicketTransferModeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChooseTicketTransferModeViewController.swift; sourceTree = "<group>"; };
@ -1820,6 +1822,7 @@
29BDF1991FEE50B60023A45F /* Types */, 29BDF1991FEE50B60023A45F /* Types */,
29BDF1921FEE437E0023A45F /* Controllers */, 29BDF1921FEE437E0023A45F /* Controllers */,
299B5E361FCBCDE90051361C /* ViewModels */, 299B5E361FCBCDE90051361C /* ViewModels */,
5E7C7DB8A228007C94CF94AF /* ViewControllers */,
); );
path = Transfer; path = Transfer;
sourceTree = "<group>"; sourceTree = "<group>";
@ -2427,6 +2430,14 @@
path = Helpers; path = Helpers;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
5E7C7DB8A228007C94CF94AF /* ViewControllers */ = {
isa = PBXGroup;
children = (
5E7C7021EE19C4B81CAAF3C0 /* TransferTicketsQuantitySelectionViewControllerTests.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
};
5E7C7F64537949FBD3F77457 /* Views */ = { 5E7C7F64537949FBD3F77457 /* Views */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -3696,6 +3707,7 @@
76F1D850F4F2E968CF8D9C86 /* MonkeyTest.swift in Sources */, 76F1D850F4F2E968CF8D9C86 /* MonkeyTest.swift in Sources */,
5E7C786AD8E4877C36D3B14A /* TicketAdaptorTest.swift in Sources */, 5E7C786AD8E4877C36D3B14A /* TicketAdaptorTest.swift in Sources */,
5E7C7CCA357CB7BF12E1F2B4 /* UIStackView+Array.swift in Sources */, 5E7C7CCA357CB7BF12E1F2B4 /* UIStackView+Array.swift in Sources */,
5E7C7EAED92E4AE8B99217AB /* TransferTicketsQuantitySelectionViewControllerTests.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

@ -39,13 +39,23 @@ public class UniversalLinkHandler {
let binaryData = Data(bytes: link) let binaryData = Data(bytes: link)
let base64String = binaryData.base64EncodedString() let base64String = binaryData.base64EncodedString()
return urlPrefix + base64String return urlPrefix + b64SafeEncoding(base64String)
}
func b64SafeEncoding(_ b64String: String) -> String {
let safeEncodingB64 = b64String.replacingOccurrences(of: "+", with: "-")
return safeEncodingB64.replacingOccurrences(of: "/", with: "_")
}
func b64SafeEncodingToRegularEncoding(_ b64SafeEncodedString: String) -> String {
let regularEncodingb64 = b64SafeEncodedString.replacingOccurrences(of: "-", with: "+")
return regularEncodingb64.replacingOccurrences(of: "_", with: "/")
} }
//TODO add exception handling //TODO add exception handling
//link has shortened price and expiry and must be expanded //link has shortened price and expiry and must be expanded
func parseUniversalLink(url: String) -> SignedOrder { func parseUniversalLink(url: String) -> SignedOrder {
let linkInfo = url.substring(from: urlPrefix.count) let linkInfo = b64SafeEncodingToRegularEncoding(url.substring(from: urlPrefix.count))
let linkBytes = Data(base64Encoded: linkInfo)?.array let linkBytes = Data(base64Encoded: linkInfo)?.array
let price = getPriceFromLinkBytes(linkBytes: linkBytes!) let price = getPriceFromLinkBytes(linkBytes: linkBytes!)
let expiry = getExpiryFromLinkBytes(linkBytes: linkBytes!) let expiry = getExpiryFromLinkBytes(linkBytes: linkBytes!)

@ -53,6 +53,7 @@ class TransferTicketsQuantitySelectionViewController: UIViewController {
quantityStepper, quantityStepper,
].asStackView(axis: .vertical, alignment: .center) ].asStackView(axis: .vertical, alignment: .center)
stackView.translatesAutoresizingMaskIntoConstraints = false stackView.translatesAutoresizingMaskIntoConstraints = false
roundedBackground.addSubview(stackView)
let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required) let buttonsStackView = [nextButton].asStackView(distribution: .fillEqually, contentHuggingPriority: .required)
buttonsStackView.translatesAutoresizingMaskIntoConstraints = false buttonsStackView.translatesAutoresizingMaskIntoConstraints = false

@ -0,0 +1,19 @@
// Copyright © 2018 Stormbird PTE. LTD.
import XCTest
@testable import Trust
import UIKit
class TransferTicketsQuantitySelectionViewControllerTests: XCTestCase {
func testTransferTicketQuantitySelectionViewControllerCanBeCreated() {
let token = TokenObject()
let type = PaymentFlow.send(type: .stormBird(token))
let ticket = Ticket(id: "1", index: 1, city: "", name: "", venue: "", match: 1, date: Date(), seatId: 1, category: 1, countryA: "", countryB: "")
let ticketHolder = TicketHolder(tickets: [ticket], status: .available)
let controller = TransferTicketsQuantitySelectionViewController(paymentFlow: type)
let viewModel = TransferTicketsQuantitySelectionViewModel(ticketHolder: ticketHolder)
controller.configure(viewModel: viewModel)
XCTAssertNoThrow(controller.view)
}
}
Loading…
Cancel
Save