mirror of
https://github.com/bitwarden/mobile
synced 2025-12-16 16:23:29 +00:00
run on main thread fixes
This commit is contained in:
@@ -174,12 +174,14 @@ namespace Bit.iOS.Autofill
|
|||||||
public override void TextChanged(UISearchBar searchBar, string searchText)
|
public override void TextChanged(UISearchBar searchBar, string searchText)
|
||||||
{
|
{
|
||||||
var cts = new CancellationTokenSource();
|
var cts = new CancellationTokenSource();
|
||||||
Task.Run(async () =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
if(!string.IsNullOrWhiteSpace(searchText))
|
NSRunLoop.Main.BeginInvokeOnMainThread(async () =>
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(searchText))
|
||||||
{
|
{
|
||||||
await Task.Delay(300);
|
await Task.Delay(300);
|
||||||
if(searchText != searchBar.Text)
|
if (searchText != searchBar.Text)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -193,7 +195,9 @@ namespace Bit.iOS.Autofill
|
|||||||
((TableSource)_controller.TableView.Source).FilterResults(searchText, cts.Token);
|
((TableSource)_controller.TableView.Source).FilterResults(searchText, cts.Token);
|
||||||
_controller.TableView.ReloadData();
|
_controller.TableView.ReloadData();
|
||||||
}
|
}
|
||||||
catch(OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
|
_filterResultsCancellationTokenSource = cts;
|
||||||
|
});
|
||||||
}, cts.Token);
|
}, cts.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user