Skip to content

Commit

Permalink
Adding ReCharge India source
Browse files Browse the repository at this point in the history
  • Loading branch information
kamleshgk committed Mar 17, 2016
1 parent 642a6a5 commit edf5a65
Show file tree
Hide file tree
Showing 310 changed files with 35,898 additions and 8 deletions.
Binary file added Classes/.DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions Classes/Common/ChargingMarker.h
@@ -0,0 +1,20 @@
//
// ChargingMarker.h
//
// Copyright (c) 2016. All rights reserved.

#import <Foundation/Foundation.h>
#import "ChargingStation.h"
@import GoogleMaps;

@interface ChargingMarker : GMSMarker
{
ChargingStation *stationDetails;
}

@property (nonatomic, retain) ChargingStation *stationDetails;

- (id) initWithStation: (ChargingStation *) station;

@end

39 changes: 39 additions & 0 deletions Classes/Common/ChargingMarker.m
@@ -0,0 +1,39 @@
//
// ChargingMarker.m
//
// Copyright (c) 2014. All rights reserved.

#import "ChargingMarker.h"

@implementation ChargingMarker

@synthesize stationDetails;

- (id) initWithStation: (ChargingStation *) station {
if ( self = [super init] ) {
// Set defaults
}

self.stationDetails = station;

self.position = CLLocationCoordinate2DMake([stationDetails.lattitude floatValue], [stationDetails.longitude floatValue]);
self.title = stationDetails.name;

NSString *snippetString = [NSString stringWithFormat:@"Tap to view details >> \n\n%@", stationDetails.notes];

self.snippet = snippetString;

if ([stationDetails.type isEqualToString:@"1"])
self.icon = [UIImage imageNamed:@"green"];
else if ([stationDetails.type isEqualToString:@"2"])
self.icon = [UIImage imageNamed:@"red"];
else if ([stationDetails.type isEqualToString:@"3"])
self.icon = [UIImage imageNamed:@"blue"];

self.groundAnchor = CGPointMake(0.5, 1);
self.appearAnimation = kGMSMarkerAnimationPop;

return self;
}

@end
36 changes: 36 additions & 0 deletions Classes/Common/ChargingStation.h
@@ -0,0 +1,36 @@
//
// ChargingStation.h
//
// Copyright (c) 2016. All rights reserved.

#import <Foundation/Foundation.h>

@interface ChargingStation : NSObject
{
NSString* stationid;
NSString* name;
NSString* contact;
NSString* address;
NSString* phones;
NSString* pricing;
NSString* notes;
NSString* type;
NSString* isValidated;
NSString* lattitude;
NSString* longitude;
}

@property (nonatomic, retain) NSString* stationid;
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* contact;
@property (nonatomic, retain) NSString* address;
@property (nonatomic, retain) NSString* phones;
@property (nonatomic, retain) NSString* pricing;
@property (nonatomic, retain) NSString* notes;
@property (nonatomic, retain) NSString* type;
@property (nonatomic, retain) NSString* isValidated;
@property (nonatomic, retain) NSString* lattitude;
@property (nonatomic, retain) NSString* longitude;

@end

13 changes: 13 additions & 0 deletions Classes/Common/ChargingStation.m
@@ -0,0 +1,13 @@
//
// Author.m
//
// Copyright (c) 2014. All rights reserved.

#import "ChargingStation.h"

@implementation ChargingStation

@synthesize stationid,name, contact, address, phones, pricing, notes, type, isValidated, lattitude, longitude;


@end
20 changes: 20 additions & 0 deletions Classes/Common/ManagerBase.h
@@ -0,0 +1,20 @@
//
// ManagerBase.h
// viperTest
//
// Created by kamyFCMacBook on 7/9/15.
//
//

#import <Foundation/Foundation.h>

@protocol ManagerDelegate <NSObject>

-(void)SuccessCallback:(id)data
operation:(NSString *)operation;

-(void)FailureCallback:(NSString *)errorDescription
operation:(NSString *)operation;


@end
41 changes: 41 additions & 0 deletions Classes/Common/UserSessionInfo.h
@@ -0,0 +1,41 @@
//
// UserSessionInfo.h
//
// Copyright (c) 2014. All rights reserved.
//


#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "viperTestDependencies.h"

//This is a Singleton class that is cached as long as the app is operating.
//Logon info is stored here and is used throught the app
@interface UserSessionInfo : NSObject
{
NSString *databasePath;
NSString *databaseBackupPath;
NSString *dbVersion;
NSMutableArray *stationsCache;

NSMutableArray *displayStationTypes;
float distanceToBeCovered; //in km
CLLocationCoordinate2D currentUserLocation;

viperTestDependencies *dependencies;
}

@property (nonatomic, copy) NSString *databasePath;
@property (nonatomic, copy) NSString *databaseBackupPath;
@property (nonatomic, copy) NSString *dbVersion;
@property (nonatomic, copy) NSMutableArray *stationsCache;
@property (nonatomic, copy) NSMutableArray *displayStationTypes;
@property (nonatomic, assign) float distanceToBeCovered;

@property (nonatomic, assign) CLLocationCoordinate2D currentUserLocation;

