Commit 3be9c6c46dc0030a5b02eab6dccf2335dddb1cdb

  • avatar
  • dBsooner <daniel.beames @dbt…nk.com>
  • Wed Oct 07 07:14:53 CEST 2009
Updated v0.5.0
  
1diff --git a/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js b/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
2index 1692085..998dfdc 100644
3--- a/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
4+++ b/usr/palm/applications/com.palm.app.messaging/app/controllers/notification-assistant.js
5@@ -51,6 +51,19 @@ NotificationAssistant.prototype.sendNotification = function(notificationType, re
6 }
7 };
8
9+NotificationAssistant.prototype.doBanner = function(bannerParams,bannerLaunchParams,bannerType,payload) {
10+ if (payload.messagetone.fullPath)
11+ bannerParams.soundFile = payload.messagetone.fullPath;
12+ this.controller.showBanner(bannerParams,bannerLaunchParams,bannerType);
13+};
14+
15+NotificationAssistant.prototype.playMessagetone = function(payload){
16+ if (payload.messagetone.fullPath)
17+ this.controller.playSoundNotification('alerts',payload.messagetone.fullPath);
18+ else
19+ this.controller.playSoundNotification('alerts','');
20+};
21+
22 /*
23 * <ReminderCode>
24 */
25@@ -140,7 +153,7 @@ NotificationAssistant.prototype.considerForNotification = function(notificationD
26
27 // check if we should only play a sound (when you are already in a chat & a new message comes in)
28 if(notificationData.get('playSoundOnly') && this.Messaging.messagingPrefs.enableNotificationSound) {
29- this.controller.playSoundNotification('alerts','');
30+ MessagingMojoService.getMessagetone(this.playMessagetone.bind(this));
31 return; // don't display any visual notification
32 }
33
34@@ -176,10 +189,10 @@ NotificationAssistant.prototype.sendClass0PopupAlert = function(notificationData
35
36 notificationData.set('alertTitle',alertTitle);
37 this.class0AlertData.list.push(notificationData);
38- this.renderClass0PopupAlert(true);
39+ MessagingMojoService.getMessagetone(this.renderClass0PopupAlert.bind(this,true));
40 };
41
42-NotificationAssistant.prototype.renderClass0PopupAlert = function(playSound) {
43+NotificationAssistant.prototype.renderClass0PopupAlert = function(playSound,messageTone) {
44 var class0Stage = this.controller.getStageController(Class0AlertStageName);
45
46 if(class0Stage) {
47@@ -188,6 +201,8 @@ NotificationAssistant.prototype.renderClass0PopupAlert = function(playSound) {
48 var soundClass = 'none';
49 if(playSound) {
50 soundClass = 'alerts';
51+ if(messageTone)
52+ soundFile = messageTone;
53 }
54
55 var pushClass0AlertScene = function(stageController) {
56@@ -198,7 +213,8 @@ NotificationAssistant.prototype.renderClass0PopupAlert = function(playSound) {
57 name: Class0AlertStageName,
58 lightweight: true,
59 height: 300,
60- soundclass: soundClass
61+ soundclass: soundClass,
62+ soundfile: soundFile
63 }, pushClass0AlertScene, 'popupalert');
64 }
65
66@@ -253,8 +269,6 @@ NotificationAssistant.prototype.sendNewMessageNotificationAndUpdateDashboard = f
67 var bannerParams = {
68 messageText: notificationText
69 };
70- if (this.Messaging.messagingPrefs.enableNotificationSound)
71- bannerParams.soundClass = "alerts";
72 var bannerLaunchParams = {
73 chatThreadId: chatThreadId,
74 clearBanner: true
75@@ -262,10 +276,14 @@ NotificationAssistant.prototype.sendNewMessageNotificationAndUpdateDashboard = f
76
77 if (this.Messaging.DisplayState.isDisplayOn()) {
78 Mojo.Log.info("notificationAssistant - executing full banner notification");
79+ if (this.Messaging.messagingPrefs.enableNotificationSound) {
80+ bannerParams.soundClass = "alerts";
81+ MessagingMojoService.getMessagetone(this.doBanner.bind(this,bannerParams,bannerLaunchParams,'chat'));
82+ } else
83 this.controller.showBanner(bannerParams, bannerLaunchParams, 'chat');
84 } else if (this.Messaging.messagingPrefs.enableNotificationSound) {
85 Mojo.Log.info("notificationAssistant - playing sound notification only");
86- this.controller.playSoundNotification('alerts','');
87+ MessagingMojoService.getMessagetone(this.playMessagetone.bind(this));
88 }
89
90 // Store the data so it can be used in the dashboard
91@@ -324,14 +342,14 @@ NotificationAssistant.prototype.sendNewMessageNotificationAndUpdateDashboard = f
92 // delay creating the dashboard window for the case where the banner is clicked on
93 // to take you to the chat view. This will likely result in the dashboard data
94 // being cleared. If the dashboard data is empty, we do not need to create the dashboard.
95- if (this.Messaging.DisplayState.isDisplayOn()) {
96+ //if (this.Messaging.DisplayState.isDisplayOn()) {
97 if (!this.isNewMessageDashboardPending) {
98 this.isNewMessageDashboardPending = true;
99 createDashboard.delay(5);
100 }
101- } else {
102- createDashboard(); // if the screen is off, create the dashboard right away
103- }
104+ // } else {
105+ // createDashboard(); // if the screen is off, create the dashboard right away
106+ // }
107 }
108 };
109
110diff --git a/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js b/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
111index 808aaa7..862d04c 100644
112--- a/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
113+++ b/usr/palm/applications/com.palm.app.messaging/app/models/messaging-luna-service.js
114@@ -9,6 +9,16 @@ var MessagingMojoService = {
115 telephonyIdentifier: 'palm://com.palm.telephony',
116 systemManagerIdentifier: 'palm://com.palm.systemmanager',
117
118+ getMessagetone: function(callback) {
119+ var request = new Mojo.Service.Request('palm://com.palm.systemservice', {
120+ method: 'getPreferences',
121+ parameters: {"keys":["messagetone"]},
122+ onSuccess: callback,
123+ onFailure: callback
124+ });
125+ return request;
126+ },
127+
128 launchMessaging: function(sceneController,params) {
129 return sceneController.serviceRequest("palm://com.palm.applicationManager", {
130 method:'launch',