Give contextual feedback for manual update check instead of banner
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
c68f35060a
commit
1fd74f22c8
3 changed files with 31 additions and 67 deletions
|
@ -18,18 +18,19 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import VectorBasePlatform, {updateCheckStatusEnum} from './VectorBasePlatform';
|
||||
import VectorBasePlatform from './VectorBasePlatform';
|
||||
import {UpdateCheckStatus} from "matrix-react-sdk/src/BasePlatform";
|
||||
import BaseEventIndexManager, {
|
||||
MatrixEvent,
|
||||
MatrixProfile,
|
||||
SearchResult,
|
||||
CrawlerCheckpoint,
|
||||
EventAndProfile,
|
||||
IndexStats,
|
||||
MatrixEvent,
|
||||
MatrixProfile,
|
||||
SearchArgs,
|
||||
IndexStats
|
||||
SearchResult
|
||||
} from 'matrix-react-sdk/src/indexing/BaseEventIndexManager';
|
||||
import dis from 'matrix-react-sdk/src/dispatcher/dispatcher';
|
||||
import { _t, _td } from 'matrix-react-sdk/src/languageHandler';
|
||||
import {_t, _td} from 'matrix-react-sdk/src/languageHandler';
|
||||
import * as rageshake from 'matrix-react-sdk/src/rageshake/rageshake';
|
||||
import {MatrixClient} from "matrix-js-sdk/src/client";
|
||||
import {Room} from "matrix-js-sdk/src/models/room";
|
||||
|
@ -41,8 +42,9 @@ import {Key} from "matrix-react-sdk/src/Keyboard";
|
|||
import React from "react";
|
||||
import {randomString} from "matrix-js-sdk/src/randomstring";
|
||||
import {Action} from "matrix-react-sdk/src/dispatcher/actions";
|
||||
import { ActionPayload } from "matrix-react-sdk/src/dispatcher/payloads";
|
||||
import { showToast as showUpdateToast } from "matrix-react-sdk/src/toasts/UpdateToast";
|
||||
import {ActionPayload} from "matrix-react-sdk/src/dispatcher/payloads";
|
||||
import {showToast as showUpdateToast} from "matrix-react-sdk/src/toasts/UpdateToast";
|
||||
import { CheckUpdatesPayload } from 'matrix-react-sdk/src/dispatcher/payloads/CheckUpdatesPayload';
|
||||
|
||||
const ipcRenderer = window.ipcRenderer;
|
||||
const isMac = navigator.platform.toUpperCase().includes('MAC');
|
||||
|
@ -73,14 +75,14 @@ function _onAction(payload: ActionPayload) {
|
|||
}
|
||||
}
|
||||
|
||||
function getUpdateCheckStatus(status) {
|
||||
function getUpdateCheckStatus(status: boolean | string) {
|
||||
if (status === true) {
|
||||
return { status: updateCheckStatusEnum.DOWNLOADING };
|
||||
return { status: UpdateCheckStatus.Downloading };
|
||||
} else if (status === false) {
|
||||
return { status: updateCheckStatusEnum.NOTAVAILABLE };
|
||||
return { status: UpdateCheckStatus.NotAvailable };
|
||||
} else {
|
||||
return {
|
||||
status: updateCheckStatusEnum.ERROR,
|
||||
status: UpdateCheckStatus.Error,
|
||||
detail: status,
|
||||
};
|
||||
}
|
||||
|
@ -214,12 +216,10 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
or the error if one is encountered
|
||||
*/
|
||||
ipcRenderer.on('check_updates', (event, status) => {
|
||||
if (!this.showUpdateCheck) return;
|
||||
dis.dispatch({
|
||||
action: 'check_updates',
|
||||
value: getUpdateCheckStatus(status),
|
||||
dis.dispatch<CheckUpdatesPayload>({
|
||||
action: Action.CheckUpdates,
|
||||
...getUpdateCheckStatus(status),
|
||||
});
|
||||
this.showUpdateCheck = false;
|
||||
});
|
||||
|
||||
// try to flush the rageshake logs to indexeddb before quit.
|
||||
|
@ -385,9 +385,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
|
|||
}
|
||||
|
||||
startUpdateCheck() {
|
||||
if (this.showUpdateCheck) return;
|
||||
super.startUpdateCheck();
|
||||
|
||||
ipcRenderer.send('check_updates');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue