Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to allow users to toggle notifications on or off? #76

Open
jamminjames opened this issue Mar 3, 2018 · 1 comment
Open

How to allow users to toggle notifications on or off? #76

jamminjames opened this issue Mar 3, 2018 · 1 comment

Comments

@jamminjames
Copy link

I am trying to create a toggle button to allow users of our app to control notifications. I have this, but it's not working:

$(document).on("pagecreate", "#about", function () {

$('#flipnotify').on('change', function() {
       $(this).val() == "off" ? play_int() : play_on();
});

function play_int() {
    $('#flipnotify').val();
        window.plugins.PushbotsPlugin.toggleNotifications(false);
}

function play_on() {
    $('#flipnotify').val();
        window.plugins.PushbotsPlugin.toggleNotifications(true);
}

});

The html is a jquery mobile flipswitch:

		<label for="flipnotify">Toggle Notifications On/Off:</label>
			<select name="flipnotify" id="flipnotify" data-role="flipswitch">
				<option value="on">On</option>
				<option value="off">Off</option>
			</select>
		</div>

Any help getting this to work would be appreciated.

@sandstrom
Copy link

@jamminjames Most people would implement this server-side, i.e. keep track of users that has disabled push and don't send them any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants