Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🇺🇦[Feature] added Ukrainian and Added more Unstopppable Domains extensions #111

Merged
merged 4 commits into from
Mar 22, 2022
Merged
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
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ platform :ios, '13.0'

#Shared Cocoapods
def shared_pods
pod 'UnstoppableDomainsResolution', '~> 0.3.6'
pod 'UnstoppableDomainsResolution', '~> 4.0.0'
pod 'KeychainAccess', '~> 4.2'
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
Expand Down
19 changes: 7 additions & 12 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
PODS:
- BigInt (5.2.0)
- CryptoSwift (1.4.0)
- EthereumAddress (1.3.0):
- CryptoSwift (~> 1.0)
- CryptoSwift (1.4.3)
- Firebase/Analytics (6.34.0):
- Firebase/Core
- Firebase/Core (6.34.0):
Expand Down Expand Up @@ -76,22 +74,20 @@ PODS:
- nanopb/decode (1.30906.0)
- nanopb/encode (1.30906.0)
- PromisesObjC (1.2.12)
- UnstoppableDomainsResolution (0.3.7):
- UnstoppableDomainsResolution (4.0.0):
- BigInt
- CryptoSwift (~> 1.0)
- EthereumAddress (~> 1.3)
- CryptoSwift

DEPENDENCIES:
- Firebase/Analytics
- Firebase/Crashlytics
- KeychainAccess (~> 4.2)
- UnstoppableDomainsResolution (~> 0.3.6)
- UnstoppableDomainsResolution (~> 4.0.0)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- BigInt
- CryptoSwift
- EthereumAddress
- Firebase
- FirebaseAnalytics
- FirebaseCore
Expand All @@ -108,8 +104,7 @@ SPEC REPOS:

SPEC CHECKSUMS:
BigInt: f668a80089607f521586bbe29513d708491ef2f7
CryptoSwift: 7cc902df1784de3b389a387756c7d710f197730c
EthereumAddress: 39fe8e11cf04e4e9902b55ae653dbc4e0aee5f30
CryptoSwift: a0799ee936271bd2253a006f1e4523df21845000
Firebase: c23a36d9e4cdf7877dfcba8dd0c58add66358999
FirebaseAnalytics: 3bb096873ee0d7fa4b6c70f5e9166b6da413cc7f
FirebaseCore: d3a978a3cfa3240bf7e4ba7d137fdf5b22b628ec
Expand All @@ -122,8 +117,8 @@ SPEC CHECKSUMS:
KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
UnstoppableDomainsResolution: 1724f30c0dfa4ba672e4b74242e9fc0df240e3a6
UnstoppableDomainsResolution: c3c67f4d0a5e2437cb00d4bd50c2e00d6e743841

PODFILE CHECKSUM: 82e7dcdf6c90affbcb4bb592eaf9122a3fcbcda7
PODFILE CHECKSUM: cb5fb9baf866887c0e8fd058304fe223b0154d12

COCOAPODS: 1.10.1
14 changes: 14 additions & 0 deletions TodayExtension/uk.lproj/MainInterface.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* Class = "UIButton"; normalTitle = "setup wallet"; ObjectID = "fgE-Q8-uG8"; */
"fgE-Q8-uG8.normalTitle" = "setup wallet";

/* Class = "UILabel"; text = "Label"; ObjectID = "gQm-B2-ZXE"; */
"gQm-B2-ZXE.text" = "Label";

/* Class = "UILabel"; text = "scan QR code"; ObjectID = "JgG-Ah-UZk"; */
"JgG-Ah-UZk.text" = "scan QR code";

/* Class = "UILabel"; text = "receive"; ObjectID = "KJN-zr-IQB"; */
"KJN-zr-IQB.text" = "receive";

/* Class = "UILabel"; text = "send"; ObjectID = "QMM-JV-cTG"; */
"QMM-JV-cTG.text" = "send";
46 changes: 19 additions & 27 deletions loafwallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

66 changes: 61 additions & 5 deletions loafwallet/PartnerData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Foundation
import UIKit

enum PartnerName {
case infura
case unstop
case changeNow
}

Expand All @@ -28,10 +28,10 @@ struct Partner {
return [moonpay, simplex]
}

