ambujshukla / Database

0 stars 0 forks source link

TTS #2

Open ambujshukla opened 9 years ago

ambujshukla commented 9 years ago

// // ViewController.m // TTS // // Created by Ambuj Shukla on 29/04/15. // Copyright (c) 2015 Test. All rights reserved. //

import "ViewController.h"

import <AVFoundation/AVFoundation.h>

@interface ViewController () { AVSpeechSynthesizer synthesizer; } @property (nonatomic,strong) IBOutlet UILabel lbl;

@end

@implementation ViewController

@end

ambujshukla commented 9 years ago

// // ViewController.m // TwitterSharing // // Created by cdn105 on 23/04/15. // Copyright (c) 2015 CDN. All rights reserved. //

import "ViewController.h"

import <Social/Social.h>

import "FHSTwitterEngine.h"

@interface ViewController ()

@property (weak, nonatomic) IBOutlet UILabel *lblUserName; @property (nonatomic, assign) BOOL isStreaming;

@end

@implementation ViewController

pragma mark-View LyfeCycle Methods

pragma mark-Button Action Methods

//Used for Login -(IBAction)actionLoginButton:(id)sender { [self loginOAuth]; }

-(IBAction)actionLogoutButton:(id)sender { [self logout]; }

-(IBAction)actionPostTwitButton:(id)sender { if([[FHSTwitterEngine sharedEngine]isAuthorized]) [self postTweet]; else [self loginOAuth]; }

pragma mark-Custom Method Implementation

-(void)decorateUI { [[FHSTwitterEngine sharedEngine]permanentlySetConsumerKey:@"Xg3ACDprWAH8loEPjMzRg" andSecret:@"9LwYDxw1iTc6D9ebHdrYCZrJP4lJhQv5uf4ueiPHvJ0"]; [[FHSTwitterEngine sharedEngine]setDelegate:self]; [[FHSTwitterEngine sharedEngine]loadAccessToken]; }

-(void)doTweetWithMessage:(NSString )strTitle andImageData:(NSData )imgData { [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ @autoreleasepool {

        //id returned = [[FHSTwitterEngine sharedEngine]postTweet:tweet];
        id returned = [[FHSTwitterEngine sharedEngine] postTweet:strTitle withImageData:imgData];
        [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

        NSString *title = nil;
        NSString *message = nil;

        if ([returned isKindOfClass:[NSError class]]) {
            NSError *error = (NSError *)returned;
            title = [NSString stringWithFormat:@"Error %ld",(long)error.code];
            message = error.localizedDescription;
        } else {
            NSLog(@"%@",returned);
            title = @"Tweet Posted";
            message = strTitle;
        }

        dispatch_sync(dispatch_get_main_queue(), ^{
            @autoreleasepool {
                //Show message when
                [self showAlertWithMessage:message];
            }
        });
    }
});

}

-(void)showAlertWithMessage:(NSString )strMsg { UIAlertView alert=[[UIAlertView alloc] initWithTitle:@"Twitter Sharing" message:strMsg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; }

@end

ambujshukla commented 9 years ago

SWRevealViewController revealController = self.revealViewController; UINavigationController navigationController; switch (indexPath.row) { case 0:{ BTWDashboardDataEmailViewController * rootView = [[BTWDashboardDataEmailViewController alloc] initWithNibName:@"BTWDashboardDataEmailViewController" bundle:nil]; navigationController = [appDelegate.revealNavigation initWithRootViewController:rootView]; [revealController pushFrontViewController:navigationController animated:YES];