Page 1 of 1

Adding a disclaimer or accept terms at start of app but only once

Posted: Fri May 29, 2015 8:46 pm
by Carlos7560851

Adding a disclaimer or accept terms at start of app but only once.

I found this code to do this but I dont know how to add it to appery

NSString *myString = [[NSUserDefaults standardUserDefaults] stringForKey:@"DidShowDisclaimer"]

if ([myString iEqualToString:@"YES"]) {
//show the view controller and once they have accepted save this key
[[NSUserDefaults standardUserDefaults] setValue:@"YES" forKey:@"DidShowDisclaimer"];
[[NSUserDefaults standardUserDefaults] synchronize]; //next time when the app is launched it will never execute this if condition
}

Any direction would be greatly appreciated :)


Adding a disclaimer or accept terms at start of app but only once

Posted: Sat May 30, 2015 2:32 am
by Illya Stepanov

Hi Carlos -

This code looks like Objective-C, in Appery.io we are working with JavaScript.

Here is a code that can give a basic idea -- you need to make a flag variable and check its value, and after first iteration make this flag value true:

pre
code
var afterLoad = localStorage.getItem("afterLoad");
if(!afterLoad)
alert("Message that will be shown only once!");
localStorage.setItem("afterLoad", "true");
/code
/pre


Adding a disclaimer or accept terms at start of app but only once

Posted: Tue Jun 02, 2015 4:23 pm
by Carlos7560851

Thank you Stepanov

Ill try it out and let you know.


Adding a disclaimer or accept terms at start of app but only once

Posted: Mon Jul 13, 2015 3:22 pm
by josh

Carlos,
I am getting ready to do the same for my app, did the code above work for you? What other changes did you have to make? Any tips/tricks/lessons learned from going through it? I am not a developer so any help you can offer would be greatly appreciated.
Thanks!
Josh


Adding a disclaimer or accept terms at start of app but only once

Posted: Wed Jul 15, 2015 8:24 pm
by josh

Illya,
Could you please describe how to make a flag variable in Appery.io?

I want to have the initial page be the disclaimer with an Agree button and Do Not Agree button. Would I put the JavaScript above in the event-run javascript for the "Agree" button? Or do I need to do something else?

Thanks in advance!
Josh


Adding a disclaimer or accept terms at start of app but only once

Posted: Wed Jul 15, 2015 11:46 pm
by Illya Stepanov

Hi Josh -

The above code actually is making, so called "flag" local storage variable with name "afterLoad" on the 1st line it's initialized, but has value "null" if you will try to check it's value on the first line.
After that on lines 2 and 3 there is an 'if' statement which makes a checking is variable "afterLoad" is true or "not true" and after that shows alert message, that based on all above conditions will be shown only once.
And on line 4 we're assigning value "true" to our variable "afterLoad".

In your case the screen with disclaimer or the pop-up window, should be in place where alert message is, but you also would need to check the user choice that was made whether he agree or not.


Adding a disclaimer or accept terms at start of app but only once

Posted: Thu Jul 16, 2015 2:14 pm
by josh

Illya,
Thank you so much for your reply!

I added this under my JavaScript folder in my project and is working nicely, but I'm trying to do something a little different. I've been trying to modify it to do what I want for the past hour but am still having trouble.

What I'm really hoping to do is have a distinct 'Disclaimer' page in my project that would have my disclaimer text, an Agree button, a Disagree button and that would only display on the initial load of the app, and once they click Agree, would not display again and would navigate to the Main Menu, and if they hit Disagree, the app would close or display some sort of message that they can't continue until they agree.

Could you please describe how I can do this in my Appery.io project?

Thanks so much!
Josh


Adding a disclaimer or accept terms at start of app but only once

Posted: Tue Jul 21, 2015 12:34 pm
by josh

Hey Illya,
Any other thoughts on this?

I guess the two things I'd really like to accomplish that I can't with an Alert is:
1 - Basic formatting of disclaimer text (i.e. Bold, Italic, Underline)
2 - Ability to define the text in the button. Alert's just show up with an "OK" button which is more of acknowledgment than agreement/acceptance, so I really want a button that says "Agree" so that it's very clear to the user what they're doing.

Thanks for the help,
Josh


Adding a disclaimer or accept terms at start of app but only once

Posted: Sun Jul 26, 2015 10:31 am
by Alena Prykhodko

Dear Josh,

This can be done but requires custom coding, which is outside the scope of our standard support.
Probably someone from community can share solution.

Also you may consider purchasing Advisory Pack to get more in-depth help on this question. Here is more information about Advisory Pack (http://appery.io/services/#Advisory_Pack).