Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandroboron committed Aug 16, 2012
1 parent bf7fb4d commit 67540be
Show file tree
Hide file tree
Showing 76 changed files with 3,380 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
655 changes: 655 additions & 0 deletions Timeline.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Binary file added Timeline/.DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions Timeline/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// Timeline
//
// Created by Alessandro Boron on 08/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate,CLLocationManagerDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) CLLocationManager *locationManager;
@property (strong, nonatomic) CLLocation *userLocation;
@end
68 changes: 68 additions & 0 deletions Timeline/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// AppDelegate.m
// Timeline
//
// Created by Alessandro Boron on 08/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import "AppDelegate.h"


@implementation AppDelegate

@synthesize locationManager = _locationManager;
@synthesize userLocation = _userLocation;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.


self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
self.locationManager.delegate = self;

[self.locationManager startUpdatingLocation];

return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

#pragma mark -
#pragma mark CLLocationManagerDelegate

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{

if (oldLocation!=newLocation) {
self.userLocation = newLocation;
}
}

@end
16 changes: 16 additions & 0 deletions Timeline/Categories/NSString+MD5.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// NSString+MD5.h
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (MD5)

//This method is used to return a MD5 encrypted string
- (NSString*)MD5;

@end
34 changes: 34 additions & 0 deletions Timeline/Categories/NSString+MD5.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// NSString+MD5.m
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import "NSString+MD5.h"
#import <CommonCrypto/CommonDigest.h>

@implementation NSString (MD5)

//This method is used to return a MD5 encrypted string
- (NSString*)MD5{

// Create pointer to the string as UTF8
const char *ptr = [self UTF8String];

// Create byte array of unsigned chars
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];

// Create 16 byte MD5 hash value, store in buffer
CC_MD5(ptr, strlen(ptr), md5Buffer);

// Convert MD5 value in the buffer to NSString of hex values
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x",md5Buffer[i]];

return output;
}

@end
23 changes: 23 additions & 0 deletions Timeline/Model/BaseEvent/BaseEvent.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//
// BaseEvent.h
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>

@interface BaseEvent : NSObject

@property (strong, nonatomic) NSString *baseEventId;
@property (strong, nonatomic) CLLocation *location;
@property (strong, nonatomic) NSDate *date;
@property (assign, nonatomic) BOOL shared;
@property (strong, nonatomic) NSString *creator;

//The designated initializer
- (id)initBaseEventWithLocation:(CLLocation *)location date:(NSDate *)date shared:(BOOL)shared creator:(NSString *)creator;

@end
35 changes: 35 additions & 0 deletions Timeline/Model/BaseEvent/BaseEvent.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// BaseEvent.m
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import "BaseEvent.h"

@implementation BaseEvent

@synthesize baseEventId = _baseEventId;
@synthesize location = _location;
@synthesize date = _date;
@synthesize shared = _shared;
@synthesize creator = _creator;

//The designated initializer
- (id)initBaseEventWithLocation:(CLLocation *)location date:(NSDate *)date shared:(BOOL)shared creator:(NSString *)creator{

self = [super init];

if (self) {
_baseEventId = [Utility MD5ForString:[NSString stringWithFormat:@"%f%f%@%i%@",location.coordinate.latitude,location.coordinate.longitude,[date description],shared,creator]];
_location = location;
_date = date;
_shared = shared;
_creator = creator;
}

return self;
}

@end
20 changes: 20 additions & 0 deletions Timeline/Model/Event/Event.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Event.h
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseEvent.h"

@interface Event : BaseEvent

@property (strong, nonatomic) NSMutableArray *eventItems;
@property (strong, nonatomic) NSMutableArray *emotions;

//The designated Initializer
- (id)initEventWithLocation:(CLLocation *)location date:(NSDate *)date shared:(BOOL)shared creator:(NSString *)creator;

@end
29 changes: 29 additions & 0 deletions Timeline/Model/Event/Event.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Event.m
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import "Event.h"

@implementation Event

@synthesize eventItems = _eventItems;
@synthesize emotions = _emotions;

//The designated Initializer
- (id)initEventWithLocation:(CLLocation *)location date:(NSDate *)date shared:(BOOL)shared creator:(NSString *)creator{

self = [super initBaseEventWithLocation:location date:date shared:shared creator:creator];

if (self) {
_eventItems = [[NSMutableArray alloc] init];
_emotions = [[NSMutableArray alloc] init];
}

return self;
}

@end
19 changes: 19 additions & 0 deletions Timeline/Model/EventItem/EventItem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// EventItem.h
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface EventItem : NSObject

@property (strong, nonatomic) NSString *eventItemId;
@property (strong, nonatomic) NSString *creator;

//The designated initializer
- (id)initEventItemWithId:(NSString *)eventId creator:(NSString *)creator;

@end
30 changes: 30 additions & 0 deletions Timeline/Model/EventItem/EventItem.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// EventItem.m
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import "EventItem.h"

@implementation EventItem

@synthesize eventItemId = _eventItemId;
@synthesize creator = _creator;

//The designated initializer
- (id)initEventItemWithId:(NSString *)eventId creator:(NSString *)creator{

self = [super init];

if (self) {

_eventItemId = [Utility MD5ForString:eventId];
_creator = creator;
}

return self;
}

@end
20 changes: 20 additions & 0 deletions Timeline/Model/EventItem/SampleNote/SampleNote.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// SampleNote.h
// Timeline
//
// Created by Alessandro Boron on 14/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "EventItem.h"

@interface SampleNote : EventItem

@property (strong, nonatomic) NSString *noteTitle;
@property (strong, nonatomic) NSString *noteText;

//The designated initializer
- (id)initSampleNoteWithTitle:(NSString *)title text:(NSString *)text eventItemCreator:(NSString *)creator;

@end
29 changes: 29 additions & 0 deletions Timeline/Model/EventItem/SampleNote/SampleNote.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// SampleNote.m
// Timeline
//
// Created by Alessandro Boron on 14/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import "SampleNote.h"

@implementation SampleNote

@synthesize noteTitle = _noteTitle;
@synthesize noteText = _noteText;

//The designated initializer
- (id)initSampleNoteWithTitle:(NSString *)title text:(NSString *)text eventItemCreator:(NSString *)eventCreator;{

self = [super initEventItemWithId:[NSString stringWithFormat:@"%@%@%@",title,text,eventCreator] creator:eventCreator];

if (self) {
_noteTitle = title;
_noteText = text;
}

return self;
}

@end
27 changes: 27 additions & 0 deletions Timeline/Model/Timeline/Timeline.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Timeline.h
// Timeline
//
// Created by Alessandro Boron on 10/08/2012.
// Copyright (c) 2012 Alessandro Boron. All rights reserved.
//

#import <Foundation/Foundation.h>

@class BaseEvent;

@interface Timeline : NSObject

@property (strong, nonatomic) NSString *tId;
@property (strong, nonatomic) NSString *title;
@property (strong, nonatomic) NSString *creator;
@property (strong, nonatomic) NSMutableArray *baseEvents;
@property (assign, nonatomic) BOOL shared;

//The designated initializer
- (id)initTimelineWithTitle:(NSString *)title creator:(NSString *)creator shared:(BOOL)shared;

//This method is used to return the string representation of the sharing attribute
- (NSString *)sharedDescription;

@end
Loading

0 comments on commit 67540be

Please sign in to comment.