6 new and 3 modified patches. All via New Portal.
[webos-internals:imagineer1981s-modifications.git] / sounds-and-alerts / sounds-and-alerts-really-silent-ringer-switch-mute.patch
1 Name: Really Silent Ringer Switch Mute\r
2 Version: 1.3.5.1-1\r
3 Author: Jason Robitaille\r
4 Description: Flicking the ringer switch to off will mute every aspect of the webOS, music and games included.  (MIT license)\r
5 \r
6 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js\r
7 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js\r
8 @@ -2891,6 +2891,71 @@\r
9                 method: 'status',\r
10                 parameters: {"subscribe":true},\r
11                 onSuccess: this.handleVoiceDialingAudioNotifications.bind(this)});\r
12 +               \r
13 +       this.controller.serviceRequest('palm://com.palm.audio/media', {\r
14 +               method:'status',\r
15 +               parameters: {},\r
16 +               onSuccess: function(response) {\r
17 +                       this.setMutedSystem(!response['ringer switch']);\r
18 +                       this.setMutedRingtone(!response['ringer switch']);\r
19 +                       this.setMutedMedia(!response['ringer switch']);\r
20 +                       this.setMutedPhone(!response['ringer switch']);\r
21 +               }.bind(this)\r
22 +       });\r
23 +       \r
24 +       this.controller.serviceRequest('palm://com.palm.keys/switches', {\r
25 +               method:'status',\r
26 +               parameters: {subscribe:true},\r
27 +               onSuccess: this.handleRingerNotifications.bind(this)\r
28 +       });\r
29 +},\r
30 +\r
31 +handleRingerNotifications: function(payload) {\r
32 +       if(payload.key=="ringer") {\r
33 +               if(payload.state=="up") { //unmute\r
34 +                       this.setMutedSystem(false);\r
35 +                       this.setMutedRingtone(false);\r
36 +                       this.setMutedMedia(false);\r
37 +                       this.setMutedPhone(false);\r
38 +               } else if(payload.state=="down") { //mute\r
39 +                       this.setMutedSystem(true);\r
40 +                       this.setMutedRingtone(true);\r
41 +                       this.setMutedMedia(true);\r
42 +                       this.setMutedPhone(true);\r
43 +               }\r
44 +       }\r
45 +},\r
46 +\r
47 +setMutedPhone: function(mute) {\r
48 +       this.controller.serviceRequest('palm://com.palm.audio/phone', {\r
49 +               method:'setMuted',\r
50 +               parameters:{muted:mute}\r
51 +       });\r
52 +},\r
53 +\r
54 +setMutedSystem: function(mute) {\r
55 +       this.controller.serviceRequest('palm://com.palm.audio/system', {\r
56 +               method:'setMuted',\r
57 +               parameters:{muted:mute}\r
58 +       });\r
59 +},\r
60 +\r
61 +setMutedRingtone: function(mute) {\r
62 +       this.controller.serviceRequest('palm://com.palm.audio/ringtone', {\r
63 +               method:'setMuted',\r
64 +               parameters:{muted:mute}\r
65 +       });\r
66 +},\r
67 +\r
68 +setMutedMedia: function(mute) {\r
69 +       var value = "up";\r
70 +       if(mute) {\r
71 +               value = "down";\r
72 +       }\r
73 +       this.controller.serviceRequest('palm://com.palm.audio/media', {\r
74 +               method:'ramp',\r
75 +               parameters:{command:value}\r
76 +       });\r
77  },\r
78  \r
79  handlePhoneAudioNotifications: function(payload) {\r