Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
define(['require','modules/base/module','modules/base/event_emitter'],function(require){'use strict';var Module=require('modules/base/module');var EventEmitter=require('modules/base/event_emitter');var APIS=['unlockCardLock','setCardLock','updateContact','getCardLock','getCardLockRetryCount'];var EVENT_CHANGE_APIS=['unlockCardLock','setCardLock'];var _debug=false;var debug=function(){};if(_debug){debug=function ss_debug(msg){console.log('--> [SimSecurity]: '+msg);};}
|
||||
var SimSecurity=Module.create(function(){this.super(EventEmitter).call(this,['pin-enabled','pin-disabled','pin2-enabled','pin2-disabled','fdn-enabled','fdn-disabled','pin-changed','pin2-changed','puk2-changed']);}).extend(EventEmitter);SimSecurity.prototype._getIccByCardIndex=function(cardIndex){if(cardIndex===undefined){return null;}
|
||||
var iccObj;if(navigator.mozMobileConnections[cardIndex]){var iccId=navigator.mozMobileConnections[cardIndex].iccId;if(iccId){iccObj=navigator.mozIccManager.getIccById(iccId);}}
|
||||
return iccObj;};APIS.forEach(function(apiName){SimSecurity.prototype[apiName]=function(cardIndex){if(arguments.length<2){this.throw('You are using SimSecurity API wrongly and you may forget'+'to put your cardIndex, please check again');}
|
||||
var passedArguments=[].slice.call(arguments,1);var icc=this._getIccByCardIndex(cardIndex);if(!icc){console.error('We can\'t find needed icc object');return Promise.reject();}else{var func=icc[apiName];var promise=func.apply(icc,passedArguments);return promise.then((result)=>{if(EVENT_CHANGE_APIS.indexOf(apiName)>-1){var status='';var lockType=passedArguments[0].lockType;var enabled=passedArguments[0].enabled;var newPin=passedArguments[0].newPin;if(newPin){status='changed';}else{status=enabled?'enabled':'disabled';}
|
||||
debug('_emitEvent: '+lockType+'-'+status+' through card '+cardIndex);this._emitEvent(lockType+'-'+status,cardIndex);}
|
||||
return result;});}};});var simSecurity=new SimSecurity();return simSecurity;});
|
||||
Loading…
Reference in a new issue