Skip to content

Commit

Permalink
Merge branch 'master' into kenny/deep-linking-spike
Browse files Browse the repository at this point in the history
  • Loading branch information
KennyHuRadar authored Oct 9, 2024
2 parents 5ee2003 + d634f27 commit 6067728
Show file tree
Hide file tree
Showing 14 changed files with 172 additions and 6 deletions.
2 changes: 1 addition & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDK'
s.version = '3.18.3-beta.2'
s.version = '3.18.4-beta.1'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => 'support@radar.com' }
Expand Down
18 changes: 16 additions & 2 deletions RadarSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@
DD8E2F7D24018C54002D51AB /* CLVisitMock.m in Sources */ = {isa = PBXBuildFile; fileRef = DD8E2F7C24018C54002D51AB /* CLVisitMock.m */; };
DE1E7644239724FD006F34A1 /* search_geofences.json in Resources */ = {isa = PBXBuildFile; fileRef = DE1E7643239724FD006F34A1 /* search_geofences.json */; };
E632FA1F2CAC505B00E86C85 /* RadarURLDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E632FA1E2CAC505B00E86C85 /* RadarURLDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
E658DB072CB46277004E0F01 /* RadarOperatingHours.h in Headers */ = {isa = PBXBuildFile; fileRef = E658DB062CB46277004E0F01 /* RadarOperatingHours.h */; settings = {ATTRIBUTES = (Public, ); }; };
E658DB092CB462AA004E0F01 /* RadarOperatingHour.m in Sources */ = {isa = PBXBuildFile; fileRef = E658DB082CB462AA004E0F01 /* RadarOperatingHour.m */; };
E658DB0A2CB462AA004E0F01 /* RadarOperatingHour.m in Sources */ = {isa = PBXBuildFile; fileRef = E658DB082CB462AA004E0F01 /* RadarOperatingHour.m */; };
E658DB0C2CB46B50004E0F01 /* RadarOperatingHours+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = E658DB0B2CB46B50004E0F01 /* RadarOperatingHours+Internal.h */; };
E698B6502C6112FA00084371 /* RadarMotionProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = E698B64F2C6112FA00084371 /* RadarMotionProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
E6B93B722C90E2B8003CB858 /* RadarInitializeOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = E6B93B712C90E2B8003CB858 /* RadarInitializeOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
E6B93B742C90E5B8003CB858 /* RadarInitializeOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = E6B93B732C90E5B8003CB858 /* RadarInitializeOptions.m */; };
Expand Down Expand Up @@ -341,6 +345,9 @@
DDF1157C2524E18100D575C4 /* RadarTrip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RadarTrip.m; sourceTree = "<group>"; };
DE1E7643239724FD006F34A1 /* search_geofences.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = search_geofences.json; sourceTree = "<group>"; };
E632FA1E2CAC505B00E86C85 /* RadarURLDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarURLDelegate.h; sourceTree = "<group>"; };
E658DB062CB46277004E0F01 /* RadarOperatingHours.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarOperatingHours.h; sourceTree = "<group>"; };
E658DB082CB462AA004E0F01 /* RadarOperatingHour.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RadarOperatingHour.m; sourceTree = "<group>"; };
E658DB0B2CB46B50004E0F01 /* RadarOperatingHours+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RadarOperatingHours+Internal.h"; sourceTree = "<group>"; };
E698B64F2C6112FA00084371 /* RadarMotionProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarMotionProtocol.h; sourceTree = "<group>"; };
E6B93B712C90E2B8003CB858 /* RadarInitializeOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarInitializeOptions.h; sourceTree = "<group>"; };
E6B93B732C90E5B8003CB858 /* RadarInitializeOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RadarInitializeOptions.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -405,6 +412,7 @@
96A5A0E427AD9F7F007B960B /* RadarRoute.h */,
0114F057284EFDB700ADA4E4 /* RadarRouteMode.h */,
96A5A0F127AD9F7F007B960B /* RadarRouteDistance.h */,
E658DB062CB46277004E0F01 /* RadarOperatingHours.h */,
96A5A0F227AD9F7F007B960B /* RadarRouteDuration.h */,
96A5A0D927AD9F7F007B960B /* RadarRouteGeometry.h */,
96A5A0DD27AD9F7F007B960B /* RadarRouteMatrix.h */,
Expand Down Expand Up @@ -577,8 +585,10 @@
96A5A0B127AD9F40007B960B /* RadarPlace+Internal.h */,
DD236CB22308812600EB88F9 /* RadarPlace.m */,
96A5A0BB27AD9F41007B960B /* RadarPolygonGeometry+Internal.h */,
E658DB0B2CB46B50004E0F01 /* RadarOperatingHours+Internal.h */,
DD236CAB2308812600EB88F9 /* RadarPolygonGeometry.m */,
96A5A0B527AD9F40007B960B /* RadarRegion+Internal.h */,
E658DB082CB462AA004E0F01 /* RadarOperatingHour.m */,
DD236CBC2308812700EB88F9 /* RadarRegion.m */,
96A5A0B327AD9F40007B960B /* RadarRoute+Internal.h */,
DD4D4D1723E60E6300D36C1D /* RadarRoute.m */,
Expand Down Expand Up @@ -653,6 +663,8 @@
019514362BD078D90031ABA2 /* RadarVerifiedLocationToken.h in Headers */,
96A5A10B27AD9F7F007B960B /* RadarTripOptions.h in Headers */,
E698B6502C6112FA00084371 /* RadarMotionProtocol.h in Headers */,
E658DB072CB46277004E0F01 /* RadarOperatingHours.h in Headers */,
E658DB0C2CB46B50004E0F01 /* RadarOperatingHours+Internal.h in Headers */,
E6B93B722C90E2B8003CB858 /* RadarInitializeOptions.h in Headers */,
82F7FAEE2A65FE030055AA4B /* RadarVerificationManager.h in Headers */,
96A5A0C727AD9F41007B960B /* RadarChain+Internal.h in Headers */,
Expand Down Expand Up @@ -848,6 +860,7 @@
files = (
0107AAA726220160008AB52F /* RadarGeofence.m in Sources */,
0107AAC826220184008AB52F /* RadarRouteDistance.m in Sources */,
E658DB092CB462AA004E0F01 /* RadarOperatingHour.m in Sources */,
0107AA952622014C008AB52F /* RadarCoordinate.m in Sources */,
0107AA8F26220146008AB52F /* RadarCircleGeometry.m in Sources */,
0107AAD426220190008AB52F /* RadarRouteGeometry.m in Sources */,
Expand Down Expand Up @@ -908,6 +921,7 @@
files = (
DD8E2F7424018C17002D51AB /* RadarPermissionsHelperMock.m in Sources */,
DD8E2F7724018C25002D51AB /* RadarAPIHelperMock.m in Sources */,
E658DB0A2CB462AA004E0F01 /* RadarOperatingHour.m in Sources */,
96B465BC27D6732500D7119B /* CLLocation+RadarTests.m in Sources */,
E6B93B742C90E5B8003CB858 /* RadarInitializeOptions.m in Sources */,
DD103211237E0C47003DD408 /* RadarSDKTests.m in Sources */,
Expand Down Expand Up @@ -1052,7 +1066,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MARKETING_VERSION = 3.18.3-beta.2;
MARKETING_VERSION = 3.18.4-beta.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1110,7 +1124,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MARKETING_VERSION = 3.18.3-beta.2;
MARKETING_VERSION = 3.18.4-beta.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_CFLAGS = "-fembed-bitcode";
Expand Down
6 changes: 6 additions & 0 deletions RadarSDK/Include/RadarGeofence.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#import "RadarGeofenceGeometry.h"
#import <Foundation/Foundation.h>
#import "RadarOperatingHours.h"

/**
Represents a geofence.
Expand Down Expand Up @@ -45,6 +46,11 @@
*/
@property (nonnull, strong, nonatomic, readonly) RadarGeofenceGeometry *geometry;

/**
The optional operating hours for the geofence.
*/
@property (nullable, copy, nonatomic, readonly) RadarOperatingHours *operatingHours;

+ (NSArray<NSDictionary *> *_Nullable)arrayForGeofences:(NSArray<RadarGeofence *> *_Nullable)geofences;
- (NSDictionary *_Nonnull)dictionaryValue;

Expand Down
15 changes: 15 additions & 0 deletions RadarSDK/Include/RadarOperatingHour.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// RadarOperatingHour.h
// RadarSDK
//
// Created by Kenny Hu on 10/7/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RadarOperatingHour : NSObject

@property (nonatomic, strong, readonly) NSDictionary<NSString *, NSArray<NSArray<NSString *> *> *> *hours;

@end
15 changes: 15 additions & 0 deletions RadarSDK/Include/RadarOperatingHours.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// RadarOperatingHour.h
// RadarSDK
//
// Created by Kenny Hu on 10/7/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RadarOperatingHours : NSObject

@property (nonatomic, strong, readonly) NSDictionary<NSString *, NSArray<NSArray<NSString *> *> *> *hours;

@end
1 change: 1 addition & 0 deletions RadarSDK/RadarGeofence+Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
tag:(NSString *_Nullable)tag
externalId:(NSString *_Nullable)externalId
metadata:(NSDictionary *_Nullable)metadata
operatingHours:(RadarOperatingHours *_Nullable)operatingHours
geometry:(RadarGeofenceGeometry *_Nonnull)geometry;
- (instancetype _Nullable)initWithObject:(id _Nonnull)object;

Expand Down
14 changes: 13 additions & 1 deletion RadarSDK/RadarGeofence.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#import "RadarCoordinate+Internal.h"
#import "RadarGeofence+Internal.h"
#import "RadarPolygonGeometry+Internal.h"
#import "RadarOperatingHours+Internal.h"

@implementation RadarGeofence

Expand Down Expand Up @@ -36,6 +37,7 @@ - (instancetype _Nullable)initWithId:(NSString *)_id
tag:(NSString *)tag
externalId:(NSString *_Nullable)externalId
metadata:(NSDictionary *_Nullable)metadata
operatingHours: (RadarOperatingHours *_Nullable) operatingHours
geometry:(RadarGeofenceGeometry *_Nonnull)geometry {
self = [super init];
if (self) {
Expand All @@ -44,6 +46,7 @@ - (instancetype _Nullable)initWithId:(NSString *)_id
_tag = tag;
_externalId = externalId;
_metadata = metadata;
_operatingHours = operatingHours;
_geometry = geometry;
}
return self;
Expand All @@ -61,6 +64,7 @@ - (instancetype _Nullable)initWithObject:(id)object {
NSString *tag;
NSString *externalId;
NSDictionary *metadata;
RadarOperatingHours *operatingHours;
RadarGeofenceGeometry *geometry;

id idObj = dict[@"_id"];
Expand Down Expand Up @@ -88,6 +92,11 @@ - (instancetype _Nullable)initWithObject:(id)object {
metadata = (NSDictionary *)metadataObj;
}

id operatingHoursObj = dict[@"operatingHours"];
if (operatingHoursObj && [operatingHoursObj isKindOfClass:[NSDictionary class]]) {
operatingHours = [[RadarOperatingHours alloc] initWithDictionary:operatingHoursObj];
}

id typeObj = dict[@"type"];
if ([typeObj isKindOfClass:[NSString class]]) {
NSString *type = (NSString *)typeObj;
Expand Down Expand Up @@ -130,7 +139,7 @@ - (instancetype _Nullable)initWithObject:(id)object {
}
}

return [[RadarGeofence alloc] initWithId:_id description:description tag:tag externalId:externalId metadata:metadata geometry:geometry];
return [[RadarGeofence alloc] initWithId:_id description:description tag:tag externalId:externalId metadata:metadata operatingHours:operatingHours geometry:geometry];
}

- (NSMutableArray<RadarCoordinate *> *)getPolygonCoordinates:(NSDictionary *)dict {
Expand Down Expand Up @@ -212,6 +221,9 @@ - (NSDictionary *)dictionaryValue {
[dict setValue:self.externalId forKey:@"externalId"];
[dict setValue:self.__description forKey:@"description"];
[dict setValue:self.metadata forKey:@"metadata"];
if (self.operatingHours) {
[dict setValue:self.operatingHours.hours forKey:@"operatingHours"];
}
if ([self.geometry isKindOfClass:[RadarCircleGeometry class]]) {
RadarCircleGeometry *circleGeometry = (RadarCircleGeometry *)self.geometry;
[dict setValue:@(circleGeometry.radius) forKey:@"geometryRadius"];
Expand Down
15 changes: 15 additions & 0 deletions RadarSDK/RadarOperatingHour+Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// RadarOperatingHour+Internal.h
// RadarSDK
//
// Created by Kenny Hu on 10/7/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//

#import "RadarOperatingHour.h"

@interface RadarOperatingHour()

- (instancetype)initWithDictionary:(NSDictionary *)dictionary;

@end
47 changes: 47 additions & 0 deletions RadarSDK/RadarOperatingHour.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// RadarOperatingHour.m
// RadarSDK
//
// Created by Kenny Hu on 10/7/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "RadarOperatingHours+Internal.h"

@implementation RadarOperatingHours

- (instancetype)initWithDictionary:(NSDictionary *)dictionary {
self = [super init];
if (self) {
NSMutableDictionary *parsedHours = [NSMutableDictionary new];

for (NSString *key in dictionary) {
id value = dictionary[key];

if ([value isKindOfClass:[NSArray class]]) {
NSArray *dayPairs = (NSArray *)value;
NSMutableArray *parsedDayPairs = [NSMutableArray new];

for (id pair in dayPairs) {
if ([pair isKindOfClass:[NSArray class]] && [pair count] == 2) {
NSString *start = pair[0];
NSString *end = pair[1];

if ([start isKindOfClass:[NSString class]] && [end isKindOfClass:[NSString class]]) {
[parsedDayPairs addObject:@[start, end]];
}
}
}

parsedHours[key] = [parsedDayPairs copy];
}
}

_hours = [parsedHours copy];
}
return self;
}

@end
15 changes: 15 additions & 0 deletions RadarSDK/RadarOperatingHours+Internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// RadarOperatingHour+Internal.h
// RadarSDK
//
// Created by Kenny Hu on 10/7/24.
// Copyright © 2024 Radar Labs, Inc. All rights reserved.
//

#import "RadarOperatingHours.h"

@interface RadarOperatingHours()

- (instancetype)initWithDictionary:(NSDictionary *)dictionary;

@end
2 changes: 1 addition & 1 deletion RadarSDK/RadarUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ + (NSNumber *)timeZoneOffset {
}

+ (NSString *)sdkVersion {
return @"3.18.3-beta.2";
return @"3.18.4-beta.1";
}

+ (NSString *)deviceId {
Expand Down
2 changes: 1 addition & 1 deletion RadarSDKMotion.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDKMotion'
s.version = '3.18.3-beta.2'
s.version = '3.18.4-beta.1'
s.summary = 'Motion detection plugin for RadarSDK, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => 'support@radar.com' }
Expand Down
2 changes: 2 additions & 0 deletions RadarSDKTests/RadarSDKTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1114,6 +1114,8 @@ - (void)test_Radar_searchGeofences_success {
NSDictionary *geofenceDict = [geofence dictionaryValue];
XCTAssertNotNil(geofenceDict[@"geometryCenter"]);
XCTAssertNotNil(geofenceDict[@"geometryRadius"]);
XCTAssertNotNil(geofenceDict[@"operatingHours"]);


[expectation fulfill];
}];
Expand Down
24 changes: 24 additions & 0 deletions RadarSDKTests/Resources/search_geofences.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@
"metadata": {
"foo": "bar"
},
"operatingHours":{
"Mon":[
["03:43","12:12"],
["13:45","20:54"]
],
"Tue":[
["08:00","20:30"]
],
"Wed":[
["08:00","20:30"]
],
"Thu":[
["08:00","20:30"]
],
"Fri":[
["08:00","20:30"]
],
"Sat":[
["08:00","18:00"]
],
"Sun":[
["08:00","18:00"]
]
},
"tag": "station",
"externalId": "admiralty",
"geometry": {
Expand Down

0 comments on commit 6067728

Please sign in to comment.