mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-06 12:43:53 +00:00
Bug 1123624 - Part 1-1: Having a consistent proactive command format in both system message and dom event. r=bevis
This commit is contained in:
parent
6d68b546c6
commit
9c1b19b249
@ -149,7 +149,7 @@ StkIconInfo.prototype = {
|
||||
|
||||
function StkItem(aIdentifier, aText, aStkIconInfo) {
|
||||
this.identifier = aIdentifier;
|
||||
if (aText) {
|
||||
if (aText !== undefined) {
|
||||
this.text = aText;
|
||||
}
|
||||
this.iconInfo = aStkIconInfo;
|
||||
@ -318,7 +318,7 @@ function StkSetUpMenuCmd(aCommandDetails) {
|
||||
|
||||
let options = aCommandDetails.options;
|
||||
|
||||
if (options.title) {
|
||||
if (options.title !== undefined) {
|
||||
this.title = options.title;
|
||||
}
|
||||
|
||||
@ -414,13 +414,10 @@ function StkSetUpMenuMessage(aStkSetUpMenuCmd) {
|
||||
|
||||
return item;
|
||||
}),
|
||||
isHelpAvailable: aStkSetUpMenuCmd.isHelpAvailable
|
||||
isHelpAvailable: aStkSetUpMenuCmd.isHelpAvailable,
|
||||
title: aStkSetUpMenuCmd.title
|
||||
};
|
||||
|
||||
if (aStkSetUpMenuCmd.title) {
|
||||
this.options.title = aStkSetUpMenuCmd.title;
|
||||
}
|
||||
|
||||
let nextActionList = aStkSetUpMenuCmd.getNextActionList();
|
||||
if (nextActionList && nextActionList.length > 0) {
|
||||
this.options.nextActionList = nextActionList;
|
||||
@ -482,7 +479,7 @@ function StkTextMessageCmd(aCommandDetails) {
|
||||
|
||||
let options = aCommandDetails.options;
|
||||
|
||||
if (options.text) {
|
||||
if (options.text !== undefined) {
|
||||
this.text = options.text;
|
||||
}
|
||||
|
||||
@ -503,11 +500,9 @@ function StkTextMessage(aStkTextMessageCmd) {
|
||||
// Call |StkCommandMessage| constructor.
|
||||
StkCommandMessage.call(this, aStkTextMessageCmd);
|
||||
|
||||
this.options = {};
|
||||
|
||||
if (aStkTextMessageCmd.text) {
|
||||
this.options.text = aStkTextMessageCmd.text;
|
||||
}
|
||||
this.options = {
|
||||
text: aStkTextMessageCmd.text
|
||||
};
|
||||
|
||||
if (aStkTextMessageCmd.iconInfo) {
|
||||
appendIconInfo(this.options, aStkTextMessageCmd.iconInfo);
|
||||
@ -562,13 +557,13 @@ function StkInputCmd(aCommandDetails) {
|
||||
|
||||
let options = aCommandDetails.options;
|
||||
|
||||
if (options.text) {
|
||||
if (options.text !== undefined) {
|
||||
this.text = options.text;
|
||||
}
|
||||
|
||||
this.duration = mapDurationToStkDuration(options.duration);
|
||||
|
||||
if (options.defaultText) {
|
||||
if (options.defaultText !== undefined) {
|
||||
this.defaultText = options.defaultText;
|
||||
}
|
||||
|
||||
@ -607,6 +602,7 @@ function StkInputMessage(aStkInputCmd) {
|
||||
isAlphabet: aStkInputCmd.isAlphabet,
|
||||
isUCS2: aStkInputCmd.isUCS2,
|
||||
isHelpAvailable: aStkInputCmd.isHelpAvailable,
|
||||
defaultText: aStkInputCmd.defaultText
|
||||
};
|
||||
|
||||
if (aStkInputCmd.duration) {
|
||||
@ -614,10 +610,6 @@ function StkInputMessage(aStkInputCmd) {
|
||||
appendDuration(this.options.duration, aStkInputCmd.duration);
|
||||
}
|
||||
|
||||
if (aStkInputCmd.defaultText) {
|
||||
this.options.defaultText = aStkInputCmd.defaultText;
|
||||
}
|
||||
|
||||
if (aStkInputCmd.iconInfo) {
|
||||
appendIconInfo(this.options, aStkInputCmd.iconInfo);
|
||||
}
|
||||
@ -699,14 +691,14 @@ function StkSetUpCallCmd(aCommandDetails) {
|
||||
this.address = options.address;
|
||||
|
||||
if(confirmMessage) {
|
||||
if (confirmMessage.text) {
|
||||
if (confirmMessage.text !== undefined) {
|
||||
this.confirmText = confirmMessage.text;
|
||||
}
|
||||
this.confirmIconInfo = mapIconInfoToStkIconInfo(confirmMessage);
|
||||
}
|
||||
|
||||
if(callMessage) {
|
||||
if (callMessage.text) {
|
||||
if (callMessage.text !== undefined) {
|
||||
this.callText = callMessage.text;
|
||||
}
|
||||
this.callIconInfo = mapIconInfoToStkIconInfo(callMessage);
|
||||
@ -737,22 +729,22 @@ function StkSetUpCallMessage(aStkSetUpCallCmd) {
|
||||
address: aStkSetUpCallCmd.address
|
||||
};
|
||||
|
||||
if (aStkSetUpCallCmd.confirmText || aStkSetUpCallCmd.confirmIconInfo) {
|
||||
let confirmMessage = {};
|
||||
if (aStkSetUpCallCmd.confirmText) {
|
||||
confirmMessage.text = aStkSetUpCallCmd.confirmText;
|
||||
}
|
||||
if (aStkSetUpCallCmd.confirmText !== null ||
|
||||
aStkSetUpCallCmd.confirmIconInfo) {
|
||||
let confirmMessage = {
|
||||
text: aStkSetUpCallCmd.confirmText
|
||||
};
|
||||
if (aStkSetUpCallCmd.confirmIconInfo) {
|
||||
appendIconInfo(confirmMessage, aStkSetUpCallCmd.confirmIconInfo);
|
||||
}
|
||||
this.options.confirmMessage = confirmMessage;
|
||||
}
|
||||
|
||||
if (aStkSetUpCallCmd.callText || aStkSetUpCallCmd.callIconInfo) {
|
||||
let callMessage = {};
|
||||
if (aStkSetUpCallCmd.callText) {
|
||||
callMessage.text = aStkSetUpCallCmd.callText;
|
||||
}
|
||||
if (aStkSetUpCallCmd.callText !== null ||
|
||||
aStkSetUpCallCmd.callIconInfo) {
|
||||
let callMessage = {
|
||||
text: aStkSetUpCallCmd.callText
|
||||
};
|
||||
if (aStkSetUpCallCmd.callIconInfo) {
|
||||
appendIconInfo(callMessage, aStkSetUpCallCmd.callIconInfo);
|
||||
}
|
||||
@ -779,7 +771,7 @@ function StkBrowserSettingCmd(aCommandDetails) {
|
||||
let confirmMessage = options.confirmMessage;
|
||||
|
||||
if(confirmMessage) {
|
||||
if (confirmMessage.text) {
|
||||
if (confirmMessage.text !== undefined) {
|
||||
this.confirmText = confirmMessage.text;
|
||||
}
|
||||
this.confirmIconInfo = mapIconInfoToStkIconInfo(confirmMessage);
|
||||
@ -807,11 +799,11 @@ function StkBrowserSettingMessage(aStkBrowserSettingCmd) {
|
||||
mode: aStkBrowserSettingCmd.mode
|
||||
};
|
||||
|
||||
if (aStkBrowserSettingCmd.confirmText || aStkBrowserSettingCmd.confirmIconInfo) {
|
||||
let confirmMessage = {};
|
||||
if (aStkBrowserSettingCmd.confirmText) {
|
||||
confirmMessage.text = aStkBrowserSettingCmd.confirmText;
|
||||
}
|
||||
if (aStkBrowserSettingCmd.confirmText !== null ||
|
||||
aStkBrowserSettingCmd.confirmIconInfo) {
|
||||
let confirmMessage = {
|
||||
text: aStkBrowserSettingCmd.confirmText
|
||||
};
|
||||
if (aStkBrowserSettingCmd.confirmIconInfo) {
|
||||
appendIconInfo(confirmMessage, aStkBrowserSettingCmd.confirmIconInfo);
|
||||
}
|
||||
@ -826,7 +818,7 @@ function StkPlayToneCmd(aCommandDetails) {
|
||||
|
||||
let options = aCommandDetails.options;
|
||||
|
||||
if(options.text) {
|
||||
if(options.text !== undefined) {
|
||||
this.text = options.text;
|
||||
}
|
||||
|
||||
@ -862,13 +854,10 @@ function StkPlayToneMessage(aStkPlayToneCmd) {
|
||||
StkCommandMessage.call(this, aStkPlayToneCmd);
|
||||
|
||||
this.options = {
|
||||
isVibrate: aStkPlayToneCmd.isVibrate
|
||||
isVibrate: aStkPlayToneCmd.isVibrate,
|
||||
text: aStkPlayToneCmd.text
|
||||
};
|
||||
|
||||
if (aStkPlayToneCmd.text) {
|
||||
this.options.text = aStkPlayToneCmd.text;
|
||||
}
|
||||
|
||||
if (aStkPlayToneCmd.tone != Ci.nsIStkPlayToneCmd.TONE_TYPE_INVALID) {
|
||||
this.options.tone = aStkPlayToneCmd.tone;
|
||||
}
|
||||
|
@ -10777,7 +10777,10 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
*/
|
||||
processSelectItem: function(cmdDetails, ctlvs, onComplete) {
|
||||
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
|
||||
let menu = {};
|
||||
let menu = {
|
||||
// Help information available.
|
||||
isHelpAvailable: !!(cmdDetails.commandQualifier & 0x80)
|
||||
};
|
||||
|
||||
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
|
||||
COMPREHENSIONTLV_TAG_ALPHA_ID,
|
||||
@ -10812,11 +10815,6 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
menu.presentationType = cmdDetails.commandQualifier & 0x03;
|
||||
}
|
||||
|
||||
// Help information available.
|
||||
if (cmdDetails.commandQualifier & 0x80) {
|
||||
menu.isHelpAvailable = true;
|
||||
}
|
||||
|
||||
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_NEXT_ACTION_IND);
|
||||
if (ctlv) {
|
||||
menu.nextActionList = ctlv.value;
|
||||
@ -10862,7 +10860,10 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
|
||||
processDisplayText: function(cmdDetails, ctlvs, onComplete) {
|
||||
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
|
||||
let textMsg = {};
|
||||
let textMsg = {
|
||||
isHighPriority: !!(cmdDetails.commandQualifier & 0x01),
|
||||
userClear: !!(cmdDetails.commandQualifier & 0x80)
|
||||
};
|
||||
|
||||
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
|
||||
COMPREHENSIONTLV_TAG_TEXT_STRING,
|
||||
@ -10880,26 +10881,14 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
}
|
||||
textMsg.text = ctlv.value.textString;
|
||||
|
||||
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE);
|
||||
if (ctlv) {
|
||||
textMsg.responseNeeded = true;
|
||||
}
|
||||
textMsg.responseNeeded =
|
||||
!!(selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_IMMEDIATE_RESPONSE));
|
||||
|
||||
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_DURATION);
|
||||
if (ctlv) {
|
||||
textMsg.duration = ctlv.value;
|
||||
}
|
||||
|
||||
// High priority.
|
||||
if (cmdDetails.commandQualifier & 0x01) {
|
||||
textMsg.isHighPriority = true;
|
||||
}
|
||||
|
||||
// User clear.
|
||||
if (cmdDetails.commandQualifier & 0x80) {
|
||||
textMsg.userClear = true;
|
||||
}
|
||||
|
||||
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
|
||||
textMsg,
|
||||
onComplete);
|
||||
@ -10930,7 +10919,17 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
|
||||
processGetInkey: function(cmdDetails, ctlvs, onComplete) {
|
||||
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
|
||||
let input = {};
|
||||
let input = {
|
||||
minLength: 1,
|
||||
maxLength: 1,
|
||||
isAlphabet: !!(cmdDetails.commandQualifier & 0x01),
|
||||
isUCS2: !!(cmdDetails.commandQualifier & 0x02),
|
||||
// Character sets defined in bit 1 and bit 2 are disable and
|
||||
// the YES/NO reponse is required.
|
||||
isYesNoRequested: !!(cmdDetails.commandQualifier & 0x04),
|
||||
// Help information available.
|
||||
isHelpAvailable: !!(cmdDetails.commandQualifier & 0x80)
|
||||
};
|
||||
|
||||
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
|
||||
COMPREHENSIONTLV_TAG_TEXT_STRING,
|
||||
@ -10953,30 +10952,6 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
input.duration = ctlv.value;
|
||||
}
|
||||
|
||||
input.minLength = 1;
|
||||
input.maxLength = 1;
|
||||
|
||||
// isAlphabet
|
||||
if (cmdDetails.commandQualifier & 0x01) {
|
||||
input.isAlphabet = true;
|
||||
}
|
||||
|
||||
// UCS2
|
||||
if (cmdDetails.commandQualifier & 0x02) {
|
||||
input.isUCS2 = true;
|
||||
}
|
||||
|
||||
// Character sets defined in bit 1 and bit 2 are disable and
|
||||
// the YES/NO reponse is required.
|
||||
if (cmdDetails.commandQualifier & 0x04) {
|
||||
input.isYesNoRequested = true;
|
||||
}
|
||||
|
||||
// Help information available.
|
||||
if (cmdDetails.commandQualifier & 0x80) {
|
||||
input.isHelpAvailable = true;
|
||||
}
|
||||
|
||||
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
|
||||
input,
|
||||
onComplete);
|
||||
@ -10984,7 +10959,16 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
|
||||
processGetInput: function(cmdDetails, ctlvs, onComplete) {
|
||||
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
|
||||
let input = {};
|
||||
let input = {
|
||||
isAlphabet: !!(cmdDetails.commandQualifier & 0x01),
|
||||
isUCS2: !!(cmdDetails.commandQualifier & 0x02),
|
||||
// User input shall not be revealed
|
||||
hideInput: !!(cmdDetails.commandQualifier & 0x04),
|
||||
// User input in SMS packed format
|
||||
isPacked: !!(cmdDetails.commandQualifier & 0x08),
|
||||
// Help information available.
|
||||
isHelpAvailable: !!(cmdDetails.commandQualifier & 0x80)
|
||||
};
|
||||
|
||||
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
|
||||
COMPREHENSIONTLV_TAG_TEXT_STRING,
|
||||
@ -11013,31 +10997,6 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
input.defaultText = ctlv.value.textString;
|
||||
}
|
||||
|
||||
// Alphabet only
|
||||
if (cmdDetails.commandQualifier & 0x01) {
|
||||
input.isAlphabet = true;
|
||||
}
|
||||
|
||||
// UCS2
|
||||
if (cmdDetails.commandQualifier & 0x02) {
|
||||
input.isUCS2 = true;
|
||||
}
|
||||
|
||||
// User input shall not be revealed
|
||||
if (cmdDetails.commandQualifier & 0x04) {
|
||||
input.hideInput = true;
|
||||
}
|
||||
|
||||
// User input in SMS packed format
|
||||
if (cmdDetails.commandQualifier & 0x08) {
|
||||
input.isPacked = true;
|
||||
}
|
||||
|
||||
// Help information available.
|
||||
if (cmdDetails.commandQualifier & 0x80) {
|
||||
input.isHelpAvailable = true;
|
||||
}
|
||||
|
||||
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
|
||||
input,
|
||||
onComplete);
|
||||
@ -11124,7 +11083,9 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
|
||||
processLaunchBrowser: function(cmdDetails, ctlvs, onComplete) {
|
||||
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
|
||||
let browser = {};
|
||||
let browser = {
|
||||
mode: cmdDetails.commandQualifier & 0x03
|
||||
};
|
||||
let confirmMessage = {};
|
||||
|
||||
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
|
||||
@ -11142,8 +11103,6 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
}
|
||||
browser.url = ctlv.value.url;
|
||||
|
||||
browser.mode = cmdDetails.commandQualifier & 0x03;
|
||||
|
||||
ctlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID);
|
||||
if (ctlv) {
|
||||
confirmMessage.text = ctlv.value.identifier;
|
||||
@ -11165,7 +11124,10 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
|
||||
processPlayTone: function(cmdDetails, ctlvs, onComplete) {
|
||||
let StkProactiveCmdHelper = this.context.StkProactiveCmdHelper;
|
||||
let playTone = {};
|
||||
let playTone = {
|
||||
// The vibrate is only defined in TS 102.223.
|
||||
isVibrate: !!(cmdDetails.commandQualifier & 0x01)
|
||||
};
|
||||
|
||||
let selectedCtlvs = StkProactiveCmdHelper.searchForSelectedTags(ctlvs, [
|
||||
COMPREHENSIONTLV_TAG_ALPHA_ID,
|
||||
@ -11189,9 +11151,6 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
playTone.duration = ctlv.value;
|
||||
}
|
||||
|
||||
// vibrate is only defined in TS 102.223
|
||||
playTone.isVibrate = (cmdDetails.commandQualifier & 0x01) !== 0x00;
|
||||
|
||||
this.appendIconIfNecessary(selectedCtlvs[COMPREHENSIONTLV_TAG_ICON_ID] || null,
|
||||
playTone,
|
||||
onComplete);
|
||||
|
Loading…
Reference in New Issue
Block a user