Skip to content

Commit 7827c85

Browse files
committed
Merge remote-tracking branch 'ParsePlatform/master' into release/1.15.1
* ParsePlatform/master: ⚡ Release 1.15.1 Makes sure we stop the dispatch_source to prevent cycle/leak (parse-community#1161) Add Polygon Type and PolygonContain to Query (parse-community#1157)
2 parents 47df435 + 8276355 commit 7827c85

File tree

33 files changed

+528
-32
lines changed

33 files changed

+528
-32
lines changed

Parse.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'Parse'
3-
s.version = '1.15.0'
3+
s.version = '1.15.1'
44
s.license = { :type => 'BSD', :file => 'LICENSE' }
55
s.homepage = 'http://parseplatform.org/'
66
s.summary = 'A library that gives you access to the powerful Parse cloud platform from your iOS/OS X/watchOS/tvOS app.'

Parse.xcodeproj/project.pbxproj

Lines changed: 54 additions & 0 deletions
Large diffs are not rendered by default.

Parse/Internal/PFEventuallyQueue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ extern NSTimeInterval const PFEventuallyQueueDefaultTimeoutRetryInterval;
6767
- (void)start NS_REQUIRES_SUPER;
6868
- (void)resume NS_REQUIRES_SUPER;
6969
- (void)pause NS_REQUIRES_SUPER;
70-
70+
- (void)stop NS_REQUIRES_SUPER;
7171
- (void)removeAllCommands NS_REQUIRES_SUPER;
7272

7373
@end

Parse/Internal/PFEventuallyQueue.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ - (void)pause {
197197
dispatch_suspend(_processingQueueSource);
198198
}
199199

200+
- (void)stop {
201+
dispatch_source_cancel(_processingQueueSource);
202+
}
203+
200204
- (void)removeAllCommands {
201205
dispatch_sync(_synchronizationQueue, ^{
202206
[_taskCompletionSources removeAllObjects];

Parse/Internal/PFPolygonPrivate.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
* Copyright (c) 2015-present, Parse, LLC.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import <Foundation/Foundation.h>
11+
12+
#import <Parse/PFPolygon.h>
13+
14+
@class PFPolygon;
15+
16+
@interface PFPolygon (Private)
17+
18+
// Internal commands
19+
20+
/*
21+
Gets the encoded format for a Polygon.
22+
*/
23+
- (NSDictionary *)encodeIntoDictionary;
24+
25+
/**
26+
Creates a Polygon from its encoded format.
27+
*/
28+
+ (instancetype)polygonWithDictionary:(NSDictionary *)dictionary;
29+
30+
@end

Parse/Internal/ParseInternal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import "PFEventuallyQueue.h"
1717
#import "PFFieldOperation.h"
1818
#import "PFGeoPointPrivate.h"
19+
#import "PFPolygonPrivate.h"
1920
#import "PFInternalUtils.h"
2021
#import "PFKeyValueCache.h"
2122
#import "PFObjectPrivate.h"

Parse/Internal/ParseManager.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ - (PFEventuallyQueue *)eventuallyQueue {
174174
[PFPinningEventuallyQueue newDefaultPinningEventuallyQueueWithDataSource:self]
175175
:
176176
commandCache);
177-
178177
// We still need to clear out the old command cache even if we're using Pinning in case
179178
// anything is left over when the user upgraded. Checking number of pending and then
180179
// clearing should be enough.
181-
if (self.offlineStoreLoaded && commandCache.commandCount > 0) {
182-
[commandCache removeAllCommands];
180+
if (self.offlineStoreLoaded) {
181+
if (commandCache.commandCount > 0) {
182+
[commandCache removeAllCommands];
183+
}
184+
// we won't need it after stop everything...
185+
[commandCache stop];
183186
}
184187
}
185188
#endif

Parse/Internal/Query/PFQueryConstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ extern NSString *const PFQueryKeyContainsAll;
2222
extern NSString *const PFQueryKeyNearSphere;
2323
extern NSString *const PFQueryKeyWithin;
2424
extern NSString *const PFQueryKeyGeoWithin;
25+
extern NSString *const PFQueryKeyGeoIntersects;
2526
extern NSString *const PFQueryKeyRegex;
2627
extern NSString *const PFQueryKeyExists;
2728
extern NSString *const PFQueryKeyInQuery;
@@ -37,6 +38,7 @@ extern NSString *const PFQueryKeyObject;
3738
extern NSString *const PFQueryOptionKeyMaxDistance;
3839
extern NSString *const PFQueryOptionKeyBox;
3940
extern NSString *const PFQueryOptionKeyPolygon;
41+
extern NSString *const PFQueryOptionKeyPoint;
4042
extern NSString *const PFQueryOptionKeyRegexOptions;
4143

4244
NS_ASSUME_NONNULL_END

Parse/Internal/Query/PFQueryConstants.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
NSString *const PFQueryKeyNearSphere = @"$nearSphere";
2121
NSString *const PFQueryKeyWithin = @"$within";
2222
NSString *const PFQueryKeyGeoWithin = @"$geoWithin";
23+
NSString *const PFQueryKeyGeoIntersects = @"$geoIntersects";
2324
NSString *const PFQueryKeyRegex = @"$regex";
2425
NSString *const PFQueryKeyExists = @"$exists";
2526
NSString *const PFQueryKeyInQuery = @"$inQuery";
@@ -35,4 +36,5 @@
3536
NSString *const PFQueryOptionKeyMaxDistance = @"$maxDistance";
3637
NSString *const PFQueryOptionKeyBox = @"$box";
3738
NSString *const PFQueryOptionKeyPolygon = @"$polygon";
39+
NSString *const PFQueryOptionKeyPoint = @"$point";
3840
NSString *const PFQueryOptionKeyRegexOptions = @"$options";

Parse/PFConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#pragma mark - SDK Version
1414
///--------------------------------------
1515

16-
#define PARSE_VERSION @"1.15.0"
16+
#define PARSE_VERSION @"1.15.1"
1717

1818
///--------------------------------------
1919
#pragma mark - Platform

Parse/PFDecoder.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#import "PFFieldOperationDecoder.h"
1616
#import "PFFile_Private.h"
1717
#import "PFGeoPointPrivate.h"
18+
#import "PFPolygonPrivate.h"
1819
#import "PFInternalUtils.h"
1920
#import "PFMacros.h"
2021
#import "PFObjectPrivate.h"
@@ -56,6 +57,9 @@ - (id)decodeDictionary:(NSDictionary *)dictionary {
5657
} else if ([type isEqualToString:@"GeoPoint"]) {
5758
return [PFGeoPoint geoPointWithDictionary:dictionary];
5859

60+
} else if ([type isEqualToString:@"Polygon"]) {
61+
return [PFPolygon polygonWithDictionary:dictionary];
62+
5963
} else if ([type isEqualToString:@"Relation"]) {
6064
return [PFRelation relationFromDictionary:dictionary withDecoder:self];
6165

Parse/PFEncoder.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#import "PFFieldOperation.h"
1717
#import "PFFile_Private.h"
1818
#import "PFGeoPointPrivate.h"
19+
#import "PFPolygonPrivate.h"
1920
#import "PFObjectPrivate.h"
2021
#import "PFOfflineStore.h"
2122
#import "PFRelationPrivate.h"
@@ -75,6 +76,10 @@ - (id)encodeObject:(id)object {
7576
// TODO (hallucinogen): pass object encoder here
7677
return [object encodeIntoDictionary];
7778

79+
} else if ([object isKindOfClass:[PFPolygon class]]) {
80+
// TODO (hallucinogen): pass object encoder here
81+
return [object encodeIntoDictionary];
82+
7883
} else if ([object isKindOfClass:[PFRelation class]]) {
7984
// TODO (hallucinogen): pass object encoder here
8085
return [object encodeIntoDictionary];

Parse/PFPolygon.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Copyright (c) 2015-present, Parse, LLC.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree. An additional grant
7+
* of patent rights can be found in the PATENTS file in the same directory.
8+
*/
9+
10+
#import <CoreLocation/CoreLocation.h>
11+
#import <Foundation/Foundation.h>
12+
#import "PFGeoPoint.h"
13+
14+
NS_ASSUME_NONNULL_BEGIN
15+
16+
@class PFPolygon;
17+
18+
/**
19+
`PFPolygon` may be used to embed a latitude / longitude points as the value for a key in a `PFObject`.
20+
It could be used to perform queries in a geospatial manner using `PFQuery.-whereKey:polygonContains:`.
21+
*/
22+
@interface PFPolygon : NSObject <NSCopying, NSCoding>
23+
24+
///--------------------------------------
25+
#pragma mark - Creating a Polygon
26+
///--------------------------------------
27+
28+
/**
29+
Creates a new `PFPolygon` object for the given `CLLocation`, set to the location's coordinates.
30+
31+
@param coordinates Array of `CLLocation`, `PFGeoPoint` or `(lat,lng)`
32+
@return Returns a new PFPolygon at specified location.
33+
*/
34+
+ (instancetype)polygonWithCoordinates:(NSArray *)coordinates;
35+
36+
/**
37+
Test if this polygon contains a point
38+
39+
@param point `PFGeoPoint` to test
40+
@return Returns a boolean.
41+
*/
42+
- (BOOL)containsPoint:(PFGeoPoint *)point;
43+
44+
///--------------------------------------
45+
#pragma mark - Controlling Position
46+
///--------------------------------------
47+
48+
/**
49+
Array of `PFGeoPoints` or CLLocations
50+
*/
51+
@property (nonatomic, strong) NSArray* coordinates;
52+
53+
@end
54+
55+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)