Results 1 to 2 of 2
  1.    #1  
    I'm trying to make my first Tweaks patch and seem to have hit a snag - any advice would be much appreciated! I've attached the non-tweaks version, the tweaks version and the code from the .json file.
    The problem I'm running into is that when I run the tweaks version on the emulator (I'm sending the .json file to the preferences folder), it shows up in Tweaks but when I change the toggle, it's not having any effect.
    Upon looking at the logs and doing some debugging, for some reason, Tweaks does not seem to be defining the variable previousEmailSwipeControl, so response.previousEmailSwipeControl is being returned as undefined.
    I'm hoping that someone with a bit more experience will spot something I've missed - here's the relevant portion from the tweaks version of the patch (but check the whole patch if you think I've missed something else). Thanks!!
    Code:
    	MessageAssistant.prototype.flickHandler = function(event) {
    	console.info('Swipe Detected')
    	    this.controller.serviceRequest("palm://org.webosinternals.tweaks.prefs/", {method: "get", 
    		parameters: {owner: "org.webosinternals.patches.patches.swipe-to-previous-or-next-email",
    			keys: ["previousEmailSwipeControl"]},
    			onSuccess: function(response) {
    				if(response) {
    					console.info('test1');
    					if(response.previousEmailSwipeControl != undefined){
    						this.previousEmailSwipeControl = response.previousEmailSwipeControl;
    						console.info('test2');
    						}
    					}
    			}.bind(this)});
    		if(this.previousEmailSwipeControl == true){
    			if (event.velocity.x > 0) {
    				this.boundGotoNextEmailNewer();
    			}
    			else {
    				this.boundGotoNextEmailOlder();
    			}
    		}
    	},
    .json file code:
    Code:
    [
    	{
    		"category": "email", 
    		"owner": "org.webosinternals.patches.swipe-to-previous-or-next-email", 
    		"prefs": [ {
    			"group": "behavior", 
    			"restart": "luna",
    			"label": "Swipe for Next Email",
    			"help": "When this is turned on, swiping from left to right will advance to the newer email. Swiping from right to left will return to the older email.",
    			"key": "previousEmailSwipeControl",	
    			"type": "ToggleButton",
    			"value": true
    		} ]
    	}
    ]
    Attached Files Attached Files
  2.    #2  
    Of course, once I posted this and looked back at the post, I found a typo in the code (i added an extra .patches into the owner name) which once I fixed it, fixed all of my problems. So, nevermind the question!

Posting Permissions