Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright 2013, Guy Federovsky
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice which includes the
- * name(s) of the copyright holders. It must also retain this list of conditions and the
- * following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * Neither the name of David Book, or buzztouch.com nor the names of its contributors
- * may be used to endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- */
- #import "SCR_chatRooms.h"
- #import "BT_strings.h"
- #import "BT_viewUtilities.h"
- #import "BT_navController.h"
- #import "BT_debugger.h"
- #import "YOURAPPNAME_appDelegate.h"
- #import <Scringo/Scringo.h>
- #import <Scringo/ScringoChatRoomsViewController.h>
- @interface SCR_chatRooms ()
- @property (nonatomic, retain) ScringoChatRoomsViewController *chatRoomsVC;
- @end
- @implementation SCR_chatRooms
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- self.chatRoomsVC = [[ScringoChatRoomsViewController alloc] initFromNib:YES];
- [self.chatRoomsVC setTitleText:NSLocalizedStringFromTable(@"scringo_text_chatrooms_tab_title", @"ScringoLocalizable", @"Chat Rooms")];
- self.chatRoomsVC.featureTabDelegate = self;
- }
- return self;
- }
- //added for tab bars
- //view will appear
- -(void)viewWillAppear:(BOOL)animated{
- [super viewWillAppear:animated];
- [BT_debugger showIt:self theMessage:@"viewWillAppear"];
- //flag this as the current screen
- YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];
- appDelegate.rootApp.currentScreenData = self.screenData;
- //setup navigation bar and background
- [BT_viewUtilities getNavBarBackgroundColorForScreen:self.screenData];
- //create adView?
- if([[BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"includeAds" defaultValue:@"0"] isEqualToString:@"1"]){
- [self createAdBannerView];
- }
- }
- - (void)viewDidLoad
- {
- [BT_debugger showIt:self theMessage:@"viewDidLoad"];
- [super viewDidLoad];
- NSString *appId = [BT_strings getJsonPropertyValue:self.screenData.jsonVars nameOfProperty:@"scringoAppId" defaultValue:@""];
- [Scringo initWithAppId:appId completion:^{
- [BT_debugger showIt:self theMessage:@"Scringo is initialized"];
- }];
- [Scringo preloadChatRoomsWithCompletion:^{
- [BT_debugger showIt:self theMessage:@"Scringo Chat Rooms were preloaded successfully"];
- }];
- [self addChildViewController:self.chatRoomsVC];
- self.chatRoomsVC.view.frame = self.view.bounds;
- [self.view addSubview:self.chatRoomsVC.view];
- [self.chatRoomsVC didMoveToParentViewController:self];
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Dispose of any resources that can be recreated.
- }
- -(void)didClickBack {
- [self navLeftTap];
- }
- -(void)didClose {
- YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];
- BT_navController *theNavController = [appDelegate getNavigationController];
- [theNavController popToRootViewControllerAnimated:YES];
- }
- -(void)backToPanel {
- YOURAPPNAME_appDelegate *appDelegate = (YOURAPPNAME_appDelegate *)[[UIApplication sharedApplication] delegate];
- BT_navController *theNavController = [appDelegate getNavigationController];
- [theNavController popToViewController:self animated:YES];
- }
- -(BOOL)isUsingPopover {
- return NO;
- }
- -(BOOL)isTopPanelHidden {
- return NO;
- }
- -(BOOL)isOpenedAsFeature {
- return YES;
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement