mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1072126: merge duplicated lines for STK icon loading. r=hsinyi
This commit is contained in:
parent
c1d21622a6
commit
786172e79c
@ -10524,6 +10524,32 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
return method.call(this, cmdDetails, ctlvs);
|
||||
},
|
||||
|
||||
loadIconIfNecessary: function(cmdDetails, ctlvs, ret) {
|
||||
let ctlv =
|
||||
this.context.StkProactiveCmdHelper
|
||||
.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
ret.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
ret.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
ret.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
/**
|
||||
* Construct a param for Refresh.
|
||||
*
|
||||
@ -10733,27 +10759,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
textMsg.userClear = true;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return textMsg;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
textMsg.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
textMsg.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
textMsg.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return textMsg;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, textMsg);
|
||||
},
|
||||
|
||||
processSetUpIdleModeText: function(cmdDetails, ctlvs) {
|
||||
@ -10770,27 +10776,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
}
|
||||
textMsg.text = ctlv.value.textString;
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return textMsg;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
textMsg.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
textMsg.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
textMsg.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return textMsg;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, textMsg);
|
||||
},
|
||||
|
||||
processGetInkey: function(cmdDetails, ctlvs) {
|
||||
@ -10837,27 +10823,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
input.isHelpAvailable = true;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return input;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
input.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
input.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
input.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return input;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, input);
|
||||
},
|
||||
|
||||
processGetInput: function(cmdDetails, ctlvs) {
|
||||
@ -10909,27 +10875,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
input.isHelpAvailable = true;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return input;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
input.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
input.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
input.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return input;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, input);
|
||||
},
|
||||
|
||||
processEventNotify: function(cmdDetails, ctlvs) {
|
||||
@ -10942,28 +10888,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
textMsg.text = ctlv.value.identifier;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(
|
||||
COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return textMsg;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
textMsg.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
textMsg.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
textMsg.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return textMsg;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, textMsg);
|
||||
},
|
||||
|
||||
processSetupCall: function(cmdDetails, ctlvs) {
|
||||
@ -10996,27 +10921,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
call.duration = ctlv.value;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return call;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
call.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
call.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
call.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return call;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, call);
|
||||
},
|
||||
|
||||
processLaunchBrowser: function(cmdDetails, ctlvs) {
|
||||
@ -11039,27 +10944,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
|
||||
browser.mode = cmdDetails.commandQualifier & 0x03;
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return browser;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
browser.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
browser.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
browser.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return browser;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, browser);
|
||||
},
|
||||
|
||||
processPlayTone: function(cmdDetails, ctlvs) {
|
||||
@ -11086,28 +10971,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
// vibrate is only defined in TS 102.223
|
||||
playTone.isVibrate = (cmdDetails.commandQualifier & 0x01) !== 0x00;
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(
|
||||
COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return playTone;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
playTone.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
playTone.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
playTone.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return playTone;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, playTone);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -11164,27 +11028,7 @@ StkCommandParamsFactoryObject.prototype = {
|
||||
bipMsg.text = ctlv.value.identifier;
|
||||
}
|
||||
|
||||
ctlv = StkProactiveCmdHelper.searchForTag(COMPREHENSIONTLV_TAG_ICON_ID, ctlvs);
|
||||
if (!ctlv || !this.context.ICCUtilsHelper.isICCServiceAvailable("IMG")) {
|
||||
return bipMsg;
|
||||
}
|
||||
|
||||
let iconId = ctlv.value;
|
||||
bipMsg.iconSelfExplanatory = iconId.qualifier == 0 ? true : false;
|
||||
|
||||
let onerror = (function() {
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
let onsuccess = (function(result) {
|
||||
bipMsg.icons = result[0];
|
||||
this.context.RIL.sendChromeMessage(cmdDetails);
|
||||
}).bind(this);
|
||||
|
||||
bipMsg.pending = true;
|
||||
this.context.IconLoader.loadIcons([iconId.identifier], onsuccess, onerror);
|
||||
|
||||
return bipMsg;
|
||||
return this.loadIconIfNecessary(cmdDetails, ctlvs, bipMsg);
|
||||
}
|
||||
};
|
||||
StkCommandParamsFactoryObject.prototype[STK_CMD_REFRESH] = function STK_CMD_REFRESH(cmdDetails, ctlvs) {
|
||||
|
Loading…
Reference in New Issue
Block a user