forked from alunny/Pigeon
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
alunny
committed
Jul 16, 2009
0 parents
commit fe0b3d9
Showing
39 changed files
with
9,231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
/* | |||
* Contact.h | |||
* | |||
* Created by Nitobi on 12/12/08. | |||
* Copyright 2008 Nitobi. All rights reserved. | |||
* | |||
*/ | |||
|
|||
#import <Foundation/Foundation.h> | |||
#import <AddressBook/ABAddressBook.h> | |||
|
|||
@interface Contacts : NSObject { | |||
ABAddressBookRef addressBook; | |||
NSArray *allPeople; | |||
CFIndex nPeople; | |||
} | |||
|
|||
@property (getter=getAddressBook,assign) ABAddressBookRef addressBook; | |||
@property (getter=getContacts,assign) NSArray *allPeople; | |||
|
|||
//- (NSString *)stringValueForRow:(NSInteger)row; | |||
|
|||
- (id)init; | |||
- (void) displayContact:(ABRecordRef *) person; | |||
- (void) addContact; | |||
|
|||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,86 @@ | |||
/* | |||
* Contact.m | |||
* | |||
* Created by Nitobi on 2/3/09 | |||
* Copyright 2008 Nitobi. All rights reserved. | |||
* Rob Ellis rob.ellis@nitobi.com | |||
* | |||
*/ | |||
|
|||
|
|||
#import <AddressBook/AddressBook.h> | |||
#import "Contacts.h" | |||
|
|||
@implementation Contacts | |||
|
|||
@synthesize addressBook; | |||
@synthesize allPeople; | |||
|
|||
- (id)init | |||
{ | |||
self = [super init]; | |||
addressBook = ABAddressBookCreate(); | |||
return self; | |||
} | |||
|
|||
- (NSMutableString *)getContacts { | |||
NSMutableString *update = [[[NSMutableString alloc] init] autorelease]; | |||
|
|||
if (allPeople == nil) { | |||
allPeople = (NSArray *)ABAddressBookCopyArrayOfAllPeople(self.addressBook); | |||
CFIndex numberOfPeople = ABAddressBookGetPersonCount(self.addressBook); | |||
|
|||
[update appendString:@"var _contacts=["]; | |||
|
|||
for (int i=0;i < numberOfPeople;i++) { | |||
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople,i); | |||
|
|||
if (ABRecordCopyValue(ref, kABPersonFirstNameProperty) != nil && ABRecordCopyValue(ref, kABPersonLastNameProperty) != nil) { | |||
CFStringRef firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty); | |||
CFStringRef lastName = ABRecordCopyValue(ref, kABPersonLastNameProperty); | |||
CFStringRef phoneNumber = ABMultiValueCopyValueAtIndex(ABRecordCopyValue(ref,kABPersonPhoneProperty) ,0); | |||
|
|||
NSString *contactFirstLast = [NSString stringWithFormat:@"%@ %@",firstName, lastName]; | |||
NSString *contactFirstLast2 = [NSString stringWithFormat:@"{'name':'%@','phone':'%@'}",contactFirstLast,phoneNumber]; | |||
[update appendFormat:@"%@", contactFirstLast2]; | |||
if (i+1 != numberOfPeople) { | |||
[update appendFormat:@","]; | |||
} | |||
|
|||
CFRelease(firstName); | |||
CFRelease(lastName); | |||
CFRelease(phoneNumber); | |||
} | |||
} | |||
|
|||
[update appendString:@"];"]; | |||
} | |||
return update; | |||
} | |||
|
|||
- (void) addContact { | |||
|
|||
ABAddressBookRef libroDirec = ABAddressBookCreate(); | |||
ABRecordRef persona = ABPersonCreate(); | |||
|
|||
ABRecordSetValue(persona, kABPersonFirstNameProperty, @"kate" , nil); | |||
ABRecordSetValue(persona, kABPersonLastNameProperty, @"Hutson", nil); | |||
ABAddressBookAddRecord(libroDirec, persona, nil); | |||
ABAddressBookSave(libroDirec, nil); | |||
|
|||
CFRelease(persona); | |||
} | |||
|
|||
|
|||
- (void) displayContact:(ABRecordRef *) person { | |||
NSLog(@"HERE"); | |||
} | |||
|
|||
- (ABAddressBookRef)getAddressBook { | |||
if (nil == addressBook) | |||
{ | |||
addressBook = ABAddressBookCreate(); | |||
} | |||
return addressBook; | |||
} | |||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
/* | |||
* Device.h | |||
* Used to display Device centric details handset. | |||
* | |||
* Created by Nitobi on 12/12/08. | |||
* Copyright 2008 Nitobi. All rights reserved. | |||
*/ | |||
|
|||
#import <UIKit/UIKit.h> | |||
#import <UIKit/UIDevice.h> | |||
|
|||
@interface Device : NSObject { | |||
UIDevice *myCurrentDevice; | |||
} | |||
|
|||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
/* | |||
* Device.m | |||
* Used to display Device centric details handset. | |||
* | |||
* Created by Nitobi on 12/12/08. | |||
* Copyright 2008 Nitobi. All rights reserved. | |||
*/ | |||
|
|||
#import "Device.h" | |||
|
|||
@implementation Device | |||
|
|||
/* | |||
* init | |||
* returns a JS String with various device settings | |||
* - gap enabled | |||
* - version | |||
* - Device model | |||
* - Device Version | |||
* - Device UUID | |||
*/ | |||
- (NSString *)init{ | |||
|
|||
myCurrentDevice = [UIDevice currentDevice]; | |||
// | |||
// return jsCallBack = [[NSString alloc] initWithFormat:@"\ | |||
// __gap = true; \ | |||
// __gap_version='0.2'; \ | |||
// __gap_device_model='%s'; \ | |||
// __gap_device_version='%s';\ | |||
// __gap_device_uniqueid='%s';", | |||
// [[myCurrentDevice model] UTF8String], | |||
// [[myCurrentDevice systemVersion] UTF8String], | |||
// [[myCurrentDevice uniqueIdentifier] UTF8String] | |||
// ]; | |||
|
|||
|
|||
return [[NSString alloc] initWithFormat:@"Device={};Device.platform='%s';Device.version='%s';Device.uuid='%s';",[[myCurrentDevice model] UTF8String], [[myCurrentDevice systemVersion] UTF8String], [[myCurrentDevice uniqueIdentifier] UTF8String] ]; | |||
} | |||
|
|||
- (void)dealloc { | |||
[myCurrentDevice release]; | |||
[super dealloc]; | |||
|
|||
} | |||
|
|||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
// | |||
// File.h | |||
// PhoneGap | |||
// | |||
// Created by Nitobi on 19/12/08. | |||
// Copyright 2008 Nitobi. All rights reserved. | |||
// | |||
|
|||
#import <Foundation/Foundation.h> | |||
|
|||
|
|||
@interface File : NSObject { | |||
|
|||
} | |||
|
|||
|
|||
|
|||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,14 @@ | |||
// | |||
// File.m | |||
// PhoneGap | |||
// | |||
// Created by Nitobi on 19/12/08. | |||
// Copyright 2008 Nitobi. All rights reserved. | |||
// | |||
|
|||
#import "File.h" | |||
|
|||
|
|||
@implementation File | |||
|
|||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,31 @@ | |||
/* | |||
* Image.h | |||
* PhoneGap | |||
* | |||
* Created by Nitobi on 04/02/09. | |||
* Copyright 2009 Nitobi. All rights reserved. | |||
* | |||
*/ | |||
|
|||
#import <Foundation/Foundation.h> | |||
|
|||
|
|||
@interface Image : NSObject { | |||
IBOutlet UIWindow *window; | |||
IBOutlet UIWebView *webView; | |||
|
|||
UIImagePickerController *picker; // added by urbian | |||
NSString *photoUploadUrl; // added by urbian | |||
NSString *lastUploadedPhoto; // added by urbian | |||
NSURLConnection *conn; // added by urbian | |||
NSMutableData *receivedData; // added by urbian | |||
|
|||
} | |||
|
|||
@property (nonatomic, retain) UIImagePickerController *imagePickerController; | |||
@property (nonatomic, retain) UIWindow *window; | |||
|
|||
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image2 editingInfo:(NSDictionary *)editingInfo; | |||
- (void) imagePickerControllerDidCancel:(UIImagePickerController *)picker; | |||
|
|||
@end |
Oops, something went wrong.