From d24d025e5d1f36cee942d1001ae3571df1814ae4 Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Fri, 18 Nov 2022 15:40:55 +0000
Subject: [PATCH 1/8] Added Package.swift
---
.../contents.xcworkspacedata | 7 ++++++
Package.swift | 24 +++++++++++++++++++
2 files changed, 31 insertions(+)
create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
create mode 100644 Package.swift
diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..919434a
--- /dev/null
+++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/Package.swift b/Package.swift
new file mode 100644
index 0000000..a88d8e4
--- /dev/null
+++ b/Package.swift
@@ -0,0 +1,24 @@
+// swift-tools-version:5.6
+// The swift-tools-version declares the minimum version of Swift required to build this package.
+
+
+import PackageDescription
+
+
+let package = Package(
+ name: "RXPiOS",
+ platforms: [.iOS(.v13)],
+ products: [
+ .library(
+ name: "RXPiOS",
+ targets: ["RXPiOS"]),
+ ],
+ dependencies: [],
+ targets: [
+ .target(
+ name: "RXPiOS",
+ dependencies: [ ],
+ path: "Pod/Classes"
+ ),
+ ]
+)
From a7b5cdce95950443e1c1afafc40abd9abab6aba8 Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Fri, 18 Nov 2022 15:49:34 +0000
Subject: [PATCH 2/8] decrease version required to iOS 9
---
Package.swift | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Package.swift b/Package.swift
index a88d8e4..c66c9df 100644
--- a/Package.swift
+++ b/Package.swift
@@ -7,7 +7,7 @@ import PackageDescription
let package = Package(
name: "RXPiOS",
- platforms: [.iOS(.v13)],
+ platforms: [.iOS(.v9)],
products: [
.library(
name: "RXPiOS",
From 822b6bef0cfc26358ff6172d1077daced835fd45 Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Fri, 18 Nov 2022 15:56:07 +0000
Subject: [PATCH 3/8] Update README
---
README.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/README.md b/README.md
index 2c44e5a..3d67572 100755
--- a/README.md
+++ b/README.md
@@ -22,6 +22,16 @@ pod 'RXPiOS', '~> 1.7.0'
$ pod install
```
+### Swift Package Manager
+
+1. To integrate the Realex Payments iOS Library into your Xcode project using Swift Package Manager, add it as a dependency in your Package.swift file:
+
+```
+dependencies: [
+ .package(url: "https://github.com/wolfej94/rxp-ios", branch: "master")
+]
+```
+
### Manual
If you prefer not to use a dependency manager, you can integrate the Realex Payments iOS Library into your project manually.
From 02c9f99ff353461237faa85106661c8bcd9c9465 Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Fri, 18 Nov 2022 15:57:21 +0000
Subject: [PATCH 4/8] Correct url in README
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 3d67572..ccf291d 100755
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ $ pod install
```
dependencies: [
- .package(url: "https://github.com/wolfej94/rxp-ios", branch: "master")
+ .package(url: "https://github.com/globalpayments/rxp-ios", branch: "master")
]
```
From 1e41f741fa19f78f2a65df2072b1b416da9a5715 Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Thu, 15 Dec 2022 04:01:30 +0000
Subject: [PATCH 5/8] SwiftUI support
---
Pod/Classes/RealexComponent/HPPManager.swift | 14 +++++++-
Pod/Classes/RealexComponent/HPPView.swift | 36 +++++++++++++++++++
.../RealexComponent/HPPViewController.swift | 16 ++++-----
3 files changed, 57 insertions(+), 9 deletions(-)
create mode 100644 Pod/Classes/RealexComponent/HPPView.swift
diff --git a/Pod/Classes/RealexComponent/HPPManager.swift b/Pod/Classes/RealexComponent/HPPManager.swift
index 79fbd67..3826d68 100755
--- a/Pod/Classes/RealexComponent/HPPManager.swift
+++ b/Pod/Classes/RealexComponent/HPPManager.swift
@@ -202,10 +202,22 @@ public class GenericHPPManager: NSObject, HPPViewControllerDelegat
}
getHPPRequest()
let navigationController = UINavigationController(rootViewController: self.hppViewController)
- navigationController.modalPresentationStyle = .fullScreen
+ navigationController.modalPresentationStyle = .pageSheet
viewController.present(navigationController, animated: true, completion: nil)
}
+
+ public func viewController() -> HPPViewController {
+ guard let producerURL = HPPRequestProducerURL, !producerURL.absoluteString.isEmpty else {
+ let error = HPPManagerError.missingProducerURL()
+ self.delegate?.HPPManagerFailedWithError(error)
+ self.genericDelegate?.HPPManagerFailedWithError(error)
+ return hppViewController
+ }
+ getHPPRequest()
+ return self.hppViewController
+ }
+
/// Converts a dictionay of string pairs into a html string reporesentation and encoded that as date for attaching to the request.
/// - Parameter json: The dictionary of paramaters and values to be encoded.
/// - Returns: The data encoded HTML string representation of the paramaters and values.
diff --git a/Pod/Classes/RealexComponent/HPPView.swift b/Pod/Classes/RealexComponent/HPPView.swift
new file mode 100644
index 0000000..015f921
--- /dev/null
+++ b/Pod/Classes/RealexComponent/HPPView.swift
@@ -0,0 +1,36 @@
+//
+// HPPView.swift
+// HippoTrade
+//
+// Created by James Wolfe on 15/12/2022.
+//
+
+
+
+import UIKit
+import SwiftUI
+
+
+
+public struct HPPView: UIViewControllerRepresentable {
+
+ var manager: Binding
+
+ public func makeCoordinator() -> Coordinator {
+ Coordinator(manager: manager)
+ }
+
+ public class Coordinator: NSObject {
+ var manager: Binding
+
+ init(manager: Binding) {
+ self.manager = manager
+ }
+ }
+
+ public func makeUIViewController(context: UIViewControllerRepresentableContext) -> UINavigationController {
+ return UINavigationController(rootViewController: context.coordinator.manager.wrappedValue.viewController())
+ }
+
+ public func updateUIViewController(_ uiViewController: UINavigationController, context: UIViewControllerRepresentableContext) { }
+}
diff --git a/Pod/Classes/RealexComponent/HPPViewController.swift b/Pod/Classes/RealexComponent/HPPViewController.swift
index cf03c0f..c68d147 100755
--- a/Pod/Classes/RealexComponent/HPPViewController.swift
+++ b/Pod/Classes/RealexComponent/HPPViewController.swift
@@ -9,12 +9,12 @@ import WebKit
}
/// The Web View Controller which encapsulates the management of the webivew and the interaction with the HPP web page.
-class HPPViewController: UIViewController, WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler {
+public class HPPViewController: UIViewController, WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler {
var webView: WKWebView?
var delegate: HPPViewControllerDelegate?
- override func viewDidLoad() {
+ public override func viewDidLoad() {
super.viewDidLoad()
initialiseWebView()
@@ -77,26 +77,26 @@ class HPPViewController: UIViewController, WKNavigationDelegate, WKUIDelegate,
// MARK: - WKWebView Delegate Callbacks
- func webView(_ webView: WKWebView,
+ public func webView(_ webView: WKWebView,
didStartProvisionalNavigation navigation: WKNavigation) {
UIApplication.shared.isNetworkActivityIndicatorVisible = true
}
- func webView(_ webView: WKWebView,
+ public func webView(_ webView: WKWebView,
didFinish navigation: WKNavigation) {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
}
- func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
+ public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
UIApplication.shared.isNetworkActivityIndicatorVisible = false
delegate?.HPPViewControllerFailedWithError(error)
}
/// Allow all requests to be loaded
- func webView(_ webView: WKWebView,
+ public func webView(_ webView: WKWebView,
decidePolicyFor navigationResponse: WKNavigationResponse,
decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
@@ -104,7 +104,7 @@ class HPPViewController: UIViewController, WKNavigationDelegate, WKUIDelegate,
}
/// Allow all navigation actions
- func webView(_ webView: WKWebView,
+ public func webView(_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
@@ -114,7 +114,7 @@ class HPPViewController: UIViewController, WKNavigationDelegate, WKUIDelegate,
// MARK: - Javascript Message Callback
/// Delegate callback which receives any massages from the Javascript bridge
- func userContentController(_ userContentController: WKUserContentController,
+ public func userContentController(_ userContentController: WKUserContentController,
didReceive message: WKScriptMessage) {
if let messageString = message.body as? String {
From 1ed0574f96f27740b092a04af794211dc9c84cac Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Thu, 15 Dec 2022 04:03:41 +0000
Subject: [PATCH 6/8] up target
---
Package.swift | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Package.swift b/Package.swift
index c66c9df..a88d8e4 100644
--- a/Package.swift
+++ b/Package.swift
@@ -7,7 +7,7 @@ import PackageDescription
let package = Package(
name: "RXPiOS",
- platforms: [.iOS(.v9)],
+ platforms: [.iOS(.v13)],
products: [
.library(
name: "RXPiOS",
From 88b4cd0473d07cb5b047ddc5a21ba18f35cb521e Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Thu, 15 Dec 2022 04:05:22 +0000
Subject: [PATCH 7/8] make swiftUi only available for iOS 13
---
Package.swift | 2 +-
Pod/Classes/RealexComponent/HPPView.swift | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Package.swift b/Package.swift
index a88d8e4..c66c9df 100644
--- a/Package.swift
+++ b/Package.swift
@@ -7,7 +7,7 @@ import PackageDescription
let package = Package(
name: "RXPiOS",
- platforms: [.iOS(.v13)],
+ platforms: [.iOS(.v9)],
products: [
.library(
name: "RXPiOS",
diff --git a/Pod/Classes/RealexComponent/HPPView.swift b/Pod/Classes/RealexComponent/HPPView.swift
index 015f921..3c817d2 100644
--- a/Pod/Classes/RealexComponent/HPPView.swift
+++ b/Pod/Classes/RealexComponent/HPPView.swift
@@ -11,7 +11,7 @@ import UIKit
import SwiftUI
-
+@available(iOS 13, *)
public struct HPPView: UIViewControllerRepresentable {
var manager: Binding
From 1917dc5e803cfee90082ba65a9f7667306bc1122 Mon Sep 17 00:00:00 2001
From: James Wolfe <56296015+wolfej94@users.noreply.github.com>
Date: Thu, 15 Dec 2022 04:08:22 +0000
Subject: [PATCH 8/8] public init
---
Pod/Classes/RealexComponent/HPPView.swift | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Pod/Classes/RealexComponent/HPPView.swift b/Pod/Classes/RealexComponent/HPPView.swift
index 3c817d2..88acdb1 100644
--- a/Pod/Classes/RealexComponent/HPPView.swift
+++ b/Pod/Classes/RealexComponent/HPPView.swift
@@ -16,6 +16,10 @@ public struct HPPView: UIViewControllerRepresentable {
var manager: Binding
+ public init(manager: Binding) {
+ self.manager = manager
+ }
+
public func makeCoordinator() -> Coordinator {
Coordinator(manager: manager)
}