Skip to content

Commit 67fce54

Browse files
Merge pull request #81 from Adamant-im/develop
Socket support & Open specific chat from Push notification & Fix nodes crash
2 parents 8f5bdd1 + 589d76c commit 67fce54

34 files changed

+484
-306
lines changed

Adamant.xcodeproj/project.pbxproj

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
3A64FAA827BA67BF007D5588 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A64FAA527BA67BF007D5588 /* AdamantSecret.swift */; };
1313
3A64FAA927BA67BF007D5588 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A64FAA527BA67BF007D5588 /* AdamantSecret.swift */; };
1414
3A8875EF27BBF38D00436195 /* Parchment in Frameworks */ = {isa = PBXBuildFile; productRef = 3A8875EE27BBF38D00436195 /* Parchment */; };
15+
3AA2D5F7280EADE3000ED971 /* SocketService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AA2D5F6280EADE3000ED971 /* SocketService.swift */; };
16+
3AA2D5FA280EAF5D000ED971 /* AdamantSocketService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AA2D5F9280EAF5D000ED971 /* AdamantSocketService.swift */; };
1517
3C06931576393125C61FB8F6 /* Pods_Adamant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33975C0D891698AA7E74EBCC /* Pods_Adamant.framework */; };
18+
553B1284281C6EE100FFF24C /* GCDUtilites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 553B1283281C6EE100FFF24C /* GCDUtilites.swift */; };
1619
6403F5DB2272389800D58779 /* (null) in Sources */ = {isa = PBXBuildFile; };
1720
6403F5DE22723C6800D58779 /* DashMainnet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6403F5DD22723C6800D58779 /* DashMainnet.swift */; };
1821
6403F5E022723F6400D58779 /* DashWalletRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6403F5DF22723F6400D58779 /* DashWalletRouter.swift */; };
@@ -607,7 +610,10 @@
607610
33975C0D891698AA7E74EBCC /* Pods_Adamant.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Adamant.framework; sourceTree = BUILT_PRODUCTS_DIR; };
608611
36AB8CE9537B3B873972548B /* Pods_AdmCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AdmCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
609612
3A64FAA527BA67BF007D5588 /* AdamantSecret.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdamantSecret.swift; sourceTree = "<group>"; };
613+
3AA2D5F6280EADE3000ED971 /* SocketService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketService.swift; sourceTree = "<group>"; };
614+
3AA2D5F9280EAF5D000ED971 /* AdamantSocketService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantSocketService.swift; sourceTree = "<group>"; };
610615
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>"; };
616+
553B1283281C6EE100FFF24C /* GCDUtilites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GCDUtilites.swift; sourceTree = "<group>"; };
611617
6403F5DD22723C6800D58779 /* DashMainnet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashMainnet.swift; sourceTree = "<group>"; };
612618
6403F5DF22723F6400D58779 /* DashWalletRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashWalletRouter.swift; sourceTree = "<group>"; };
613619
6403F5E122723F7500D58779 /* DashWallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashWallet.swift; sourceTree = "<group>"; };
@@ -1101,6 +1107,14 @@
11011107
path = Pods;
11021108
sourceTree = "<group>";
11031109
};
1110+
3AA2D5F8280EAF49000ED971 /* SocketService */ = {
1111+
isa = PBXGroup;
1112+
children = (
1113+
3AA2D5F9280EAF5D000ED971 /* AdamantSocketService.swift */,
1114+
);
1115+
path = SocketService;
1116+
sourceTree = "<group>";
1117+
};
11041118
6403F5DC22723C2800D58779 /* Dash */ = {
11051119
isa = PBXGroup;
11061120
children = (
@@ -1262,6 +1276,7 @@
12621276
E913C9071FFFA943001A83F7 /* AdamantCore.swift */,
12631277
6455E9F021075D3600B2E94C /* AddressBookService.swift */,
12641278
E91947AB20001A9A001362F8 /* ApiService.swift */,
1279+
3AA2D5F6280EADE3000ED971 /* SocketService.swift */,
12651280
648BCA6C213D384F00875EB5 /* AvatarService.swift */,
12661281
E9A174B22057EC47003667CD /* BackgroundFetchService.swift */,
12671282
E9E7CDBD2003AEFB00DFC4DB /* CellFactory.swift */,
@@ -1281,6 +1296,7 @@
12811296
E913C9061FFFA92E001A83F7 /* Services */ = {
12821297
isa = PBXGroup;
12831298
children = (
1299+
3AA2D5F8280EAF49000ED971 /* SocketService */,
12841300
E9CAE8D02018AA5000345E76 /* ApiService */,
12851301
E9B3D39F201FA2090019EB36 /* DataProviders */,
12861302
E9E7CD922002740500DFC4DB /* AdamantAccountService.swift */,
@@ -1759,6 +1775,7 @@
17591775
E927171D20C04613002BB9A6 /* UIColor+hex.swift */,
17601776
E9D1BE19211DA25300E86B72 /* UIView+constraints.swift */,
17611777
E935C84C22AC06E500A8CA2F /* RichMessageTools.swift */,
1778+
553B1283281C6EE100FFF24C /* GCDUtilites.swift */,
17621779
);
17631780
path = Helpers;
17641781
sourceTree = "<group>";
@@ -2311,6 +2328,8 @@
23112328
"${BUILT_PRODUCTS_DIR}/MessageKit/MessageKit.framework",
23122329
"${BUILT_PRODUCTS_DIR}/MyLittlePinpad/MyLittlePinpad.framework",
23132330
"${BUILT_PRODUCTS_DIR}/PMAlertController/PMAlertController.framework",
2331+
"${BUILT_PRODUCTS_DIR}/Socket.IO-Client-Swift/SocketIO.framework",
2332+
"${BUILT_PRODUCTS_DIR}/Starscream/Starscream.framework",
23142333
);
23152334
name = "[CP] Embed Pods Frameworks";
23162335
outputPaths = (
@@ -2320,6 +2339,8 @@
23202339
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MessageKit.framework",
23212340
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MyLittlePinpad.framework",
23222341
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PMAlertController.framework",
2342+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketIO.framework",
2343+
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Starscream.framework",
23232344
);
23242345
runOnlyForDeploymentPostprocessing = 0;
23252346
shellPath = /bin/sh;
@@ -2432,6 +2453,7 @@
24322453
6449BA69235CA0930033B936 /* ERC20TransferViewController.swift in Sources */,
24332454
E9E7CD8B20026B0600DFC4DB /* AccountService.swift in Sources */,
24342455
640EFAA42558613A00E9724B /* EthProvider.swift in Sources */,
2456+
553B1284281C6EE100FFF24C /* GCDUtilites.swift in Sources */,
24352457
648CE3AC229AD2190070A2CC /* DashTransferViewController.swift in Sources */,
24362458
640EFA9C2558613200E9724B /* AdamantProvider.swift in Sources */,
24372459
64F085D920E2D7600006DE68 /* AdmTransactionsViewController.swift in Sources */,
@@ -2516,6 +2538,7 @@
25162538
644793C32166314A00FC4CF5 /* OnboardPage.swift in Sources */,
25172539
64E1C831222E9617006C4DA7 /* DogeWalletService.swift in Sources */,
25182540
E91947B22000246A001362F8 /* AdamantError.swift in Sources */,
2541+
3AA2D5F7280EADE3000ED971 /* SocketService.swift in Sources */,
25192542
E95F85802008C8D70070534A /* ChatsRoutes.swift in Sources */,
25202543
6416B1A721B024B6006089AC /* LskWalletService+Send.swift in Sources */,
25212544
E9942B87203D9E5100C163AF /* EurekaQRRow.swift in Sources */,
@@ -2617,6 +2640,7 @@
26172640
E9502740202E257E002C1098 /* RepeaterService.swift in Sources */,
26182641
E93D7AC02052CF63005D19DC /* AdamantNotificationService.swift in Sources */,
26192642
645938942378395E00A2BE7C /* EulaViewController.swift in Sources */,
2643+
3AA2D5FA280EAF5D000ED971 /* AdamantSocketService.swift in Sources */,
26202644
649D6BEC21BD5A53009E727B /* UISuffixTextField.swift in Sources */,
26212645
E93B0D762028B28E00126346 /* AdamantChatsProvider.swift in Sources */,
26222646
E993302021354B1800CD5200 /* AdmWalletRoutes.swift in Sources */,
@@ -2877,7 +2901,7 @@
28772901
CODE_SIGN_ENTITLEMENTS = MessageNotificationContentExtension/Debug.entitlements;
28782902
CODE_SIGN_IDENTITY = "iPhone Developer";
28792903
CODE_SIGN_STYLE = Manual;
2880-
CURRENT_PROJECT_VERSION = 173;
2904+
CURRENT_PROJECT_VERSION = 180;
28812905
DEVELOPMENT_TEAM = J2L77FMN46;
28822906
INFOPLIST_FILE = MessageNotificationContentExtension/Info.plist;
28832907
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -2886,7 +2910,7 @@
28862910
"@executable_path/Frameworks",
28872911
"@executable_path/../../Frameworks",
28882912
);
2889-
MARKETING_VERSION = 2.3.0;
2913+
MARKETING_VERSION = 2.4.0;
28902914
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
28912915
MTL_FAST_MATH = YES;
28922916
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev.MessageNotificationContentExtension";
@@ -2906,7 +2930,7 @@
29062930
CODE_SIGN_IDENTITY = "Apple Development";
29072931
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
29082932
CODE_SIGN_STYLE = Manual;
2909-
CURRENT_PROJECT_VERSION = 173;
2933+
CURRENT_PROJECT_VERSION = 180;
29102934
DEVELOPMENT_TEAM = J2L77FMN46;
29112935
INFOPLIST_FILE = MessageNotificationContentExtension/Info.plist;
29122936
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -2915,7 +2939,7 @@
29152939
"@executable_path/Frameworks",
29162940
"@executable_path/../../Frameworks",
29172941
);
2918-
MARKETING_VERSION = 2.3.0;
2942+
MARKETING_VERSION = 2.4.0;
29192943
MTL_FAST_MATH = YES;
29202944
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger.MessageNotificationContentExtension";
29212945
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -3053,7 +3077,7 @@
30533077
CODE_SIGN_ENTITLEMENTS = Adamant/Debug.entitlements;
30543078
CODE_SIGN_IDENTITY = "iPhone Developer";
30553079
CODE_SIGN_STYLE = Manual;
3056-
CURRENT_PROJECT_VERSION = 173;
3080+
CURRENT_PROJECT_VERSION = 180;
30573081
DEVELOPMENT_TEAM = J2L77FMN46;
30583082
DISPLAY_NAME = ADM.Dev;
30593083
EXCLUDED_SOURCE_FILE_NAMES = "";
@@ -3063,7 +3087,7 @@
30633087
"$(inherited)",
30643088
"@executable_path/Frameworks",
30653089
);
3066-
MARKETING_VERSION = 2.3.0;
3090+
MARKETING_VERSION = 2.4.0;
30673091
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev";
30683092
PRODUCT_NAME = "$(TARGET_NAME)";
30693093
PROVISIONING_PROFILE = "e4233bbf-3705-44fe-95b0-e77475672c60";
@@ -3082,7 +3106,7 @@
30823106
CODE_SIGN_IDENTITY = "Apple Development";
30833107
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
30843108
CODE_SIGN_STYLE = Manual;
3085-
CURRENT_PROJECT_VERSION = 173;
3109+
CURRENT_PROJECT_VERSION = 180;
30863110
DEVELOPMENT_TEAM = J2L77FMN46;
30873111
DISPLAY_NAME = Adamant;
30883112
EXCLUDED_SOURCE_FILE_NAMES = Debug.xcassets;
@@ -3092,7 +3116,7 @@
30923116
"$(inherited)",
30933117
"@executable_path/Frameworks",
30943118
);
3095-
MARKETING_VERSION = 2.3.0;
3119+
MARKETING_VERSION = 2.4.0;
30963120
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger";
30973121
PRODUCT_NAME = "$(TARGET_NAME)";
30983122
PROVISIONING_PROFILE = "bedd1b75-2f23-4a85-a0b2-14c424fcff42";
@@ -3110,7 +3134,7 @@
31103134
CODE_SIGN_ENTITLEMENTS = TransferNotificationContentExtension/Debug.entitlements;
31113135
CODE_SIGN_IDENTITY = "iPhone Developer";
31123136
CODE_SIGN_STYLE = Manual;
3113-
CURRENT_PROJECT_VERSION = 173;
3137+
CURRENT_PROJECT_VERSION = 180;
31143138
DEVELOPMENT_TEAM = J2L77FMN46;
31153139
INFOPLIST_FILE = TransferNotificationContentExtension/Info.plist;
31163140
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3119,7 +3143,7 @@
31193143
"@executable_path/Frameworks",
31203144
"@executable_path/../../Frameworks",
31213145
);
3122-
MARKETING_VERSION = 2.3.0;
3146+
MARKETING_VERSION = 2.4.0;
31233147
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
31243148
MTL_FAST_MATH = YES;
31253149
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev.TransferNotificationContentExtension";
@@ -3139,7 +3163,7 @@
31393163
CODE_SIGN_IDENTITY = "Apple Development";
31403164
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
31413165
CODE_SIGN_STYLE = Manual;
3142-
CURRENT_PROJECT_VERSION = 173;
3166+
CURRENT_PROJECT_VERSION = 180;
31433167
DEVELOPMENT_TEAM = J2L77FMN46;
31443168
INFOPLIST_FILE = TransferNotificationContentExtension/Info.plist;
31453169
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3148,7 +3172,7 @@
31483172
"@executable_path/Frameworks",
31493173
"@executable_path/../../Frameworks",
31503174
);
3151-
MARKETING_VERSION = 2.3.0;
3175+
MARKETING_VERSION = 2.4.0;
31523176
MTL_FAST_MATH = YES;
31533177
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger.TransferNotificationContentExtension";
31543178
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -3168,7 +3192,7 @@
31683192
CODE_SIGN_ENTITLEMENTS = NotificationServiceExtension/Debug.entitlements;
31693193
CODE_SIGN_IDENTITY = "iPhone Developer";
31703194
CODE_SIGN_STYLE = Manual;
3171-
CURRENT_PROJECT_VERSION = 173;
3195+
CURRENT_PROJECT_VERSION = 180;
31723196
DEVELOPMENT_TEAM = J2L77FMN46;
31733197
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
31743198
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3177,7 +3201,7 @@
31773201
"@executable_path/Frameworks",
31783202
"@executable_path/../../Frameworks",
31793203
);
3180-
MARKETING_VERSION = 2.3.0;
3204+
MARKETING_VERSION = 2.4.0;
31813205
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
31823206
MTL_FAST_MATH = YES;
31833207
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev.NotificationServiceExtension";
@@ -3197,7 +3221,7 @@
31973221
CODE_SIGN_IDENTITY = "Apple Development";
31983222
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
31993223
CODE_SIGN_STYLE = Manual;
3200-
CURRENT_PROJECT_VERSION = 173;
3224+
CURRENT_PROJECT_VERSION = 180;
32013225
DEVELOPMENT_TEAM = J2L77FMN46;
32023226
INFOPLIST_FILE = NotificationServiceExtension/Info.plist;
32033227
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
@@ -3206,7 +3230,7 @@
32063230
"@executable_path/Frameworks",
32073231
"@executable_path/../../Frameworks",
32083232
);
3209-
MARKETING_VERSION = 2.3.0;
3233+
MARKETING_VERSION = 2.4.0;
32103234
MTL_FAST_MATH = YES;
32113235
PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger.NotificationServiceExtension";
32123236
PRODUCT_NAME = "$(TARGET_NAME)";

