77//
88
99#import " ALContactDBService.h"
10- #import " ALDBHandler .h"
10+ #import " KMCoreDBHandler .h"
1111#import " ALConstant.h"
1212#import " DB_Message.h"
1313#import " ALSearchResultCache.h"
@@ -36,7 +36,7 @@ - (BOOL)purgeListOfContacts:(NSArray *)contacts {
3636
3737- (BOOL )purgeContact : (ALContact *)contact {
3838
39- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
39+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
4040
4141 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
4242 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
@@ -71,7 +71,7 @@ - (BOOL)purgeContact:(ALContact *)contact {
7171}
7272
7373- (BOOL )purgeAllContact {
74- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
74+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
7575
7676 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
7777
@@ -125,7 +125,7 @@ - (BOOL)updateListOfContacts:(NSArray *)contacts {
125125
126126- (BOOL )updateContactInDatabase : (ALContact *)contact {
127127
128- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
128+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
129129
130130 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
131131
@@ -204,7 +204,7 @@ - (BOOL)updateContactInDatabase:(ALContact *)contact {
204204
205205- (BOOL )setUnreadCountDB : (ALContact *)contact {
206206
207- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
207+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
208208 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
209209 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
210210 if (contactEntity) {
@@ -297,7 +297,7 @@ - (ALContact *)loadContactByKey:(NSString *)key
297297
298298- (DB_CONTACT *)getContactByKey : (NSString *)key
299299 value : (NSString *)value {
300- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
300+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
301301 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
302302 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
303303 if (contactEntity) {
@@ -368,7 +368,7 @@ - (void)updateConnectedStatus:(NSString *)userId
368368}
369369
370370- (BOOL )updateUserDetail : (KMCoreUserDetail *)userDetail {
371- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
371+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
372372
373373 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
374374 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
@@ -444,7 +444,7 @@ - (BOOL)updateUserDetail:(KMCoreUserDetail *)userDetail {
444444}
445445
446446- (BOOL )updateLastSeenDBUpdate : (KMCoreUserDetail *)userDetail {
447- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
447+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
448448
449449 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
450450 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
@@ -476,7 +476,7 @@ - (BOOL)updateLastSeenDBUpdate:(KMCoreUserDetail *)userDetail {
476476- (NSUInteger )markConversationAsDeliveredAndRead : (NSString *)contactId {
477477 NSArray *messages = [self getUnreadMessagesForIndividual: contactId];
478478
479- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
479+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
480480 for (DB_Message *dbMessage in messages) {
481481 dbMessage.status = @(DELIVERED_AND_READ);
482482 }
@@ -493,7 +493,7 @@ - (NSUInteger)markConversationAsDeliveredAndRead:(NSString *)contactId {
493493- (NSArray *)getUnreadMessagesForIndividual : (NSString *)contactId {
494494
495495 // Runs at Opening AND Leaving ChatVC AND Opening MessageList..
496- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
496+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
497497 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
498498
499499 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_Message" ];
@@ -518,7 +518,7 @@ - (NSArray *)getUnreadMessagesForIndividual:(NSString *)contactId {
518518
519519- (BOOL )setBlockUser : (NSString *)userId
520520 andBlockedState : (BOOL )flag {
521- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
521+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
522522 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
523523 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
524524
@@ -559,7 +559,7 @@ - (void)blockByUserInList:(NSMutableArray *)userList {
559559
560560- (BOOL )setBlockByUser : (NSString *)userId
561561 andBlockedByState : (BOOL )flag {
562- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
562+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
563563 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
564564 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
565565
@@ -585,7 +585,7 @@ - (BOOL)setBlockByUser:(NSString *)userId
585585}
586586
587587- (NSMutableArray *)getListOfBlockedUsers {
588- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
588+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
589589 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
590590 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
591591
@@ -624,7 +624,7 @@ - (NSMutableArray*)updateFilteredContacts:(ALContactsResponse *)contactsResponse
624624}
625625
626626- (NSMutableArray *)getAllContactsFromDB {
627- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
627+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
628628
629629 NSPredicate *predicate = [NSPredicate predicateWithFormat: @" userId !=%@ AND deletedAtTime == nil" ,[KMCoreUserDefaultsHandler getUserId ]];
630630 NSFetchRequest *contactListRequest = [NSFetchRequest fetchRequestWithEntityName: @" DB_CONTACT" ];
@@ -704,7 +704,7 @@ - (DB_CONTACT *)replaceContact:(DB_CONTACT *)originalContact
704704
705705#pragma mark - Insert new contact in Database
706706- (BOOL )insertNewContact : (ALContact*)contact {
707- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
707+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
708708 DB_CONTACT *dbContact = (DB_CONTACT *)[alDBHandler insertNewObjectForEntityForName: @" DB_CONTACT" ];
709709
710710 if (dbContact) {
@@ -724,7 +724,7 @@ - (BOOL)insertNewContact:(ALContact*)contact {
724724#pragma mark - Update mute time in Database
725725
726726- (KMCoreUserDetail *)updateMuteAfterTime : (NSNumber *)notificationAfterTime andUserId : (NSString *)userId {
727- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
727+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
728728
729729 DB_CONTACT *dbContact = [self getContactByKey: @" userId" value: userId];
730730
@@ -761,7 +761,7 @@ - (BOOL)addOrUpdateMetadataWithUserId:(NSString *)userId withMetadataKey:(NSStri
761761 return isSuccess;
762762 }
763763
764- ALDBHandler *alDBHandler = [ALDBHandler sharedInstance ];
764+ KMCoreDBHandler *alDBHandler = [KMCoreDBHandler sharedInstance ];
765765 NSFetchRequest *fetchRequest = [[NSFetchRequest alloc ] init ];
766766
767767 NSEntityDescription *contactEntity = [alDBHandler entityDescriptionWithEntityForName: @" DB_CONTACT" ];
0 commit comments