|
| 1 | +#import "../Global.h" |
| 2 | +#import <CoreLocation/CoreLocation.h> |
| 3 | +#define LogCLRegion(obj) \ |
| 4 | + WTAdd(obj.identifier,@"identifier");\ |
| 5 | + WTAdd([NSNumber numberWithDouble:obj.center.latitude],@"center.latitude");\ |
| 6 | + WTAdd([NSNumber numberWithDouble:obj.center.longitude],@"center.longitude");\ |
| 7 | + WTAdd([NSNumber numberWithDouble:obj.radius],@"radius"); |
| 8 | +typedef double CLLocationDegrees; |
| 9 | + |
| 10 | +/* |
| 11 | + * CLLocationAccuracy |
| 12 | + * |
| 13 | + * Discussion: |
| 14 | + * Type used to represent a location accuracy level in meters. The lower the value in meters, the |
| 15 | + * more physically precise the location is. A negative accuracy value indicates an invalid location. |
| 16 | + */ |
| 17 | +typedef double CLLocationAccuracy; |
| 18 | + |
| 19 | +/* |
| 20 | + * CLLocationSpeed |
| 21 | + * |
| 22 | + * Discussion: |
| 23 | + * Type used to represent the speed in meters per second. |
| 24 | + */ |
| 25 | +typedef double CLLocationSpeed; |
| 26 | + |
| 27 | +/* |
| 28 | + * CLLocationDirection |
| 29 | + * |
| 30 | + * Discussion: |
| 31 | + * Type used to represent the direction in degrees from 0 to 359.9. A negative value indicates an |
| 32 | + * invalid direction. |
| 33 | + */ |
| 34 | +typedef double CLLocationDirection; |
| 35 | + |
| 36 | +%group CoreLocation |
| 37 | +%hook CLLocationManager |
| 38 | +- (void)startUpdatingLocation{ |
| 39 | + if(WTShouldLog){ |
| 40 | + WTInit(@"CLLocationManager",@"startUpdatingLocation"); |
| 41 | + WTSave; |
| 42 | + WTRelease; |
| 43 | + } |
| 44 | + %orig; |
| 45 | +} |
| 46 | +- (void)stopMonitoringSignificantLocationChanges{ |
| 47 | + if(WTShouldLog){ |
| 48 | + WTInit(@"CLLocationManager",@"stopMonitoringSignificantLocationChanges"); |
| 49 | + WTSave; |
| 50 | + WTRelease; |
| 51 | + } |
| 52 | + %orig; |
| 53 | +} |
| 54 | +- (void)startMonitoringSignificantLocationChanges{ |
| 55 | + if(WTShouldLog){ |
| 56 | + WTInit(@"CLLocationManager",@"startMonitoringSignificantLocationChanges"); |
| 57 | + WTSave; |
| 58 | + WTRelease; |
| 59 | + } |
| 60 | + %orig; |
| 61 | +} |
| 62 | +- (void)stopUpdatingLocation{ |
| 63 | + if(WTShouldLog){ |
| 64 | + WTInit(@"CLLocationManager",@"stopUpdatingLocation"); |
| 65 | + WTSave; |
| 66 | + WTRelease; |
| 67 | + } |
| 68 | + %orig; |
| 69 | +} |
| 70 | +- (void)stopUpdatingHeading{ |
| 71 | + if(WTShouldLog){ |
| 72 | + WTInit(@"CLLocationManager",@"stopUpdatingHeading"); |
| 73 | + WTSave; |
| 74 | + WTRelease; |
| 75 | + } |
| 76 | + %orig; |
| 77 | +} |
| 78 | +- (void)stopMonitoringForRegion:(CLRegion *)region{ |
| 79 | + if(WTShouldLog){ |
| 80 | + WTInit(@"CLLocationManager",@"stopMonitoringForRegion:"); |
| 81 | + LogCLRegion(region); |
| 82 | + WTSave; |
| 83 | + WTRelease; |
| 84 | + } |
| 85 | + %orig; |
| 86 | +} |
| 87 | +- (void)startMonitoringForRegion:(CLRegion *)region{ |
| 88 | + if(WTShouldLog){ |
| 89 | + WTInit(@"CLLocationManager",@"startMonitoringForRegion:"); |
| 90 | + LogCLRegion(region); |
| 91 | + WTSave; |
| 92 | + WTRelease; |
| 93 | + } |
| 94 | + %orig; |
| 95 | +} |
| 96 | +- (void)startUpdatingHeading{ |
| 97 | + if(WTShouldLog){ |
| 98 | + WTInit(@"CLLocationManager",@"startUpdatingHeading"); |
| 99 | + WTSave; |
| 100 | + WTRelease; |
| 101 | + } |
| 102 | + %orig; |
| 103 | +} |
| 104 | +- (void)requestStateForRegion:(CLRegion *)region{ |
| 105 | + if(WTShouldLog){ |
| 106 | + WTInit(@"CLLocationManager",@"requestStateForRegion:"); |
| 107 | + LogCLRegion(region); |
| 108 | + WTSave; |
| 109 | + WTRelease; |
| 110 | + } |
| 111 | + %orig; |
| 112 | +} |
| 113 | +- (void)stopRangingBeaconsInRegion:(CLBeaconRegion *)region{ |
| 114 | + if(WTShouldLog){ |
| 115 | + WTInit(@"CLLocationManager",@"stopRangingBeaconsInRegion:"); |
| 116 | + LogCLRegion(region); |
| 117 | + WTAdd(region.proximityUUID,@"proximityUUID"); |
| 118 | + WTSave; |
| 119 | + WTRelease; |
| 120 | + } |
| 121 | + %orig; |
| 122 | +} |
| 123 | +- (void)startRangingBeaconsInRegion:(CLBeaconRegion *)region{ |
| 124 | + if(WTShouldLog){ |
| 125 | + WTInit(@"CLLocationManager",@"startRangingBeaconsInRegion:"); |
| 126 | + LogCLRegion(region); |
| 127 | + WTAdd(region.proximityUUID,@"proximityUUID"); |
| 128 | + WTSave; |
| 129 | + WTRelease; |
| 130 | + } |
| 131 | + %orig; |
| 132 | +} |
| 133 | +%end |
| 134 | +/*%hook CLLocation |
| 135 | +- (id)initWithLatitude:(CLLocationDegrees)latitude |
| 136 | + longitude:(CLLocationDegrees)longitude{ |
| 137 | +
|
| 138 | + } |
| 139 | +- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate |
| 140 | + altitude:(CLLocationDistance)altitude |
| 141 | + horizontalAccuracy:(CLLocationAccuracy)hAccuracy |
| 142 | + verticalAccuracy:(CLLocationAccuracy)vAccuracy |
| 143 | + timestamp:(NSDate *)timestamp; |
| 144 | +- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate |
| 145 | + altitude:(CLLocationDistance)altitude |
| 146 | + horizontalAccuracy:(CLLocationAccuracy)hAccuracy |
| 147 | + verticalAccuracy:(CLLocationAccuracy)vAccuracy |
| 148 | + course:(CLLocationDirection)course |
| 149 | + speed:(CLLocationSpeed)speed |
| 150 | + timestamp:(NSDate *)timestamp |
| 151 | +- (double)distanceFromLocation:(const CLLocation *)location{ |
| 152 | +
|
| 153 | +
|
| 154 | +} |
| 155 | +%end*/ |
| 156 | + |
| 157 | + |
| 158 | +%end |
| 159 | +extern void init_CoreLocation_hook() { |
| 160 | + %init(CoreLocation); |
| 161 | +} |
| 162 | +#undef LogCLRegion |
0 commit comments