mirror of
https://github.com/standardnotes/mobile.git
synced 2026-04-19 21:58:51 -04:00
Reset search state after unlocking app
This commit is contained in:
@@ -438,7 +438,11 @@ export default class KeysManager {
|
||||
static getDeviceBiometricsAvailability(callback) {
|
||||
let isAndroid = Platform.OS == "android";
|
||||
if(__DEV__) {
|
||||
callback(true, "touch", "Fingerprint (Dev)");
|
||||
if(isAndroid) {
|
||||
callback(true, "touch", "Fingerprint (Dev)");
|
||||
} else {
|
||||
callback(true, "face", "Face ID");
|
||||
}
|
||||
return;
|
||||
}
|
||||
FingerprintScanner.isSensorAvailable().then((type) => {
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class Abstract extends ThemedComponent {
|
||||
if(!templateOptions) { templateOptions = {}; }
|
||||
let options = {
|
||||
headerTitle:<HeaderTitleView
|
||||
title={navigation.getParam("title") || templateOptions.title}
|
||||
title={navigation.getParam("title") || templateOptions.title}
|
||||
subtitle={navigation.getParam("subtitle") || templateOptions.subtitle}
|
||||
subtitleColor={navigation.getParam("subtitleColor")}
|
||||
/>,
|
||||
@@ -186,11 +186,13 @@ export default class Abstract extends ThemedComponent {
|
||||
this.configureNavBar();
|
||||
}
|
||||
|
||||
unlockContent() {
|
||||
unlockContent(callback) {
|
||||
if(!this.loadedInitialState) {
|
||||
this.loadInitialState();
|
||||
}
|
||||
this.mergeState({lockContent: false});
|
||||
this.setState({lockContent: false}, () => {
|
||||
callback && callback();
|
||||
});
|
||||
}
|
||||
|
||||
constructState(state) {
|
||||
|
||||
@@ -27,6 +27,7 @@ export default class Notes extends Abstract {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.stateNotes = [];
|
||||
|
||||
this.options = ApplicationState.getOptions();
|
||||
this.registerObservers();
|
||||
@@ -61,11 +62,20 @@ export default class Notes extends Abstract {
|
||||
// not be sent again. So we want to make sure that we're able to reload state when component mounts,
|
||||
// and loadInitialState is called on componentDidMount
|
||||
this.reloadList();
|
||||
|
||||
}
|
||||
|
||||
unlockContent() {
|
||||
super.unlockContent();
|
||||
this.reloadHeaderBar();
|
||||
unlockContent(callback) {
|
||||
super.unlockContent(() => {
|
||||
// wait for the state.unlocked setState call to finish
|
||||
if(this.searching) {
|
||||
this.searching = false;
|
||||
this.options.setSearchTerm(null);
|
||||
}
|
||||
|
||||
this.reloadHeaderBar();
|
||||
callback && callback();
|
||||
});
|
||||
}
|
||||
|
||||
componentWillFocus() {
|
||||
@@ -119,15 +129,19 @@ export default class Notes extends Abstract {
|
||||
|
||||
registerObservers() {
|
||||
this.optionsObserver = this.options.addChangeObserver((options, eventType) => {
|
||||
|
||||
this.reloadList(true);
|
||||
|
||||
// should only show for non-search term change
|
||||
let shouldReloadSubtitleAfterNotesReload = false;
|
||||
if(eventType !== OptionsState.OptionsStateChangeEventSearch) {
|
||||
shouldReloadSubtitleAfterNotesReload = true;
|
||||
this.setSubTitle("Loading...");
|
||||
this.reloadHeaderBar();
|
||||
} else {
|
||||
this.reloadHeaderBar();
|
||||
}
|
||||
|
||||
this.reloadList(true);
|
||||
|
||||
if(shouldReloadSubtitleAfterNotesReload) {
|
||||
this.setSubTitle(null);
|
||||
@@ -215,8 +229,11 @@ export default class Notes extends Abstract {
|
||||
}
|
||||
|
||||
var tags = ModelManager.get().getTagsWithIds(this.options.selectedTagIds);
|
||||
// Tags might not be completely loaded yet, as reloadHeaderBar can be called from incrementalSync
|
||||
if(tags.length > 0) {
|
||||
|
||||
if(this.searching) {
|
||||
this.setTitle(`${this.stateNotes.length} search results`);
|
||||
} else if(tags.length > 0) {
|
||||
// Tags might not be completely loaded yet, as reloadHeaderBar can be called from incrementalSync
|
||||
var tag = tags[0];
|
||||
notesTitle = tag.title;
|
||||
this.setTitle(notesTitle);
|
||||
@@ -315,15 +332,13 @@ export default class Notes extends Abstract {
|
||||
}
|
||||
|
||||
onSearchTextChange = (text) => {
|
||||
this.skipUpdatingNavBar = true;
|
||||
this.searching = true;
|
||||
this.options.setSearchTerm(text);
|
||||
this.skipUpdatingNavBar = false;
|
||||
}
|
||||
|
||||
onSearchCancel = () => {
|
||||
this.skipUpdatingNavBar = true;
|
||||
this.searching = false;
|
||||
this.options.setSearchTerm(null);
|
||||
this.skipUpdatingNavBar = false;
|
||||
}
|
||||
|
||||
handleActionsheetAction = (item, action, callback) => {
|
||||
|
||||
Reference in New Issue
Block a user