Adamant/AppDelegate.swift

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
182182

183183
// Register repeater services
184184
if let chatsProvider = container.resolve(ChatsProvider.self) {
185-
repeater.registerForegroundCall(label: "chatsProvider", interval: 3, queue: .global(qos: .utility), callback: chatsProvider.update)
185+
repeater.registerForegroundCall(label: "chatsProvider", interval: 10, queue: .global(qos: .utility), callback: chatsProvider.update)
186+
186187
} else {
187188
dialogService.showError(withMessage: "Failed to register ChatsProvider autoupdate. Please, report a bug", error: nil)
188189
}
@@ -264,7 +265,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
264265
}
265266

266267
// MARK: - Remote notifications
267-
extension AppDelegate {
268+
extension AppDelegate: UNUserNotificationCenterDelegate {
268269
private struct RegistrationPayload: Codable {
269270
let token: String
270271

@@ -283,7 +284,6 @@ extension AppDelegate {
283284
}
284285

285286
let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
286-
287287
// MARK: 1. Checking, if device token had not changed
288288
guard let securedStore = container.resolve(SecuredStore.self) else {
289289
fatalError("can't get secured store to get device token hash")
@@ -338,6 +338,66 @@ extension AppDelegate {
338338
service.showError(withMessage: String.localizedStringWithFormat(String.adamantLocalized.notifications.registerRemotesError, error.localizedDescription), error: error)
339339
}
340340
}
341+
342+
//MARK: Open Chat From Notification
343+
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
344+
if let recipientAddress = userInfo[AdamantNotificationUserInfoKeys.pushRecipient] as? String
345+
{
346+
if application.applicationState != .background && application.applicationState != .inactive {
347+
completionHandler(.noData)
348+
return
349+
}
350+
351+
if let tabbar = window?.rootViewController as? UITabBarController,
352+
let chats = tabbar.viewControllers?.first as? UISplitViewController,
353+
let chatList = chats.viewControllers.first as? UINavigationController,
354+
let list = chatList.viewControllers.first as? ChatListViewController {
355+
356+
switch list.accountService.state {
357+
case .loggedIn:
358+
self.openDialog(chatList: chatList, tabbar: tabbar, list: list, recipientAddress: recipientAddress)
359+
case .notLogged:
360+
break
361+
case .isLoggingIn:
362+
break
363+
case .updating:
364+
break
365+
}
366+
367+
// if not logged in
368+
list.didLoadedMessages = { [weak self] in
369+
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
370+
self?.openDialog(chatList: chatList, tabbar: tabbar, list: list, recipientAddress: recipientAddress)
371+
}
372+
}
373+
}
374+
completionHandler(.newData)
375+
} else {
376+
completionHandler(.noData)
377+
}
378+
}
379+
380+
func openDialog(chatList: UINavigationController, tabbar: UITabBarController, list: ChatListViewController, recipientAddress: String) {
381+
guard let chatroom = list.chatsController?.fetchedObjects?.first(where: { room in
382+
return room.lastTransaction?.recipientAddress == recipientAddress
383+
}) else { return }
384+
385+
chatList.popToRootViewController(animated: false)
386+
chatList.dismiss(animated: false, completion: nil)
387+
tabbar.selectedIndex = 0
388+
389+
let vc = list.chatViewController(for: chatroom, forceScrollToBottom: true)
390+
if let split = list.splitViewController {
391+
var timeout = 0.25
392+
if #available(iOS 13.0, *) { timeout = 0 }
393+
DispatchQueue.main.asyncAfter(deadline: .now() + timeout) {
394+
let chat = UINavigationController(rootViewController:vc)
395+
split.showDetailViewController(chat, sender: self)
396+
}
397+
} else {
398+
chatList.pushViewController(vc, animated: false)
399+
}
400+
}
341401
}
342402

