{"action":"created","issue":{"url":"https://api.github.com/repos/ucla/ohmageX/issues/727","labels_url":"https://api.github.com/repos/ucla/ohmageX/issues/727/labels{/name}","comments_url":"https://api.github.com/repos/ucla/ohmageX/issues/727/comments","events_url":"https://api.github.com/repos/ucla/ohmageX/issues/727/events","html_url":"https://github.com/ucla/ohmageX/pull/727","id":99847759,"number":727,"title":"Wifi only upload","user":{"login":"stevenolen","id":808870,"avatar_url":"https://avatars.githubusercontent.com/u/808870?v=3","gravatar_id":"","url":"https://api.github.com/users/stevenolen","html_url":"https://github.com/stevenolen","followers_url":"https://api.github.com/users/stevenolen/followers","following_url":"https://api.github.com/users/stevenolen/following{/other_user}","gists_url":"https://api.github.com/users/stevenolen/gists{/gist_id}","starred_url":"https://api.github.com/users/stevenolen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevenolen/subscriptions","organizations_url":"https://api.github.com/users/stevenolen/orgs","repos_url":"https://api.github.com/users/stevenolen/repos","events_url":"https://api.github.com/users/stevenolen/events{/privacy}","received_events_url":"https://api.github.com/users/stevenolen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ucla/ohmageX/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-09T00:26:16Z","updated_at":"2015-08-10T22:57:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ucla/ohmageX/pulls/727","html_url":"https://github.com/ucla/ohmageX/pull/727","diff_url":"https://github.com/ucla/ohmageX/pull/727.diff","patch_url":"https://github.com/ucla/ohmageX/pull/727.patch"},"body":"a basic implementation for #655.\r\n\r\nDetails of implementation:\r\n  * New base entity (UserPreferences)\r\n    * generically implemented as this could be useful for other things down the road.\r\n    * offers a getter and setter method for an arbitrary preference\r\n    * Defaults of these preferences can/should be specific in config files\r\n    * Persists user changes to localstorage so they survive app death.\r\n  * Added row to profile page for wifi-upload-only preference\r\n    * rough css, Profile page still has some rudimentary styling so I didn't go overboard on this..\r\n    * copied switch css from reminder page (noted that this could be abstracted, but I'm terrible at CSS and know nothing about blocks...so it's probably best if I don't do this).\r\n    * toggling switch sets the preference (OFF = normal state, ON = app will *not* upload when on cell network.\r\n  * Set `if` block for `native && wifi-upload-only && on cell network` in uploader:new method.\r\n    * Continue to allow user to \"retry\" even with this failure (existing code appears to assume this)\r\n    * added upload failure state for `wifionly` to all upload contexts.\r\n    * this preference is not available in the browser (profile page is disabled currently), so \"preference\" is ignored if in browser.\r\n\r\n@ctrance -- this has yet to be tested on iOS as I don't have iOS device with a cell connection (and it's required for testing the feature, ha!). Could you test this with the builds labeled `ohmageX-steve` on https://apps.ohmage.org ? -- note that I haven't pulled in @wrenr's recent dashboard changes (and pull from his branch mid-implementation) so it's best to report issues only relating to:\r\n  * profile page (displaying wifi switch, toggling switch)\r\n  * survey uploads (both from survey context and upload queue context)\r\n    * should always upload if on wifi as well as if on cell and preference is set to \"off\" (which is default)\r\n    * should never upload if on cell network and preference is set to \"on\" (survey upload attempts and upload queue single survey attempts should provide info about the preference being on, \"upload all attempts\" currently do not specify errors.\r\n  * Killing app should keep preference. \r\n  * Logging out should set back to default "},"comment":{"url":"https://api.github.com/repos/ucla/ohmageX/issues/comments/129640116","html_url":"https://github.com/ucla/ohmageX/pull/727#issuecomment-129640116","issue_url":"https://api.github.com/repos/ucla/ohmageX/issues/727","id":129640116,"user":{"login":"wrenr","id":865444,"avatar_url":"https://avatars.githubusercontent.com/u/865444?v=3","gravatar_id":"","url":"https://api.github.com/users/wrenr","html_url":"https://github.com/wrenr","followers_url":"https://api.github.com/users/wrenr/followers","following_url":"https://api.github.com/users/wrenr/following{/other_user}","gists_url":"https://api.github.com/users/wrenr/gists{/gist_id}","starred_url":"https://api.github.com/users/wrenr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wrenr/subscriptions","organizations_url":"https://api.github.com/users/wrenr/orgs","repos_url":"https://api.github.com/users/wrenr/repos","events_url":"https://api.github.com/users/wrenr/events{/privacy}","received_events_url":"https://api.github.com/users/wrenr/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T22:57:16Z","updated_at":"2015-08-10T22:57:16Z","body":"I will integrate this pull request, but I must make some refactors to the added  functionality to keep this in line with the proper implementation structure throughout the app. Of note:\n\nThis functions correctly, the implementation does however break view encapsulation in the changes to `/profile/show/show_view.js.coffee`. The view should not fetch data from an outside Entity from inside its onRender method. The view's model is defined in the \"profile:current\" event handler of the Profile entity when the Controller is initialized, and this `get` event should happen there and added as a property of this model. To manipulate setting the value, the `change` event on the switch should be broadcast as a view change event that its controller listens for inside of the profile `show_controller`, then that event should be listened for in the `profile_app` base Module and execute an event that the profile:set entity. Also the `user:preferences:set` event should be a Command instead of Request since it is not returning a requested value, but executing a change on the contents of the User Preferences Entity."}}