2014-08-01 07:53:58 +02:00
|
|
|
//
|
|
|
|
// PushManager.h
|
|
|
|
// Signal
|
|
|
|
//
|
|
|
|
// Created by Frederic Jacobs on 31/07/14.
|
|
|
|
// Copyright (c) 2014 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
2014-10-06 01:28:45 +02:00
|
|
|
#import <CollapsingFutures.h>
|
2014-08-01 07:53:58 +02:00
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
2014-12-01 23:24:35 +01:00
|
|
|
#define Signal_Call_Accept_Identifier @"Signal_Call_Accept"
|
|
|
|
#define Signal_Call_Decline_Identifier @"Signal_Call_Decline"
|
|
|
|
|
|
|
|
#define Signal_Call_Category @"Signal_IncomingCall"
|
|
|
|
#define Signal_Message_Category @"Signal_Message"
|
|
|
|
|
|
|
|
#define Signal_Message_View_Identifier @"Signal_Message_Read"
|
|
|
|
#define Signal_Message_MarkAsRead_Identifier @"Signal_Message_MarkAsRead"
|
2014-09-15 01:32:19 +02:00
|
|
|
|
2015-02-20 17:02:31 +01:00
|
|
|
typedef void(^failedPushRegistrationBlock)(NSError *error);
|
|
|
|
|
2014-09-15 01:32:19 +02:00
|
|
|
/**
|
|
|
|
* The Push Manager is responsible for registering the device for Signal push notifications.
|
|
|
|
*/
|
|
|
|
|
2014-08-01 07:53:58 +02:00
|
|
|
@interface PushManager : NSObject
|
|
|
|
|
2014-10-07 00:04:50 +02:00
|
|
|
+ (PushManager*)sharedManager;
|
2014-08-01 07:53:58 +02:00
|
|
|
|
2014-09-15 01:32:19 +02:00
|
|
|
/**
|
2015-04-07 17:22:57 +02:00
|
|
|
* Registers the push token with the RedPhone server, then returns the push token and a signup token to be used to register with TextSecure.
|
2014-09-15 01:32:19 +02:00
|
|
|
*
|
2015-04-07 17:22:57 +02:00
|
|
|
* @param success Success completion block - registering with TextSecure server
|
|
|
|
* @param failure Failure completion block
|
2014-09-15 01:32:19 +02:00
|
|
|
*/
|
2014-08-02 13:57:50 +02:00
|
|
|
|
2015-04-07 17:22:57 +02:00
|
|
|
- (void)registrationAndRedPhoneTokenRequestWithSuccess:(void (^)(NSData* pushToken, NSString* signupToken))success failure:(failedPushRegistrationBlock)failure;
|
2014-08-01 07:53:58 +02:00
|
|
|
|
2014-11-20 21:36:20 +01:00
|
|
|
/**
|
2015-04-07 17:22:57 +02:00
|
|
|
* Returns the Push Notification Token of this device
|
2014-11-20 21:36:20 +01:00
|
|
|
*
|
2015-04-07 17:22:57 +02:00
|
|
|
* @param success Completion block that is passed the token as a parameter
|
|
|
|
* @param failure Failure block, executed when failed to get push token
|
2014-11-20 21:36:20 +01:00
|
|
|
*/
|
|
|
|
|
2015-04-07 17:22:57 +02:00
|
|
|
- (void)requestPushTokenWithSuccess:(void (^)(NSData* pushToken))success failure:(void(^)(NSError *))failure;
|
2014-11-20 21:36:20 +01:00
|
|
|
|
2014-09-15 01:32:19 +02:00
|
|
|
/**
|
2015-04-07 17:22:57 +02:00
|
|
|
* Registers for Users Notifications. By doing this on launch, we are sure that the correct categories of user notifications is registered.
|
2014-09-15 01:32:19 +02:00
|
|
|
*/
|
|
|
|
|
2015-04-07 17:22:57 +02:00
|
|
|
- (void)validateUserNotificationSettings;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The pushNotification and userNotificationFutureSource are accessed by the App Delegate after requested permissions.
|
|
|
|
*/
|
2015-02-20 17:02:31 +01:00
|
|
|
|
2014-09-15 01:32:19 +02:00
|
|
|
@property TOCFutureSource *pushNotificationFutureSource;
|
|
|
|
@property TOCFutureSource *userNotificationFutureSource;
|
2014-08-01 07:53:58 +02:00
|
|
|
|
2014-09-15 01:32:19 +02:00
|
|
|
@end
|