Skip to content

Commit

Permalink
fix: optimized initContactService method
Browse files Browse the repository at this point in the history
  • Loading branch information
Sardar1208 committed Dec 13, 2023
1 parent cf15cc9 commit ac7f0e7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/at_contacts_flutter/lib/services/contact_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,20 @@ class ContactService {
List<String> allContactsList = [];

Future<void> initContactsService(
String rootDomainFromApp, int rootPortFromApp) async {
String rootDomainFromApp, int rootPortFromApp,
{bool fetchContacts = true}) async {
loggedInUserDetails = null;
rootDomain = rootDomainFromApp;
rootPort = rootPortFromApp;
atClientManager = AtClientManager.getInstance();
currentAtsign = atClientManager.atClient.getCurrentAtSign()!;
atContactImpl = await AtContactsImpl.getInstance(currentAtsign);
loggedInUserDetails = await getAtSignDetails(currentAtsign);
cachedContactList = await atContactImpl.listContacts();
await fetchContactList();
await fetchBlockContactList();
if (fetchContacts) {
cachedContactList = await atContactImpl.listContacts();
await fetchContactList();
await fetchBlockContactList();
}
}

void resetData() {
Expand Down

0 comments on commit ac7f0e7

Please sign in to comment.