@@ -18,18 +18,19 @@ See the License for the specific language governing permissions and
1818limitations under the License.
1919*/
2020
21- import VectorBasePlatform , { updateCheckStatusEnum } from './VectorBasePlatform' ;
21+ import VectorBasePlatform from './VectorBasePlatform' ;
22+ import { UpdateCheckStatus } from "matrix-react-sdk/src/BasePlatform" ;
2223import BaseEventIndexManager , {
23- MatrixEvent ,
24- MatrixProfile ,
25- SearchResult ,
2624 CrawlerCheckpoint ,
2725 EventAndProfile ,
26+ IndexStats ,
27+ MatrixEvent ,
28+ MatrixProfile ,
2829 SearchArgs ,
29- IndexStats
30+ SearchResult
3031} from 'matrix-react-sdk/src/indexing/BaseEventIndexManager' ;
3132import dis from 'matrix-react-sdk/src/dispatcher/dispatcher' ;
32- import { _t , _td } from 'matrix-react-sdk/src/languageHandler' ;
33+ import { _t , _td } from 'matrix-react-sdk/src/languageHandler' ;
3334import * as rageshake from 'matrix-react-sdk/src/rageshake/rageshake' ;
3435import { MatrixClient } from "matrix-js-sdk/src/client" ;
3536import { Room } from "matrix-js-sdk/src/models/room" ;
@@ -41,8 +42,9 @@ import {Key} from "matrix-react-sdk/src/Keyboard";
4142import React from "react" ;
4243import { randomString } from "matrix-js-sdk/src/randomstring" ;
4344import { Action } from "matrix-react-sdk/src/dispatcher/actions" ;
44- import { ActionPayload } from "matrix-react-sdk/src/dispatcher/payloads" ;
45- import { showToast as showUpdateToast } from "matrix-react-sdk/src/toasts/UpdateToast" ;
45+ import { ActionPayload } from "matrix-react-sdk/src/dispatcher/payloads" ;
46+ import { showToast as showUpdateToast } from "matrix-react-sdk/src/toasts/UpdateToast" ;
47+ import { CheckUpdatesPayload } from 'matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload' ;
4648
4749const ipcRenderer = window . ipcRenderer ;
4850const isMac = navigator . platform . toUpperCase ( ) . includes ( 'MAC' ) ;
@@ -73,14 +75,14 @@ function _onAction(payload: ActionPayload) {
7375 }
7476}
7577
76- function getUpdateCheckStatus ( status ) {
78+ function getUpdateCheckStatus ( status : boolean | string ) {
7779 if ( status === true ) {
78- return { status : updateCheckStatusEnum . DOWNLOADING } ;
80+ return { status : UpdateCheckStatus . Downloading } ;
7981 } else if ( status === false ) {
80- return { status : updateCheckStatusEnum . NOTAVAILABLE } ;
82+ return { status : UpdateCheckStatus . NotAvailable } ;
8183 } else {
8284 return {
83- status : updateCheckStatusEnum . ERROR ,
85+ status : UpdateCheckStatus . Error ,
8486 detail : status ,
8587 } ;
8688 }
@@ -214,12 +216,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
214216 or the error if one is encountered
215217 */
216218 ipcRenderer . on ( 'check_updates' , ( event , status ) => {
217- if ( ! this . showUpdateCheck ) return ;
218- dis . dispatch ( {
219- action : 'check_updates' ,
220- value : getUpdateCheckStatus ( status ) ,
219+ dis . dispatch < CheckUpdatesPayload > ( {
220+ action : Action . CheckUpdates ,
221+ ...getUpdateCheckStatus ( status ) ,
221222 } ) ;
222- this . showUpdateCheck = false ;
223223 } ) ;
224224
225225 // try to flush the rageshake logs to indexeddb before quit.
@@ -385,9 +385,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
385385 }
386386
387387 startUpdateCheck ( ) {
388- if ( this . showUpdateCheck ) return ;
389388 super . startUpdateCheck ( ) ;
390-
391389 ipcRenderer . send ( 'check_updates' ) ;
392390 }
393391
0 commit comments