Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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(.v9)],
products: [
.library(
name: "RXPiOS",
targets: ["RXPiOS"]),
],
dependencies: [],
targets: [
.target(
name: "RXPiOS",
dependencies: [ ],
path: "Pod/Classes"
),
]
)
14 changes: 13 additions & 1 deletion Pod/Classes/RealexComponent/HPPManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,22 @@ public class GenericHPPManager<T: Decodable>: 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.
Expand Down
40 changes: 40 additions & 0 deletions Pod/Classes/RealexComponent/HPPView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//
// HPPView.swift
// HippoTrade
//
// Created by James Wolfe on 15/12/2022.
//



import UIKit
import SwiftUI


@available(iOS 13, *)
public struct HPPView: UIViewControllerRepresentable {

var manager: Binding<HPPManager>

public init(manager: Binding<HPPManager>) {
self.manager = manager
}

public func makeCoordinator() -> Coordinator {
Coordinator(manager: manager)
}

public class Coordinator: NSObject {
var manager: Binding<HPPManager>

init(manager: Binding<HPPManager>) {
self.manager = manager
}
}

public func makeUIViewController(context: UIViewControllerRepresentableContext<HPPView>) -> UINavigationController {
return UINavigationController(rootViewController: context.coordinator.manager.wrappedValue.viewController())
}

public func updateUIViewController(_ uiViewController: UINavigationController, context: UIViewControllerRepresentableContext<HPPView>) { }
}
16 changes: 8 additions & 8 deletions Pod/Classes/RealexComponent/HPPViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -77,34 +77,34 @@ 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) {

decisionHandler(.allow)
}

/// Allow all navigation actions
func webView(_ webView: WKWebView,
public func webView(_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {

Expand All @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/globalpayments/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.
Expand Down