Skip to content

Commit e5b2f16

Browse files
Merge pull request #102 from Adamant-im/feature/nodes_reset_fix
Fixed nodes resetting
2 parents a2ef4a6 + a9cdddc commit e5b2f16

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
41E142F5289E60EB002EE8D7 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E142F1289E60EB002EE8D7 /* AdamantSecret.swift */; };
2222
550066C5284D65DB0044C0B1 /* HealthCheckService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 550066C4284D65DB0044C0B1 /* HealthCheckService.swift */; };
2323
550066C7284D682D0044C0B1 /* AdamantHealthCheckService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 550066C6284D682D0044C0B1 /* AdamantHealthCheckService.swift */; };
24+
550698B628C00AED000E8A2B /* CollectionUtilites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 550698B528C00AED000E8A2B /* CollectionUtilites.swift */; };
2425
551F66E628959A5300DE5D69 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 551F66E528959A5200DE5D69 /* LoadingView.swift */; };
2526
551F66E82895B3DA00DE5D69 /* AdamantHealthCheckServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 551F66E72895B3DA00DE5D69 /* AdamantHealthCheckServiceTests.swift */; };
2627
5522A44028B758530029B543 /* UIKitUtilites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5522A43F28B758530029B543 /* UIKitUtilites.swift */; };
@@ -632,6 +633,7 @@
632633
4A4D67BD3DC89C07D1351248 /* Pods-AdmCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AdmCore.release.xcconfig"; path = "Target Support Files/Pods-AdmCore/Pods-AdmCore.release.xcconfig"; sourceTree = "<group>"; };
633634
550066C4284D65DB0044C0B1 /* HealthCheckService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HealthCheckService.swift; sourceTree = "<group>"; };
634635
550066C6284D682D0044C0B1 /* AdamantHealthCheckService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantHealthCheckService.swift; sourceTree = "<group>"; };
636+
550698B528C00AED000E8A2B /* CollectionUtilites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionUtilites.swift; sourceTree = "<group>"; };
635637
551F66E528959A5200DE5D69 /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = "<group>"; };
636638
551F66E72895B3DA00DE5D69 /* AdamantHealthCheckServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantHealthCheckServiceTests.swift; sourceTree = "<group>"; };
637639
5522A43F28B758530029B543 /* UIKitUtilites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIKitUtilites.swift; sourceTree = "<group>"; };
@@ -1817,6 +1819,7 @@
18171819
E935C84C22AC06E500A8CA2F /* RichMessageTools.swift */,
18181820
553B1283281C6EE100FFF24C /* GCDUtilites.swift */,
18191821
5522A43F28B758530029B543 /* UIKitUtilites.swift */,
1822+
550698B528C00AED000E8A2B /* CollectionUtilites.swift */,
18201823
);
18211824
path = Helpers;
18221825
sourceTree = "<group>";
@@ -2607,6 +2610,7 @@
26072610
E9E7CDC02003AF6D00DFC4DB /* AdamantCellFactory.swift in Sources */,
26082611
646DF92422C29F6E00DCC864 /* ERC20Token.swift in Sources */,
26092612
E9DFB71C21624C9200CF8C7C /* AdmTransactionDetailsViewController.swift in Sources */,
2613+
550698B628C00AED000E8A2B /* CollectionUtilites.swift in Sources */,
26102614
6403F5E022723F6400D58779 /* DashWalletRouter.swift in Sources */,
26112615
E94008722114EACF00CD2D67 /* WalletAccount.swift in Sources */,
26122616
640EFA9E2558613700E9724B /* DashProvider.swift in Sources */,

Adamant/Stories/NodesEditor/NodesListViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ extension NodesListViewController {
286286
func updateNodesRows() {
287287
guard let nodesSection = getNodesSection() else { return }
288288

289-
guard displayedNodes != nodesSource.nodes else {
289+
guard !displayedNodes.hasTheSameReferences(as: nodesSource.nodes) else {
290290
nodesSection.allRows.forEach { $0.updateCell() }
291291
return
292292
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// CollectionUtilites.swift
3+
// Adamant
4+
//
5+
// Created by Andrey on 01.09.2022.
6+
// Copyright © 2022 Adamant. All rights reserved.
7+
//
8+
9+
extension Collection where Element: AnyObject {
10+
func hasTheSameReferences(as collection: Self) -> Bool {
11+
count == collection.count
12+
&& !zip(self, collection)
13+
.map({ $0 === $1 })
14+
.contains(false)
15+
}
16+
}

0 commit comments

Comments
 (0)