fix: mobile workspace related fixes (#1130)
* feat: put workspaces under unfinished features flag * fix: mention that signing out will quit the app * fix: put more affected places under features flag
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useSignedIn } from '@Lib/SnjsHelperHooks'
|
||||
import { isUnfinishedFeaturesEnabled } from '@Lib/Utils'
|
||||
import { useNavigation } from '@react-navigation/native'
|
||||
import { ButtonCell } from '@Root/Components/ButtonCell'
|
||||
import { SectionedAccessoryTableCell } from '@Root/Components/SectionedAccessoryTableCell'
|
||||
@@ -6,6 +7,7 @@ import { SectionedOptionsTableCell } from '@Root/Components/SectionedOptionsTabl
|
||||
import { SectionHeader } from '@Root/Components/SectionHeader'
|
||||
import { TableSection } from '@Root/Components/TableSection'
|
||||
import { useSafeApplicationContext } from '@Root/Hooks/useSafeApplicationContext'
|
||||
import { useSafeEnvironmentContext } from '@Root/Hooks/useSafeEnvironmentContext'
|
||||
import { ModalStackNavigationProp } from '@Root/ModalStack'
|
||||
import { SCREEN_MANAGE_SESSIONS, SCREEN_SETTINGS } from '@Root/Screens/screens'
|
||||
import { ButtonType, PrefKey } from '@standardnotes/snjs'
|
||||
@@ -26,6 +28,7 @@ export const OptionsSection = ({ title, encryptionAvailable }: Props) => {
|
||||
|
||||
const [signedIn] = useSignedIn()
|
||||
const navigation = useNavigation<ModalStackNavigationProp<typeof SCREEN_SETTINGS>['navigation']>()
|
||||
const env = useSafeEnvironmentContext()
|
||||
|
||||
// State
|
||||
const [importing, setImporting] = useState(false)
|
||||
@@ -76,14 +79,14 @@ export const OptionsSection = ({ title, encryptionAvailable }: Props) => {
|
||||
}, [encryptionAvailable])
|
||||
|
||||
const destroyLocalData = async () => {
|
||||
if (
|
||||
await application.alertService.confirm(
|
||||
'Signing out will remove all data from this device, including notes and tags. Make sure your data is synced before proceeding.',
|
||||
'Sign Out?',
|
||||
'Sign Out',
|
||||
ButtonType.Danger,
|
||||
)
|
||||
) {
|
||||
let signoutText =
|
||||
'Signing out will remove all data from this device, including notes and tags. Make sure your data is synced before proceeding.'
|
||||
|
||||
if (isUnfinishedFeaturesEnabled(env)) {
|
||||
signoutText += '\n\nYour app will quit after sign out completes.'
|
||||
}
|
||||
|
||||
if (await application.alertService.confirm(signoutText, 'Sign Out?', 'Sign Out', ButtonType.Danger)) {
|
||||
await application.user.signOut()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ export const WorkspacesSection = () => {
|
||||
break
|
||||
case Remove:
|
||||
message =
|
||||
'This action will remove this workspace and its related data from this device. Your synced data will not be affected.'
|
||||
'This action will remove this workspace and its related data from this device. Your synced data will not be affected.\n\nYour app will quit after workspace removal completes.'
|
||||
buttonText = 'Delete Workspace'
|
||||
buttonType = Danger
|
||||
break
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { useSignedIn } from '@Lib/SnjsHelperHooks'
|
||||
import { isUnfinishedFeaturesEnabled } from '@Lib/Utils'
|
||||
import { useSafeApplicationContext } from '@Root/Hooks/useSafeApplicationContext'
|
||||
import { useSafeEnvironmentContext } from '@Root/Hooks/useSafeEnvironmentContext'
|
||||
import { ModalStackNavigationProp } from '@Root/ModalStack'
|
||||
import { SCREEN_SETTINGS } from '@Root/Screens/screens'
|
||||
import { FilesSection } from '@Screens/Settings/Sections/FilesSection'
|
||||
@@ -20,6 +22,7 @@ type Props = ModalStackNavigationProp<typeof SCREEN_SETTINGS>
|
||||
export const Settings = (props: Props) => {
|
||||
// Context
|
||||
const application = useSafeApplicationContext()
|
||||
const env = useSafeEnvironmentContext()
|
||||
|
||||
// State
|
||||
const [hasPasscode, setHasPasscode] = useState(() => Boolean(application.hasPasscode()))
|
||||
@@ -55,7 +58,7 @@ export const Settings = (props: Props) => {
|
||||
<Container keyboardShouldPersistTaps={'always'} keyboardDismissMode={'interactive'}>
|
||||
<AuthSection title="Account" signedIn={signedIn} />
|
||||
<OptionsSection encryptionAvailable={!!encryptionAvailable} title="Options" />
|
||||
<WorkspacesSection />
|
||||
{isUnfinishedFeaturesEnabled(env) && <WorkspacesSection />}
|
||||
<PreferencesSection />
|
||||
{application.hasAccount() && isEntitledToFiles && <FilesSection />}
|
||||
<SecuritySection
|
||||
|
||||
Reference in New Issue
Block a user