Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
6cbfcb9d
Commit
6cbfcb9d
authored
5 years ago
by
mashazyu
Browse files
Options
Downloads
Patches
Plain Diff
Fixes delete data bug
parent
138f1d28
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/settings/data-management/delete-data.js
+9
-1
9 additions, 1 deletion
components/settings/data-management/delete-data.js
components/settings/data-management/index.js
+26
-5
26 additions, 5 deletions
components/settings/data-management/index.js
with
35 additions
and
6 deletions
components/settings/data-management/delete-data.js
+
9
−
1
View file @
6cbfcb9d
import
React
,
{
Component
}
from
'
react
'
import
React
,
{
Component
}
from
'
react
'
import
RNFS
from
'
react-native-fs
'
import
RNFS
from
'
react-native-fs
'
import
{
Alert
,
ToastAndroid
}
from
'
react-native
'
import
{
Alert
,
ToastAndroid
}
from
'
react-native
'
import
PropTypes
from
'
prop-types
'
import
{
clearDb
,
isDbEmpty
}
from
'
../../../db
'
import
{
clearDb
,
isDbEmpty
}
from
'
../../../db
'
import
{
hasEncryptionObservable
}
from
'
../../../local-storage
'
import
{
hasEncryptionObservable
}
from
'
../../../local-storage
'
...
@@ -24,6 +25,7 @@ export default class DeleteData extends Component {
...
@@ -24,6 +25,7 @@ export default class DeleteData extends Component {
}
}
onAlertConfirmation
=
()
=>
{
onAlertConfirmation
=
()
=>
{
this
.
props
.
onStartDeletion
()
if
(
this
.
state
.
isPasswordSet
)
{
if
(
this
.
state
.
isPasswordSet
)
{
this
.
setState
({
isConfirmingWithPassword
:
true
})
this
.
setState
({
isConfirmingWithPassword
:
true
})
}
else
{
}
else
{
...
@@ -78,8 +80,9 @@ export default class DeleteData extends Component {
...
@@ -78,8 +80,9 @@ export default class DeleteData extends Component {
render
()
{
render
()
{
const
{
isConfirmingWithPassword
}
=
this
.
state
const
{
isConfirmingWithPassword
}
=
this
.
state
const
{
isDeletingData
}
=
this
.
props
if
(
isConfirmingWithPassword
)
{
if
(
isConfirmingWithPassword
&&
isDeletingData
)
{
return
(
return
(
<
ConfirmWithPassword
<
ConfirmWithPassword
onSuccess
=
{
this
.
deleteAppData
}
onSuccess
=
{
this
.
deleteAppData
}
...
@@ -94,4 +97,9 @@ export default class DeleteData extends Component {
...
@@ -94,4 +97,9 @@ export default class DeleteData extends Component {
<
/SettingsButton
>
<
/SettingsButton
>
)
)
}
}
}
DeleteData
.
propTypes
=
{
isDeletingData
:
PropTypes
.
bool
,
onStartDeletion
:
PropTypes
.
func
.
isRequired
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
components/settings/data-management/index.js
+
26
−
5
View file @
6cbfcb9d
...
@@ -13,7 +13,10 @@ export default class DataManagement extends Component {
...
@@ -13,7 +13,10 @@ export default class DataManagement extends Component {
constructor
(
props
)
{
constructor
(
props
)
{
super
(
props
)
super
(
props
)
this
.
state
=
{
isLoading
:
false
}
this
.
state
=
{
isLoading
:
false
,
currentAction
:
null
}
}
}
startLoading
=
()
=>
{
startLoading
=
()
=>
{
...
@@ -33,7 +36,22 @@ export default class DataManagement extends Component {
...
@@ -33,7 +36,22 @@ export default class DataManagement extends Component {
this
.
endLoading
()
this
.
endLoading
()
}
}
startExport
=
()
=>
{
this
.
setCurrentAction
(
'
export
'
)
openShareDialogAndExport
()
}
startImport
=
()
=>
{
this
.
setCurrentAction
(
'
import
'
)
openImportDialog
(
this
.
startImportFlow
)
}
setCurrentAction
=
(
action
)
=>
{
this
.
setState
({
currentAction
:
action
})
}
render
()
{
render
()
{
const
{
currentAction
}
=
this
.
state
return
(
return
(
<
View
flex
=
{
1
}
>
<
View
flex
=
{
1
}
>
{
this
.
state
.
isLoading
&&
<
AppLoadingView
/>
}
{
this
.
state
.
isLoading
&&
<
AppLoadingView
/>
}
...
@@ -42,14 +60,14 @@ export default class DataManagement extends Component {
...
@@ -42,14 +60,14 @@ export default class DataManagement extends Component {
<
View
>
<
View
>
<
FramedSegment
title
=
{
labels
.
export
.
button
}
>
<
FramedSegment
title
=
{
labels
.
export
.
button
}
>
<
AppText
>
{
labels
.
export
.
segmentExplainer
}
<
/AppText
>
<
AppText
>
{
labels
.
export
.
segmentExplainer
}
<
/AppText
>
<
SettingsButton
onPress
=
{
openShareDialogAnd
Export
}
>
<
SettingsButton
onPress
=
{
this
.
start
Export
}
>
{
labels
.
export
.
button
}
{
labels
.
export
.
button
}
<
/SettingsButton
>
<
/SettingsButton
>
<
/FramedSegment
>
<
/FramedSegment
>
<
FramedSegment
title
=
{
labels
.
import
.
button
}
>
<
FramedSegment
title
=
{
labels
.
import
.
button
}
>
<
AppText
>
{
labels
.
import
.
segmentExplainer
}
<
/AppText
>
<
AppText
>
{
labels
.
import
.
segmentExplainer
}
<
/AppText
>
<
SettingsButton
<
SettingsButton
onPress
=
{
()
=>
openImportDialog
(
this
.
startImport
Flow
)
}
onPress
=
{
this
.
startImport
}
>
>
{
labels
.
import
.
button
}
{
labels
.
import
.
button
}
<
/SettingsButton
>
<
/SettingsButton
>
...
@@ -59,7 +77,10 @@ export default class DataManagement extends Component {
...
@@ -59,7 +77,10 @@ export default class DataManagement extends Component {
last
last
>
>
<
AppText
>
{
labels
.
deleteSegment
.
explainer
}
<
/AppText
>
<
AppText
>
{
labels
.
deleteSegment
.
explainer
}
<
/AppText
>
<
DeleteData
/>
<
DeleteData
isDeletingData
=
{
currentAction
===
'
delete
'
}
onStartDeletion
=
{()
=>
this
.
setCurrentAction
(
'
delete
'
)}
/
>
<
/FramedSegment
>
<
/FramedSegment
>
<
/View
>
<
/View
>
<
/ScrollView
>
<
/ScrollView
>
...
@@ -67,4 +88,4 @@ export default class DataManagement extends Component {
...
@@ -67,4 +88,4 @@ export default class DataManagement extends Component {
<
/View
>
<
/View
>
)
)
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment