Add LND test wallet

This commit is contained in:
adrianaepure
2023-06-08 09:36:06 +03:00
commit 1313d727cf
251 changed files with 57518 additions and 0 deletions

19
wallet/Utils/Colors.swift Normal file
View File

@ -0,0 +1,19 @@
//
// Colors.swift
// wallet
//
// Created by Jason on 8/20/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
extension UIColor {
public static let yellow500 = #colorLiteral(red: 1, green: 0.9176470588, blue: 0, alpha: 1)
public static let yellow600 = #colorLiteral(red: 0.9294117647, green: 0.8549019608, blue: 0.03137254902, alpha: 1)
public static let purple500 = #colorLiteral(red: 0.6156862745, green: 0.2352941176, blue: 1, alpha: 1)
public static let gray900 = #colorLiteral(red: 0.07058823529, green: 0.07058823529, blue: 0.07058823529, alpha: 1)
public static let white500 = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)
}

23
wallet/Utils/Dimens.swift Normal file
View File

@ -0,0 +1,23 @@
//
// Dimens.swift
// wallet
//
// Created by Jason on 8/27/20.
// Copyright © 2020 Jason. All rights reserved.
//
import Foundation
struct Dimens {
public static let tall = 72
public static let button = 56
public static let bar = 88
public static let minButtonWidth = 140
public static let chip = 44
public static let titleText = 20
public static let normalText = 16
public static let mediumMargin = 16
public static let shadow = 2
}

View File

@ -0,0 +1,24 @@
//
// Date.swift
// wallet
//
// Created by Adriana Epure on 24.08.2022.
// Copyright © 2022 Jason. All rights reserved.
//
import Foundation
extension Date{
func adding(minutes: Int) -> Date {
return Calendar.current.date(byAdding: .minute, value: minutes, to: self)!
}
func adding(seconds: Int) -> Date {
return Calendar.current.date(byAdding: .second, value: seconds, to: self)!
}
func format(style: DateFormatter.Style)->String{
let utcDateFormatter = DateFormatter()
utcDateFormatter.dateStyle = style
utcDateFormatter.timeStyle = style
return utcDateFormatter.string(from: self)
}
}

View File

@ -0,0 +1,15 @@
//
// Date.swift
// wallet
//
// Created by Adriana Epure on 24.08.2022.
// Copyright © 2022 Jason. All rights reserved.
//
import Foundation
extension Int64{
func getAsDate()->Date{
return Date(timeIntervalSince1970: TimeInterval(self))
}
}

View File

@ -0,0 +1,38 @@
//
// Misc.swift
// wallet
//
// Created by Jason on 8/30/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
extension Array {
func chunked(into size: Int) -> [[Element]] {
return stride(from: 0, to: count, by: size).map {
Array(self[$0 ..< Swift.min($0 + size, count)])
}
}
}
extension String {
func toQR(scale: CGFloat = 15.0) -> UIImage? {
let data = self.data(using: String.Encoding.ascii)
// Create the filter and transform it's scale
if let filter = CIFilter(name: "CIQRCodeGenerator") {
filter.setValue(data, forKey: "inputMessage")
let transform = CGAffineTransform(scaleX: scale, y: scale)
if let output = filter.outputImage?.transformed(by: transform) {
return UIImage(ciImage: output)
}
}
return nil
}
}

View File

@ -0,0 +1,17 @@
//
// UIImageView.swift
// wallet
//
// Created by Jason on 8/27/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
extension UIImage {
func tint(_ color: UIColor) -> UIImage {
return withRenderingMode(.alwaysTemplate).withTintColor(color)
}
}

View File

@ -0,0 +1,22 @@
//
// UIView.swift
// wallet
//
// Created by Jason on 8/23/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
extension UIView {
func addSubviewAndFill(_ view: UIView, top: CGFloat = 0.0, bottom: CGFloat = 0.0, leading: CGFloat = 0.0, trailing: CGFloat = 0.0) {
addSubview(view)
view.translatesAutoresizingMaskIntoConstraints = false
view.topAnchor.constraint(equalTo: topAnchor, constant: top).isActive = true
view.leadingAnchor.constraint(equalTo: leadingAnchor, constant: leading).isActive = true
view.trailingAnchor.constraint(equalTo: trailingAnchor, constant: trailing).isActive = true
view.bottomAnchor.constraint(equalTo: bottomAnchor, constant: bottom).isActive = true
}
}

View File

