Skip to content

Commit

Permalink
Merge pull request #663 from dashpay/develop
Browse files Browse the repository at this point in the history
chore: Release 8.2.0
  • Loading branch information
pankcuf authored Jul 31, 2024
2 parents 8080db4 + 943b515 commit 3623cb7
Show file tree
Hide file tree
Showing 111 changed files with 1,627 additions and 1,496 deletions.
2 changes: 1 addition & 1 deletion DashSyncCurrentCommit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
49b6db28808308255a8a6a30d1fe5670d9c9c50e
751595434308e0761cceb15b428a41ca5eefdb8b
224 changes: 106 additions & 118 deletions DashWallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "Group 1805.png",
"filename" : "cn-tx.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Group 1805@2x.png",
"filename" : "cn-tx@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Group 1805@3x.png",
"filename" : "cn-tx@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"images" : [
{
"filename" : "transaction.prev.receive.png",
"filename" : "Transaction types - Primary.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "transaction.prev.receive@2x.png",
"filename" : "Transaction types - Primary@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "transaction.prev.receive@3x.png",
"filename" : "Transaction types - Primary@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Transaction types - Primary.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Transaction types - [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Transaction types - [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "Transaction types - Primary.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Transaction types - [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Transaction types - [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import Foundation

private let kChainManagerNotificationChainKey = "DSChainManagerNotificationChainKey"
private let kChainManagerNotificationSyncStateKey = "DSChainManagerNotificationSyncStateKey"

private let kSyncingCompleteProgress = 1.0
private let kMaxProgressDelta = 0.1 // 10%
Expand Down Expand Up @@ -53,6 +54,7 @@ class SyncingActivityMonitor: NSObject, NetworkReachabilityHandling {
case noConnection
case unknown
}
public lazy var model: DSSyncState = DSSyncState(syncPhase: .offline)

@objc
public var progress: Double = 0 {
Expand Down Expand Up @@ -122,14 +124,6 @@ class SyncingActivityMonitor: NSObject, NetworkReachabilityHandling {
@objc
func chainManagerSyncStartedNotification(notification: Notification) {
guard shouldAcceptSyncNotification(notification) else { return }

startSyncingActivity()
}

@objc
func chainManagerParametersUpdatedNotification(notification: Notification) {
guard shouldAcceptSyncNotification(notification) else { return }

startSyncingActivity()
}

Expand All @@ -147,20 +141,20 @@ class SyncingActivityMonitor: NSObject, NetworkReachabilityHandling {

stopSyncingActivity(failed: true)
}

@objc
func chainManagerChainBlocksDidChangeNotification(notification: Notification) {
guard !isSyncing, chainSyncProgress < kSyncingCompleteProgress else { return }

startSyncingActivity()
func chainManagerSyncStateChangedNotification(notification: Notification) {
guard shouldAcceptSyncNotification(notification) else { return }

if let model = notification.userInfo?[kChainManagerNotificationSyncStateKey] as? DSSyncState {
self.model = model
}
}

@objc
func peerManagerConnectedPeersDidChangeNotification(notification: Notification) {
let isConnected = DWEnvironment.sharedInstance().currentChainManager.peerManager.connected

if isConnected {
NotificationCenter.default.removeObserver(self, name: .peerManagerConnectedPeersDidChange, object: nil)
if model.peerManagerConnected {
removeChainObserver(.peerManagerConnectedPeersDidChange)
startSyncingIfNeeded()
}
}
Expand All @@ -173,14 +167,13 @@ class SyncingActivityMonitor: NSObject, NetworkReachabilityHandling {
@objc public static let shared = SyncingActivityMonitor()
}

// MARK: Suncing
// MARK: Syncing

extension SyncingActivityMonitor {

private func startSyncingIfNeeded() {
guard DWEnvironment.sharedInstance().currentChainManager.peerManager.connected else {
NotificationCenter.default.addObserver(self, selector: #selector(peerManagerConnectedPeersDidChangeNotification(notification:)),
name: .peerManagerConnectedPeersDidChange, object: nil)

guard model.peerManagerConnected else {
addChainObserver(.peerManagerConnectedPeersDidChange, #selector(peerManagerConnectedPeersDidChangeNotification(notification:)))
return
}

Expand All @@ -190,7 +183,7 @@ extension SyncingActivityMonitor {
private func startSyncingActivity() {
guard !isSyncing else { return }

progress = chainSyncProgress
progress = model.combinedSyncProgress
lastPeakDate = nil

NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(syncLoop), object: nil)
Expand All @@ -205,16 +198,18 @@ extension SyncingActivityMonitor {
isSyncing = false
state = failed ? .syncFailed : .syncDone
}

@objc
private func syncLoop() {
guard reachability.networkReachabilityStatus != .notReachable else {
state = .noConnection
return
}
updateProgress()
}

let progress = chainSyncProgress

private func updateProgress() {
let progress = model.combinedSyncProgress
if progress < kSyncingCompleteProgress {
isSyncing = true

Expand Down Expand Up @@ -261,26 +256,26 @@ extension SyncingActivityMonitor {
syncLoop()
}

private func addChainObserver(_ aName: NSNotification.Name?, _ aSelector: Selector) {
NotificationCenter.default.addObserver(self, selector: aSelector, name: aName, object: nil)
}
private func removeChainObserver(_ aName: NSNotification.Name?) {
NotificationCenter.default.removeObserver(self, name: aName, object: nil)
}

private func configureObserver() {
let notificationCenter = NotificationCenter.default
notificationCenter.addObserver(self, selector: #selector(chainManagerSyncStartedNotification(notification:)),
name: .chainManagerSyncStarted, object: nil)
notificationCenter.addObserver(self, selector: #selector(chainManagerParametersUpdatedNotification(notification:)),
name: .chainManagerParametersUpdated, object: nil)
notificationCenter.addObserver(self, selector: #selector(chainManagerSyncFinishedNotification(notification:)),
name: .chainManagerSyncFinished, object: nil)
notificationCenter.addObserver(self, selector: #selector(chainManagerSyncFailedNotification(notification:)),
name: .chainManagerSyncFailed, object: nil)
notificationCenter.addObserver(self, selector: #selector(chainManagerChainBlocksDidChangeNotification(notification:)),
name: .chainManagerChainSyncBlocksDidChange, object: nil)
addChainObserver(.chainManagerSyncStarted, #selector(chainManagerSyncStartedNotification(notification:)))
addChainObserver(.chainManagerSyncFinished, #selector(chainManagerSyncFinishedNotification(notification:)))
addChainObserver(.chainManagerSyncFailed, #selector(chainManagerSyncFailedNotification(notification:)))
addChainObserver(.chainManagerSyncStateChanged, #selector(chainManagerSyncStateChangedNotification(notification:)))
}
}

// MARK: Utils

extension SyncingActivityMonitor {
private var chainSyncProgress: Double {
DWEnvironment.sharedInstance().currentChainManager.combinedSyncProgress
model.combinedSyncProgress
}

private var shouldStopSyncing: Bool {
Expand All @@ -305,16 +300,12 @@ extension SyncingActivityMonitor {
}

extension Notification.Name {
// TODO: unused?
static let syncStateChangedNotification: Notification.Name = .init(rawValue: "DWSyncStateChangedNotification")

static let chainManagerSyncStarted: Notification.Name = .init(rawValue: "DSChainManagerSyncWillStartNotification")
static let chainManagerParametersUpdated: Notification
.Name = .init(rawValue: "DSChainManagerSyncParametersUpdatedNotification")
static let chainManagerSyncFinished: Notification.Name = .init(rawValue: "DSChainManagerSyncFinishedNotification")
static let chainManagerSyncFailed: Notification.Name = .init(rawValue: "DSChainManagerSyncFailedNotification")
static let chainManagerChainSyncBlocksDidChange: Notification
.Name = .init(rawValue: "DSChainChainSyncBlocksDidChangeNotification")
static let peerManagerConnectedPeersDidChange: Notification
.Name = .init(rawValue: "DSPeerManagerConnectedPeersDidChangeNotification")

static let peerManagerConnectedPeersDidChange: Notification.Name = .init(rawValue: "DSPeerManagerConnectedPeersDidChangeNotification")
static let chainManagerSyncStateChanged: Notification.Name = .init(rawValue: "DSChainManagerSyncStateDidChangeNotification")
}
Loading

0 comments on commit 3623cb7

Please sign in to comment.