| 
				
			 | 
			
			
				
				@@ -10,14 +10,14 @@ import { translate } from '../../base/i18n'; 
			 | 
		
		
	
		
			
			| 
				10
			 | 
			
				10
			 | 
			
			
				
				 import { Icon, IconBlurBackground, IconCancelSelection } from '../../base/icons'; 
			 | 
		
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				
				 import { connect } from '../../base/redux'; 
			 | 
		
		
	
		
			
			| 
				12
			 | 
			
				12
			 | 
			
			
				
				 import { Tooltip } from '../../base/tooltip'; 
			 | 
		
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				
				-import { toggleBackgroundEffect, setVirtualBackground } from '../actions'; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				
				+import { toggleBackgroundEffect } from '../actions'; 
			 | 
		
		
	
		
			
			| 
				14
			 | 
			
				14
			 | 
			
			
				
				 import { resizeImage, toDataURL } from '../functions'; 
			 | 
		
		
	
		
			
			| 
				15
			 | 
			
				15
			 | 
			
			
				
				 import logger from '../logger'; 
			 | 
		
		
	
		
			
			| 
				16
			 | 
			
				16
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				17
			 | 
			
				
			 | 
			
			
				
				-// The limit of virtual background uploads is 21. When the number 
			 | 
		
		
	
		
			
			| 
				18
			 | 
			
				
			 | 
			
			
				
				-// of uploads is 22 we trigger the deleteStoredImage function to delete 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				
				+// The limit of virtual background uploads is 24. When the number 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				
				+// of uploads is 25 we trigger the deleteStoredImage function to delete 
			 | 
		
		
	
		
			
			| 
				19
			 | 
			
				19
			 | 
			
			
				
				 // the first/oldest uploaded background. 
			 | 
		
		
	
		
			
			| 
				20
			 | 
			
				
			 | 
			
			
				
				-const backgroundsLimit = 22; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				
				+const backgroundsLimit = 25; 
			 | 
		
		
	
		
			
			| 
				21
			 | 
			
				21
			 | 
			
			
				
				 const images = [ 
			 | 
		
		
	
		
			
			| 
				22
			 | 
			
				22
			 | 
			
			
				
				     { 
			 | 
		
		
	
		
			
			| 
				23
			 | 
			
				23
			 | 
			
			
				
				         id: 1, 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -67,42 +67,67 @@ function VirtualBackground({ dispatch, t }: Props) { 
			 | 
		
		
	
		
			
			| 
				67
			 | 
			
				67
			 | 
			
			
				
				      * Updates stored images on local storage. 
			 | 
		
		
	
		
			
			| 
				68
			 | 
			
				68
			 | 
			
			
				
				      */ 
			 | 
		
		
	
		
			
			| 
				69
			 | 
			
				69
			 | 
			
			
				
				     useEffect(() => { 
			 | 
		
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				
				-        jitsiLocalStorage.setItem('virtualBackgrounds', JSON.stringify(storedImages)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				70
			 | 
			
			
				
				+        try { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				71
			 | 
			
			
				
				+            jitsiLocalStorage.setItem('virtualBackgrounds', JSON.stringify(storedImages)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				72
			 | 
			
			
				
				+        } catch (err) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				73
			 | 
			
			
				
				+            // Preventing localStorage QUOTA_EXCEEDED_ERR 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				
				+            err && deleteStoredImage(storedImages[0]); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				
				+        } 
			 | 
		
		
	
		
			
			| 
				71
			 | 
			
				76
			 | 
			
			
				
				         if (storedImages.length === backgroundsLimit) { 
			 | 
		
		
	
		
			
			| 
				72
			 | 
			
				77
			 | 
			
			
				
				             deleteStoredImage(storedImages[0]); 
			 | 
		
		
	
		
			
			| 
				73
			 | 
			
				78
			 | 
			
			
				
				         } 
			 | 
		
		
	
		
			
			| 
				74
			 | 
			
				79
			 | 
			
			
				
				     }, [ storedImages ]); 
			 | 
		
		
	
		
			
			| 
				75
			 | 
			
				80
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				76
			 | 
			
				81
			 | 
			
			
				
				     const [ selected, setSelected ] = useState(''); 
			 | 
		
		
	
		
			
			| 
				77
			 | 
			
				
			 | 
			
			
				
				-    const enableBlur = async () => { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				82
			 | 
			
			
				
				+    const enableBlur = async (blurValue, selection) => { 
			 | 
		
		
	
		
			
			| 
				78
			 | 
			
				83
			 | 
			
			
				
				         isloading(true); 
			 | 
		
		
	
		
			
			| 
				79
			 | 
			
				
			 | 
			
			
				
				-        setSelected('blur'); 
			 | 
		
		
	
		
			
			| 
				80
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(setVirtualBackground('', false)); 
			 | 
		
		
	
		
			
			| 
				81
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(toggleBackgroundEffect(true)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				84
			 | 
			
			
				
				+        setSelected(selection); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				
				+        await dispatch( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				
				+            toggleBackgroundEffect({ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				
				+                backgroundType: 'blur', 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				
				+                enabled: true, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				
				+                blurValue 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				
				+            }) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				
				+        ); 
			 | 
		
		
	
		
			
			| 
				82
			 | 
			
				92
			 | 
			
			
				
				         isloading(false); 
			 | 
		
		
	
		
			
			| 
				83
			 | 
			
				93
			 | 
			
			
				
				     }; 
			 | 
		
		
	
		
			
			| 
				84
			 | 
			
				94
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				85
			 | 
			
				95
			 | 
			
			
				
				     const removeBackground = async () => { 
			 | 
		
		
	
		
			
			| 
				86
			 | 
			
				96
			 | 
			
			
				
				         isloading(true); 
			 | 
		
		
	
		
			
			| 
				87
			 | 
			
				97
			 | 
			
			
				
				         setSelected('none'); 
			 | 
		
		
	
		
			
			| 
				88
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(setVirtualBackground('', false)); 
			 | 
		
		
	
		
			
			| 
				89
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(toggleBackgroundEffect(false)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				
				+        await dispatch( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				
				+            toggleBackgroundEffect({ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				100
			 | 
			
			
				
				+                enabled: false 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				101
			 | 
			
			
				
				+            }) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				102
			 | 
			
			
				
				+        ); 
			 | 
		
		
	
		
			
			| 
				90
			 | 
			
				103
			 | 
			
			
				
				         isloading(false); 
			 | 
		
		
	
		
			
			| 
				91
			 | 
			
				104
			 | 
			
			
				
				     }; 
			 | 
		
		
	
		
			
			| 
				92
			 | 
			
				105
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				93
			 | 
			
				106
			 | 
			
			
				
				     const setUploadedImageBackground = async image => { 
			 | 
		
		
	
		
			
			| 
				94
			 | 
			
				107
			 | 
			
			
				
				         isloading(true); 
			 | 
		
		
	
		
			
			| 
				95
			 | 
			
				108
			 | 
			
			
				
				         setSelected(image.id); 
			 | 
		
		
	
		
			
			| 
				96
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(setVirtualBackground(image.src, true)); 
			 | 
		
		
	
		
			
			| 
				97
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(toggleBackgroundEffect(true)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				109
			 | 
			
			
				
				+        await dispatch( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				110
			 | 
			
			
				
				+            toggleBackgroundEffect({ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				111
			 | 
			
			
				
				+                backgroundType: 'image', 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				112
			 | 
			
			
				
				+                enabled: true, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				113
			 | 
			
			
				
				+                url: image.src 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				114
			 | 
			
			
				
				+            }) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				115
			 | 
			
			
				
				+        ); 
			 | 
		
		
	
		
			
			| 
				98
			 | 
			
				116
			 | 
			
			
				
				         isloading(false); 
			 | 
		
		
	
		
			
			| 
				99
			 | 
			
				117
			 | 
			
			
				
				     }; 
			 | 
		
		
	
		
			
			| 
				100
			 | 
			
				118
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				101
			 | 
			
				119
			 | 
			
			
				
				     const setImageBackground = async image => { 
			 | 
		
		
	
		
			
			| 
				102
			 | 
			
				120
			 | 
			
			
				
				         isloading(true); 
			 | 
		
		
	
		
			
			| 
				103
			 | 
			
				121
			 | 
			
			
				
				         setSelected(image.id); 
			 | 
		
		
	
		
			
			| 
				104
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(setVirtualBackground(await toDataURL(image.src), true)); 
			 | 
		
		
	
		
			
			| 
				105
			 | 
			
				
			 | 
			
			
				
				-        await dispatch(toggleBackgroundEffect(true)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				122
			 | 
			
			
				
				+        const url = await toDataURL(image.src); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				123
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				124
			 | 
			
			
				
				+        await dispatch( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				125
			 | 
			
			
				
				+            toggleBackgroundEffect({ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				126
			 | 
			
			
				
				+                backgroundType: 'image', 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				127
			 | 
			
			
				
				+                enabled: true, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				128
			 | 
			
			
				
				+                url 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				129
			 | 
			
			
				
				+            }) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				130
			 | 
			
			
				
				+        ); 
			 | 
		
		
	
		
			
			| 
				106
			 | 
			
				131
			 | 
			
			
				
				         isloading(false); 
			 | 
		
		
	
		
			
			| 
				107
			 | 
			
				132
			 | 
			
			
				
				     }; 
			 | 
		
		
	
		
			
			| 
				108
			 | 
			
				133
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -111,19 +136,23 @@ function VirtualBackground({ dispatch, t }: Props) { 
			 | 
		
		
	
		
			
			| 
				111
			 | 
			
				136
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				112
			 | 
			
				137
			 | 
			
			
				
				         reader.readAsDataURL(imageFile[0]); 
			 | 
		
		
	
		
			
			| 
				113
			 | 
			
				138
			 | 
			
			
				
				         reader.onload = async () => { 
			 | 
		
		
	
		
			
			| 
				114
			 | 
			
				
			 | 
			
			
				
				-            const resizedImage = await resizeImage(reader.result); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				139
			 | 
			
			
				
				+            const url = await resizeImage(reader.result); 
			 | 
		
		
	
		
			
			| 
				115
			 | 
			
				140
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				116
			 | 
			
				141
			 | 
			
			
				
				             isloading(true); 
			 | 
		
		
	
		
			
			| 
				117
			 | 
			
				142
			 | 
			
			
				
				             setStoredImages([ 
			 | 
		
		
	
		
			
			| 
				118
			 | 
			
				143
			 | 
			
			
				
				                 ...storedImages, 
			 | 
		
		
	
		
			
			| 
				119
			 | 
			
				144
			 | 
			
			
				
				                 { 
			 | 
		
		
	
		
			
			| 
				120
			 | 
			
				145
			 | 
			
			
				
				                     id: uuid.v4(), 
			 | 
		
		
	
		
			
			| 
				121
			 | 
			
				
			 | 
			
			
				
				-                    src: resizedImage 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				146
			 | 
			
			
				
				+                    src: url 
			 | 
		
		
	
		
			
			| 
				122
			 | 
			
				147
			 | 
			
			
				
				                 } 
			 | 
		
		
	
		
			
			| 
				123
			 | 
			
				148
			 | 
			
			
				
				             ]); 
			 | 
		
		
	
		
			
			| 
				124
			 | 
			
				
			 | 
			
			
				
				- 
			 | 
		
		
	
		
			
			| 
				125
			 | 
			
				
			 | 
			
			
				
				-            await dispatch(setVirtualBackground(resizedImage, true)); 
			 | 
		
		
	
		
			
			| 
				126
			 | 
			
				
			 | 
			
			
				
				-            await dispatch(toggleBackgroundEffect(true)); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				149
			 | 
			
			
				
				+            await dispatch( 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				150
			 | 
			
			
				
				+                toggleBackgroundEffect({ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				151
			 | 
			
			
				
				+                    backgroundType: 'image', 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				152
			 | 
			
			
				
				+                    enabled: true, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				153
			 | 
			
			
				
				+                    url 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				154
			 | 
			
			
				
				+                }) 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				155
			 | 
			
			
				
				+            ); 
			 | 
		
		
	
		
			
			| 
				127
			 | 
			
				156
			 | 
			
			
				
				             isloading(false); 
			 | 
		
		
	
		
			
			| 
				128
			 | 
			
				157
			 | 
			
			
				
				         }; 
			 | 
		
		
	
		
			
			| 
				129
			 | 
			
				158
			 | 
			
			
				
				         reader.onerror = () => { 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -137,7 +166,7 @@ function VirtualBackground({ dispatch, t }: Props) { 
			 | 
		
		
	
		
			
			| 
				137
			 | 
			
				166
			 | 
			
			
				
				             hideCancelButton = { true } 
			 | 
		
		
	
		
			
			| 
				138
			 | 
			
				167
			 | 
			
			
				
				             submitDisabled = { false } 
			 | 
		
		
	
		
			
			| 
				139
			 | 
			
				168
			 | 
			
			
				
				             titleKey = { 'virtualBackground.title' } 
			 | 
		
		
	
		
			
			| 
				140
			 | 
			
				
			 | 
			
			
				
				-            width = 'small'> 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				169
			 | 
			
			
				
				+            width = '450px'> 
			 | 
		
		
	
		
			
			| 
				141
			 | 
			
				170
			 | 
			
			
				
				             {loading ? ( 
			 | 
		
		
	
		
			
			| 
				142
			 | 
			
				171
			 | 
			
			
				
				                 <div className = 'virtual-background-loading'> 
			 | 
		
		
	
		
			
			| 
				143
			 | 
			
				172
			 | 
			
			
				
				                     <span className = 'loading-content-text'>{t('virtualBackground.pleaseWait')}</span> 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -158,11 +187,20 @@ function VirtualBackground({ dispatch, t }: Props) { 
			 | 
		
		
	
		
			
			| 
				158
			 | 
			
				187
			 | 
			
			
				
				                             </div> 
			 | 
		
		
	
		
			
			| 
				159
			 | 
			
				188
			 | 
			
			
				
				                         </Tooltip> 
			 | 
		
		
	
		
			
			| 
				160
			 | 
			
				189
			 | 
			
			
				
				                         <Tooltip 
			 | 
		
		
	
		
			
			| 
				161
			 | 
			
				
			 | 
			
			
				
				-                            content = { t('virtualBackground.enableBlur') } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				190
			 | 
			
			
				
				+                            content = { t('virtualBackground.slightBlur') } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				191
			 | 
			
			
				
				+                            position = { 'top' }> 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				192
			 | 
			
			
				
				+                            <Icon 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				193
			 | 
			
			
				
				+                                className = { selected === 'slight-blur' ? 'blur-selected' : '' } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				194
			 | 
			
			
				
				+                                onClick = { () => enableBlur(8, 'slight-blur') } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				195
			 | 
			
			
				
				+                                size = { 50 } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				196
			 | 
			
			
				
				+                                src = { IconBlurBackground } /> 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				197
			 | 
			
			
				
				+                        </Tooltip> 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				198
			 | 
			
			
				
				+                        <Tooltip 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				199
			 | 
			
			
				
				+                            content = { t('virtualBackground.blur') } 
			 | 
		
		
	
		
			
			| 
				162
			 | 
			
				200
			 | 
			
			
				
				                             position = { 'top' }> 
			 | 
		
		
	
		
			
			| 
				163
			 | 
			
				201
			 | 
			
			
				
				                             <Icon 
			 | 
		
		
	
		
			
			| 
				164
			 | 
			
				202
			 | 
			
			
				
				                                 className = { selected === 'blur' ? 'blur-selected' : '' } 
			 | 
		
		
	
		
			
			| 
				165
			 | 
			
				
			 | 
			
			
				
				-                                onClick = { () => enableBlur() } 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				203
			 | 
			
			
				
				+                                onClick = { () => enableBlur(25, 'blur') } 
			 | 
		
		
	
		
			
			| 
				166
			 | 
			
				204
			 | 
			
			
				
				                                 size = { 50 } 
			 | 
		
		
	
		
			
			| 
				167
			 | 
			
				205
			 | 
			
			
				
				                                 src = { IconBlurBackground } /> 
			 | 
		
		
	
		
			
			| 
				168
			 | 
			
				206
			 | 
			
			
				
				                         </Tooltip> 
			 |