зеркало из https://github.com/nextcloud/talk-ios.git
Save push token in the keychain.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
d316c027d6
Коммит
5c7d2c738a
|
@ -16,7 +16,7 @@
|
|||
#import <WebRTC/RTCAudioSession.h>
|
||||
#import <WebRTC/RTCAudioSessionConfiguration.h>
|
||||
|
||||
#import "UICKeyChainStore.h"
|
||||
#import "NCSettingsController.h"
|
||||
|
||||
@interface AppDelegate () <UNUserNotificationCenterDelegate, FIRMessagingDelegate>
|
||||
|
||||
|
@ -100,6 +100,7 @@
|
|||
- (void)messaging:(FIRMessaging *)messaging didRefreshRegistrationToken:(NSString *)fcmToken
|
||||
{
|
||||
NSLog(@"FCM registration token: %@", fcmToken);
|
||||
[NCSettingsController sharedInstance].ncPushToken = fcmToken;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ extern NSString * const kNCServerKey;
|
|||
extern NSString * const kNCUserKey;
|
||||
extern NSString * const kNCUserDisplayNameKey;
|
||||
extern NSString * const kNCTokenKey;
|
||||
extern NSString * const kNCPushTokenKey;
|
||||
|
||||
|
||||
@interface NCSettingsController : NSObject
|
||||
|
@ -23,6 +24,7 @@ extern NSString * const kNCTokenKey;
|
|||
@property (nonatomic, copy) NSString *ncUser;
|
||||
@property (nonatomic, copy) NSString *ncUserDisplayName;
|
||||
@property (nonatomic, copy) NSString *ncToken;
|
||||
@property (nonatomic, copy) NSString *ncPushToken;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
- (void)cleanAllStoredValues;
|
||||
|
|
|
@ -16,6 +16,7 @@ NSString * const kNCServerKey = @"ncServer";
|
|||
NSString * const kNCUserKey = @"ncUser";
|
||||
NSString * const kNCUserDisplayNameKey = @"ncUserDisplayName";
|
||||
NSString * const kNCTokenKey = @"ncToken";
|
||||
NSString * const kNCPushTokenKey = @"ncPushToken";
|
||||
|
||||
+ (NCSettingsController *)sharedInstance
|
||||
{
|
||||
|
@ -42,6 +43,7 @@ NSString * const kNCTokenKey = @"ncToken";
|
|||
_ncUser = [UICKeyChainStore stringForKey:kNCUserKey];
|
||||
_ncUserDisplayName = [UICKeyChainStore stringForKey:kNCUserDisplayNameKey];
|
||||
_ncToken = [UICKeyChainStore stringForKey:kNCTokenKey];
|
||||
_ncPushToken = [UICKeyChainStore stringForKey:kNCPushTokenKey];
|
||||
}
|
||||
|
||||
- (void)cleanAllStoredValues
|
||||
|
@ -50,6 +52,7 @@ NSString * const kNCTokenKey = @"ncToken";
|
|||
_ncUser = nil;
|
||||
_ncUserDisplayName = nil;
|
||||
_ncToken = nil;
|
||||
_ncPushToken = nil;
|
||||
|
||||
[UICKeyChainStore removeAllItems];
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче