Skip to content

Commit 7432e9b

Browse files
authored
🚀[Release v3.10.0] Merge into Main (#136)
* 🦺[Techdebt] fix firebase (#115) * Update firebase config auto clean up strings - version bump - Commented out debug FB file * Checked the version is sending FB data - bump build number * 🥳[Techdebt] relayout address view controller (#120) * Successfully placed in UIHosting Address Updated the strings file * Added event * added delay - used for animating U Domain * Added function of subviews in SendViewController Layout is updated * Adding the function to the send Cleaned up and wired up Cells - UD View/Model - Send Address View/Model Reset the amount Label in SendViewController * Refactored SendButton - Using UIHostingViewController * Successfully send LTC -WIP: fix white space * Refactored the layout of the send button * buiid bump (#125) * [Techdebt] ci cd refactor (#132) * Removed flaky tests * build bump * build bump * removed unused file - build bump * build bump * fixed scan QR (#130) * fixed scan QR * update gitignore * Feature/add bitrefill new (#134) * Added llocalView - added bitrefill - basic function is available - build bump * bump * added basic web widget * updated logo * build bump * changed the Bitrefill link - build bump * pre-bump version - to get a binary to TestFlight * build bump * build bump again * Clean up background * build bump
1 parent de424b4 commit 7432e9b

16 files changed

Lines changed: 283 additions & 384 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Packages/
2727
Package.pins
2828
Package.resolved
2929
.build/
30-
/*.xcodeproj
3130

3231
# Add this line if you want to avoid checking in Xcode SPM integration.
3332
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

loafwallet.xcodeproj/project.pbxproj

Lines changed: 20 additions & 24 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"images" : [
33
{
4+
"filename" : "bitrefill-logo-app.png",
45
"idiom" : "universal",
5-
"filename" : "bitrefill@1x.png",
66
"scale" : "1x"
77
},
88
{
@@ -11,12 +11,11 @@
1111
},
1212
{
1313
"idiom" : "universal",
14-
"filename" : "bitrefill@3x.png",
1514
"scale" : "3x"
1615
}
1716
],
1817
"info" : {
19-
"version" : 1,
20-
"author" : "xcode"
18+
"author" : "xcode",
19+
"version" : 1
2120
}
22-
}
21+
}
6.44 KB
Loading
Binary file not shown.
Binary file not shown.

loafwallet/BuyTableViewController.swift

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,28 @@
88

99
import UIKit
1010
import SafariServices
11+
import WebKit
12+
import SwiftUI
1113

1214
class BuyTableViewController: UITableViewController, SFSafariViewControllerDelegate {
1315

16+
@IBOutlet weak var bitrefillLogoImageView: UIImageView!
17+
@IBOutlet weak var bitrefillHeaderLabel: UILabel!
18+
@IBOutlet weak var bitrefillDetailsLabel: UILabel!
19+
@IBOutlet weak var bitrefillCellContainerView: UIView!
20+
21+
@IBAction func didTapBitrefill(_ sender: UIButton) {
22+
23+
guard let url = URL(string: "https://www.bitrefill.com/?ref=bAshL935") else
24+
{
25+
return
26+
}
27+
28+
let sfSafariVC = SFSafariViewController(url: url)
29+
sfSafariVC.delegate = self
30+
present(sfSafariVC, animated: true)
31+
}
32+
1433
//MARK: Moonpay UI
1534
@IBOutlet weak var moonpayLogoImageView: UIImageView!
1635
@IBOutlet weak var moonpayHeaderLabel: UILabel!
@@ -94,9 +113,18 @@ class BuyTableViewController: UITableViewController, SFSafariViewControllerDeleg
94113
setupWkVCData()
95114
}
96115

97-
private func setupWkVCData() {
116+
private func setupWkVCData() {
117+
118+
let bitrefillData = Partner.partnerDataArray()[0]
119+
bitrefillLogoImageView.image = bitrefillData.logo
120+
bitrefillHeaderLabel.text = bitrefillData.headerTitle
121+
bitrefillDetailsLabel.text = bitrefillData.details
122+
bitrefillCellContainerView.layer.cornerRadius = 6.0
123+
bitrefillCellContainerView.layer.borderColor = UIColor.white.cgColor
124+
bitrefillCellContainerView.layer.borderWidth = 1.0
125+
bitrefillCellContainerView.clipsToBounds = true
98126

99-
let moonpayData = Partner.partnerDataArray()[0]
127+
let moonpayData = Partner.partnerDataArray()[1]
100128
moonpayLogoImageView.image = moonpayData.logo
101129
moonpayHeaderLabel.text = moonpayData.headerTitle
102130
moonpayDetailsLabel.text = moonpayData.details
@@ -105,7 +133,7 @@ class BuyTableViewController: UITableViewController, SFSafariViewControllerDeleg
105133
moonpayCellContainerView.layer.borderWidth = 1.0
106134
moonpayCellContainerView.clipsToBounds = true
107135

108-
let simplexData = Partner.partnerDataArray()[1]
136+
let simplexData = Partner.partnerDataArray()[2]
109137
simplexLogoImageView.image = simplexData.logo
110138
simplexHeaderLabel.text = simplexData.headerTitle
111139
simplexDetailsLabel.text = simplexData.details

loafwallet/LocalWebView.swift

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
//
2+
// LocalWebView.swift
3+
// loafwallet
4+
//
5+
// Created by Kerry Washington on 10/8/22.
6+
// Copyright © 2022 Litecoin Foundation. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import UIKit
11+
import SwiftUI
12+
import WebKit
13+
import Combine
14+
15+
// MARK: - WebViewHandlerDelegate
16+
protocol WebViewHandlerDelegate {
17+
}
18+
19+
struct LocalWebView: UIViewRepresentable, WebViewHandlerDelegate {
20+
21+
@ObservedObject
22+
var viewModel: LocalWebViewModel
23+
24+
func makeCoordinator() -> Coordinator {
25+
Coordinator(self)
26+
}
27+
28+
func makeUIView(context: Context) -> WKWebView {
29+
30+
let preferences = WKPreferences()
31+
preferences.javaScriptCanOpenWindowsAutomatically = true
32+
33+
let configuration = WKWebViewConfiguration()
34+
configuration.preferences = preferences
35+
36+
let webView = WKWebView(frame: CGRect.zero, configuration: configuration)
37+
webView.navigationDelegate = context.coordinator
38+
webView.allowsBackForwardNavigationGestures = false
39+
webView.scrollView.isScrollEnabled = true
40+
return webView
41+
}
42+
43+
func updateUIView(_ webView: WKWebView, context: Context) {
44+
45+
if let url = Bundle.main.url(forResource: "bitrefill_index", withExtension: "html") {
46+
webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent())
47+
} else {
48+
NSLog("ERROR: Local html not found")
49+
}
50+
}
51+
52+
class Coordinator : NSObject, WKNavigationDelegate {
53+
var parent: LocalWebView
54+
var delegate: WebViewHandlerDelegate?
55+
var valueSubscriber: AnyCancellable? = nil
56+
var webViewNavigationSubscriber: AnyCancellable? = nil
57+
58+
init(_ uiWebView: LocalWebView) {
59+
self.parent = uiWebView
60+
self.delegate = parent
61+
}
62+
63+
deinit {
64+
valueSubscriber?.cancel()
65+
webViewNavigationSubscriber?.cancel()
66+
}
67+
68+
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
69+
70+
self.parent.viewModel.showLoader.send(false)
71+
}
72+
73+
//MARK: WKWebView's delegate functions
74+
func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
75+
// Hides loader
76+
parent.viewModel.showLoader.send(false)
77+
}
78+
79+
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
80+
// Shows loader
81+
parent.viewModel.showLoader.send(true)
82+
}
83+
84+
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
85+
// Shows loader
86+
parent.viewModel.showLoader.send(true)
87+
}
88+
89+
}
90+
}
91+
92+
// MARK: - Extensions
93+
extension LocalWebView.Coordinator: WKScriptMessageHandler {
94+
func userContentController(_ userContentController: WKUserContentController,
95+
didReceive message: WKScriptMessage) {
96+
}
97+
}
98+
99+

loafwallet/LocalWebViewModel.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// LocalWebViewModel.swift
3+
// loafwallet
4+
5+
import Foundation
6+
import Combine
7+
8+
class LocalWebViewModel: ObservableObject {
9+
10+
var showLoader = PassthroughSubject<Bool, Never>()
11+
var valuePublisher = PassthroughSubject<String, Never>()
12+
}

loafwallet/PartnerData.swift

Lines changed: 4 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -23,129 +23,13 @@ struct Partner {
2323
/// Fills partner data
2424
/// - Returns: Array of Partner Data
2525
static func partnerDataArray() -> [Partner] {
26+
27+
let bitrefill = Partner(logo: UIImage(named: "bitrefillLogo")!, headerTitle: S.BuyCenter.Cells.bitrefillTitle, details: S.BuyCenter.Cells.bitrefillFinancialDetails)
2628
let moonpay = Partner(logo: UIImage(named: "moonpay-logo")!, headerTitle: S.BuyCenter.Cells.moonpayTitle, details: S.BuyCenter.Cells.moonpayFinancialDetails)
2729
let simplex = Partner(logo: UIImage(named: "simplexLogo")!, headerTitle: S.BuyCenter.Cells.simplexTitle, details: S.BuyCenter.Cells.simplexFinancialDetails)
28-
return [moonpay, simplex]
29-
}
30-
31-
/// Returns Partner Key + URL
32-
/// - Parameter name: Enum for the different partners
33-
/// - Returns: Key string url
34-
static func partnerKeyPathURL(name: PartnerName) -> String {
35-
36-
/// Switch the config file based on the environment
37-
var filePath: String
38-
#if Release
39-
40-
// Loads the release Partner Keys config file.
41-
guard let releasePath = Bundle.main.path(forResource: "partner-keys",
42-
ofType: "plist") else {
43-
return "ERROR: FILE-NOT-FOUND"
44-
}
45-
filePath = releasePath
46-
47-
#else
48-
49-
// Loads the debug Partner Keys config file.
50-
guard let debugPath = Bundle.main.path(forResource: "debug-partner-keys",
51-
ofType: "plist") else {
52-
return "ERROR: FILE-NOT-FOUND"
53-
}
54-
55-
filePath = debugPath
56-
57-
#endif
58-
59-
switch name {
60-
61-
case .unstop:
62-
63-
if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
64-
let key = dictionary["infura-api"] as? String {
65-
return "https://mainnet.infura.io/v3/" + key
66-
} else {
67-
68-
let errorDescription = "ERROR-INFURA_KEY"
69-
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription])
70-
return errorDescription
71-
}
72-
73-
case .changeNow:
74-
75-
if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
76-
let key = dictionary["change-now-api"] as? String {
77-
return key
78-
} else {
79-
80-
let errorDescription = "ERROR-CHANGENOW_KEY"
81-
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription])
82-
return errorDescription
83-
}
84-
}
85-
86-
}
87-
88-
/// Returns Partner Key
89-
/// - Parameter name: Enum for the different partners
90-
/// - Returns: Key string
91-
static func partnerKey(name: PartnerName) -> String {
92-
93-
/// Switch the config file based on the environment
94-
var filePath: String
95-
#if Release
96-
97-
// Loads the release Partner Keys config file.
98-
guard let releasePath = Bundle.main.path(forResource: "partner-keys",
99-
ofType: "plist") else {
100-
return "ERROR: FILE-NOT-FOUND"
101-
}
102-
filePath = releasePath
103-
104-
#else
105-
106-
// Loads the debug Partner Keys config file.
107-
guard let debugPath = Bundle.main.path(forResource: "debug-partner-keys",
108-
ofType: "plist") else {
109-
return "ERROR: FILE-NOT-FOUND"
110-
}
111-
112-
filePath = debugPath
113-
114-
#endif
115-
116-
switch name {
117-
118-
case .unstop:
119-
120-
if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
121-
let key = dictionary["infura-api"] as? String {
122-
return key
123-
} else {
124-
125-
let errorDescription = "ERROR-INFURA_KEY"
126-
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription])
127-
return errorDescription
128-
}
129-
130-
case .changeNow:
131-
132-
if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
133-
let key = dictionary["change-now-api"] as? String {
134-
return key
135-
} else {
136-
137-
let errorDescription = "ERROR-CHANGENOW_KEY"
138-
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription])
139-
return errorDescription
140-
}
141-
}
30+
return [bitrefill, moonpay, simplex]
14231
}
14332

144-
//TODO: Uncomment as integration progresses, kcw-grunt
145-
// let bitrefillDictionary =
146-
// ["title":S.BuyCenter.Cells.bitrefillTitle as AnyObject,
147-
// "details":S.BuyCenter.Cells.bitrefillFinancialDetails,
148-
// "logo":UIImage(named:"bitrefillLogo") ?? " ",
149-
// "baseColor":#colorLiteral(red: 0.2235294118, green: 0.5490196078, blue: 0.9333333333, alpha: 1)] as [String : AnyObject]
33+
15034
}
15135

0 commit comments

Comments
 (0)