Skip to content

Commit

Permalink
Release - 0.26.0 (#1061)
Browse files Browse the repository at this point in the history
- Fixed issue with available balance. Now the time-locked tokes will be subtracted from the available balance.
- The screenshots and screen recording are now disabled by default.
- The user can enable screenshots and screen recording from the settings menu.
- Fixed reported issue, now TransactionFormatter will format the amount as negative only when the transaction was ongoing.
- Changed FFI log level from 2 (warning) to 4 (info) on production builds.
- Added logs from Tor Framework to App's log file.
- Added address poisoning prevention feature. Now when the user has a contact that is similar to another, he will be asked for confirmation or to switch to another one.
- Fixed issue with the onboarding screen. Now the screen still be responsive when the emoji ID view is expanded.
- Updated block explorer URLs
- Moved constants related to block explorer from TariSettings to AppValues
- removed isBlockExplorerAvaiable flag
- Fixed reported issue. Now profile page generates te QR code with the "profile" deep link type.
- Fixed issue with the UI. Now AddressPoisoningDataHandler will always present UI on the main thread.
- Replaced availableToSpend property to the available variable,
- Removed availableToSpend combined property from WalletBalance
- Implemented DNS Lookup functionality using an existing feature from the FFI Library
- Adopted coinbase transaction maturity feature from FFI Library.
- Now, UTXOs that came from coinbase will be unspanable before they "mature".
- Added 3 new transaction states. New states are handled by all state handlers and formatters.
- Added a new field to TariNetwork. blockExplorerURL will store block explorer URL related to the network. When blockExplorerURL is nil then the block explorer feature is disabled in the app.
- Added NextNet TariNetwork configuration
- Hidden contact section on the transaction details screen for the coinbase's transaction type.
- Fixed issue with some UI elements was unresponsive on iOS 15.
- Fixed reported issue. The App will no longer crash when user move to the screenshot prevention settings screen.
- Turned on generated asset symbols in project settings
- Converted new Theme variables to generated asset symbols
- Converted older vector assets to the Generated Asset Symbols
- Removed unnecessary UIColor from every color input in ColorTheme.
- Replaced old base node screen with form.
- Replaced form single field form on the restore wallet screen with a new form with two fields.
- Added a one-time peer db migration feature
- Updated FFI Library to v1.0.0-rc.8
- Switched used network to NextNet
  • Loading branch information
TruszczynskiA authored May 16, 2024
1 parent 573e70f commit 0c8565e
Show file tree
Hide file tree
Showing 446 changed files with 3,102 additions and 1,584 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ disabled_rules:
- multiple_closures_with_trailing_closure
- function_parameter_count
- todo
- opening_brace # False positives on regex

excluded:
- Pods
Expand Down
178 changes: 125 additions & 53 deletions MobileWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
LastUpgradeVersion = "1530"
wasCreatedForAppExtension = "YES"
version = "1.3">
<BuildAction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.700",
"blue" : "0x00",
"green" : "0x00",
"red" : "0x00"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
9 changes: 9 additions & 0 deletions MobileWallet/Assets.xcassets/Icons/General/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "ShieldCheckmark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "Camera.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
9 changes: 9 additions & 0 deletions MobileWallet/Assets.xcassets/Icons/UTXO/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
9 changes: 9 additions & 0 deletions MobileWallet/Assets.xcassets/Icons/Yat/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
9 changes: 9 additions & 0 deletions MobileWallet/Assets.xcassets/Images/Themes/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
9 changes: 9 additions & 0 deletions MobileWallet/Assets.xcassets/Images/UTXO/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"provides-namespace" : true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
2 changes: 1 addition & 1 deletion MobileWallet/Backup/ICloud/ICloudBackupService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ extension ICloudBackupService: BackupServicable {

func performBackup(forced: Bool) {

guard !AppValues.isSimulator, isOn else { return }
guard !AppValues.general.isSimulator, isOn else { return }
guard forced || backupStatusValue.isFailed else { return }

Task {
Expand Down
27 changes: 20 additions & 7 deletions MobileWallet/Common/AppRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,19 @@ enum AppRouter {
tabBar?.present(controller, animated: true)
}

static func presentOnTop(controller: UIViewController) {
static func presentOnTop(controller: UIViewController, onFullScreen: Bool = false) {

guard var topViewController = UIApplication.shared.topController else { return }

while let presentedViewController = topViewController.presentedViewController {
topViewController = presentedViewController
}

topViewController.present(controller, animated: true)
if onFullScreen {
topViewController.presentOnFullScreen(controller)
} else {
topViewController.present(controller, animated: true)
}
}

static func presentVerifiySeedPhrase() {
Expand Down Expand Up @@ -169,11 +173,20 @@ enum AppRouter {
tabBar?.present(navigationController, animated: true)
}

static func presentSendTransaction(paymentInfo: PaymentInfo) {
let controller = AddAmountViewController(paymentInfo: paymentInfo)
let navigationController = AlwaysPoppableNavigationController(rootViewController: controller)
navigationController.isNavigationBarHidden = true
tabBar?.presentOnFullScreen(navigationController)
@MainActor static func presentSendTransaction(paymentInfo: PaymentInfo, presenter: UINavigationController? = nil) {
AddressPoisoningDataHandler.handleAddressSelection(paymentInfo: paymentInfo) { selectedPaymentInfo in

let controller = AddAmountViewController(paymentInfo: selectedPaymentInfo)

guard let presenter else {
let navigationController = AlwaysPoppableNavigationController(rootViewController: controller)
navigationController.isNavigationBarHidden = true
presentOnTop(controller: navigationController, onFullScreen: true)
return
}

presenter.pushViewController(controller, animated: true)
}
}

@MainActor static func presentQrCodeScanner(expectedDataTypes: [QRCodeScannerModel.ExpectedType], onExpectedDataScan: ((QRCodeData) -> Void)?) {
Expand Down
4 changes: 4 additions & 0 deletions MobileWallet/Common/AppValues.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
*/

enum AppValues {
static let general = GeneralValues.self
}

enum GeneralValues {
static var isSimulator: Bool {
#if targetEnvironment(simulator)
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ enum DeepLinkDefaultActionsHandler {
}

let paymentInfo = PaymentInfo(address: transactionSendDeepLink.receiverAddress, alias: nil, yatID: nil, amount: amount, feePerGram: nil, note: transactionSendDeepLink.note)
AppRouter.presentSendTransaction(paymentInfo: paymentInfo)

Task { @MainActor in
AppRouter.presentSendTransaction(paymentInfo: paymentInfo)
}
}

private static func handle(deeplink: DeepLinkable, contacts: [ContactData], actionType: ActionType) throws {
Expand Down
2 changes: 1 addition & 1 deletion MobileWallet/Common/Extensions/LAContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ extension LAContext {
func authenticateUser(reason: AuthenticateUserReason = .logIn, showFailedDialog: Bool = true, onSuccess: @escaping () -> Void) {

// Skip auth on simulator, quicker for development
guard !AppValues.isSimulator else {
guard !AppValues.general.isSimulator else {
onSuccess()
return
}
Expand Down
19 changes: 18 additions & 1 deletion MobileWallet/Common/Extensions/String+Emoji.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,22 @@ extension Character {
}

extension String {
var containsOnlyEmoji: Bool { !isEmpty && !contains { !$0.isEmoji } }

var containsOnlyEmoji: Bool { !isEmpty && !contains { !$0.isEmoji }}

func isSimilar(to text: String, minSameCharacters: Int, usedPrefixSuffixCharacters: Int) -> Bool {

guard self != text, count == text.count, count >= (usedPrefixSuffixCharacters * 2) else { return false }

let lShortText = prefix(usedPrefixSuffixCharacters) + suffix(usedPrefixSuffixCharacters)
let rShortText = text.prefix(usedPrefixSuffixCharacters) + text.suffix(usedPrefixSuffixCharacters)

let result = zip(lShortText, rShortText)
.reduce(into: 0) { result, elements in
guard elements.0 == elements.1 else { return }
result += 1
}

return result >= minSameCharacters
}
}
21 changes: 21 additions & 0 deletions MobileWallet/Common/Extensions/String+Tools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@

extension String {

static func isBaseNodeAddress(hex: String, address: String?) -> Bool {

if #available(iOS 16.0, *) {
guard hex.ranges(of: /^[a-f0-9]{64}$/).count == 1 else { return false }
guard let address else { return true }
return address.ranges(of: /^\/onion3\/[a-z0-9]{56}:[0-9]{2,6}$/).count == 1 || address.ranges(of: /^\/ip4\/[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}\/tcp\/[0-9]{2,6}$/).count == 1
} else {
guard let hexRegex = try? NSRegularExpression(pattern: "^[a-f0-9]{64}$") else { return false }
guard hexRegex.matches(in: hex, range: NSRange(location: 0, length: hex.count)).count == 1 else { return false }
guard let address else { return true }

guard let onionRegex = try? NSRegularExpression(pattern: "^\\/onion3\\/[a-z0-9]{56}:[0-9]{2,6}$"),
let ip4Regex = try? NSRegularExpression(pattern: "^\\/ip4\\/[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}\\/tcp\\/[0-9]{2,6}$") else {
return false
}

let range = NSRange(location: 0, length: address.count)
return onionRegex.matches(in: address, options: [], range: range).count == 1 || ip4Regex.matches(in: address, range: range).count == 1
}
}

func splitElementsInBrackets() -> [String] {
guard #available(iOS 16.0, *) else { return components(separatedBy: CharacterSet(charactersIn: "[]")).map { String($0) }}
return split(separator: /\[|\]/).map { String($0) }
Expand Down
25 changes: 6 additions & 19 deletions MobileWallet/Common/Formatters/AmountNumberFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ final class AmountNumberFormatter {
return formatter
}()

private var cancellables = Set<AnyCancellable>()

init() {
setupBindings()
}
Expand All @@ -71,23 +69,12 @@ final class AmountNumberFormatter {
let inputStream = $rawAmount
.filter { [unowned self] in self.isValidNumber(string: $0) }

if #available(iOS 14.0, *) {
inputStream
.compactMap { [weak self] in self?.format(string: $0) }
.assign(to: &$amount)
inputStream
.compactMap { [weak self] in self?.formatter.number(from: $0)?.doubleValue }
.assign(to: &$amountValue)
} else {
inputStream
.compactMap { [weak self] in self?.format(string: $0) }
.assign(to: \.amount, on: self)
.store(in: &cancellables)
inputStream
.compactMap { [weak self] in self?.formatter.number(from: $0)?.doubleValue }
.assign(to: \.amountValue, on: self)
.store(in: &cancellables)
}
inputStream
.compactMap { [weak self] in self?.format(string: $0) }
.assign(to: &$amount)
inputStream
.compactMap { [weak self] in self?.formatter.number(from: $0)?.doubleValue }
.assign(to: &$amountValue)
}

func append(string: String) {
Expand Down
6 changes: 4 additions & 2 deletions MobileWallet/Common/Formatters/TransactionFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ final class TransactionFormatter {
}

private func contactName(transaction: Transaction) throws -> String {
guard try !transaction.isCoinbase else { return localized("transaction.coinbase.user_placeholder") }
let contact = try contact(transaction: transaction)
return contact?.name ?? localized("transaction.one_sided_payment.inbound_user_placeholder")
}
Expand All @@ -129,7 +130,8 @@ final class TransactionFormatter {

private func amountViewModel(transaction: Transaction) throws -> AmountBadge.ViewModel {

let amount = try MicroTari(transaction.amount).formattedWithNegativeOperator
let tariAmount = try MicroTari(transaction.amount)
let amount = try transaction.isOutboundTransaction ? tariAmount.formattedWithNegativeOperator : tariAmount.formattedWithOperator

let valueType: AmountBadge.ValueType

Expand Down Expand Up @@ -165,7 +167,7 @@ final class TransactionFormatter {
return localized("refresh_view.final_processing")
}
return localized("refresh_view.final_processing_with_param", arguments: confirmationCount + 1, requiredConfirmationCount + 1)
case .imported, .coinbase, .minedConfirmed, .rejected, .fauxUnconfirmed, .fauxConfirmed, .queued, .txNullError, .unknown:
case .imported, .coinbase, .minedConfirmed, .rejected, .oneSidedUnconfirmed, .oneSidedConfirmed, .queued, .coinbaseUnconfirmed, .coinbaseConfirmed, .coinbaseNotInBlockChain, .txNullError, .unknown:
return nil
}
}
Expand Down
Loading

0 comments on commit 0c8565e

Please sign in to comment.