Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  *  Copyright 2013, Guy Federovsky
  3.  *
  4.  *  All rights reserved.
  5.  *
  6.  *  Redistribution and use in source and binary forms, with or without modification, are
  7.  *  permitted provided that the following conditions are met:
  8.  *
  9.  *  Redistributions of source code must retain the above copyright notice which includes the
  10.  *  name(s) of the copyright holders. It must also retain this list of conditions and the
  11.  *  following disclaimer.
  12.  *
  13.  *  Redistributions in binary form must reproduce the above copyright notice, this list
  14.  *  of conditions and the following disclaimer in the documentation and/or other materials
  15.  *  provided with the distribution.
  16.  *
  17.  *  Neither the name of David Book, or buzztouch.com nor the names of its contributors
  18.  *  may be used to endorse or promote products derived from this software without specific
  19.  *  prior written permission.
  20.  *
  21.  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  22.  *  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  23.  *  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  24.  *  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  25.  *  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  26.  *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  27.  *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  28.  *  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29.  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  30.  *  OF SUCH DAMAGE.
  31.  */
  32.  
  33. #import "SCR_chatRooms.h"
  34.  
  35. #import "BT_strings.h"
  36. #import "BT_viewUtilities.h"
  37. #import "BT_navController.h"
  38. #import "BT_debugger.h"
  39. #import "YOURAPPNAME_appDelegate.h"
  40.  
  41. #import <Scringo/Scringo.h>
  42. #import <Scringo/ScringoChatRoomsViewController.h>
  43.  
  44. @interface SCR_chatRooms ()
  45. @property (nonatomic, retain) ScringoChatRoomsViewController *chatRoomsVC;
  46. @end
  47.  
  48. @implementation SCR_chatRooms
  49.  
  50. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
  51. {
  52.     self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
  53.     if (self) {
  54.         self.chatRoomsVC = [[ScringoChatRoomsViewController alloc] initFromNib:YES];
  55.         [self.chatRoomsVC setTitleText:NSLocalizedStringFromTable(@"scringo_text_chatrooms_tab_title", @"ScringoLocalizable", @"Chat Rooms")];
  56.         self.chatRoomsVC.featureTabDelegate = self;
  57.     }
  58.     return self;
  59. }
  60.  
  61.  
  62.  
  63.  
  64. //added for tab bars
  65. //view will appear
  66. -(void)viewWillAppear:(BOOL)animated{
  67.     [super viewWillAppear:animated];
  68.     [BT_debugger showIt:self theMessage:@"viewWillAppear"];
  69.    
  70.     //flag this as the current screen
  71.     YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];
  72.     appDelegate.rootApp.currentScreenData = self.screenData;
  73.    
  74.     //setup navigation bar and background
  75.    
  76.     [BT_viewUtilities getNavBarBackgroundColorForScreen:self.screenData];
  77.    
  78.    
  79.    
  80.     //create adView?
  81.     if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"includeAds" defaultValue:@"0"] isEqualToString:@"1"]){
  82.         [self createAdBannerView];
  83.     }
  84.    
  85.    
  86. }
  87.  
  88.  
  89.  
  90.  
  91. - (void)viewDidLoad
  92. {
  93.     [BT_debugger showIt:self theMessage:@"viewDidLoad"];
  94.     [super viewDidLoad];
  95.    
  96.     NSString *appId = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"scringoAppId" defaultValue:@""];
  97.     [Scringo initWithAppId:appId completion:^{
  98.         [BT_debugger showIt:self theMessage:@"Scringo is initialized"];
  99.     }];
  100.    
  101.     [Scringo preloadChatRoomsWithCompletion:^{
  102.         [BT_debugger showIt:self theMessage:@"Scringo Chat Rooms were preloaded successfully"];
  103.     }];
  104.    
  105.     [self addChildViewController:self.chatRoomsVC];
  106.     self.chatRoomsVC.view.frame = self.view.bounds;
  107.     [self.view addSubview:self.chatRoomsVC.view];
  108.     [self.chatRoomsVC didMoveToParentViewController:self];
  109. }
  110.  
  111. - (void)didReceiveMemoryWarning
  112. {
  113.     [super didReceiveMemoryWarning];
  114.     // Dispose of any resources that can be recreated.
  115. }
  116.  
  117. -(void)didClickBack {
  118.     [self navLeftTap];
  119. }
  120. -(void)didClose {
  121.     YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];
  122.     BT_navController *theNavController = [appDelegate getNavigationController];
  123.     [theNavController popToRootViewControllerAnimated:YES];
  124. }
  125. -(void)backToPanel {
  126.     YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];
  127.     BT_navController *theNavController = [appDelegate getNavigationController];
  128.     [theNavController popToViewController:self animated:YES];
  129. }
  130. -(BOOL)isUsingPopover {
  131.     return NO;
  132.    
  133. }
  134. -(BOOL)isTopPanelHidden {
  135.     return NO;
  136. }
  137. -(BOOL)isOpenedAsFeature {
  138.     return YES;
  139. }
  140.  
  141. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement