show a toast instead of dialog when feature flag is enabled
							parent
							
								
									c705752317
								
							
						
					
					
						commit
						8cb362002b
					
				|  | @ -62,6 +62,7 @@ import { countRoomsWithNotif } from '../../RoomNotifs'; | |||
| import { ThemeWatcher } from "../../theme"; | ||||
| import { storeRoomAliasInCache } from '../../RoomAliasCache'; | ||||
| import { defer } from "../../utils/promise"; | ||||
| import KeyVerificationStateObserver from '../../utils/KeyVerificationStateObserver'; | ||||
| 
 | ||||
| // Disable warnings for now: we use deprecated bluebird functions
 | ||||
| // and need to migrate, but they spam the console with warnings.
 | ||||
|  | @ -1270,7 +1271,6 @@ export default createReactClass({ | |||
|         this.firstSyncComplete = false; | ||||
|         this.firstSyncPromise = defer(); | ||||
|         const cli = MatrixClientPeg.get(); | ||||
|         const IncomingSasDialog = sdk.getComponent('views.dialogs.IncomingSasDialog'); | ||||
| 
 | ||||
|         // Allow the JS SDK to reap timeline events. This reduces the amount of
 | ||||
|         // memory consumed as the JS SDK stores multiple distinct copies of room
 | ||||
|  | @ -1469,12 +1469,35 @@ export default createReactClass({ | |||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         cli.on("crypto.verification.start", (verifier) => { | ||||
|             Modal.createTrackedDialog('Incoming Verification', '', IncomingSasDialog, { | ||||
|                 verifier, | ||||
|             }); | ||||
|         }); | ||||
|         if (SettingsStore.isFeatureEnabled("feature_dm_verification")) { | ||||
|             cli.on("crypto.verification.request", request => { | ||||
|                 let requestObserver; | ||||
|                 if (request.event.getRoomId()) { | ||||
|                     requestObserver = new KeyVerificationStateObserver( | ||||
|                         request.event, MatrixClientPeg.get()); | ||||
|                 } | ||||
| 
 | ||||
|                 if (!requestObserver || requestObserver.pending) { | ||||
|                     dis.dispatch({ | ||||
|                         action: "show_toast", | ||||
|                         toast: { | ||||
|                             key: request.event.getId(), | ||||
|                             title: _t("Verification Request"), | ||||
|                             icon: "verification", | ||||
|                             props: {request, requestObserver}, | ||||
|                             component: sdk.getComponent("toasts.VerificationRequestToast"), | ||||
|                         }, | ||||
|                     }); | ||||
|                 } | ||||
|             }); | ||||
|         } else { | ||||
|             cli.on("crypto.verification.start", (verifier) => { | ||||
|                 const IncomingSasDialog = sdk.getComponent("views.dialogs.IncomingSasDialog"); | ||||
|                 Modal.createTrackedDialog('Incoming Verification', '', IncomingSasDialog, { | ||||
|                     verifier, | ||||
|                 }); | ||||
|             }); | ||||
|         } | ||||
|         // Fire the tinter right on startup to ensure the default theme is applied
 | ||||
|         // A later sync can/will correct the tint to be the right value for the user
 | ||||
|         const colorScheme = SettingsStore.getValue("roomColor"); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Bruno Windels
						Bruno Windels