Skip to content

Commit 1092422

Browse files
Merge pull request #26 from Kommunicate-io/release/1.0.5
Release/1.0.5
2 parents c898a11 + 06d200e commit 1092422

12 files changed

Lines changed: 48 additions & 19 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
The changelog for [KommunicateCore-iOS-SDK](https://github.com/Kommunicate-io/KommunicateCore-iOS-SDK). Also see the [releases](https://github.com/Kommunicate-io/KommunicateCore-iOS-SDK/releases) on Github.
44

5+
##[Unreleased]
6+
-
7+
## [1.0.5] 2022-09-09
8+
- [CM-787] Fixed the issue of user can login with wrong password
59
## [1.0.4] 2022-06-22
610
- [CM-961] Updated Create Channel Api endpoint
711
- [CM-962] Fixed In App Notification Tile issue for lengthy messages

Example/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- KommunicateCore-iOS-SDK (1.0.4)
2+
- KommunicateCore-iOS-SDK (1.0.5)
33

44

55
DEPENDENCIES:
@@ -10,7 +10,7 @@ EXTERNAL SOURCES:
1010
:path: "../"
1111

1212
SPEC CHECKSUMS:
13-
KommunicateCore-iOS-SDK: f4cbf5ee3a11f869d7effaff4270823bb1336991
13+
KommunicateCore-iOS-SDK: 211b78283a90da82a631fe0831d81536b2e46d6f
1414

1515
PODFILE CHECKSUM: 8b029372b67d72364ec33cf0ba3ca373cec02677
1616

Example/Pods/Local Podspecs/KommunicateCore-iOS-SDK.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Manifest.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Pods/Target Support Files/KommunicateCore-iOS-SDK/KommunicateCore-iOS-SDK-Info.plist

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

KommunicateCore-iOS-SDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'KommunicateCore-iOS-SDK'
3-
s.version = '1.0.4'
3+
s.version = '1.0.5'
44
s.summary = 'KommunicateCore-iOS SDK pod'
55
s.description = <<-DESC
66
The KommunicateCore-iOS SDK helps you build your own custom UI in your iOS app

Sources/account/ALRegisterUserClientService.m

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,7 @@ - (void)logoutWithCompletionHandler:(void(^)(ALAPIResponse *response, NSError *e
435435

436436
ALSLog(ALLoggerSeverityInfo, @"RESPONSE_USER_LOGOUT :: %@", (NSString *)theJson);
437437
ALAPIResponse *response = [[ALAPIResponse alloc] initWithJSONString:theJson];
438-
[[ALMQTTConversationService sharedInstance] publishOfflineStatus];
439-
NSString *userKey = [ALUserDefaultsHandler getUserKeyString];
440-
BOOL completed = [[ALMQTTConversationService sharedInstance] unsubscribeToConversation: userKey];
441-
ALSLog(ALLoggerSeverityInfo, @"Unsubscribed to conversation after logout: %d", completed);
442-
443-
[ALUserDefaultsHandler clearAll];
444-
[ALApplozicSettings clearAll];
445-
446-
ALMessageDBService *messageDBService = [[ALMessageDBService alloc] init];
447-
[messageDBService deleteAllObjectsInCoreData];
438+
[self clearLocalDBAndPublishOfflineStatus];
448439

449440
if (error) {
450441
ALSLog(ALLoggerSeverityError, @"Error in logout: %@", error.description);
@@ -454,6 +445,25 @@ - (void)logoutWithCompletionHandler:(void(^)(ALAPIResponse *response, NSError *e
454445
}];
455446
}
456447

448+
// This funtion logs out user locally by clearing local DB. Useful when the logout API is not working due to password change and you want to logout.
449+
- (void)logoutUserLocally {
450+
[self clearLocalDBAndPublishOfflineStatus];
451+
}
452+
453+
// This function changes the status to offline, unsubscribes from MQTT and clears the local data.
454+
- (void) clearLocalDBAndPublishOfflineStatus {
455+
[[ALMQTTConversationService sharedInstance] publishOfflineStatus];
456+
NSString *userKey = [ALUserDefaultsHandler getUserKeyString];
457+
BOOL completed = [[ALMQTTConversationService sharedInstance] unsubscribeToConversation: userKey];
458+
ALSLog(ALLoggerSeverityInfo, @"Unsubscribed to conversation after logout: %d", completed);
459+
460+
[ALUserDefaultsHandler clearAll];
461+
[ALApplozicSettings clearAll];
462+
463+
ALMessageDBService *messageDBService = [[ALMessageDBService alloc] init];
464+
[messageDBService deleteAllObjectsInCoreData];
465+
}
466+
457467
+ (BOOL)isAppUpdated {
458468

459469
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

Sources/applozickit/ALMQTTConversationService.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ - (void)subscribeToConversationWithTopic:(NSString *) topic {
176176
[self subscribeToConversationWithTopic:topic withCompletionHandler:^(BOOL subscribed, NSError *error) {
177177
if (error) {
178178
ALSLog(ALLoggerSeverityError, @"MQTT : ERROR_IN_SUBSCRIBE :: %@", error.description);
179+
if ([error.description isEqual: @"MQTT CONNACK: bad user name or password"]) {
180+
[[NSNotificationCenter defaultCenter] postNotificationName:@"LOGOUT_UNAUTHORIZED_USER"
181+
object:nil
182+
userInfo:nil];
183+
}
179184
}
180185
}];
181186
}

Sources/include/ALRegisterUserClientService.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ static NSString *const AL_LOGOUT_URL = @"/rest/ws/device/logout";
3333

3434
- (void)logoutWithCompletionHandler:(void(^)(ALAPIResponse *response, NSError *error))completion;
3535

36+
- (void)logoutUserLocally;
37+
3638
+ (BOOL)isAppUpdated;
3739

3840
- (void)syncAccountStatus;

Sources/networkcommunication/ALResponseHandler.m

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ - (void)processRequest:(NSMutableURLRequest *)theRequest
3535

3636
NSHTTPURLResponse *httpURLResponse = (NSHTTPURLResponse *)response;
3737

38+
if (httpURLResponse.statusCode == 401) {
39+
//Trigger LOGOUT_UNAUTHORIZED_USER notification incase of 401 response.
40+
[[NSNotificationCenter defaultCenter] postNotificationName:@"LOGOUT_UNAUTHORIZED_USER"
41+
object:nil
42+
userInfo:nil];
43+
}
44+
3845
if (connectionError.code == kCFURLErrorUserCancelledAuthentication) {
3946
NSString *failingURL = connectionError.userInfo[@"NSErrorFailingURLStringKey"] != nil ? connectionError.userInfo[@"NSErrorFailingURLStringKey"]:@"Empty";
4047
ALSLog(ALLoggerSeverityError, @"Authentication error: HTTP 401 : ERROR CODE : %ld, FAILING URL: %@", (long)connectionError.code, failingURL);

0 commit comments

Comments
 (0)