Developer Area

Changeset 671

Show
Ignore:
Timestamp:
01/19/10 15:57:18 (8 weeks ago)
Author:
henri
Message:

Added Buy Account functionality

Location:
apps/iphone/my.tel/trunk/Classes
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • apps/iphone/my.tel/trunk/Classes/RootViewController.h

    r653 r671  
    1717        kKRootTableViewSectionAccounts,                 // Existing .tel accounts 
    1818        kKRootTableViewSectionAddAccount,               // Single section to add an account 
     19        kKRootTableViewSectionBuyAccount,               // Single section to buy an account 
    1920        kKRootTableViewSectionsCount,                   // Keep this last to get the count of sections 
    2021        // Anything below is disabled 
    2122        // move it above the SectionsCount item to enable it 
    22         kKRootTableViewSectionBuyAccount,               // Single section to buy an account 
    2323}; 
    2424 
  • apps/iphone/my.tel/trunk/Classes/RootViewController.m

    r659 r671  
    3333        self.title = @"Accounts"; 
    3434        self.tableView.allowsSelectionDuringEditing = YES; 
    35         self.view.backgroundColor = [UIColor darkGrayColor]; 
     35//      self.view.backgroundColor = [UIColor darkGrayColor]; 
    3636        self.navigationItem.rightBarButtonItem = self.editButtonItem; 
    3737        self.navigationItem.rightBarButtonItem.enabled = YES; 
     
    158158        if (forced || mustLogin) { 
    159159                NSDictionary *selectedAccount = [self.accountsArray objectAtIndex:self.currentAccountIndex]; 
     160                NSString *apiRoot = [selectedAccount objectForKey:@"apiUrl"]; 
     161                if ((apiRoot == nil) || [apiRoot length] == 0) { 
     162                        // nonexistent api Root URL. Send to edit view 
     163                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Missing API URL" 
     164                                                                                                                        message:@"Please verify your account settings" 
     165                                                                                                                   delegate:nil 
     166                                                                                                  cancelButtonTitle:@"OK" 
     167                                                                                                  otherButtonTitles:nil]; 
     168                        [alert show]; 
     169                        [alert release]; 
     170                        [self objectWillGetEditedInController:self]; 
     171                        return; 
     172                } 
    160173                [[[UIApplication sharedApplication] keyWindow] addSubview:[MyTelConnect sharedInstance].view]; 
    161174                [[MyTelConnect sharedInstance] loginToTelAccountWithName:[selectedAccount objectForKey:@"userName"] 
     
    275288                        } 
    276289                        cell.textLabel.textAlignment = UITextAlignmentCenter; 
    277                         cell.textLabel.text = @"Add account";            
     290                        cell.textLabel.text = @"Add a .tel account";             
    278291                        break; 
    279292                case kKRootTableViewSectionBuyAccount: 
     
    293306} 
    294307 
     308- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 
     309        NSString *footerString = nil; 
     310        switch (section) { 
     311                case kKRootTableViewSectionBuyAccount: 
     312                        footerString = @"Don't own a .tel domain?"; 
     313                        break; 
     314                default: 
     315                        break; 
     316        } 
     317        return footerString; 
     318} 
     319 
     320- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 
     321        NSString *footerString = nil; 
     322        switch (section) { 
     323                case kKRootTableViewSectionBuyAccount: 
     324                        footerString = @"Download DomainApp:\na free third party app to buy domains"; 
     325                        break; 
     326                default: 
     327                        break; 
     328        } 
     329        return footerString; 
     330} 
     331 
    295332 
    296333- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    297334        [tableView deselectRowAtIndexPath:indexPath animated:YES]; 
    298335        AccountEditController *eVC; 
     336        NSURL *appURL; 
    299337        switch (indexPath.section) { 
    300338                case kKRootTableViewSectionAccounts: 
     
    313351                        break; 
    314352                case kKRootTableViewSectionBuyAccount: 
     353                        appURL = [NSURL URLWithString:@"http://itunes.apple.com/us/app/domainapp/id295892753?mt=8&uo=6"]; 
     354                        [[UIApplication sharedApplication] openURL:appURL]; 
     355                        // Note: The above doesn't work in the simulator because iTunes is missing 
    315356                        break; 
    316357        } 
Telnic
Search This Site
Partners
Neustar
ICANN
Main site | WHOIS | Sell .tel | FAQ | Archived Site | About Telnic | Contact Us