diff --git a/phoneClients/android/.idea/workspace.xml b/phoneClients/android/.idea/workspace.xml index 0a07377..0e0c938 100644 --- a/phoneClients/android/.idea/workspace.xml +++ b/phoneClients/android/.idea/workspace.xml @@ -41,9 +41,6 @@ - - - @@ -107,11 +104,11 @@ - + - - + + @@ -120,6 +117,16 @@ + + + + + + + + + + @@ -940,11 +947,11 @@ @@ -1466,7 +1473,7 @@ - + @@ -1908,14 +1915,6 @@ - - - - - - - - @@ -1937,8 +1936,8 @@ - - + + @@ -1946,6 +1945,14 @@ + + + + + + + + diff --git a/phoneClients/android/build/intermediates/model_data.bin b/phoneClients/android/build/intermediates/model_data.bin index b754fdc..051aef7 100644 --- a/phoneClients/android/build/intermediates/model_data.bin +++ b/phoneClients/android/build/intermediates/model_data.bin Binary files differ diff --git a/phoneClients/ios/GpsTracker.xcodeproj/project.pbxproj b/phoneClients/ios/GpsTracker.xcodeproj/project.pbxproj index 647b731..24cea96 100644 --- a/phoneClients/ios/GpsTracker.xcodeproj/project.pbxproj +++ b/phoneClients/ios/GpsTracker.xcodeproj/project.pbxproj @@ -7,8 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 88051648195AB5EB0069FAC6 /* CustomButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 88051647195AB5EB0069FAC6 /* CustomButton.m */; }; - 8805164B195ABC2C0069FAC6 /* UIColor+HexColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 8805164A195ABC2C0069FAC6 /* UIColor+HexColor.m */; }; 8884704B1874EB9400867228 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8884704A1874EB9400867228 /* Foundation.framework */; }; 8884704D1874EB9400867228 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8884704C1874EB9400867228 /* CoreGraphics.framework */; }; 8884704F1874EB9400867228 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8884704E1874EB9400867228 /* UIKit.framework */; }; @@ -24,10 +22,6 @@ /* Begin PBXFileReference section */ 6C8880B2EE17432CA6FDD050 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 88051646195AB5EB0069FAC6 /* CustomButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomButton.h; sourceTree = ""; }; - 88051647195AB5EB0069FAC6 /* CustomButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomButton.m; sourceTree = ""; }; - 88051649195ABC2C0069FAC6 /* UIColor+HexColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+HexColor.h"; sourceTree = ""; }; - 8805164A195ABC2C0069FAC6 /* UIColor+HexColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+HexColor.m"; sourceTree = ""; }; 888470471874EB9400867228 /* GpsTracker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GpsTracker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8884704A1874EB9400867228 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 8884704C1874EB9400867228 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; @@ -42,6 +36,10 @@ 8884705F1874EB9400867228 /* WSViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WSViewController.h; sourceTree = ""; }; 888470601874EB9400867228 /* WSViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WSViewController.m; sourceTree = ""; }; 888470621874EB9400867228 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 888470691874EB9400867228 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 888470711874EB9400867228 /* GpsTrackerTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "GpsTrackerTests-Info.plist"; sourceTree = ""; }; + 888470731874EB9400867228 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 888470751874EB9400867228 /* GpsTrackerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GpsTrackerTests.m; sourceTree = ""; }; 8884707F1875826600867228 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; BE3B3497D30F48C2ADC3BCE7 /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ @@ -66,6 +64,7 @@ isa = PBXGroup; children = ( 888470501874EB9400867228 /* GpsTracker */, + 8884706F1874EB9400867228 /* GpsTrackerTests */, 888470491874EB9400867228 /* Frameworks */, 888470481874EB9400867228 /* Products */, BE3B3497D30F48C2ADC3BCE7 /* Pods.xcconfig */, @@ -87,6 +86,7 @@ 8884704A1874EB9400867228 /* Foundation.framework */, 8884704C1874EB9400867228 /* CoreGraphics.framework */, 8884704E1874EB9400867228 /* UIKit.framework */, + 888470691874EB9400867228 /* XCTest.framework */, 6C8880B2EE17432CA6FDD050 /* libPods.a */, ); name = Frameworks; @@ -100,10 +100,6 @@ 8884705C1874EB9400867228 /* Main.storyboard */, 8884705F1874EB9400867228 /* WSViewController.h */, 888470601874EB9400867228 /* WSViewController.m */, - 88051646195AB5EB0069FAC6 /* CustomButton.h */, - 88051647195AB5EB0069FAC6 /* CustomButton.m */, - 88051649195ABC2C0069FAC6 /* UIColor+HexColor.h */, - 8805164A195ABC2C0069FAC6 /* UIColor+HexColor.m */, 888470621874EB9400867228 /* Images.xcassets */, 888470511874EB9400867228 /* Supporting Files */, ); @@ -121,6 +117,24 @@ name = "Supporting Files"; sourceTree = ""; }; + 8884706F1874EB9400867228 /* GpsTrackerTests */ = { + isa = PBXGroup; + children = ( + 888470751874EB9400867228 /* GpsTrackerTests.m */, + 888470701874EB9400867228 /* Supporting Files */, + ); + path = GpsTrackerTests; + sourceTree = ""; + }; + 888470701874EB9400867228 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 888470711874EB9400867228 /* GpsTrackerTests-Info.plist */, + 888470721874EB9400867228 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -231,8 +245,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 88051648195AB5EB0069FAC6 /* CustomButton.m in Sources */, - 8805164B195ABC2C0069FAC6 /* UIColor+HexColor.m in Sources */, 8884705B1874EB9400867228 /* WSAppDelegate.m in Sources */, 888470571874EB9400867228 /* main.m in Sources */, 888470611874EB9400867228 /* WSViewController.m in Sources */, @@ -258,6 +270,14 @@ name = Main.storyboard; sourceTree = ""; }; + 888470721874EB9400867228 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 888470731874EB9400867228 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -294,7 +314,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; @@ -327,7 +347,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; @@ -342,7 +362,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "GpsTracker/GpsTracker-Prefix.pch"; INFOPLIST_FILE = "GpsTracker/GpsTracker-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -357,7 +377,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "GpsTracker/GpsTracker-Prefix.pch"; INFOPLIST_FILE = "GpsTracker/GpsTracker-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 7.1; + IPHONEOS_DEPLOYMENT_TARGET = 7.0; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; diff --git a/phoneClients/ios/GpsTracker/Base.lproj/Main.storyboard b/phoneClients/ios/GpsTracker/Base.lproj/Main.storyboard index 24d72a7..b942d4a 100644 --- a/phoneClients/ios/GpsTracker/Base.lproj/Main.storyboard +++ b/phoneClients/ios/GpsTracker/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - - + + @@ -17,78 +17,84 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - + - + diff --git a/phoneClients/ios/GpsTracker/CustomButton.h b/phoneClients/ios/GpsTracker/CustomButton.h deleted file mode 100644 index 62416d8..0000000 --- a/phoneClients/ios/GpsTracker/CustomButton.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import - -@interface CustomButton : UIButton - -- (void)setButtonColor:(NSString *)buttonHexColor andHighLightColor:(NSString *)highlightHexColor andTextColor:(NSString *)textHexColor andHighlightTextColor:(NSString *)highlighTextHexColor; - -@end diff --git a/phoneClients/ios/GpsTracker/CustomButton.m b/phoneClients/ios/GpsTracker/CustomButton.m deleted file mode 100644 index 19da1f3..0000000 --- a/phoneClients/ios/GpsTracker/CustomButton.m +++ /dev/null @@ -1,146 +0,0 @@ - -#import "CustomButton.h" -#import "UIColor+HexColor.h" - -@interface CustomButton () - @property (assign, nonatomic) BOOL tapped; - @property (assign, nonatomic) BOOL setupLayers; - @property (strong, nonatomic) CALayer *backgroundLayer; - @property (strong, nonatomic) CALayer *highlightBackgroundLayer; - @property (strong, nonatomic) CALayer *innerGlow; - @property (strong, nonatomic) NSString *buttonHexColor; - @property (strong, nonatomic) NSString *highlightHexColor; - @property (strong, nonatomic) NSString *textHexColor; - @property (strong, nonatomic) NSString *highlighTextHexColor; -@end - -@implementation CustomButton - -#pragma mark - - -- (void)drawRect:(CGRect)rect -{ - // this is not drawing properly when changing orientation, but i'm staying in portrait anyway, will deal with it later - - if (!_setupLayers) - { - self.layer.cornerRadius = 4.5f; - self.layer.masksToBounds = YES; - self.layer.borderWidth = 1; - self.layer.borderColor = [UIColor colorFromHexString:@"#999999" andAlpha:1.0].CGColor; - - // [self setInnerGlow]; - [self setBackgroundLayer]; - [self setHighlightBackgroundLayer]; - } - - if (_tapped) - { - //NSLog(@"highlighted"); - _highlightBackgroundLayer.hidden = NO; - // self.titleLabel.textColor = [UIColor colorFromHexString:@"#999999" andAlpha:1.0]; - self.titleLabel.textColor = [UIColor colorFromHexString:_highlighTextHexColor andAlpha:1.0]; - _backgroundLayer.backgroundColor = [UIColor colorFromHexString:_highlightHexColor andAlpha:1.0].CGColor; - } - else - { - //NSLog(@"not highlighted"); - _highlightBackgroundLayer.hidden = YES; - // self.titleLabel.textColor = [UIColor colorFromHexString:@"#333333" andAlpha:1.0]; - self.titleLabel.textColor = [UIColor colorFromHexString:_textHexColor andAlpha:1.0]; - _backgroundLayer.backgroundColor = [UIColor colorFromHexString:_buttonHexColor andAlpha:1.0].CGColor; - } - - _setupLayers = YES; -} - -#pragma mark - Layer setters - -- (void)setBackgroundLayer -{ - if (!_backgroundLayer) - { - _backgroundLayer = [CAGradientLayer layer]; - _backgroundLayer.frame = self.bounds; - _backgroundLayer.backgroundColor = [UIColor colorFromHexString:_buttonHexColor andAlpha:1.0].CGColor; - - [self.layer insertSublayer:_backgroundLayer atIndex:0]; - - // here is the red color, #ff0033 and its highlight, #ff7691 - // here is the green color, #33ffcc and it's highlight, #a9ffe9 - } -} - -- (void)setHighlightBackgroundLayer -{ - if (!_highlightBackgroundLayer) - { - _highlightBackgroundLayer = [CAGradientLayer layer]; - _highlightBackgroundLayer.frame = self.bounds; - _highlightBackgroundLayer.backgroundColor = [UIColor colorFromHexString:_highlightHexColor andAlpha:1.0].CGColor; - [self.layer insertSublayer:_highlightBackgroundLayer atIndex:1]; - } -} - -- (void)setInnerGlow -{ - if (!_innerGlow) - { - _innerGlow = [CALayer layer]; - CGRect innerGlowFrame = CGRectMake(self.bounds.origin.x+1, self.bounds.origin.y+1, self.bounds.size.width-2, self.bounds.size.height-2); - _innerGlow.frame = innerGlowFrame; - _innerGlow.cornerRadius= 4.5f; - _innerGlow.borderWidth = 1; - _innerGlow.borderColor = [[UIColor whiteColor] CGColor]; - _innerGlow.opacity = 0.5; - - [self.layer insertSublayer:_innerGlow atIndex:2]; - } -} - -- (void)setButtonColor:(NSString *)buttonHexColor andHighLightColor:(NSString *)highlightHexColor andTextColor:(NSString *)textHexColor andHighlightTextColor:(NSString *)highlighTextHexColor { - _buttonHexColor = buttonHexColor; - _highlightHexColor = highlightHexColor; - _textHexColor = textHexColor; - _highlighTextHexColor = highlighTextHexColor; - - //[self setNeedsDisplay]; -} - -#pragma mark - Touch event overrides - --(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - _tapped = YES; - [self setNeedsDisplay]; - [super touchesBegan:touches withEvent:event]; -} - --(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - _tapped = NO; - [self setNeedsDisplay]; - [super touchesEnded:touches withEvent:event]; -} - --(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - CGPoint touchPoint = [[touches anyObject] locationInView:self]; - CGRect testRect = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height); - - if (CGRectContainsPoint(testRect, touchPoint)) - { - _tapped = YES; - [self setNeedsDisplay]; - } - - else - { - _tapped = NO; - [self setNeedsDisplay]; - } - - [super touchesMoved:touches withEvent:event]; -} - -@end diff --git a/phoneClients/ios/GpsTracker/GpsTracker-Info.plist b/phoneClients/ios/GpsTracker/GpsTracker-Info.plist index 611aa65..076b570 100644 --- a/phoneClients/ios/GpsTracker/GpsTracker-Info.plist +++ b/phoneClients/ios/GpsTracker/GpsTracker-Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 3.2.5 + 3.0.0 CFBundleSignature ???? CFBundleVersion - 3 + 1 LSRequiresIPhoneOS UIBackgroundModes diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/Contents.json b/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/Contents.json index a396706..39169e3 100644 --- a/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/Contents.json @@ -3,17 +3,104 @@ { "idiom" : "iphone", "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", - "size" : "60x60", + "size" : "40x40", + "scale" : "3x" + }, + { + "size" : "57x57", + "idiom" : "iphone", + "filename" : "icon@.png", + "scale" : "1x" + }, + { + "idiom" : "iphone", + "size" : "57x57", "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@2x.png", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "50x50", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "50x50", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "72x72", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "72x72", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "car", + "size" : "120x120", + "scale" : "1x" } ], "info" : { diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/icon-60@2x.png b/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 0000000..4e6b976 --- /dev/null +++ b/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/icon-60@2x.png Binary files differ diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/icon@.png b/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/icon@.png new file mode 100644 index 0000000..599a4a6 --- /dev/null +++ b/phoneClients/ios/GpsTracker/Images.xcassets/AppIcon.appiconset/icon@.png Binary files differ diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/Image.imageset/Contents.json b/phoneClients/ios/GpsTracker/Images.xcassets/Image.imageset/Contents.json new file mode 100644 index 0000000..1ad6524 --- /dev/null +++ b/phoneClients/ios/GpsTracker/Images.xcassets/Image.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "gpstracker.png" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/Image.imageset/gpstracker.png b/phoneClients/ios/GpsTracker/Images.xcassets/Image.imageset/gpstracker.png new file mode 100644 index 0000000..bcd3176 --- /dev/null +++ b/phoneClients/ios/GpsTracker/Images.xcassets/Image.imageset/gpstracker.png Binary files differ diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/gpstracker.imageset/Contents.json b/phoneClients/ios/GpsTracker/Images.xcassets/gpstracker.imageset/Contents.json deleted file mode 100644 index e67c7ca..0000000 --- a/phoneClients/ios/GpsTracker/Images.xcassets/gpstracker.imageset/Contents.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "gpstracker.png" - }, - { - "idiom" : "universal", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/phoneClients/ios/GpsTracker/Images.xcassets/gpstracker.imageset/gpstracker.png b/phoneClients/ios/GpsTracker/Images.xcassets/gpstracker.imageset/gpstracker.png deleted file mode 100644 index bcd3176..0000000 --- a/phoneClients/ios/GpsTracker/Images.xcassets/gpstracker.imageset/gpstracker.png +++ /dev/null Binary files differ diff --git a/phoneClients/ios/GpsTracker/UIColor+HexColor.h b/phoneClients/ios/GpsTracker/UIColor+HexColor.h deleted file mode 100644 index cf80859..0000000 --- a/phoneClients/ios/GpsTracker/UIColor+HexColor.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// UiColor+HexColor.h -// GpsTracker -// -// Created by Nick Fox on 6/25/14. -// Copyright (c) 2014 Nick Fox. All rights reserved. -// - -@interface UIColor (HexColor) - -// this category allows us to create a UIColor using a hex color value like #FF00FF -+ (UIColor *)colorFromHexString:(NSString *)hexString andAlpha:(float)alphaValue; - -@end diff --git a/phoneClients/ios/GpsTracker/UIColor+HexColor.m b/phoneClients/ios/GpsTracker/UIColor+HexColor.m deleted file mode 100644 index d371ee4..0000000 --- a/phoneClients/ios/GpsTracker/UIColor+HexColor.m +++ /dev/null @@ -1,60 +0,0 @@ -// -// UiColor+HexColor.m -// GpsTracker -// -// Created by Nick Fox on 6/25/14. -// Copyright (c) 2014 Nick Fox. All rights reserved. -// - -#import "UIColor+HexColor.h" - -// modified from https://gist.github.com/simonwhitaker/1219029 - -@implementation UIColor (HexColor) - -+ (UIColor *)colorFromHexString:(NSString *)hexValue andAlpha:(float)alphaValue -{ - UIColor *defaultColor = [UIColor blackColor]; - - // Strip leading # if there is one - if ([hexValue hasPrefix:@"#"] && [hexValue length] > 1) { - hexValue = [hexValue substringFromIndex:1]; - } - - NSUInteger componentLength = 0; - if ([hexValue length] == 3) - componentLength = 1; - else if ([hexValue length] == 6) - componentLength = 2; - else - return defaultColor; - - BOOL isValid = YES; - CGFloat components[3]; - - for (NSUInteger i = 0; i < 3; i++) { - NSString *component = [hexValue substringWithRange:NSMakeRange(componentLength * i, componentLength)]; - if (componentLength == 1) { - component = [component stringByAppendingString:component]; - } - NSScanner *scanner = [NSScanner scannerWithString:component]; - unsigned int value; - isValid &= [scanner scanHexInt:&value]; - components[i] = (CGFloat)value / 256.0; - } - - if (!isValid) { - return defaultColor; - } - - if (alphaValue < 0.0 || alphaValue > 1.0 ) { - alphaValue = 1.0; - } - - return [UIColor colorWithRed:components[0] - green:components[1] - blue:components[2] - alpha:alphaValue]; -} - -@end diff --git a/phoneClients/ios/GpsTracker/WSViewController.m b/phoneClients/ios/GpsTracker/WSViewController.m index c17769d..6fdde5d 100644 --- a/phoneClients/ios/GpsTracker/WSViewController.m +++ b/phoneClients/ios/GpsTracker/WSViewController.m @@ -9,14 +9,15 @@ #import "WSViewController.h" #import #import "AFHTTPRequestOperationManager.h" -#import "UIColor+HexColor.h" -#import "CustomButton.h" @interface WSViewController () -@property (weak, nonatomic) IBOutlet CustomButton *trackingButton; -@property (weak, nonatomic) IBOutlet UITextField *uploadWebsiteTextField; -@property (weak, nonatomic) IBOutlet UITextField *userNameTextField; -@property (weak, nonatomic) IBOutlet UISegmentedControl *intervalControl; +@property (weak, nonatomic) IBOutlet UILabel *latitudeLabel; +@property (weak, nonatomic) IBOutlet UILabel *longitudeLabel; +@property (weak, nonatomic) IBOutlet UILabel *accuracyLabel; +@property (weak, nonatomic) IBOutlet UILabel *timestampLabel; +@property (weak, nonatomic) IBOutlet UIButton *trackingButton; +@property (weak, nonatomic) IBOutlet UILabel *accuracyLevelLabel; +@property (weak, nonatomic) IBOutlet UILabel *sessionIDLabel; @end @implementation WSViewController @@ -30,25 +31,14 @@ NSDate *lastWebsiteUpdateTime; int timeIntervalInSeconds; bool increasedAccuracy; - NSString *defaultUploadWebsite; } - (void)viewDidLoad { [super viewDidLoad]; - - // use the websmithing defaultUploadWebsite for testing, change the userName parameter to something you - // know and then check your location with your browser here: https://www.websmithing.com/gpstracker/displaymap.php - - defaultUploadWebsite = @"https://www.websmithing.com/gpstracker/updatelocation.php"; - self.uploadWebsiteTextField.text = defaultUploadWebsite; - - [self.trackingButton setButtonColor:@"#ff0033" andHighLightColor:@"#ff7691" andTextColor:@"#FFFFFF" andHighlightTextColor:@"#333333"]; - currentlyTracking = NO; timeIntervalInSeconds = 60; // change this to the time interval you want - BOOL appIDIsSet = [[NSUserDefaults standardUserDefaults] boolForKey:@"appIDIsSet"]; if (!appIDIsSet) { [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"appIDIsSet"]; @@ -64,7 +54,7 @@ locationManager = [[CLLocationManager alloc] init]; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; locationManager.distanceFilter = 0; // meters - locationManager.pausesLocationUpdatesAutomatically = NO; // YES is default + //locationManager.pausesLocationUpdatesAutomatically = NO; // YES is default locationManager.activityType = CLActivityTypeAutomotiveNavigation; locationManager.delegate = self; @@ -73,62 +63,31 @@ increasedAccuracy = YES; firstTimeGettingPosition = YES; lastWebsiteUpdateTime = [NSDate date]; // new timestamp + [self updateAccuracyLevel:@"high"]; + [self sessionIDLabel].text = [guid UUIDString]; [locationManager startUpdatingLocation]; } - - - - (void)stopTracking { NSLog(@"stop tracking"); - + + [self sessionIDLabel].text = @"phoneNumber:"; [locationManager stopUpdatingLocation]; locationManager = nil; } -- (void)checkTextFields { - NSLog(@"check Text Fields"); - - NSString *uploadWebsite = [self.uploadWebsiteTextField.text stringByTrimmingCharactersInSet: - [NSCharacterSet whitespaceCharacterSet]]; - - NSString *userName = [self.userNameTextField.text stringByTrimmingCharactersInSet: - [NSCharacterSet whitespaceCharacterSet]]; - - if (uploadWebsite.length == 0 || userName.length == 0) { - NSLog(@"make your user name longer."); - } else { - NSLog(@"it's ok."); - } - -} - - (IBAction)handleTrackingButton:(id)sender { if (currentlyTracking) { [self stopTracking]; currentlyTracking = NO; - - // set to RED - [self.trackingButton setButtonColor:@"#ff0033" andHighLightColor:@"#ff7691" andTextColor:@"#FFFFFF" andHighlightTextColor:@"#333333"]; - [self.trackingButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - - // here is the red color, #ff0033 and its highlight, #ff7691 - // here is the green color, #33ffcc and it's highlight, #a9ffe9 - - [self.trackingButton setTitle:@"Tracking is Off" forState:UIControlStateNormal]; + [self.trackingButton setTitle:@"start tracking" forState:UIControlStateNormal]; } else { [self startTracking]; currentlyTracking = YES; - - [self checkTextFields]; - - // set to GREEN - [self.trackingButton setButtonColor:@"#33ffcc" andHighLightColor:@"#a9ffe9" andTextColor:@"#000000" andHighlightTextColor:@"#999999"]; - [self.trackingButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; - [self.trackingButton setTitle:@"Tracking is On" forState:UIControlStateNormal]; + [self.trackingButton setTitle:@"stop tracking" forState:UIControlStateNormal]; } } @@ -137,6 +96,7 @@ locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers; locationManager.distanceFilter = 5; increasedAccuracy = NO; + [self updateAccuracyLevel:@"low"]; } - (void)increaseTrackingAccuracy @@ -144,6 +104,7 @@ locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; locationManager.distanceFilter = 0; increasedAccuracy = YES; + [self updateAccuracyLevel:@"high"]; } - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations @@ -156,7 +117,7 @@ NSTimeInterval secondsSinceLastWebsiteUpdate = fabs([lastWebsiteUpdateTime timeIntervalSinceNow]); if (firstTimeGettingPosition || (secondsSinceLastWebsiteUpdate > timeIntervalInSeconds)) { // currently one minute - if (location.horizontalAccuracy < 500.0 && location.coordinate.latitude != 0 && location.coordinate.longitude != 0) { + if (location.horizontalAccuracy < 100.0 && location.coordinate.latitude != 0 && location.coordinate.longitude != 0) { if (increasedAccuracy) { [self reduceTrackingAccuracy]; @@ -192,9 +153,24 @@ } } - NSString *trackingAccuracy = (increasedAccuracy) ? @"high" : @"low"; - NSLog(@"tracking accuracy: %@ lat/lng: %f/%f accuracy: %dm", trackingAccuracy, location.coordinate.latitude, location.coordinate.longitude, (int)location.horizontalAccuracy); - + if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive) { + [self updateUIWithLocationData:location]; + } +} + +- (void)updateAccuracyLevel:(NSString *)accuracyLevel +{ + [self accuracyLevelLabel].text= [NSString stringWithFormat:@"accuracy level: %@", accuracyLevel]; +} + +- (void)updateUIWithLocationData:(CLLocation *)location +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"dd/MM/yyyy HH:mm"]; + [self timestampLabel].text = [NSString stringWithFormat:@"timestamp: %@",[dateFormatter stringFromDate:location.timestamp]]; + [self latitudeLabel].text = [NSString stringWithFormat:@"latitude: %f", location.coordinate.latitude]; + [self longitudeLabel].text = [NSString stringWithFormat:@"longitude: %f", location.coordinate.longitude]; + [self accuracyLabel].text= [NSString stringWithFormat:@"accuracy: %dm", (int)location.horizontalAccuracy]; } - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error @@ -204,7 +180,10 @@ - (void)updateWebsiteWithLatitde:(NSString *)latitude longitude:(NSString *)longitude speed:(NSString *)speed date:(NSString *)date distance:(NSString *)distance sessionID:(NSString *)sessionID accuracy:(NSString *)accuracy extraInfo:(NSString *)extraInfo direction:(NSString *)direction { - + // use the websmithing defaultUploadWebsite for testing, change the *phoneNumber* form variable to something you + // know and then check your location with your browser here: https://www.websmithing.com/gpstracker/displaymap.php + + NSString *defaultUploadWebsite = @"https://www.websmithing.com/gpstracker/updatelocation.php"; AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; @@ -215,7 +194,7 @@ @"date": date, @"locationmethod": @"n/a", @"distance": distance, - @"username": @"iosUser01", + @"username": @"iosUser1", @"phonenumber": [[NSUserDefaults standardUserDefaults] stringForKey:@"appID"], @"sessionid": sessionID, @"extrainfo": extraInfo, @@ -223,10 +202,13 @@ @"eventtype": @"ios", @"direction": direction}; - [manager GET:defaultUploadWebsite parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { - NSLog(@"location sent to website."); - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - NSLog(@"AFHTTPRequestOperation Error: %@", [error description]); + [manager GET:defaultUploadWebsite parameters:parameters + success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSString *response = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; + NSLog(@"Response: %@", response); + } + failure:^(AFHTTPRequestOperation *operation, NSError *error) { + NSLog(@"AFHTTPRequestOperation Error: %@", [error description]); }]; } diff --git a/phoneClients/ios/Podfile b/phoneClients/ios/Podfile index 4400945..f560a47 100644 --- a/phoneClients/ios/Podfile +++ b/phoneClients/ios/Podfile @@ -1,2 +1,2 @@ platform :ios, '7.0' -pod 'AFNetworking', '~> 2.2' \ No newline at end of file +pod "AFNetworking/NSURLConnection", "~> 2.4" diff --git a/phoneClients/ios/Podfile.lock b/phoneClients/ios/Podfile.lock index c366e90..d1685e7 100644 --- a/phoneClients/ios/Podfile.lock +++ b/phoneClients/ios/Podfile.lock @@ -1,28 +1,14 @@ PODS: - - AFNetworking (2.4.1): - - AFNetworking/NSURLConnection - - AFNetworking/NSURLSession - - AFNetworking/Reachability - - AFNetworking/Security - - AFNetworking/Serialization - - AFNetworking/UIKit - AFNetworking/NSURLConnection (2.4.1): - AFNetworking/Reachability - AFNetworking/Security - AFNetworking/Serialization - - AFNetworking/NSURLSession (2.4.1): - - AFNetworking/Reachability - - AFNetworking/Security - - AFNetworking/Serialization - AFNetworking/Reachability (2.4.1) - AFNetworking/Security (2.4.1) - AFNetworking/Serialization (2.4.1) - - AFNetworking/UIKit (2.4.1): - - AFNetworking/NSURLConnection - - AFNetworking/NSURLSession DEPENDENCIES: - - AFNetworking (~> 2.2) + - AFNetworking/NSURLConnection (~> 2.4) SPEC CHECKSUMS: AFNetworking: 0aabc6fae66d6e5d039eeb21c315843c7aae51ab diff --git a/phoneClients/ios/README.md b/phoneClients/ios/README.md index 16dc63d..73b7f9b 100644 --- a/phoneClients/ios/README.md +++ b/phoneClients/ios/README.md @@ -1,15 +1,8 @@ -PLEASE NOTE - THIS APP IS CURRENTLY BEING REWRITTEN. +This is the ios client for gpstracker. Remember that you need to open this project with GpsTracker.xcworkspace since you are using AFNetworking cocoapods. Don't forget to install your pod before using this. -It is functional but only the start tracking button is working. The values for default upload website and username must be hardcoded in WSViewController.m. -Remember that you need to open this project with GpsTracker.xcworkspace since you are using AFNetworking cocoapods. +In order to use this, you need to change the username on line 197 of WSViewController.m. Then test the app on the websmithing website: -use the websmithing defaultUploadWebsite: - -https://www.websmithing.com/gpstracker/updatelocation.php - -for testing - -change the *phoneNumber* form variable to something you know and then check your location with your browser here: - https://www.websmithing.com/gpstracker/displaymap.php + +Once you have tested the app on websmithing, you need to update your own website by changing line 186, defaultUploadWebsite to your own website. Don't forget to change from http to https if you are not using ssl.