20
20
using System . Linq ;
21
21
using Windows . UI . Xaml . Controls ;
22
22
using System . Globalization ;
23
+ using System . Threading ;
23
24
24
25
namespace Signal_Windows . ViewModels
25
26
{
26
27
public class AddContactPageViewModel : ViewModelBase
27
28
{
28
29
public ObservableCollection < PhoneContact > Contacts ;
29
30
private List < PhoneContact > signalContacts ;
30
- private List < PhoneContact > otherContacts ;
31
31
private PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil . GetInstance ( ) ;
32
+ private CancellationToken cancellationToken ;
32
33
33
34
private string _ContactName = "" ;
34
35
public string ContactName
@@ -48,10 +49,9 @@ public AddContactPageViewModel()
48
49
{
49
50
Contacts = new ObservableCollection < PhoneContact > ( ) ;
50
51
signalContacts = new List < PhoneContact > ( ) ;
51
- otherContacts = new List < PhoneContact > ( ) ;
52
52
}
53
53
54
- public async Task OnNavigatedTo ( )
54
+ public async Task OnNavigatedTo ( CancellationToken ? cancellationToken = null )
55
55
{
56
56
SignalServiceAccountManager accountManager = new SignalServiceAccountManager ( App . ServiceUrls , App . Store . Username , App . Store . Password , ( int ) App . Store . DeviceId , App . USER_AGENT ) ;
57
57
ContactStore contactStore = await ContactManager . RequestStoreAsync ( ContactStoreAccessType . AllContactsReadOnly ) ;
@@ -110,13 +110,8 @@ public async Task OnNavigatedTo()
110
110
contact . OnSignal = true ;
111
111
signalContacts . Add ( contact ) ;
112
112
}
113
- else
114
- {
115
- otherContacts . Add ( contact ) ;
116
- }
117
113
}
118
114
Contacts . AddRange ( signalContacts ) ;
119
- Contacts . AddRange ( otherContacts ) ;
120
115
}
121
116
else
122
117
{
@@ -183,7 +178,6 @@ internal void searchBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextCha
183
178
{
184
179
string text = sender . Text ;
185
180
var validContacts = GetContactsMatchingText ( text , signalContacts ) . ToList ( ) ;
186
- validContacts . AddRange ( GetContactsMatchingText ( text , otherContacts ) ) ;
187
181
Contacts . Clear ( ) ;
188
182
Contacts . AddRange ( validContacts ) ;
189
183
}
0 commit comments