Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpublicize localeIdentifier property on PFInstallation. #54

Merged
merged 1 commit into from
Aug 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Parse/Internal/Installation/PFInstallationPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@
@property (nonatomic, copy, readwrite) NSString *deviceType;
@property (nonatomic, copy, readwrite) NSString *installationId;
@property (nonatomic, copy, readwrite) NSString *timeZone;
@property (nonatomic, copy, readwrite) NSString *localeIdentifier;

@end
5 changes: 0 additions & 5 deletions Parse/PFInstallation.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ PF_ASSUME_NONNULL_BEGIN
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy, readonly) NSString *timeZone;

/*!
@abstract The localeIdentifier for the `PFInstallation` ([language code]-[COUNTRY CODE]).
*/
@property (PF_NULLABLE_PROPERTY nonatomic, copy, readonly) NSString *localeIdentifier;

/*!
@abstract The channels for the `PFInstallation`.
*/
Expand Down
7 changes: 4 additions & 3 deletions Parse/PFInstallation.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ @implementation PFInstallation
@dynamic installationId;
@dynamic deviceToken;
@dynamic timeZone;
@dynamic localeIdentifier;
@dynamic channels;
@dynamic badge;

Expand Down Expand Up @@ -336,8 +335,10 @@ - (void)_updateLocaleIdentifierFromDevice {
localeIdentifier = language;
}

if (localeIdentifier.length > 0 && ![localeIdentifier isEqualToString:self.localeIdentifier]) {
self.localeIdentifier = localeIdentifier;
NSString *currentLocaleIdentifier = self[PFInstallationKeyLocaleIdentifier];
if (localeIdentifier.length > 0 && ![localeIdentifier isEqualToString:currentLocaleIdentifier]) {
// Call into super to avoid checking on protected keys.
[super setObject:localeIdentifier forKey:PFInstallationKeyLocaleIdentifier];
}
}

Expand Down
4 changes: 4 additions & 0 deletions Tests/Unit/InstallationUnitTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ - (void)testInstallationImmutableFieldsCannotBeChanged {
@"Should throw an exception for trying to change deviceType.");
PFAssertThrowsInvalidArgumentException(installation[@"installationId"] = @"a"
@"Should throw an exception for trying to change installationId.");
PFAssertThrowsInvalidArgumentException(installation[@"localeIdentifier"] = @"a"
@"Should throw an exception for trying to change installationId.");
}

- (void)testInstallationImmutableFieldsCannotBeDeleted {
Expand All @@ -41,6 +43,8 @@ - (void)testInstallationImmutableFieldsCannotBeDeleted {
@"Should throw an exception for trying to delete deviceType.");
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"installationId"],
@"Should throw an exception for trying to delete installationId.");
PFAssertThrowsInvalidArgumentException([installation removeObjectForKey:@"localeIdentifier"],
@"Should throw an exception for trying to delete installationId.");
}

@end