Skip to content

Commit

Permalink
Release/0.16.0 (#790)
Browse files Browse the repository at this point in the history
- Simplified the code related to the splash screen
- Separated business logic from UI logic of splash screen
- Fixed issue related to UInt64 underflow. Now, the value used to calculate transaction fees can't be negative.
- Fixed issue with shortcut text formatting. Now it will be presenting ticker text after "send".
- Fixed reported issue. Now, the tab bar will always have a background color.
- Simplified and encapsulated routing/navigation code inside AppRouter
- Fixed minor issues related to CustomTabBar
- Removed access to the Dibbler network
- Added access to Esmeralda network
- Updated FFILib to v0.38.5
- Encapsulated Tor-related functionality into TorManager
- Encapsulated FFI/Protocol-related functionality into FFIWalletManager
- Created a dedicated manager to handle actions and states used by Internet Connection, Tor, and Protocol managers
- Fixed several UI issues
- Fixed broken reported broken functionalities (invalid balance value, missing transactions on TX list, unresponsive button on in the transaction flow and on the home screen, deadlock on switching Tor bridges)
- Simplified code related to communication with FFI/Protocol
- Removed dead code
- Removed unused files
- Fixed reported issue. Now, the app will deallocate FFI Wallet when the app goes to the background.
- Created a new, modular logger adapter
- Removed old loggers
- Reatach all log events to the new logger
- Removed unused frameworks
- Updated link to block explorer
  • Loading branch information
TruszczynskiA authored Oct 19, 2022
1 parent a1a1faf commit 06e145d
Show file tree
Hide file tree
Showing 183 changed files with 7,337 additions and 8,348 deletions.
482 changes: 327 additions & 155 deletions MobileWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -47,6 +47,10 @@
BlueprintName = "UnitTests"
ReferencedContainer = "container:MobileWallet.xcodeproj">
</BuildableReference>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
</LocationScenarioReference>
</TestableReference>
</Testables>
</TestAction>
Expand Down
45 changes: 7 additions & 38 deletions MobileWallet/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@
import UIKit
import CoreData
import AVFoundation
import Sentry
import GiphyUISDK
import GiphyCoreSDK

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {

private let statusLoggerManager = StatusLoggerManager()

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
// Override point for customization after application launch.
handleCommandLineArgs()
setupSentryCrashReporting()

UNUserNotificationCenter.current().delegate = self
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: .mixWithOthers)
Expand All @@ -64,43 +64,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
if let giphyApiKey = TariSettings.shared.giphyApiKey {
Giphy.configure(apiKey: giphyApiKey)
}


AppConfigurator.configureLoggers()

return true
}

private func setupSentryCrashReporting() {
guard TariSettings.shared.environment != .debug,
let sentryPublicDSN = TariSettings.shared.sentryPublicDSN else {
return
}
SentrySDK.start(options: [
"dsn": sentryPublicDSN,
"debug": false
])
TariLogger.info("Sentry crash reporting has been started.")

TariLogger.breadcrumbCallback = { (message, loggerLevel) in
var sentryLevel: SentryLevel = .debug
switch loggerLevel {
case .error:
sentryLevel = .error
case .info:
sentryLevel = .info
case .warning:
sentryLevel = .warning
default:
sentryLevel = .debug
}

let crumb = Breadcrumb(
level: sentryLevel,
category: "TariLogger \(loggerLevel.rawValue)"
)
crumb.message = message
return SentrySDK.addBreadcrumb(crumb: crumb)
}
}

