Don't kill other sessions when running as a widget
This commit is contained in:
		
					parent
					
						
							
								3bffe58549
							
						
					
				
			
			
				commit
				
					
						fd18f2acdf
					
				
			
		
					 2 changed files with 5 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -258,7 +258,11 @@ export const ClientProvider: FC<Props> = ({ children }) => {
 | 
			
		|||
  }, [history]);
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    if (client) {
 | 
			
		||||
    // To protect against multiple sessions writing to the same storage
 | 
			
		||||
    // simultaneously, we send a to-device message that shuts down all other
 | 
			
		||||
    // running instances of the app. This isn't necessary if the app is running
 | 
			
		||||
    // in a widget though, since then it'll be mostly stateless.
 | 
			
		||||
    if (!widget && client) {
 | 
			
		||||
      const loadTime = Date.now();
 | 
			
		||||
 | 
			
		||||
      const onToDeviceEvent = (event: MatrixEvent) => {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -106,7 +106,6 @@ export const widget: WidgetHelpers | null = (() => {
 | 
			
		|||
        EventType.CallSDPStreamMetadataChanged,
 | 
			
		||||
        EventType.CallSDPStreamMetadataChangedPrefix,
 | 
			
		||||
        EventType.CallReplaces,
 | 
			
		||||
        "org.matrix.call_duplicate_session",
 | 
			
		||||
      ];
 | 
			
		||||
 | 
			
		||||
      const client = createRoomWidgetClient(
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue