Skip to content

Commit 73fb4a4

Browse files
committed
Code cleaning
1 parent 1960ff8 commit 73fb4a4

7 files changed

+189
-288
lines changed

Ingress/API.m

-59
Original file line numberDiff line numberDiff line change
@@ -256,65 +256,6 @@ - (void)playSounds:(NSArray *)soundNames {
256256

257257
}
258258

259-
//- (void)playBackgroundMusic {
260-
//
261-
//// NSString *path = [[NSBundle mainBundle] pathForResource:@"sfx_ambient_alien_base" ofType:@"aif" inDirectory:@"Sound"];
262-
//// NSURL *url = [NSURL fileURLWithPath:path];
263-
//// _backgroundAudioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
264-
//// _backgroundAudioPlayer.numberOfLoops = -1;
265-
//// _backgroundAudioPlayer.volume = .25;
266-
//// [_backgroundAudioPlayer prepareToPlay];
267-
//// [_backgroundAudioPlayer play];
268-
//
269-
// [[SoundManager sharedManager] playMusic:@"Sound/sfx_ambient_alien_base.aif" looping:YES];
270-
//
271-
//}
272-
//
273-
//- (void)playSoundNamed:(NSString *)name completionHandler:(void (^)(void))handler {
274-
//
275-
// return;
276-
//
277-
// if (_audioPlayer) {
278-
// [_audioPlayer stop];
279-
// _audioPlayer = nil;
280-
// }
281-
//
282-
// NSError *err;
283-
// NSString *path = [[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Sound"] stringByAppendingPathComponent:name];
284-
//
285-
// if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
286-
// NSURL *url = [NSURL fileURLWithPath:path];
287-
// _audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&err];
288-
// if (err) { NSLog(@"Sound named '%@' had error %@", name, [err localizedDescription]); }
289-
// if (_audioPlayer) {
290-
// soundCompletionHandlerBlock = handler;
291-
// [_audioPlayer setDelegate:self];
292-
// [_audioPlayer prepareToPlay];
293-
// [_audioPlayer play];
294-
// } else {
295-
// if (handler) { handler(); }
296-
// }
297-
// } else {
298-
// NSLog(@"Sound file '%@' doesn't exist at '%@'", name, path);
299-
// if (handler) { handler(); }
300-
// }
301-
//
302-
//}
303-
//
304-
//- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag {
305-
// if (soundCompletionHandlerBlock) {
306-
// soundCompletionHandlerBlock();
307-
// soundCompletionHandlerBlock = nil;
308-
// }
309-
//}
310-
//
311-
//- (void)audioPlayerDecodeErrorDidOccur:(AVAudioPlayer *)player error:(NSError *)error {
312-
// if (soundCompletionHandlerBlock) {
313-
// soundCompletionHandlerBlock();
314-
// soundCompletionHandlerBlock = nil;
315-
// }
316-
//}
317-
318259
#pragma mark - Location
319260

