//
//  Integrating_Twitter_Functionality_Into_Your_AppsViewController.m
//  Integrating Twitter Functionality Into Your Apps
//
//  Created by Vandad Nahavandipoor on 20/07/2011.
//  Copyright 2011 Pixolity Ltd. All rights reserved.
//

#import "Integrating_Twitter_Functionality_Into_Your_AppsViewController.h"

@implementation 
  Integrating_Twitter_Functionality_Into_Your_AppsViewController

@synthesize twitterController;

/* 1 */
//- (void)viewDidLoad{
//  [super viewDidLoad];
//  
//  self.twitterController = [[TWTweetComposeViewController alloc] init];
//  [self.twitterController setInitialText:@"Miejsce na Twoją wiadomość"];
//  [self.navigationController presentModalViewController:self.twitterController
//                                               animated:YES];
//  
//}

/* 2 */
- (void)viewDidLoad{
  [super viewDidLoad];
  
  self.twitterController = [[TWTweetComposeViewController alloc] init];
  
  NSString *text = 
  @"Antoni Nowak na targach Unleash the Power Within (UPW) w Londynie";
  
  [self.twitterController setInitialText:text];
  
  UIImage *antoniNowak = [UIImage imageNamed:@"Antoni Nowak.jpg"];
  [self.twitterController addImage:antoniNowak];
  
  NSURL *url = [NSURL URLWithString:@"http://www.tonyrobbins.com"];
  [self.twitterController addURL:url];
  
  
  [self.navigationController presentModalViewController:self.twitterController
                                               animated:YES];
  
}

/* 3 */
//- (void)viewDidLoad{
//  [super viewDidLoad];
//  
//  self.twitterController = [[TWTweetComposeViewController alloc] init];
//  
//  __weak 
//    Integrating_Twitter_Functionality_Into_Your_AppsViewController
//      *weakSelf = self;
//  
//  [self.twitterController setCompletionHandler:
//   ^(TWTweetComposeViewControllerResult result){
//    
//     Integrating_Twitter_Functionality_Into_Your_AppsViewController
//      *strongSelf = weakSelf;
//     
//     switch (result){
//       case TWTweetComposeViewControllerResultDone:{
//         /* Wysłanie wiadomości zakończyło się powodzeniem. Okno zostanie zamknięte automatycznie. */
//         break;
//       }
//       case TWTweetComposeViewControllerResultCancelled:{
//         if (strongSelf != nil){
//           [strongSelf.twitterController 
//            dismissModalViewControllerAnimated:YES];
//         }
//         break;
//       }
//     }
//     
//  }];
//  
//  NSString *text = 
//  @"Antoni Nowak na targach Unleash the Power Within (UPW) w Londynie";
//  
//  [self.twitterController setInitialText:text];
//  
//  UIImage *antoniNowak = [UIImage imageNamed:@"Antoni Nowak.jpg"];
//  [self.twitterController addImage:antoniNowak];
//  
//  NSURL *url = [NSURL URLWithString:@"http://www.tonyrobbins.com"];
//  [self.twitterController addURL:url];
//  
//  
//  [self.navigationController presentModalViewController:self.twitterController
//                                               animated:YES];
//  
//}



- (BOOL)shouldAutorotateToInterfaceOrientation
        :(UIInterfaceOrientation)interfaceOrientation{
  return YES;
}

@end
