WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
04/22/13 07:26 AM (12 years ago)

Disable / Enable Scringo from Control Panel Temporarily

I don't know about you guys, but I was impressed by Scringo and wanted to use it later on in my app, just since I am not sure of all the different problems it might cause (I have seen a couple myself, like getting my webview screens unresponsive sometimes) I thought it's best to have a switch for it in the control panel. I can now turn it on or off from the CP whenever I like. So this way I'll get it tested more while I'm waiting for the Apple reviews and releasing my apps. Then whenever I feel stable about it I'll just turn it on: WHOALLA. Maybe I'll get some extra $$ from my clients then as I'm implementing collection of new social features for their app! I don't know if anybody else has done this. So if you need any pointers in doing so let me know. I'll just post my code or something.
 
Auggnet
Veteran developer
Profile
Posts: 225
Reg: Nov 20, 2012
USA
2,550
like
04/22/13 07:39 AM (12 years ago)
I have made a suggestion list here https://www.buzztouch.com/forum/thread.php?tid=767DE11546B599760A2AB70&fid=06DB0BCB08E1010&sortColumn=FT.id&sortUpDown=DESC&currentPage=1 I think i added something with control on scringo on the control panel so we dont have to change it in the code.
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
04/22/13 08:10 AM (12 years ago)
Yup but until David and the crew get in packed into the source code we're gonna need to do it ourselves. It's a couple lines inside the appdelegate.
 
trouty
I hate code!
Profile
Posts: 338
Reg: Mar 26, 2013
London Outskirt...
4,830
like
04/22/13 08:37 AM (12 years ago)
Yes please webnerves
 
Dragon007
Lost but trying
Profile
Posts: 1509
Reg: Dec 17, 2011
London
20,590
like
04/22/13 09:10 AM (12 years ago)
Hi WebNevees please share your technique for doing this as I would like to know how. Thanks!
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
04/26/13 03:43 AM (12 years ago)
Ok so you can make minimal edits to your appdelegate code and achieve this switching functionality This consists of 2 steps as below: STEP 1: In the appdelegate file at around line 404 you'll find the method: -(void)configureEnvironmentUsingAppData:(NSString *)appData Go to the ending few lines of the method and you'll find the line: //init Scringo agent… [ScringoAgent startSession:@"YOUR_SCRINGO_APP_ID" locationManager:nil]; just replace the above two lines with the following lines: ///////////////////////////////////////////////////////////////////// //WEBNEVEES: CHECK TO SEE IF SCRINGO HAS BEEN TURNED ON FROM THE CP /////////////////// BOOL activateScringo = FALSE; //appDelegate sarafishirazapp_appDelegate *appDelegate = (sarafishirazapp_appDelegate *)[[UIApplication sharedApplication] delegate]; NSString *stringActivateScringo = [BT_strings getJsonPropertyValue:appDelegate.rootApp.rootTheme.jsonVars nameOfProperty:@"activateScringo" defaultValue:@"No"]; [BT_debugger showIt:self theMessage:[NSString stringWithFormat:@"SCRINGOACTIVATION: Does the CP want to activate Scringo: %@", stringActivateScringo]]; if([stringActivateScringo isEqualToString:@"Yes"]){ [BT_debugger showIt:self theMessage:[NSString stringWithFormat:@"YES the CP wants to activate Scringo: %@", stringActivateScringo]]; activateScringo = TRUE; } //WEBNEVEES: Now check to see if switch is on. Then turn call the scringo start session method if(activateScringo){ //init Scringo agent… [ScringoAgent startSession:@"YOUR_SCRINGO_APP_ID" locationManager:nil]; } //WEBNEVEES:just the scringo line here was original ///////////////////////////////////////////////////////////////////// So now just after the new code you will see the following 2 lines and you'll know you've placed the code in the right place: }//app parsed it's configuration data } STEP 2: You'll have to specify if you want to use the switch you've just made as follows: Go to your "app Control Panel". Select "Theme" from the "Application Options" bar on your left. In the "Advanced, Manually Edit JSON " section add the following key and value pair just before the closing curly brace (don't forget to add a comma before it!): "activateScringo":"No" OR "activateScringo":"Yes" If you want it to be active. Then just save (and rinse!) ** The good part about this method is that users without a self-hosted panel can also do the same. So if your control panel is on BUZZTOUCH.COM you will have to: Go to your "app Control Panel". Go to "Global Themes" Select "Default Theme" (or the one that is active) In the "Advanced, Manually Edit JSON " section add the above following key and value pair just before the closing curly brace (and again don't forget to add a comma before it!). Oh and don't forget to save and rinse! Now after you submit to apple and hopefully get approved you'll be able to turn off scringo via the control panel if you find your app is bleeding, or turn it on if you're in the mood for socializing. Nothing to it! ALSO REMEMBER TO INCLUDE THE LATEST BT_CONFIG.TXT FILE IN YOUR XCODE SOURCE (WHICH INCLUDES YOUR NEW ACTIVATESCRINGO KEY). AND TELL ME IF YOU EXPERIENCE ANY PROBLEMS WITH THE CODE. I HAVE ONLY TESTED IT MYSELF FOR 3-4 DAYS.
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
04/26/13 06:06 AM (12 years ago)
Good stuff. Might want to also convert your string to a capitalized string, so users can enter "yes", "YES", " "Yes", etc, on the control panel.
 
WebNevees
Code is Art
Profile
Posts: 206
Reg: Oct 28, 2012
KL
11,660
like
04/26/13 06:40 AM (12 years ago)
Oh yes of course, thanks for the note. Just was eager to finish off in order to submit! And nice badge Chris! I saw David on the Buzzcon13 video talking about it. and the "Lifetime Membership!"
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
04/26/13 11:44 AM (12 years ago)
Good Stuff!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.