320261
- (NSString *)currentE6Location {

Ingress/LoadingViewController.m

+4-133
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,6 @@ - (void)viewDidLoad {
1818
[label setFont:[UIFont fontWithName:@"Coda-Regular" size:20]];
1919
}
2020

21-
//function $e(a) { //8823, 5510
22-
// for(var b = [], c = ZOOM_LEVEL;c > 0;c--) {
23-
// var d = 0, e = 1 << c - 1;
24-
// (a.x & e) != 0 && d++;
25-
// (a.y & e) != 0 && (d++, d++);
26-
// b.push(d)
27-
// }
28-
// return b.join("")
29-
//}
30-
31-
//- (NSString *)e:(CLLocationCoordinate2D)a {
32-
//
33-
// NSMutableArray *b = [NSMutableArray array];
34-
//
35-
// for (int c = 16; c > 0; c--) {
36-
//
37-
// int d = 0;
38-
// int e = 1 << c - 1;
39-
// ((int)a.latitude & e) != 0 && d++;
40-
// ((int)a.longitude & e) != 0 && (d++, d++);
41-
//
42-
// [b addObject:@(d)];
43-
//
44-
// }
45-
//
46-
// return [b componentsJoinedByString:@""];
47-
//
48-
//}
49-
5021
- (void)viewWillAppear:(BOOL)animated {
5122
[super viewWillAppear:animated];
5223

@@ -59,105 +30,6 @@ - (void)viewWillAppear:(BOOL)animated {
5930
[[SoundManager sharedManager] playMusic:@"Sound/sfx_throbbing_wheels.aif" looping:YES];
6031

6132
[self performHandshake];
62-
63-
// dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC));
64-
// dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
65-
// [self performSegueWithIdentifier:@"LoadingCompletedSegue" sender:self];
66-
// });
67-
68-
// return;
69-
//
70-
// UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
71-
// [webView setDelegate:self];
72-
// [webView setUserInteractionEnabled:NO];
73-
// [webView setAlpha:0];
74-
// [self.view addSubview:webView];
75-
// NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]];
76-
// [webView loadRequest:request];
77-
//
78-
// CLLocationCoordinate2D neLoc = CLLocationCoordinate2DMake(50.64601929058625, 13.84268054053473);
79-
// CLLocationCoordinate2D swLoc = CLLocationCoordinate2DMake(50.63809963027642, 13.809120741340394);
80-
//
81-
// float x = round(256 * 0.9999 * fabsf(1 / cos(neLoc.latitude * (M_PI / 180)))); //404
82-
//
83-
// CLLocationCoordinate2D Ob = CLLocationCoordinate2DMake(x/2, x/2); // {202, 202}
84-
// float Pb = x / 360; //1.1222222222222222
85-
// float Qb = x / (2 * M_PI); //64.29859700912571
86-
// float R = (float)(1 << (int)(16 - (x / 256 - 1))); //32768
87-
//
88-
// /////////////////////////
89-
//
90-
//// NSLog(@"1: %@", [webView stringByEvaluatingJavaScriptFromString:@"function T(a,b){this.x=a;this.y=b}"]);
91-
//// NSLog(@"1: %@", [webView stringByEvaluatingJavaScriptFromString:@"var d = new T((202+13.84268054053473*1.1222222222222222),0)"]);
92-
//// NSLog(@"1: %@", [webView stringByEvaluatingJavaScriptFromString:@"d"]);
93-
//// NSLog(@"1: %@", [webView stringByEvaluatingJavaScriptFromString:@"d.x"]);
94-
//
95-
// CLLocationCoordinate2D d;
96-
// d.longitude = Ob.longitude + neLoc.longitude * Pb;
97-
// float e = sinf(neLoc.latitude * (M_PI / 180));
98-
// e = MAX(e, -0.9999);
99-
// e = MIN(e, 0.9999);
100-
// d.latitude = Ob.latitude + 0.5 * logf((1 + e) / (1 - e)) * -Qb;
101-
// NSLog(@"d.lat: %f, d.lng: %f", d.latitude, d.longitude); // = { x: 217.57375160467728, y: 135.87756580181085 }
102-
//
103-
// d = CLLocationCoordinate2DMake(d.longitude * R, d.latitude * R);
104-
// NSLog(@"d.lat: %f, d.lng: %f", d.latitude, d.longitude); //= { x: 7128167.06046446, y: 4452537.590702042 }
105-
//
106-
// d = CLLocationCoordinate2DMake(floor(d.longitude / x), floor(d.latitude / x));
107-
// NSLog(@"d.lat: %f, d.lng: %f", d.latitude, d.longitude); //= { x: 17643, y: 11021 }
108-
//
109-
// /////////////////////////
110-
//
111-
// CLLocationCoordinate2D c;
112-
// c.longitude = Ob.longitude + swLoc.longitude * Pb;
113-
// e = sinf(swLoc.latitude * (M_PI / 180));
114-
// e = MAX(e, -0.9999);
115-
// e = MIN(e, 0.9999);
116-
// c.latitude = Ob.latitude + 0.5 * logf((1 + e) / (1 - e)) * -Qb;
117-
// NSLog(@"c.lat: %f, c.lng: %f", c.latitude, c.longitude); //= { x: 217.496902165282, y: 135.89296880003485 }
118-
//
119-
// c = CLLocationCoordinate2DMake(c.longitude * R, c.latitude * R);
120-
// NSLog(@"c.lat: %f, c.lng: %f", c.latitude, c.longitude); //= { x: 7126938.49015196, y: 4452940.801639542 }
121-
//
122-
// c = CLLocationCoordinate2DMake(floor(c.longitude / x), floor(c.latitude / x));
123-
// NSLog(@"c.lat: %f, c.lng: %f", c.latitude, c.longitude); //= { x: 17640, y: 11022 }
124-
//
125-
// /////////////////////////
126-
//
127-
// float i = fabsf(c.longitude - d.longitude);
128-
// float j = fabsf(c.latitude - d.latitude);
129-
//
130-
// NSLog(@"i: %f", i); //3
131-
// NSLog(@"j: %f", j); //1
132-
//
133-
// NSMutableArray *f = [NSMutableArray array];
134-
//
135-
// for (int g = 0; g <= i; g++) {
136-
//
137-
// float k = fabsf(d.longitude - g);
138-
// float l = d.latitude;
139-
// CLLocationCoordinate2D m = CLLocationCoordinate2DMake(k, l);
140-
//
141-
// NSLog(@"m.lat: %f, m.lng: %f", m.latitude, m.longitude); //= { 17643, y: 11021 }
142-
//
143-
// NSString *q = [self e:m];
144-
//
145-
// [f addObject:@{@"bounds": @"bf({Ob,Qb,Pb,R}, m)", @"quadkey": q}];
146-
//
147-
// for(int o = 1; o <= j; o++) {
148-
//
149-
// float g = d.latitude + o;
150-
// CLLocationCoordinate2D h = CLLocationCoordinate2DMake(k, g);
151-
//
152-
// NSString *z = [self e:h];
153-
//
154-
// [f addObject:@{@"bounds": @"bf({Ob,Qb,Pb,R}, h)", @"quadkey": z}];
155-
//
156-
// }
157-
//
158-
// }
159-
//
160-
// NSLog(@"f: %@", f);
16133

16234
}
16335

@@ -180,7 +52,7 @@ - (void)performHandshake {
18052
//@"nemesisSoftwareVersion": @"2013-03-13T22:49:05Z 40d223faeed9 opt", // 1.21.3
18153
@"nemesisSoftwareVersion": @"2013-04-08T20:23:14Z 10b76085f06d opt", // 1.23.1
18254
@"deviceSoftwareVersion": @"4.1.1",
183-
//@"activationCode": @"B3XDFBAP",
55+
//@"activationCode": @"XXXXXXXX",
18456
//@"tosAccepted": @"1",
18557
};
18658

@@ -244,8 +116,7 @@ - (void)webViewDidFinishLoad:(UIWebView *)webView {
244116
NSArray *cookies = [sharedHTTPCookieStorage cookiesForURL:handshakeURL];
245117
for (NSHTTPCookie *cookie in cookies) {
246118
if ([cookie.name isEqualToString:@"SACSID"]) {
247-
248-
//NSLog(@"Got SACSID");
119+
249120
//NSLog(@"SACSID: %@", cookie.value);
250121
[[API sharedInstance] setSACSID:cookie.value];
251122

@@ -285,8 +156,8 @@ - (void)tabBarController:(UITabBarController *)theTabBarController didSelectView
285156

286157
}
287158

288-
#pragma mark - Animated Tab Bar
289-
159+
//#pragma mark - Animated Tab Bar
160+
//
290161
//- (CGFloat)horizontalLocationFor:(NSUInteger)tabIndex {
291162
// // A single tab item's width is the entire width of the tab bar divided by number of items
292163
// CGFloat tabItemWidth = _tabBarController.tabBar.frame.size.width / _tabBarController.tabBar.items.count;

Ingress/ProfileViewController.m

-8
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ - (void)viewDidLoad {
5252
weakPasscodeContainerView.frame = passcodeContainerViewFrame;
5353
}];
5454

55-
//
56-
5755
// [[API sharedInstance] chooseFaction:@"ALIENS" completionHandler:^{
5856
//
5957
// }];
@@ -208,12 +206,6 @@ - (IBAction)energyCollectValueChanged:(UIStepper *)sender {
208206

209207
- (IBAction)actionSheet {
210208

211-
// [[MTStatusBarOverlay sharedInstance] postMessage:@"Test :)" duration:2 animated:YES];
212-
// return;
213-
214-
// [[API sharedInstance] cheatSetPlayerLevel];
215-
// return;
216-
217209
[[SoundManager sharedManager] playSound:@"Sound/sfx_ui_success.aif"];
218210

219211
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Sign Out" otherButtonTitles:@"Submit Portal", nil];

Ingress/ScannerViewController.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#import <CoreImage/CoreImage.h>
1313
#import "LevelChooserViewController.h"
1414

15-
@interface ScannerViewController : UIViewController <MKMapViewDelegate, UIWebViewDelegate> {
15+
@interface ScannerViewController : UIViewController <MKMapViewDelegate> {
1616

1717
__weak IBOutlet MKMapView *_mapView;
1818
Portal *currentPortal;

Ingress/ScannerViewController.m

+1-80
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,13 @@
1919
#import "ColorOverlay.h"
2020
#import "ColorOverlayView.h"
2121

22-
//#import <objc/runtime.h>
23-
//#import <objc/message.h>
24-
//
25-
//void Swizzle(Class c, SEL orig, SEL new) {
26-
// Method origMethod = class_getInstanceMethod(c, orig);
27-
// Method newMethod = class_getInstanceMethod([ScannerViewController class], new);
28-
// if(class_addMethod(c, orig, method_getImplementation(newMethod), method_getTypeEncoding(newMethod)))
29-
// class_replaceMethod(c, new, method_getImplementation(origMethod), method_getTypeEncoding(origMethod));
30-
// else
31-
// method_exchangeImplementations(origMethod, newMethod);
32-
//}
33-
//
34-
//@implementation UIView (ViewHierarchyLogging)
35-
//- (void)logViewHierarchy:(int)level {
36-
// NSLog(@"%d - %@", level, self);
37-
// for (UIView *subview in self.subviews) {
38-
// [subview logViewHierarchy:(level+1)];
39-
// }
40-
//}
41-
//@end
42-
4322
@implementation ScannerViewController
4423

45-
//- (void)canvasDrawRect:(CGRect)rect {
46-
// NSLog(@"drawRect");
47-
//
48-
// CGContextRef context = UIGraphicsGetCurrentContext();
49-
//
50-
// CGContextSetBlendMode(context, kCGBlendModeSaturation);
51-
// CGContextSetRGBFillColor(context, 0, 0, 0, 1);
52-
// CGContextFillRect(context, rect);
53-
//
54-
//}
55-
5624
- (void)viewDidLoad {
5725
[super viewDidLoad];
5826

5927
[[AppDelegate instance] setMapView:_mapView];
60-
61-
//[_mapView logViewHierarchy:0];
62-
63-
//Swizzle(NSClassFromString(@"VKMapCanvas"), @selector(drawRect:), @selector(canvasDrawRect:));
64-
28+
6529
//UILongPressGestureRecognizer *xmpLongPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(xmpLongPressGestureHandler:)];
6630
//[fireXmpButton addGestureRecognizer:xmpLongPressGesture];
6731

@@ -101,8 +65,6 @@ - (void)viewDidLoad {
10165

10266
// UITapGestureRecognizer *mapViewGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(mapTapped:)];
10367
// [_mapView addGestureRecognizer:mapViewGestureRecognizer];
104-
105-
//////////
10668

10769
// [self refreshProfile];
10870

@@ -135,18 +97,6 @@ - (void)didReceiveMemoryWarning {
13597

13698
- (IBAction)refresh {
13799

138-
// int lat = mapView.userLocation.location.coordinate.latitude*1E6;
139-
// int lng = mapView.userLocation.location.coordinate.longitude*1E6;
140-
// int zoom = 20; //[self getMapViewZoomLevel];
141-
// NSString *URLStr = [NSString stringWithFormat:@"http://www.ingress.com/intel?latE6=%d&lngE6=%d&z=%d", lat, lng, zoom];
142-
//
143-
// UIWebView *_webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
144-
// //[_webView setHidden:YES];
145-
// [_webView setDelegate:self];
146-
// [self.view addSubview:_webView];
147-
// NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:URLStr]];
148-
// [_webView loadRequest:request];
149-
150100
//[mapView setRegion:MKCoordinateRegionMakeWithDistance(mapView.centerCoordinate, 1000, 1000) animated:NO];
151101
//[mapView setCenterCoordinate:mapView.userLocation.location.coordinate animated:YES];
152102

@@ -261,33 +211,6 @@ - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated {
261211

262212
[_mapView setUserTrackingMode:MKUserTrackingModeFollow animated:animated]; //WithHeading
263213

264-
// UIGraphicsBeginImageContextWithOptions(mapView.bounds.size, NO, 0.0);
265-
// [mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
266-
// UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
267-
// UIGraphicsEndImageContext();
268-
//
269-
// CIImage *beginImage = [CIImage imageWithCGImage:img.CGImage];
270-
// CIContext *context = [CIContext contextWithOptions:nil];
271-
//
272-
// CIFilter *filter = [CIFilter filterWithName:@"CIColorInvert" keysAndValues:
273-
// kCIInputImageKey, beginImage,
274-
// nil];
275-
// CIImage *outputImage = [filter outputImage];
276-
//
277-
// filter = [CIFilter filterWithName:@"CIColorControls" keysAndValues:
278-
// kCIInputImageKey, outputImage,
279-
// @"inputSaturation", @0,
280-
// //@"inputBrightness", @.25,
281-
// nil];
282-
// outputImage = [filter outputImage];
283-
//
284-
// CGImageRef cgimg = [context createCGImage:outputImage fromRect:[outputImage extent]];
285-
// UIImage *newImg = [UIImage imageWithCGImage:cgimg];
286-
//
287-
// bgImage.image = newImg;
288-
//
289-
// bgImage.alpha = 1;
290-
291214
}
292215

293216
- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view {
@@ -302,8 +225,6 @@ - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view cal
302225

303226
if ([view.annotation isKindOfClass:[Item class]]) {
304227

305-
//NSLog(@"calloutAccessoryControlTapped: %@", view.annotation);
306-
307228
__block Item *item = (Item *)view.annotation;
308229

309230
__block MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:[AppDelegate instance].window];

0 commit comments

Comments
 (0)