343403

@@ -529,9 +589,9 @@ extension AppDelegate {
529589
}
530590

531591
// if not logged in
532-
list.didLoadedMessages = {
592+
list.didLoadedMessages = { [weak self] in
533593
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
534-
self.openDialog(chatList: chatList, tabbar: tabbar, router: router, list: list, adamantAdr: adamantAdr)
594+
self?.openDialog(chatList: chatList, tabbar: tabbar, router: router, list: list, adamantAdr: adamantAdr)
535595
}
536596
}
537597
}
@@ -541,7 +601,7 @@ extension AppDelegate {
541601
return true
542602
}
543603

544-
func openDialog(chatList: UINavigationController, tabbar: UITabBarController, router: Router, list: ChatListViewController, adamantAdr: AdamantAddress){
604+
func openDialog(chatList: UINavigationController, tabbar: UITabBarController, router: Router, list: ChatListViewController, adamantAdr: AdamantAddress) {
545605
chatList.popToRootViewController(animated: false)
546606
chatList.dismiss(animated: false, completion: nil)
547607
tabbar.selectedIndex = 0

Adamant/CoreData/Chatroom+CoreDataClass.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ public class Chatroom: NSManagedObject {
1515
static let entityName = "Chatroom"
1616

1717
func markAsReaded() {
18-
if hasUnreadMessages {
19-
hasUnreadMessages = false
20-
}
21-
18+
hasUnreadMessages = false
19+
2220
if let trs = transactions as? Set<ChatTransaction> {
2321
trs.filter { $0.isUnread }.forEach { $0.isUnread = false }
2422
}
23+
lastTransaction?.isUnread = false
2524
}
2625

2726
func getFirstUnread() -> ChatTransaction? {

Adamant/ServiceProtocols/NodesSource.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ protocol NodesSource {
4343
func getNewNode() -> Node
4444
func getValidNode(completion: @escaping ((Node?) -> Void))
4545

46+
func getSocketNewNode() -> Node
47+
4648
func saveNodes()
4749
func reloadNodes()
4850

0 commit comments

Comments
 (0)