diff --git a/Classes/VoiceBase/MGMInbox.h b/Classes/VoiceBase/MGMInbox.h index 8edcde1..3ba494b 100644 --- a/Classes/VoiceBase/MGMInbox.h +++ b/Classes/VoiceBase/MGMInbox.h @@ -14,7 +14,7 @@ @class MGMInstance, MGMURLConnectionManager; -#define MGMInboxDebug 0 +#define MGMInboxDebug 1 extern NSString * const MGMIDelegate; extern NSString * const MGMIDidReceiveInfo; diff --git a/Classes/VoiceMob/MGMAccountController.h b/Classes/VoiceMob/MGMAccountController.h index 17904dd..d4f1245 100644 --- a/Classes/VoiceMob/MGMAccountController.h +++ b/Classes/VoiceMob/MGMAccountController.h @@ -40,6 +40,9 @@ - (MGMController *)controller; - (UIView *)view; +- (UIToolbar *)toolbar; +- (NSArray *)accountsItems; +- (NSArray *)accountItems; - (BOOL)isCurrent:(id)theUser; - (void)setTitle:(NSString *)theTitle; diff --git a/Classes/VoiceMob/MGMAccountController.m b/Classes/VoiceMob/MGMAccountController.m index 989d503..fd021dc 100644 --- a/Classes/VoiceMob/MGMAccountController.m +++ b/Classes/VoiceMob/MGMAccountController.m @@ -97,6 +97,15 @@ NSString * const MGMAccountsTitle = @"Accounts"; - (UIView *)view { return view; } +- (UIToolbar *)toolbar { + return toolbar; +} +- (NSArray *)accountsItems { + return accountsItems; +} +- (NSArray *)accountItems { + return accountItems; +} - (BOOL)isCurrent:(id)theUser { return ([contactsControllers indexOfObject:theUser]==currentContactsController); diff --git a/Classes/VoiceMob/Views/MGMInboxMessageView.h b/Classes/VoiceMob/Views/MGMInboxMessageView.h new file mode 100644 index 0000000..48397b6 --- /dev/null +++ b/Classes/VoiceMob/Views/MGMInboxMessageView.h @@ -0,0 +1,23 @@ +// +// MGMInboxMessageView.h +// VoiceMob +// +// Created by Mr. Gecko on 9/30/10. +// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ +// + +#import + +@class MGMInstance; + +@interface MGMInboxMessageView : UITableViewCell { + MGMInstance *instance; + + UILabel *nameField; + UILabel *dateField; + UILabel *messageField; + NSDictionary *messageData; +} +- (void)setInstance:(MGMInstance *)theInstance; +- (void)setMessageData:(NSDictionary *)theMessageData; +@end \ No newline at end of file diff --git a/Classes/VoiceMob/Views/MGMInboxMessageView.m b/Classes/VoiceMob/Views/MGMInboxMessageView.m new file mode 100644 index 0000000..5ba0db4 --- /dev/null +++ b/Classes/VoiceMob/Views/MGMInboxMessageView.m @@ -0,0 +1,84 @@ +// +// MGMInboxMessageView.m +// VoiceMob +// +// Created by Mr. Gecko on 9/30/10. +// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ +// + +#import "MGMInboxMessageView.h" +#import + +@implementation MGMInboxMessageView +- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + nameField = [[UILabel alloc] initWithFrame:CGRectZero]; + [nameField setBackgroundColor:[UIColor clearColor]]; + [nameField setFont:[UIFont boldSystemFontOfSize:18.0]]; + [[self contentView] addSubview:nameField]; + dateField = [[UILabel alloc] initWithFrame:CGRectZero]; + [dateField setBackgroundColor:[UIColor clearColor]]; + [dateField setFont:[UIFont systemFontOfSize:12.0]]; + [dateField setTextAlignment:UITextAlignmentRight]; + [dateField setTextColor:[UIColor blueColor]]; + [[self contentView] addSubview:dateField]; + messageField = [[UILabel alloc] initWithFrame:CGRectZero]; + [messageField setBackgroundColor:[UIColor clearColor]]; + [messageField setFont:[UIFont systemFontOfSize:12.0]]; + [messageField setLineBreakMode:UILineBreakModeWordWrap]; + [messageField setNumberOfLines:0]; + [messageField setTextColor:[UIColor grayColor]]; + [[self contentView] addSubview:messageField]; + } + return self; +} +- (void)dealloc { + if (nameField!=nil) + [nameField release]; + if (dateField!=nil) + [dateField release]; + if (messageField!=nil) + [messageField release]; + [super dealloc]; +} + +- (void)setInstance:(MGMInstance *)theInstance { + instance = theInstance; +} +- (void)setMessageData:(NSDictionary *)theMessageData { + if (messageData!=nil) [messageData release]; + messageData = [theMessageData retain]; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + CGRect frameRect = [[self contentView] bounds]; + + if (messageField!=nil) { + [nameField setText:[[instance contacts] nameForNumber:[messageData objectForKey:MGMIPhoneNumber]]]; + int type = [[messageData objectForKey:MGMIType] intValue]; + if (type==MGMIVoicemailType) { + [messageField setText:[messageData objectForKey:MGMIText]]; + } else if (type==MGMISMSIn || type==MGMISMSOut) { + [messageField setText:[[[[messageData objectForKey:MGMIMessages] lastObject] objectForKey:MGMIText] flattenHTML]]; + } else { + [messageField setText:[[[messageData objectForKey:MGMIPhoneNumber] areaCode] areaCodeLocation]]; + } + NSDate *today = [NSDate dateWithTimeIntervalSinceNow:-86400]; + if ([[messageData objectForKey:MGMITime] earlierDate:today]==today) { + NSDateFormatter *formatter = [[NSDateFormatter new] autorelease]; + [formatter setDateFormat:@"h:mm a"]; + [dateField setText:[formatter stringFromDate:[messageData objectForKey:MGMITime]]]; + } else { + NSDateFormatter *formatter = [[NSDateFormatter new] autorelease]; + [formatter setDateFormat:@"M/d/yy"]; + [dateField setText:[formatter stringFromDate:[messageData objectForKey:MGMITime]]]; + } + } + + [nameField setFrame:CGRectMake(8, 3, frameRect.size.width-74, 20)]; + [dateField setFrame:CGRectMake(frameRect.size.width-64, 3, 60, 20)]; + [messageField setFrame:CGRectMake(8, frameRect.size.height-35, frameRect.size.width-12, 32)]; +} +@end \ No newline at end of file diff --git a/Classes/VoiceMob/Voice/MGMVoiceContacts.m b/Classes/VoiceMob/Voice/MGMVoiceContacts.m index 43b8d54..f12ff7a 100644 --- a/Classes/VoiceMob/Voice/MGMVoiceContacts.m +++ b/Classes/VoiceMob/Voice/MGMVoiceContacts.m @@ -30,12 +30,14 @@ } - (UIView *)view { - if (![[NSBundle mainBundle] loadNibNamed:[[UIDevice currentDevice] appendDeviceSuffixToString:@"VoiceContacts"] owner:self options:nil]) { - NSLog(@"Unable to load Voice Contacts"); - [self release]; - self = nil; - } else { - [super awakeFromNib]; + if (view==nil) { + if (![[NSBundle mainBundle] loadNibNamed:[[UIDevice currentDevice] appendDeviceSuffixToString:@"VoiceContacts"] owner:self options:nil]) { + NSLog(@"Unable to load Voice Contacts"); + [self release]; + self = nil; + } else { + [super awakeFromNib]; + } } return view; } diff --git a/Classes/VoiceMob/Voice/MGMVoiceInbox.h b/Classes/VoiceMob/Voice/MGMVoiceInbox.h new file mode 100644 index 0000000..3663e5a --- /dev/null +++ b/Classes/VoiceMob/Voice/MGMVoiceInbox.h @@ -0,0 +1,49 @@ +// +// MGMVoiceInbox.h +// VoiceMob +// +// Created by Mr. Gecko on 9/30/10. +// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ +// + +#import + +@class MGMVoiceUser, MGMProgressView, MGMInstance; + +@interface MGMVoiceInbox : NSObject { + MGMVoiceUser *voiceUser; + MGMInstance *instance; + + IBOutlet UITableView *inboxesTable; + IBOutlet UITableView *messagesTable; + MGMProgressView *progressView; + + NSArray *inboxItems; + NSArray *messagesItems; + + int progressStartCount; + + int currentInbox; + int maxResults; + unsigned int start; + int resultsCount; + + float rightMax; + float leftMax; + NSMutableArray *currentData; + NSDate *lastDate; +} ++ (id)tabWithVoiceUser:(MGMVoiceUser *)theVoiceUser; +- (id)initWithVoiceUser:(MGMVoiceUser *)theVoiceUser; + +- (MGMVoiceUser *)voiceUser; + +- (UIView *)view; +- (void)releaseView; + +- (void)startProgress; +- (void)stopProgress; + +- (void)loadInbox; +- (int)currentInbox; +@end \ No newline at end of file diff --git a/Classes/VoiceMob/Voice/MGMVoiceInbox.m b/Classes/VoiceMob/Voice/MGMVoiceInbox.m new file mode 100644 index 0000000..55f2ab6 --- /dev/null +++ b/Classes/VoiceMob/Voice/MGMVoiceInbox.m @@ -0,0 +1,243 @@ +// +// MGMVoiceInbox.m +// VoiceMob +// +// Created by Mr. Gecko on 9/30/10. +// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ +// + +#import "MGMVoiceInbox.h" +#import "MGMVoiceUser.h" +#import "MGMAccountController.h" +#import "MGMInboxMessageView.h" +#import "MGMProgressView.h" +#import "MGMVMAddons.h" +#import + +static NSMutableArray *MGMInboxItems; + +NSString * const MGMSName = @"name"; +NSString * const MGMSID = @"id"; + +NSString * const MGMInboxesCellIdentifier = @"MGMInboxesCellIdentifier"; +NSString * const MGMInboxMessageCellIdentifier = @"MGMInboxMessageCellIdentifier"; + +@implementation MGMVoiceInbox ++ (id)tabWithVoiceUser:(MGMVoiceUser *)theVoiceUser { + return [[[self alloc] initWithVoiceUser:theVoiceUser] autorelease]; +} +- (id)initWithVoiceUser:(MGMVoiceUser *)theVoiceUser { + if (self = [super init]) { + if (MGMInboxItems==nil) { + MGMInboxItems = [NSMutableArray new]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Inbox", MGMSName, [NSNumber numberWithInt:0], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Starred", MGMSName, [NSNumber numberWithInt:1], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Spam", MGMSName, [NSNumber numberWithInt:2], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Trash", MGMSName, [NSNumber numberWithInt:3], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Voicemail", MGMSName, [NSNumber numberWithInt:4], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"SMS Messages", MGMSName, [NSNumber numberWithInt:5], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Recorded", MGMSName, [NSNumber numberWithInt:6], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Placed", MGMSName, [NSNumber numberWithInt:7], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Received", MGMSName, [NSNumber numberWithInt:8], MGMSID, nil]]; + [MGMInboxItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Missed", MGMSName, [NSNumber numberWithInt:9], MGMSID, nil]]; + } + voiceUser = theVoiceUser; + instance = [voiceUser instance]; + maxResults = 10; + inboxItems = [[NSArray arrayWithObjects:[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL] autorelease], [[[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:[voiceUser accountController] action:@selector(showSettings:)] autorelease], nil] retain]; + messagesItems = [[NSArray arrayWithObjects:[[[UIBarButtonItem alloc] initWithTitle:@"Inboxes" style:UIBarButtonItemStyleBordered target:self action:@selector(showInboxes:)] autorelease], [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:NULL] autorelease], [[[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:[voiceUser accountController] action:@selector(showSettings:)] autorelease], nil] retain]; + currentData = [NSMutableArray new]; + } + return self; +} +- (void)dealloc { + [self releaseView]; + [super dealloc]; +} + +- (MGMVoiceUser *)voiceUser { + return voiceUser; +} + +- (UIView *)view { + if (inboxesTable==nil) { + if (![[NSBundle mainBundle] loadNibNamed:[[UIDevice currentDevice] appendDeviceSuffixToString:@"VoiceInbox"] owner:self options:nil]) { + NSLog(@"Unable to load Voice Inbox"); + [self release]; + self = nil; + } else { + [[[voiceUser accountController] toolbar] setItems:inboxItems animated:YES]; + CGSize contentSize = [[voiceUser tabView] frame].size; + progressView = [[MGMProgressView alloc] initWithFrame:CGRectMake(0, 0, contentSize.width, contentSize.height)]; + [progressView setProgressTitle:@"Loading..."]; + [progressView setHidden:(progressStartCount<=0)]; + } + } + return inboxesTable; +} +- (void)releaseView { + if (inboxesTable!=nil) { + [inboxesTable release]; + inboxesTable = nil; + } + if (messagesTable!=nil) { + [messagesTable release]; + messagesTable = nil; + } + if (progressView!=nil) { + [progressView release]; + progressView = nil; + } +} + +- (void)startProgress { + if (progressView!=nil) { + if ([progressView superview]==nil) + [[voiceUser tabView] addSubview:progressView]; + [progressView setHidden:NO]; + [progressView startProgess]; + [progressView becomeFirstResponder]; + } + progressStartCount++; +} +- (void)stopProgress { + if (progressView!=nil) { + if (progressStartCount==1) { + [progressView setHidden:YES]; + [progressView stopProgess]; + } + } + progressStartCount--; +} + +- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section { + if (theTableView==inboxesTable) + return [MGMInboxItems count]; + else if (theTableView==messagesTable) + return [currentData count]; + return 0; +} +- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + UITableViewCell *cell = nil; + if (theTableView==inboxesTable) { + cell = [inboxesTable dequeueReusableCellWithIdentifier:MGMInboxesCellIdentifier]; + if (cell==nil) { + cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MGMInboxesCellIdentifier] autorelease]; + [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; + } + [cell setText:[[MGMInboxItems objectAtIndex:[indexPath indexAtPosition:1]] objectForKey:MGMSName]]; + } else if (theTableView==messagesTable) { + cell = (MGMInboxMessageView *)[messagesTable dequeueReusableCellWithIdentifier:MGMInboxMessageCellIdentifier]; + if (cell==nil) { + cell = [[[MGMInboxMessageView alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MGMInboxMessageCellIdentifier] autorelease]; + [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator]; + [cell setInstance:instance]; + } + [cell setMessageData:[currentData objectAtIndex:[indexPath indexAtPosition:1]]]; + } + return cell; +} +- (BOOL)tableView:(UITableView *)theTableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { + if (theTableView==inboxesTable) + return NO; + return YES; +} +- (UITableViewCellEditingStyle)tableView:(UITableView *)theTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath { + return UITableViewCellEditingStyleDelete; +} +- (NSString *)tableView:(UITableView *)theTableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath { + return @"Delete"; +} +- (void)tableView:(UITableView *)theTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { + +} +- (void)tableView:(UITableView *)theTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (theTableView==inboxesTable) { + currentInbox = [[[MGMInboxItems objectAtIndex:[indexPath indexAtPosition:1]] objectForKey:MGMSID] intValue]; + [currentData removeAllObjects]; + start = 0; + resultsCount = 0; + [self loadInbox]; + [[messagesItems objectAtIndex:1] setEnabled:NO]; + [[[voiceUser accountController] toolbar] setItems:messagesItems animated:YES]; + + CGRect inViewFrame = [messagesTable frame]; + inViewFrame.origin.x += inViewFrame.size.width; + [messagesTable setFrame:inViewFrame]; + [[voiceUser tabView] addSubview:messagesTable]; + [UIView beginAnimations:nil context:nil]; + [UIView setAnimationDuration:0.5]; + [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; + [UIView setAnimationDelegate:self]; + [UIView setAnimationDidStopSelector:@selector(messagesAnimationDidStop:finished:context:)]; + [messagesTable setFrame:[inboxesTable frame]]; + CGRect outViewFrame = [inboxesTable frame]; + outViewFrame.origin.x -= outViewFrame.size.width; + [inboxesTable setFrame:outViewFrame]; + [UIView commitAnimations]; + } +} +- (void)messagesAnimationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context { + [inboxesTable removeFromSuperview]; + [inboxesTable deselectRowAtIndexPath:[inboxesTable indexPathForSelectedRow] animated:NO]; + [[messagesItems objectAtIndex:1] setEnabled:YES]; +} + +- (void)loadInbox { + int page = (start/maxResults)+1; + [self startProgress]; + switch (currentInbox) { + case 0: + [[instance inbox] getInboxForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 1: + [[instance inbox] getStarredForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 2: + [[instance inbox] getSpamForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 3: + [[instance inbox] getTrashForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 4: + [[instance inbox] getVoicemailForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 5: + [[instance inbox] getSMSForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 6: + [[instance inbox] getRecordedCallsForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 7: + [[instance inbox] getPlacedCallsForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 8: + [[instance inbox] getReceivedCallsForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + case 9: + [[instance inbox] getMissedCallsForPage:page delegate:self didFailWithError:@selector(inbox:didFailWithError:instance:) didReceiveInfo:@selector(inboxGotInfo:instance:)]; + break; + } +} +- (void)inbox:(NSDictionary *)theInfo didFailWithError:(NSError *)theError instance:(MGMInstance *)theInstance { + NSLog(@"Inbox Error: %@ for instance: %@", theError, theInstance); + UIAlertView *theAlert = [[UIAlertView new] autorelease]; + [theAlert setTitle:@"Error loading inbox"]; + [theAlert setMessage:[theError localizedDescription]]; + [theAlert addButtonWithTitle:MGMOkButtonTitle]; + [theAlert show]; + [self stopProgress]; +} +- (void)inboxGotInfo:(NSArray *)theInfo instance:(MGMInstance *)theInstance { + if (theInfo!=nil) { + [currentData addObjectsFromArray:theInfo]; + [messagesTable reloadData]; + } else { + NSLog(@"Error 234554: Hold on, this should never happen."); + } + [self stopProgress]; +} +- (int)currentInbox { + return currentInbox; +} +@end \ No newline at end of file diff --git a/Classes/VoiceMob/Voice/MGMVoicePad.m b/Classes/VoiceMob/Voice/MGMVoicePad.m index 0b616ac..b2b8b81 100644 --- a/Classes/VoiceMob/Voice/MGMVoicePad.m +++ b/Classes/VoiceMob/Voice/MGMVoicePad.m @@ -34,15 +34,17 @@ } - (UIView *)view { - if (![[NSBundle mainBundle] loadNibNamed:[[UIDevice currentDevice] appendDeviceSuffixToString:@"VoicePad"] owner:self options:nil]) { - NSLog(@"Unable to load Voice Pad"); - [self release]; - self = nil; - } else { - if (numberString!=nil) - [numberView setNumber:numberString]; - else - [numberView setNumber:@""]; + if (view==nil) { + if (![[NSBundle mainBundle] loadNibNamed:[[UIDevice currentDevice] appendDeviceSuffixToString:@"VoicePad"] owner:self options:nil]) { + NSLog(@"Unable to load Voice Pad"); + [self release]; + self = nil; + } else { + if (numberString!=nil) + [numberView setNumber:numberString]; + else + [numberView setNumber:@""]; + } } return view; } diff --git a/Classes/VoiceMob/Voice/MGMVoiceSMS.h b/Classes/VoiceMob/Voice/MGMVoiceSMS.h new file mode 100644 index 0000000..e0635c9 --- /dev/null +++ b/Classes/VoiceMob/Voice/MGMVoiceSMS.h @@ -0,0 +1,25 @@ +// +// MGMVoiceSMS.h +// VoiceMob +// +// Created by Mr. Gecko on 9/30/10. +// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ +// + +#import + +@class MGMVoiceUser; + +@interface MGMVoiceSMS : NSObject { + MGMVoiceUser *voiceUser; + + IBOutlet UIView *view; +} ++ (id)tabWithVoiceUser:(MGMVoiceUser *)theVoiceUser; +- (id)initWithVoiceUser:(MGMVoiceUser *)theVoiceUser; + +- (MGMVoiceUser *)voiceUser; + +- (UIView *)view; +- (void)releaseView; +@end \ No newline at end of file diff --git a/Classes/VoiceMob/Voice/MGMVoiceSMS.m b/Classes/VoiceMob/Voice/MGMVoiceSMS.m new file mode 100644 index 0000000..797d50c --- /dev/null +++ b/Classes/VoiceMob/Voice/MGMVoiceSMS.m @@ -0,0 +1,51 @@ +// +// MGMVoiceSMS.m +// VoiceMob +// +// Created by Mr. Gecko on 9/30/10. +// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ +// + +#import "MGMVoiceSMS.h" +#import "MGMVoiceUser.h" +#import "MGMVMAddons.h" +#import + +@implementation MGMVoiceSMS ++ (id)tabWithVoiceUser:(MGMVoiceUser *)theVoiceUser { + return [[[self alloc] initWithVoiceUser:theVoiceUser] autorelease]; +} +- (id)initWithVoiceUser:(MGMVoiceUser *)theVoiceUser { + if (self = [super init]) { + voiceUser = theVoiceUser; + } + return self; +} +- (void)dealloc { + [self releaseView]; + [super dealloc]; +} + +- (MGMVoiceUser *)voiceUser { + return voiceUser; +} + +- (UIView *)view { + if (view==nil) { + if (![[NSBundle mainBundle] loadNibNamed:[[UIDevice currentDevice] appendDeviceSuffixToString:@"VoiceSMS"] owner:self options:nil]) { + NSLog(@"Unable to load Voice SMS"); + [self release]; + self = nil; + } else { + + } + } + return view; +} +- (void)releaseView { + if (view!=nil) { + [view release]; + view = nil; + } +} +@end \ No newline at end of file diff --git a/Classes/VoiceMob/Voice/MGMVoiceUser.h b/Classes/VoiceMob/Voice/MGMVoiceUser.h index 76744da..2e1fdde 100644 --- a/Classes/VoiceMob/Voice/MGMVoiceUser.h +++ b/Classes/VoiceMob/Voice/MGMVoiceUser.h @@ -48,6 +48,8 @@ - (NSString *)areaCode; - (UIView *)view; +- (UIView *)tabView; +- (UITabBar *)tabBar; - (void)releaseView; - (void)loginSuccessful; diff --git a/Classes/VoiceMob/Voice/MGMVoiceUser.m b/Classes/VoiceMob/Voice/MGMVoiceUser.m index bda9519..799023e 100644 --- a/Classes/VoiceMob/Voice/MGMVoiceUser.m +++ b/Classes/VoiceMob/Voice/MGMVoiceUser.m @@ -9,6 +9,8 @@ #import "MGMVoiceUser.h" #import "MGMVoicePad.h" #import "MGMVoiceContacts.h" +#import "MGMVoiceSMS.h" +#import "MGMVoiceInbox.h" #import "MGMProgressView.h" #import "MGMAccountController.h" #import "MGMVMAddons.h" @@ -23,13 +25,16 @@ if (self = [super init]) { accountController = theAccountController; user = [theUser retain]; + + if ([user isStarted]) + instance = [[MGMInstance instanceWithUser:user delegate:self] retain]; + currentTab = 0; tabObjects = [NSMutableArray new]; [tabObjects addObject:[MGMVoicePad tabWithVoiceUser:self]]; [tabObjects addObject:[MGMVoiceContacts tabWithVoiceUser:self]]; - - if ([user isStarted]) - instance = [[MGMInstance instanceWithUser:user delegate:self] retain]; + [tabObjects addObject:[MGMVoiceSMS tabWithVoiceUser:self]]; + [tabObjects addObject:[MGMVoiceInbox tabWithVoiceUser:self]]; } return self; } @@ -83,6 +88,12 @@ } return view; } +- (UIView *)tabView { + return tabView; +} +- (UITabBar *)tabBar { + return tabBar; +} - (void)releaseView { if (view!=nil) { [view release]; @@ -202,6 +213,10 @@ int tabIndex = [[tabBar items] indexOfObject:item]; if (tabIndex==currentTab) return; + if ([[accountController toolbar] items]!=[accountController accountItems]) { + [[accountController toolbar] setItems:[accountController accountItems] animated:YES]; + } + id tab = [tabObjects objectAtIndex:currentTab]; currentTab = tabIndex; id newTab = [tabObjects objectAtIndex:currentTab]; diff --git a/Resources/VoiceMob/Voice/VoiceInbox_iPhone.xib b/Resources/VoiceMob/Voice/VoiceInbox_iPhone.xib new file mode 100644 index 0000000..d6e7149 --- /dev/null +++ b/Resources/VoiceMob/Voice/VoiceInbox_iPhone.xib @@ -0,0 +1,407 @@ + + + + 1024 + 10F569 + 788 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 117 + + + YES + + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {320, 367} + + 3 + MQA + + IBCocoaTouchFramework + + + + 274 + {320, 367} + + + YES + IBCocoaTouchFramework + YES + 1 + 0 + YES + 40 + + + + 274 + {320, 367} + + + YES + IBCocoaTouchFramework + YES + 1 + 0 + YES + 60 + + + + + YES + + + inboxesTable + + + + 7 + + + + messagesTable + + + + 8 + + + + dataSource + + + + 9 + + + + dataSource + + + + 10 + + + + delegate + + + + 11 + + + + delegate + + + + 12 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 3 + + + YES + + + + + 5 + + + Inboxes + + + 6 + + + Messages + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 3.IBEditorWindowLastContentRect + 3.IBPluginDependency + 5.IBEditorWindowLastContentRect + 5.IBPluginDependency + 6.IBEditorWindowLastContentRect + 6.IBPluginDependency + + + YES + MGMVoiceInbox + UIResponder + {{558, 148}, {320, 367}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{42, 332}, {320, 367}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + {{63, 309}, {320, 367}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 12 + + + + YES + + MGMVoiceInbox + NSObject + + YES + + YES + inboxesTable + messagesTable + + + YES + UITableView + UITableView + + + + YES + + YES + inboxesTable + messagesTable + + + YES + + inboxesTable + UITableView + + + messagesTable + UITableView + + + + + IBProjectSource + Classes/VoiceMob/Voice/MGMVoiceInbox.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIResponder + NSObject + + + + UIScrollView + UIView + + IBFrameworkSource + UIKit.framework/Headers/UIScrollView.h + + + + UITableView + UIScrollView + + IBFrameworkSource + UIKit.framework/Headers/UITableView.h + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../../VoiceMob.xcodeproj + 3 + 117 + + diff --git a/Resources/VoiceMob/Voice/VoiceSMS_iPhone.xib b/Resources/VoiceMob/Voice/VoiceSMS_iPhone.xib new file mode 100644 index 0000000..4c4aec2 --- /dev/null +++ b/Resources/VoiceMob/Voice/VoiceSMS_iPhone.xib @@ -0,0 +1,279 @@ + + + + 1024 + 10F569 + 788 + 1038.29 + 461.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 117 + + + YES + + + + YES + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + YES + + YES + + + YES + + + + YES + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {322, 369} + + + 3 + MQA + + IBCocoaTouchFramework + + + + + YES + + + view + + + + 4 + + + + + YES + + 0 + + + + + + -1 + + + File's Owner + + + -2 + + + + + 3 + + + + + + + YES + + YES + -1.CustomClassName + -2.CustomClassName + 3.IBEditorWindowLastContentRect + 3.IBPluginDependency + + + YES + MGMVoiceSMS + UIResponder + {{525, 191}, {322, 369}} + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + YES + + + YES + + + + + YES + + + YES + + + + 4 + + + + YES + + MGMVoiceSMS + NSObject + + view + UIView + + + view + + view + UIView + + + + IBProjectSource + Classes/VoiceMob/Voice/MGMVoiceSMS.h + + + + + YES + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIAccessibility.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UINibLoading.h + + + + NSObject + + IBFrameworkSource + UIKit.framework/Headers/UIResponder.h + + + + UIResponder + NSObject + + + + UIView + + IBFrameworkSource + UIKit.framework/Headers/UITextField.h + + + + UIView + UIResponder + + IBFrameworkSource + UIKit.framework/Headers/UIView.h + + + + + 0 + IBCocoaTouchFramework + + com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS + + + + com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 + + + YES + ../../../VoiceMob.xcodeproj + 3 + 117 + + diff --git a/Resources/VoiceMob/Voice/VoiceUser_iPhone.xib b/Resources/VoiceMob/Voice/VoiceUser_iPhone.xib index cc3998b..df21ceb 100644 --- a/Resources/VoiceMob/Voice/VoiceUser_iPhone.xib +++ b/Resources/VoiceMob/Voice/VoiceUser_iPhone.xib @@ -12,7 +12,7 @@ YES - + YES @@ -232,7 +232,7 @@ com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin - {{497, 127}, {320, 416}} + {{620, 69}, {320, 416}} com.apple.InterfaceBuilder.IBCocoaTouchPlugin com.apple.InterfaceBuilder.IBCocoaTouchPlugin diff --git a/VoiceMob.xcodeproj/project.pbxproj b/VoiceMob.xcodeproj/project.pbxproj index 0aab6a5..407fb96 100755 --- a/VoiceMob.xcodeproj/project.pbxproj +++ b/VoiceMob.xcodeproj/project.pbxproj @@ -46,6 +46,11 @@ 2A90693C1254CF040008461E /* SMS Themes in Resources */ = {isa = PBXBuildFile; fileRef = 2A9069071254CF040008461E /* SMS Themes */; }; 2A90693D1254CF040008461E /* Sounds in Resources */ = {isa = PBXBuildFile; fileRef = 2A9069321254CF040008461E /* Sounds */; }; 2A906A041254D4BB0008461E /* blankicon.png in Resources */ = {isa = PBXBuildFile; fileRef = 2A906A031254D4BB0008461E /* blankicon.png */; }; + 2A906BEF125522800008461E /* MGMVoiceSMS.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A906BEE125522800008461E /* MGMVoiceSMS.m */; }; + 2A906BF6125522D10008461E /* MGMVoiceInbox.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A906BF5125522D10008461E /* MGMVoiceInbox.m */; }; + 2A906BFD1255231F0008461E /* VoiceSMS_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2A906BFC1255231F0008461E /* VoiceSMS_iPhone.xib */; }; + 2A906BFF1255232E0008461E /* VoiceInbox_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2A906BFE1255232E0008461E /* VoiceInbox_iPhone.xib */; }; + 2A906CBA12554DA40008461E /* MGMInboxMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A906CB912554DA40008461E /* MGMInboxMessageView.m */; }; 2ABD37AE1250D448004AAE00 /* AccountController_iPhone.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2ABD37AD1250D448004AAE00 /* AccountController_iPhone.xib */; }; 2ABD380412513B26004AAE00 /* MGMAccountController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2ABD380312513B26004AAE00 /* MGMAccountController.m */; }; /* End PBXBuildFile section */ @@ -129,6 +134,14 @@ 2A9069071254CF040008461E /* SMS Themes */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "SMS Themes"; sourceTree = ""; }; 2A9069321254CF040008461E /* Sounds */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Sounds; sourceTree = ""; }; 2A906A031254D4BB0008461E /* blankicon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = blankicon.png; sourceTree = ""; }; + 2A906BED125522800008461E /* MGMVoiceSMS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMVoiceSMS.h; sourceTree = ""; }; + 2A906BEE125522800008461E /* MGMVoiceSMS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMVoiceSMS.m; sourceTree = ""; }; + 2A906BF4125522D10008461E /* MGMVoiceInbox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMVoiceInbox.h; sourceTree = ""; }; + 2A906BF5125522D10008461E /* MGMVoiceInbox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMVoiceInbox.m; sourceTree = ""; }; + 2A906BFC1255231F0008461E /* VoiceSMS_iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VoiceSMS_iPhone.xib; sourceTree = ""; }; + 2A906BFE1255232E0008461E /* VoiceInbox_iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = VoiceInbox_iPhone.xib; sourceTree = ""; }; + 2A906CB812554DA40008461E /* MGMInboxMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMInboxMessageView.h; sourceTree = ""; }; + 2A906CB912554DA40008461E /* MGMInboxMessageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMInboxMessageView.m; sourceTree = ""; }; 2ABD37AD1250D448004AAE00 /* AccountController_iPhone.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AccountController_iPhone.xib; sourceTree = ""; }; 2ABD380212513B25004AAE00 /* MGMAccountController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGMAccountController.h; sourceTree = ""; }; 2ABD380312513B26004AAE00 /* MGMAccountController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGMAccountController.m; sourceTree = ""; }; @@ -276,6 +289,10 @@ 2A3170A612539BFA009998B6 /* MGMVoicePad.m */, 2A9067C9125430DA0008461E /* MGMVoiceContacts.h */, 2A9067CA125430DA0008461E /* MGMVoiceContacts.m */, + 2A906BED125522800008461E /* MGMVoiceSMS.h */, + 2A906BEE125522800008461E /* MGMVoiceSMS.m */, + 2A906BF4125522D10008461E /* MGMVoiceInbox.h */, + 2A906BF5125522D10008461E /* MGMVoiceInbox.m */, ); path = Voice; sourceTree = ""; @@ -294,6 +311,8 @@ 2A316C48125296A5009998B6 /* VoiceUser_iPhone.xib */, 2A31708B1253987F009998B6 /* VoicePad_iPhone.xib */, 2A9067C61254302E0008461E /* VoiceContacts_iPhone.xib */, + 2A906BFC1255231F0008461E /* VoiceSMS_iPhone.xib */, + 2A906BFE1255232E0008461E /* VoiceInbox_iPhone.xib */, ); path = Voice; sourceTree = ""; @@ -307,6 +326,8 @@ 2A316F0F1252FBED009998B6 /* MGMNumberView.m */, 2A90683E125436120008461E /* MGMContactView.h */, 2A90683F125436120008461E /* MGMContactView.m */, + 2A906CB812554DA40008461E /* MGMInboxMessageView.h */, + 2A906CB912554DA40008461E /* MGMInboxMessageView.m */, ); path = Views; sourceTree = ""; @@ -393,6 +414,8 @@ 2A90693C1254CF040008461E /* SMS Themes in Resources */, 2A90693D1254CF040008461E /* Sounds in Resources */, 2A906A041254D4BB0008461E /* blankicon.png in Resources */, + 2A906BFD1255231F0008461E /* VoiceSMS_iPhone.xib in Resources */, + 2A906BFF1255232E0008461E /* VoiceInbox_iPhone.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -417,6 +440,9 @@ 2A9067CB125430DA0008461E /* MGMVoiceContacts.m in Sources */, 2A9067CE125431010008461E /* MGMContactsController.m in Sources */, 2A906840125436130008461E /* MGMContactView.m in Sources */, + 2A906BEF125522800008461E /* MGMVoiceSMS.m in Sources */, + 2A906BF6125522D10008461E /* MGMVoiceInbox.m in Sources */, + 2A906CBA12554DA40008461E /* MGMInboxMessageView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };