1 |
efrain |
1 |
/*
|
|
|
2 |
* Copyright 2019 Google
|
|
|
3 |
*
|
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
|
6 |
* You may obtain a copy of the License at
|
|
|
7 |
*
|
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
9 |
*
|
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
13 |
* See the License for the specific language governing permissions and
|
|
|
14 |
* limitations under the License.
|
|
|
15 |
*/
|
|
|
16 |
|
|
|
17 |
#import <Foundation/Foundation.h>
|
|
|
18 |
|
|
|
19 |
NS_ASSUME_NONNULL_BEGIN
|
|
|
20 |
|
|
|
21 |
/**
|
|
|
22 |
* Represents an APNS device token and whether its environment is for sandbox.
|
|
|
23 |
* It can read from and write to an NSDictionary for simple serialization.
|
|
|
24 |
*/
|
|
|
25 |
@interface FIRMessagingAPNSInfo : NSObject <NSCoding, NSCopying>
|
|
|
26 |
|
|
|
27 |
/// The APNs device token, provided by the OS to the application delegate
|
|
|
28 |
@property(nonatomic, readonly, copy) NSData *deviceToken;
|
|
|
29 |
/// Represents whether or not this is deviceToken is for the sandbox
|
|
|
30 |
/// environment, or production.
|
|
|
31 |
@property(nonatomic, readonly, getter=isSandbox) BOOL sandbox;
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* Initializes the receiver with an APNs device token, and boolean
|
|
|
35 |
* representing whether that token is for the sandbox environment.
|
|
|
36 |
*
|
|
|
37 |
* @param deviceToken The APNs device token typically provided by the
|
|
|
38 |
* operating system.
|
|
|
39 |
* @param isSandbox YES if the APNs device token is for the sandbox
|
|
|
40 |
* environment, or NO if it is for production.
|
|
|
41 |
* @return An instance of FIRInstanceIDAPNSInfo.
|
|
|
42 |
*/
|
|
|
43 |
- (instancetype)initWithDeviceToken:(NSData *)deviceToken isSandbox:(BOOL)isSandbox;
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Initializes the receiver from a token options dictionary containing data
|
|
|
47 |
* within the `kFIRInstanceIDTokenOptionsAPNSKey` and
|
|
|
48 |
* `kFIRInstanceIDTokenOptionsAPNSIsSandboxKey` keys. The token should be an
|
|
|
49 |
* NSData blob, and the sandbox value should be an NSNumber
|
|
|
50 |
* representing a boolean value.
|
|
|
51 |
*
|
|
|
52 |
* @param dictionary A dictionary containing values under the keys
|
|
|
53 |
* `kFIRInstanceIDTokenOptionsAPNSKey` and
|
|
|
54 |
* `kFIRInstanceIDTokenOptionsAPNSIsSandboxKey`.
|
|
|
55 |
* @return An instance of FIRInstanceIDAPNSInfo, or nil if the
|
|
|
56 |
* dictionary data was invalid or missing.
|
|
|
57 |
*/
|
|
|
58 |
- (nullable instancetype)initWithTokenOptionsDictionary:(NSDictionary *)dictionary;
|
|
|
59 |
|
|
|
60 |
- (BOOL)isEqualToAPNSInfo:(FIRMessagingAPNSInfo *)otherInfo;
|
|
|
61 |
|
|
|
62 |
@end
|
|
|
63 |
|
|
|
64 |
NS_ASSUME_NONNULL_END
|