File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed
Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change 2424@property (nonatomic , copy , readwrite ) NSString *deviceType;
2525@property (nonatomic , copy , readwrite ) NSString *installationId;
2626@property (nonatomic , copy , readwrite ) NSString *timeZone;
27- @property (nonatomic , copy , readwrite ) NSString *localeIdentifier;
2827
2928@end
Original file line number Diff line number Diff line change @@ -79,11 +79,6 @@ PF_ASSUME_NONNULL_BEGIN
7979 */
8080@property (PF_NULLABLE_PROPERTY nonatomic , copy , readonly ) NSString *timeZone;
8181
82- /* !
83- @abstract The localeIdentifier for the `PFInstallation` ([language code]-[COUNTRY CODE]).
84- */
85- @property (PF_NULLABLE_PROPERTY nonatomic , copy , readonly ) NSString *localeIdentifier;
86-
8782/* !
8883 @abstract The channels for the `PFInstallation`.
8984 */
Original file line number Diff line number Diff line change @@ -108,7 +108,6 @@ @implementation PFInstallation
108108@dynamic installationId;
109109@dynamic deviceToken;
110110@dynamic timeZone;
111- @dynamic localeIdentifier;
112111@dynamic channels;
113112@dynamic badge;
114113
@@ -336,8 +335,10 @@ - (void)_updateLocaleIdentifierFromDevice {
336335 localeIdentifier = language;
337336 }
338337
339- if (localeIdentifier.length > 0 && ![localeIdentifier isEqualToString: self .localeIdentifier]) {
340- self.localeIdentifier = localeIdentifier;
338+ NSString *currentLocaleIdentifier = self[PFInstallationKeyLocaleIdentifier];
339+ if (localeIdentifier.length > 0 && ![localeIdentifier isEqualToString: currentLocaleIdentifier]) {
340+ // Call into super to avoid checking on protected keys.
341+ [super setObject: localeIdentifier forKey: PFInstallationKeyLocaleIdentifier];
341342 }
342343}
343344
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ - (void)testInstallationImmutableFieldsCannotBeChanged {
3131 @" Should throw an exception for trying to change deviceType." );
3232 PFAssertThrowsInvalidArgumentException (installation[@" installationId" ] = @" a"
3333 @" Should throw an exception for trying to change installationId." );
34+ PFAssertThrowsInvalidArgumentException (installation[@" localeIdentifier" ] = @" a"
35+ @" Should throw an exception for trying to change installationId." );
3436}
3537
3638- (void )testInstallationImmutableFieldsCannotBeDeleted {
@@ -41,6 +43,8 @@ - (void)testInstallationImmutableFieldsCannotBeDeleted {
4143 @" Should throw an exception for trying to delete deviceType." );
4244 PFAssertThrowsInvalidArgumentException ([installation removeObjectForKey: @" installationId" ],
4345 @" Should throw an exception for trying to delete installationId." );
46+ PFAssertThrowsInvalidArgumentException ([installation removeObjectForKey: @" localeIdentifier" ],
47+ @" Should throw an exception for trying to delete installationId." );
4448}
4549
4650@end
You can’t perform that action at this time.
0 commit comments