Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed contacts refetching when already present #755

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions packages/at_contacts_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ PODS:
- Flutter
- biometric_storage (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
Expand Down Expand Up @@ -43,6 +45,8 @@ PODS:
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- file_selector_ios (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_keychain (0.0.1):
- Flutter
Expand All @@ -52,7 +56,7 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.0.4):
- permission_handler_apple (9.1.1):
- Flutter
- qr_code_scanner (0.2.0):
- Flutter
Expand All @@ -77,7 +81,9 @@ DEPENDENCIES:
- at_file_saver (from `.symlinks/plugins/at_file_saver/ios`)
- at_onboarding_flutter (from `.symlinks/plugins/at_onboarding_flutter/ios`)
- biometric_storage (from `.symlinks/plugins/biometric_storage/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_selector_ios (from `.symlinks/plugins/file_selector_ios/ios`)
- Flutter (from `Flutter`)
- flutter_keychain (from `.symlinks/plugins/flutter_keychain/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
Expand Down Expand Up @@ -108,8 +114,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/at_onboarding_flutter/ios"
biometric_storage:
:path: ".symlinks/plugins/biometric_storage/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
file_selector_ios:
:path: ".symlinks/plugins/file_selector_ios/ios"
Flutter:
:path: Flutter
flutter_keychain:
Expand Down Expand Up @@ -137,23 +147,25 @@ SPEC CHECKSUMS:
at_file_saver: c0e052c72d8c0296318bd70f2ae7f510887014ce
at_onboarding_flutter: e8219b6d0bfb236d3837ec3528871aebdcc56e8d
biometric_storage: 1400f1382af3a4cc2bf05340e13c3d8de873ceb9
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
file_selector_ios: 8c25d700d625e1dcdd6599f2d927072f2254647b
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_keychain: 01aabf894ffe8b01adfda1d9df21c210c1b4b452
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: e2dae3258e06f44cc55f49d42024fd8dd03c590c
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
BiometricStorageMacOSPlugin.register(with: registry.registrar(forPlugin: "BiometricStorageMacOSPlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
Expand Down
14 changes: 8 additions & 6 deletions packages/at_contacts_flutter/lib/services/contact_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:at_contacts_flutter/models/contact_base_model.dart';
import 'package:at_contacts_flutter/utils/init_contacts_service.dart';
import 'package:at_contacts_flutter/utils/text_strings.dart';
import 'package:at_lookup/at_lookup.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

/// A service to handle CRUD operation on contacts
Expand Down Expand Up @@ -135,18 +136,19 @@ class ContactService {
try {
/// if contact list is already present, data is not fetched again
if (baseContactList.isNotEmpty) {
List<AtContact?> baseContacts =
List<AtContact?> tempBaseContacts =
baseContactList.map((e) => e.contact).toList();
baseContacts.sort((a, b) {
int? index = a?.atSign
baseContactList.sort((a, b) {
int? index = a.contact?.atSign
.toString()
.substring(1)
.compareTo((b?.atSign).toString().substring(1));
.compareTo((b.contact?.atSign).toString().substring(1));
return index ?? 0;
});
if (baseContacts == contactList) {
var res = listEquals(tempBaseContacts, contactList);
if (res == true) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
contactSink.add(baseContacts);
contactSink.add(baseContactList);
});
return contactList;
}
Expand Down