You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
| /* global textsecure, window */
 | |
| 
 | |
| // eslint-disable-next-line func-names
 | |
| (function() {
 | |
|   /** *******************************************
 | |
|    *** Utilities to store data about the user ***
 | |
|    ********************************************* */
 | |
|   window.textsecure = window.textsecure || {};
 | |
|   window.textsecure.storage = window.textsecure.storage || {};
 | |
| 
 | |
|   window.textsecure.storage.user = {
 | |
|     setNumberAndDeviceId(number, deviceId, deviceName) {
 | |
|       textsecure.storage.put('number_id', `${number}.${deviceId}`);
 | |
|       if (deviceName) {
 | |
|         textsecure.storage.put('device_name', deviceName);
 | |
|       }
 | |
|     },
 | |
| 
 | |
|     getNumber() {
 | |
|       const numberId = textsecure.storage.get('number_id');
 | |
|       if (numberId === undefined) return undefined;
 | |
|       return textsecure.utils.unencodeNumber(numberId)[0];
 | |
|     },
 | |
| 
 | |
|     getDeviceId() {
 | |
|       const numberId = textsecure.storage.get('number_id');
 | |
|       if (numberId === undefined) return undefined;
 | |
|       return textsecure.utils.unencodeNumber(numberId)[1];
 | |
|     },
 | |
| 
 | |
|     getDeviceName() {
 | |
|       return textsecure.storage.get('device_name');
 | |
|     },
 | |
|   };
 | |
| })();
 |