@ -0,0 +1,58 @@
//
// UIViewController.swift
// wallet
//
// Created by Jason van den Berg on 2020/08/18.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
extension UIViewController {
func setTheme() {
view.backgroundColor = Theme.backgroundColor
setNavBarStyles()
}
func setNavBarStyles() {
// Color
navigationController?.navigationBar.barTintColor = Theme.backgroundColor
navigationController?.navigationBar.isTranslucent = false
navigationController?.navigationBar.tintColor = Theme.inverseBackgroundColor
// Shadow
navigationController?.navigationBar.layer.shadowColor = Theme.shadowColor.cgColor
navigationController?.navigationBar.layer.shadowOffset = CGSize(width: 0.0, height: CGFloat(Dimens.shadow))
navigationController?.navigationBar.layer.shadowRadius = 0.0
navigationController?.navigationBar.layer.shadowOpacity = 1.0
navigationController?.navigationBar.layer.masksToBounds = false
navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .any, barMetrics: .default)
navigationController?.navigationBar.shadowImage = UIImage()
// Text
navigationController?.navigationBar.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: Theme.inverseBackgroundColor,
NSAttributedString.Key.font: Fonts.sofiaPro(weight: .medium, Dimens.titleText)
]
}
func hideKeyboardWhenSwipedDown() {
let swipeDown = UISwipeGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard))
swipeDown.direction = UISwipeGestureRecognizer.Direction.down
view.addGestureRecognizer(swipeDown)
}
func hideKeyboardWhenTappedAround() {
let tap = UITapGestureRecognizer(target: self, action: #selector(UIViewController.dismissKeyboard))
tap.cancelsTouchesInView = false
view.addGestureRecognizer(tap)
}
@objc func dismissKeyboard() {
view.endEditing(true)
}
}

31
wallet/Utils/Fonts.swift Normal file
View File

@ -0,0 +1,31 @@
//
// Fonts.swift
// wallet
//
// Created by Jason on 8/20/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
public enum FontStyle {
case regular
case medium
case bold
var name: String {
switch self {
case .regular: return "SofiaProRegular"
case .medium: return "SofiaProMedium"
case .bold: return "SofiaProBold"
}
}
}
struct Fonts {
public static func sofiaPro(weight: FontStyle = .regular, _ size: Int = 16) -> UIFont {
return UIFont(name: weight.name, size: CGFloat(size))!
}
}

16
wallet/Utils/Icons.swift Normal file
View File

@ -0,0 +1,16 @@
//
// Icons.swift
// wallet
//
// Created by Jason on 8/27/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
extension UIImage {
public static let back = #imageLiteral(resourceName: "ic_back")
public static let delete = #imageLiteral(resourceName: "ic_backspace")
}

View File

@ -0,0 +1 @@

View File

@ -0,0 +1,30 @@
//
// Observable.swift
// wallet
//
// Created by Jason on 8/23/20.
// Copyright © 2020 Jason. All rights reserved.
//
import Foundation
class Observable<T> {
private let thread: DispatchQueue
var value: T? {
willSet(newValue) {
if let newValue = newValue {
thread.async {
self.observe?(newValue)
}
}
}
}
var observe: ((T) -> ())?
init(_ value: T? = nil, thread dispatcherThread: DispatchQueue = DispatchQueue.main) {
self.thread = dispatcherThread
self.value = value
}
}

View File

@ -0,0 +1,13 @@
//
// Settings.swift
// wallet
//
// Created by Jason van den Berg on 2020/08/20.
// Copyright © 2020 Jason. All rights reserved.
//
import Foundation
class Settings {
static var isUnitTest = ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil
}

View File

@ -0,0 +1,21 @@
//
// Strings.swift
// wallet
//
// Created by Jason on 8/23/20.
// Copyright © 2020 Jason. All rights reserved.
//
import Foundation
extension String {
public static let defaultError = NSLocalizedString("DEFAULT_ERROR", comment: "A fallback error")
public static let request = NSLocalizedString("REQUEST", comment: "Request")
public static let note = NSLocalizedString("NOTE", comment: "Note")
public static let next = NSLocalizedString("NEXT", comment: "Next")
public static let createQR = NSLocalizedString("CREATE_QR", comment: "Create a QR code")
public static let forLabel = NSLocalizedString("FOR", comment: "For")
public static let requestNotePlaceholder = NSLocalizedString("NOTE_PLACEHOLDER", comment: "Placeholder for the note")
}

63
wallet/Utils/Theme.swift Normal file
View File

@ -0,0 +1,63 @@
//
// Theme.swift
// wallet
//
// Created by Jason on 8/20/20.
// Copyright © 2020 Jason. All rights reserved.
//
import UIKit
struct Theme {
public static let primaryColor: UIColor = {
return UIColor { (UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
return .systemTeal
} else {
return .systemTeal
}
}
}()
public static let primaryDarkColor: UIColor = {
return UIColor { (UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
return .systemBlue
} else {
return .systemBlue
}
}
}()
public static let backgroundColor: UIColor = {
return UIColor { (UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
return .gray900
} else {
return .white500
}
}
}()
public static let inverseBackgroundColor: UIColor = {
return UIColor { (UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
return .white500
} else {
return .gray900
}
}
}()
public static let shadowColor: UIColor = {
return UIColor { (UITraitCollection) -> UIColor in
if UITraitCollection.userInterfaceStyle == .dark {
return UIColor.white500.withAlphaComponent(0.25)
} else {
return UIColor.gray900.withAlphaComponent(0.25)
}
}
}()
}