1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-10 18:10:54 +09:00

JS-3580: isLocalOnly method

This commit is contained in:
Mike Mhlv 2024-03-06 13:04:32 +00:00
parent 66fc1c51f6
commit 1b20578e76
No known key found for this signature in database
GPG key ID: 82F8AC181346CE7F
2 changed files with 12 additions and 10 deletions

View file

@ -1,6 +1,6 @@
import * as React from 'react';
import { Title, Label, IconObject, ObjectName, Button } from 'Component';
import { analytics, C, UtilRouter, UtilFile, I, translate, UtilCommon } from 'Lib';
import { analytics, C, UtilRouter, UtilFile, I, translate, UtilCommon, UtilData } from 'Lib';
import { observer } from 'mobx-react';
import { authStore, commonStore, popupStore } from 'Store';
@ -21,13 +21,11 @@ const PopupSettingsPageDataManagement = observer(class PopupSettingsPageStorageI
render () {
const { onPage } = this.props;
const { localUsage } = commonStore.spaceStorage;
const { walletPath, accountPath, account } = authStore;
const { info } = account;
const { walletPath, accountPath } = authStore;
const { config } = commonStore;
const localStorage = { name: translate('popupSettingsDataLocalFiles'), iconEmoji: ':desktop_computer:' };
const canMove = config.experimental;
const localOnly = info.networkId == '';
const suffix = localOnly ? 'LocalOnly' : '';
const suffix = UtilData.isLocalOnly() ? 'LocalOnly' : '';
return (
<React.Fragment>
@ -67,17 +65,14 @@ const PopupSettingsPageDataManagement = observer(class PopupSettingsPageStorageI
onOffload (e: any) {
const { setLoading } = this.props;
const { account } = authStore;
const { info } = account;
const localOnly = info.networkId == '';
const suffix = localOnly ? 'LocalOnly' : '';
const localOnly = UtilData.isLocalOnly();
analytics.event('ScreenFileOffloadWarning');
popupStore.open('confirm',{
data: {
title: translate('popupSettingsDataOffloadWarningTitle'),
text: translate(`popupSettingsDataOffloadWarningText${suffix}`),
text: translate(`popupSettingsDataOffloadWarningText${localOnly ? 'LocalOnly' : ''}`),
textConfirm: localOnly ? translate('popupSettingsDataKeepFiles') : translate('commonYes'),
canCancel: localOnly,
textCancel: translate('popupSettingsDataRemoveFiles'),

View file

@ -981,6 +981,13 @@ class UtilData {
return ret;
};
isLocalOnly (): boolean {
const { account } = authStore;
const { info } = account;
return info.networkId == '';
};
};
export default new UtilData();