@property (nonatomic, strong) viperTestDependencies *dependencies;

+ (UserSessionInfo *)sharedUser;

@end
41 changes: 41 additions & 0 deletions Classes/Common/UserSessionInfo.m
@@ -0,0 +1,41 @@
//
// UserSessionInfo.h
//
// Copyright (c) 2014. All rights reserved.
//


#import "UserSessionInfo.h"

static UserSessionInfo *sharedUser = nil;

@implementation UserSessionInfo

@synthesize databasePath, databaseBackupPath, dbVersion, dependencies, stationsCache, distanceToBeCovered, displayStationTypes, currentUserLocation;


#pragma mark -
#pragma mark Singleton Methods
+ (UserSessionInfo *)sharedUser {

if(sharedUser == nil)
{
sharedUser = [[super allocWithZone:NULL] init];
}
return sharedUser;
}


- (void) dealloc {

}

- (id) init {
if ( self = [super init] ) {
// Set defaults
}
return self;
}


@end
57 changes: 57 additions & 0 deletions Classes/Common/Utils.h
@@ -0,0 +1,57 @@
//
// Utils.h
// vipertest
//
// Created by Kamlesh Mallick on 21/12/14.
//
//

#import <Foundation/Foundation.h>


#define CHARGING_STATION_ERRORDOMAIN @"com.recharge.station.ErrorDomain"
#define CHARGING_STATION_MARKER_DISTANCE @"200000" //200 Kilometers (200 Meters)

typedef enum {
Community = 1,
Mahindra,
QuickCharge
} StationType;


typedef enum {
AddCommunityStation = 1,
FAQ,
AboutUs,
Privacy,
Terms,
} AboutWebItem;

enum {
StationNotLoadedError = 1,
StationEmptyError,
StationInternalError
};

@interface Utils : NSObject
{



}

+ (NSString *)relativeDateStringForDate:(NSDate *)date;

+ (NSString *) getStationTypeToNumberString:(StationType)huddleKind;

+ (StationType) getStationStringToStationType:(NSString *)huddleString;

+ (NSString *)getTrimmedString: (NSString *)inputString;

+(UIFont *)getAppFont;
+(UIFont *)getAppBoldFont;

+(UIFont *)getiPadAppFont;
+(UIFont *)getiPadAppBoldFont;

@end
120 changes: 120 additions & 0 deletions Classes/Common/Utils.m
@@ -0,0 +1,120 @@
//
// Utils.m
// vipertest
//
// Created by Kamlesh Mallick on 21/12/14.
//
//

#import "Utils.h"
#import "UserSessionInfo.h"

@implementation Utils


+ (NSString *)relativeDateStringForDate:(NSDate *)date
{
NSCalendarUnit units = NSCalendarUnitDay | NSCalendarUnitWeekOfYear |
NSCalendarUnitMonth | NSCalendarUnitYear;

// if `date` is before "now" (i.e. in the past) then the components will be positive
NSDateComponents *components = [[NSCalendar currentCalendar] components:units
fromDate:date
toDate:[NSDate date]
options:0];

if (components.year > 0) {
return [NSString stringWithFormat:@"%ld years ago", (long)components.year];
} else if (components.month > 0) {
return [NSString stringWithFormat:@"%ld months ago", (long)components.month];
} else if (components.weekOfYear > 0) {
return [NSString stringWithFormat:@"%ld weeks ago", (long)components.weekOfYear];
} else if (components.day > 0) {
if (components.day > 1) {
return [NSString stringWithFormat:@"%ld days ago", (long)components.day];
} else {
return @"Yesterday";
}
} else {
return @"Today";
}
}

+ (NSString *) getStationTypeToNumberString:(StationType)huddleKind;
{
NSString *result = nil;

switch(huddleKind) {
case Community:
result = @"1";
break;
case Mahindra:
result = @"2";
break;
case QuickCharge:
result = @"3";
break;
default:
result = @"1";
}

return result;
}


+ (StationType) getStationStringToStationType:(NSString *)huddleString
{
StationType result;

if ([huddleString isEqualToString:@"1"])
{
result = Community;
}
else if ([huddleString isEqualToString:@"2"])
{
result = Mahindra;
}
else if ([huddleString isEqualToString:@"3"])
{
result = QuickCharge;
}
else
{
result = Community;
}

return result;

}



+ (NSString *)getTrimmedString: (NSString *)inputString
{
NSString* outputString = inputString;
outputString = [outputString stringByTrimmingCharactersInSet: [NSCharacterSet whitespaceAndNewlineCharacterSet]];

return outputString;
}


#pragma mark -
#pragma mark Return the font for the application

+(UIFont *)getAppFont{
return [UIFont fontWithName:@"HelveticaNeue" size:15.0];
}

+(UIFont *)getAppBoldFont{
return [UIFont fontWithName:@"HelveticaNeue-Bold" size:10.0];
}

+(UIFont *)getiPadAppFont{
return [UIFont fontWithName:@"HelveticaNeue" size:20.0];
}

+(UIFont *)getiPadAppBoldFont{
return [UIFont fontWithName:@"HelveticaNeue-Bold" size:18.0];
}

@end

0 comments on commit edf5a65

Please sign in to comment.