/// Returns Partner Key
/// Returns Partner Key + URL
/// - Parameter name: Enum for the different partners
/// - Returns: Key string
static func partnerKeyPath(name: PartnerName) -> String {
/// - Returns: Key string url
static func partnerKeyPathURL(name: PartnerName) -> String {

/// Switch the config file based on the environment
var filePath: String
Expand All @@ -58,7 +58,7 @@ struct Partner {

switch name {

case .infura:
case .unstop:

if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
let key = dictionary["infura-api"] as? String {
Expand All @@ -85,6 +85,62 @@ struct Partner {

}

/// Returns Partner Key
/// - Parameter name: Enum for the different partners
/// - Returns: Key string
static func partnerKey(name: PartnerName) -> String {

/// Switch the config file based on the environment
var filePath: String
#if Release

// Loads the release Partner Keys config file.
guard let releasePath = Bundle.main.path(forResource: "partner-keys",
ofType: "plist") else {
return "ERROR: FILE-NOT-FOUND"
}
filePath = releasePath

#else

// Loads the debug Partner Keys config file.
guard let debugPath = Bundle.main.path(forResource: "debug-partner-keys",
ofType: "plist") else {
return "ERROR: FILE-NOT-FOUND"
}

filePath = debugPath

#endif

switch name {

case .unstop:

if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
let key = dictionary["infura-api"] as? String {
return key
} else {

let errorDescription = "ERROR-INFURA_KEY"
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription])
return errorDescription
}

case .changeNow:

if let dictionary = NSDictionary(contentsOfFile: filePath) as? Dictionary<String, AnyObject>,
let key = dictionary["change-now-api"] as? String {
return key
} else {

let errorDescription = "ERROR-CHANGENOW_KEY"
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR, properties: ["error": errorDescription])
return errorDescription
}
}
}

//TODO: Uncomment as integration progresses, kcw-grunt
// let bitrefillDictionary =
// ["title":S.BuyCenter.Cells.bitrefillTitle as AnyObject,
Expand Down
58 changes: 58 additions & 0 deletions loafwallet/TextView+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// TextView+Extension.swift
// loafwallet
//
// Created by Kerry Washington on 3/12/22.
// Copyright © 2022 Litecoin Foundation. All rights reserved.
//

import Foundation
import UIKit
import SwiftUI

//https://stackoverflow.com/questions/65297333/adding-placeholder-to-uitextview-in-swiftui-uiviewrepresentable

struct TextView: UIViewRepresentable {

@Binding var text: String
@Binding var didStartEditing: Bool
private var placeholder: String

init(text: Binding<String>,
didStartEditing: Binding<Bool>,
placeholderString: String) {

self._text = text
self._didStartEditing = didStartEditing
self.placeholder = placeholderString
}
let udModel = UnstoppableDomainViewModel()
func makeUIView(context: Context) -> UITextView {
let textView = UITextView()
textView.autocapitalizationType = .sentences
textView.isSelectable = true
textView.isUserInteractionEnabled = true
textView.font = .customBody(size: 6.0)

return textView
}


func updateUIView(_ uiView: UITextView, context: Context) {

if didStartEditing {

uiView.textColor = UIColor.black
uiView.text = text

}
else {
uiView.text = self.placeholder
uiView.textColor = UIColor.lightGray
uiView.font = .customBody(size: 6.0)
}

uiView.font = UIFont.preferredFont(forTextStyle: .body)

}
}
57 changes: 38 additions & 19 deletions loafwallet/UnstoppableDomainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ struct UnstoppableDomainView: View {
@State
private var shouldDisableLookupButton: Bool = true

@State
private var didStartEditing: Bool = false

init(viewModel: UnstoppableDomainViewModel) {
self.viewModel = viewModel
}
Expand All @@ -43,14 +46,37 @@ struct UnstoppableDomainView: View {
.padding(.trailing, 20)
}
} else {

TextField(viewModel.placeholderString, text: $viewModel.searchString)


VStack {
ZStack{

Text(viewModel.placeholderString)
.font(Font(UIFont.customBody(size: 16.0)))
.keyboardType(.URL)
.autocapitalization(.none)
.disableAutocorrection(true)
.padding(.leading, 18)
.padding(.trailing, 5)
.multilineTextAlignment(.leading)
.lineLimit(nil)
.minimumScaleFactor(0.5)
.frame(minWidth: 0, maxWidth: 245)
.frame(height: 55.0, alignment: .leading)
.foregroundColor(.gray)
.opacity(didStartEditing ? 0 : 1)

TextField(".", text: $viewModel.searchString)
.onTapGesture {
didStartEditing = true
}
.font(Font(UIFont.customBody(size: 14.0)))
.keyboardType(.URL)
.autocapitalization(.none)
.disableAutocorrection(true)
.frame(height: 45.0, alignment: .leading)
}
}
.padding(.leading, 10)
.padding(.trailing, 5)



}

Spacer()
Expand All @@ -76,30 +102,23 @@ struct UnstoppableDomainView: View {
.padding(.trailing, 18)
}
}
}.onReceive(viewModel.$searchString, perform: { currentString in

// Description: the minmum domain length is 4 e.g.; 'a.zil'
// Enabling the button when the domain string is at least 4 chars long

shouldDisableLookupButton = currentString.count < 4

})
.disabled(shouldDisableLookupButton)
}

}
Spacer()
Rectangle()
.fill(Color(UIColor.secondaryBorder))
.frame(height: 1.0)
}
}.padding(.leading, 20)

HStack {
Text(S.Fragments.or)
.frame(width: 70, height: 12, alignment: .center)
.frame(width: 70, height: 20, alignment: .center)
.font(Font(UIFont.customBody(size: 15.0)))
.foregroundColor(Color(UIColor.grayTextTint))
.background(Color.white)
.padding(.top, -35)
.frame(width: 160, height: 20.0, alignment: .center)
.padding(.top, -50)
.padding(.leading, 60)
Spacer()
}
Expand Down
Loading