-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPFInstallation.h
More file actions
116 lines (89 loc) · 3.53 KB
/
PFInstallation.h
File metadata and controls
116 lines (89 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//
// PFInstallation.h
//
// Copyright 2011-present Parse Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#if TARGET_OS_IPHONE
#import <Parse/PFNullability.h>
#import <Parse/PFObject.h>
#import <Parse/PFSubclassing.h>
#else
#import <ParseOSX/PFNullability.h>
#import <ParseOSX/PFObject.h>
#import <ParseOSX/PFSubclassing.h>
#endif
PF_ASSUME_NONNULL_BEGIN
/*!
A Parse Framework Installation Object that is a local representation of an
installation persisted to the Parse cloud. This class is a subclass of a
<PFObject>, and retains the same functionality of a PFObject, but also extends
it with installation-specific fields and related immutability and validity
checks.
A valid `PFInstallation` can only be instantiated via
<[PFInstallation currentInstallation]> because the required identifier fields
are readonly. The <timeZone> and <badge> fields are also readonly properties which
are automatically updated to match the device's time zone and application badge
when the `PFInstallation` is saved, thus these fields might not reflect the
latest device state if the installation has not recently been saved.
`PFInstallation` objects which have a valid <deviceToken> and are saved to
the Parse cloud can be used to target push notifications.
*/
@interface PFInstallation : PFObject<PFSubclassing>
///--------------------------------------
/// @name Accessing the Current Installation
///--------------------------------------
/*!
@abstract Gets the currently-running installation from disk and returns an instance of it.
@discussion If this installation is not stored on disk, returns a `PFInstallation`
with <deviceType> and <installationId> fields set to those of the
current installation.
@result Returns a `PFInstallation` that represents the currently-running installation.
*/
+ (instancetype)currentInstallation;
///--------------------------------------
/// @name Installation Properties
///--------------------------------------
/*!
@abstract The device type for the `PFInstallation`.
*/
@property (nonatomic, strong, readonly) NSString *deviceType;
/*!
@abstract The installationId for the `PFInstallation`.
*/
@property (nonatomic, strong, readonly) NSString *installationId;
/*!
@abstract The device token for the `PFInstallation`.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, strong) NSString *deviceToken;
/*!
@abstract The badge for the `PFInstallation`.
*/
@property (nonatomic, assign) NSInteger badge;
/*!
@abstract The name of the time zone for the `PFInstallation`.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, strong, readonly) NSString *timeZone;
/*!
@abstract The channels for the `PFInstallation`.
*/
@property (PF_NULLABLE_PROPERTY nonatomic, strong) NSArray *channels;
/*!
@abstract Sets the device token string property from an `NSData`-encoded token.
@param deviceTokenData A token that identifies the device.
*/
- (void)setDeviceTokenFromData:(PF_NULLABLE NSData *)deviceTokenData;
///--------------------------------------
/// @name Querying for Installations
///--------------------------------------
/*!
@abstract Creates a <PFQuery> for `PFInstallation` objects.
@discussion Only the following types of queries are allowed for installations:
- `[query getObjectWithId:<value>]`
- `[query whereKey:@"installationId" equalTo:<value>]`
- `[query whereKey:@"installationId" matchesKey:<key in query> inQuery:<query>]`
You can add additional query conditions, but one of the above must appear as a top-level `AND` clause in the query.
*/
+ (PF_NULLABLE PFQuery *)query;
@end
PF_ASSUME_NONNULL_END