func applicationWillTerminate(_ application: UIApplication) {
if ICloudBackup.shared.inProgress || BackupScheduler.shared.isBackupScheduled {
UserDefaults.Key.backupOperationAborted.set(true)
Expand Down Expand Up @@ -137,15 +106,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
) {
let hexString = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
TariLogger.info("Registed for push notifications with token \(hexString).")
Logger.log(message: "Registed for push notifications with token \(hexString).", domain: .general, level: .info)
NotificationManager.shared.registerDeviceToken(deviceToken)
}

func application(
_ application: UIApplication,
didFailToRegisterForRemoteNotificationsWithError error: Error
) {
TariLogger.error("Failed to register for push notifications", error: error)
Logger.log(message: "Failed to register for push notifications: \(error.localizedDescription)", domain: .general, level: .error)
}

func application(_ application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: UIApplication.ExtensionPointIdentifier) -> Bool {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

20 changes: 5 additions & 15 deletions MobileWallet/Backup/BackupPrompts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,19 @@ private class BackupPrompts {
private init () {}

func check(_ vc: UIViewController) {
guard let wallet = TariLib.shared.tariWallet else {
return
}

for type in PromptType.allCases.reversed() {
// If they have been shown this once, skip over this prompt
guard UserDefaults.standard.bool(forKey: type.userDefaultsKey) == false else {
continue
}

var incomingTxs = wallet.pendingInboundTxs.0?.count.0 ?? 0
let completedTxs: [CompletedTx] = (wallet.completedTxs.0?.list.0 ?? [])
completedTxs.forEach { (tx) in
if tx.direction == .inbound {
incomingTxs += 1
}
}

let balance = (try? wallet.totalBalance) ?? MicroTari()

let incomingTransactionsCount = Tari.shared.transactions.pendingInbound.count + Tari.shared.transactions.completed.filter { (try? $0.isOutboundTransaction) == false }.count
let balance = Tari.shared.walletBalance.balance.total
let triggers = type.triggers

guard incomingTxs >= triggers.numberOfIncomingTxs &&
balance.rawValue >= triggers.totalBalance.rawValue &&
guard incomingTransactionsCount >= triggers.numberOfIncomingTxs &&
balance >= triggers.totalBalance.rawValue &&
ICloudBackup.shared.isValidBackupExists() == triggers.hasConnectediCloud &&
(ICloudBackup.shared.lastBackup?.isEncrypted ?? false) == triggers.backupIsEncrypted &&
!ICloudBackup.shared.iCloudBackupsIsOn
Expand Down
34 changes: 10 additions & 24 deletions MobileWallet/Backup/BackupScheduler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

import Foundation
import Combine

class BackupScheduler: NSObject {
private let autoBackupTimeInterval: TimeInterval = 60.0 // 1 min
Expand Down Expand Up @@ -66,22 +66,25 @@ class BackupScheduler: NSObject {
static let shared = BackupScheduler()
private var timer = Timer()
private(set) var scheduledBackupStarted: Bool = false
private var cancellables = Set<AnyCancellable>()

override init() {
super.init()
ICloudBackup.shared.addObserver(self)
}

func startObserveEvents() {
TariEventBus.onMainThread(self, eventType: .requiresBackup) {
[weak self] (_) in
self?.scheduleBackup()
}

cancellables.forEach { $0.cancel() }

Tari.shared.transactions.onUpdate
.sink { [weak self] in self?.scheduleBackup() }
.store(in: &cancellables)
}

func stopObserveEvents() {
timer.invalidate()
TariEventBus.unregister(self)
cancellables.forEach { $0.cancel() }
}

func scheduleBackup(immediately: Bool = false) {
Expand All @@ -99,22 +102,6 @@ class BackupScheduler: NSObject {
}

private func createWalletBackup() {
guard TariLib.shared.walletState == .started else {
TariEventBus.onMainThread(self, eventType: .walletStateChanged) {
[weak self]
(sender) in
guard let self = self else { return }
let walletState = sender!.object as! TariLib.WalletState
switch walletState {
case .started:
TariEventBus.unregister(self, eventType: .walletStateChanged)
self.createWalletBackup()
default:
break
}
}
return
}
scheduledBackupStarted = true
do {
let password = AppKeychainWrapper.loadBackupPasswordFromKeychain()
Expand Down Expand Up @@ -147,9 +134,8 @@ extension BackupScheduler: ICloudBackupObserver {
identifier: NotificationManager.NotificationIdentifier.scheduledBackupFailure.rawValue
) {
(_) in
TariLogger.info("Scheduled backup has failed.")
Logger.log(message: "Scheduled backup has failed.", domain: .general, level: .info)
self.scheduledBackupStarted = false
}
}

}
Loading

0 comments on commit 06e145d

Please sign in to comment.