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

at_follows_flutter example fails to load Connections screen due to @Sign profile pics #370

Closed
yahu1031 opened this issue Feb 21, 2022 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists Fixed Bug fixed by the developer

Comments

@yahu1031
Copy link
Member

yahu1031 commented Feb 21, 2022

Describe the bug

I was testing the at_follows_flutter package example and I found, the app is blocking me from getting the followers/following count. When I try debugging it more, It gave me Fetching keys for @capitalistfriedchicken throws Exception: cached:public:image.wavi@capitalistfriedchicken does not exist in keystore.(I got this after adding Exception catch in this function connections_service.dart#L371).

  • I have loggedin with @armadillocoffeesilky
  • I have 2 followers

To Reproduce

Steps to reproduce the behavior:

  1. Clone the repository.
  2. Head over to at_follows_flutter dir.
  3. Open it with any of the IDE/Code editors.
  4. Make the following changes, add Exception catch in this function connections_service.dart#L371

PREFFERED

// method to get atsign data
Future<Atsign> _getAtsignData(String? connection,
    {bool isFollowing = true, bool isNew = false}) async {
  AtKey atKey;
  Atsign atsignData = Atsign()
    ..title = connection
    ..isFollowing = following.list!.contains(connection);
  try {
    var data = connectionProvider.getData(!isFollowing, connection);
    // ... CODE ...
      atsignData.setData(atValue);
    }
  } on AtLookUpException catch (e) {
    _logger.severe('Fetching keys for $connection throws ${e.errorMessage}');
+  } on Exception catch (e) {
+    _logger.severe('Fetching keys for $connection throws ${e.toString()}');
  }

  return atsignData;
}

OR

// method to get atsign data
Future<Atsign> _getAtsignData(String? connection,
    {bool isFollowing = true, bool isNew = false}) async {
  AtKey atKey;
  Atsign atsignData = Atsign()
    ..title = connection
    ..isFollowing = following.list!.contains(connection);
  try {
    var data = connectionProvider.getData(!isFollowing, connection);
    // ... CODE ...
      atsignData.setData(atValue);
    }
-  } on AtLookUpException catch (e) {
+  } on Exception catch (e) {
    _logger.severe('Fetching keys for $connection throws ${e.errorMessage}');
  }

  return atsignData;
}

Add KeyNotFoundException case in errorMessage()

String? errorMessage(var exception) {
  switch (exception.runtimeType) {
    case AtClientException:
      return 'Unable to perform this action. Please try again.';
    // ... CODE ...
    case String:
      return exception;
+    case KeyNotFoundException:
+      return exception.message;
    case ResponseTimeOutException:
      return 'Server response timed out!\nPlease check your network connection and try again. Contact support@atsign.com if the issue still persists.';
    default:
      return 'Failed while loading\n please reopen the screen again.';
  }
}

Expected behavior

Must cache the user images if they exist.

Screenshots

With changes
With changes

With out changes
With out changes

Smartphone (please complete the following information):

  • Device: iPhone12
  • OS: iOS15.2

Were you using an @‎application when the bug was found?

  • at_follows_flutter example app

Additional context

Logs with changes

Launching lib[/main.dart]() on iPhone 12 in debug mode...
lib/main.dart:1
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
flutter: INFO|2022-02-21 18:22:08.967883|Connections Service|Received notification:: id:-1 key:statsNotification.@armadillocoffeesilky operation:update from:@armadillocoffeesilky to:@armadillocoffeesilky
flutter: INFO|2022-02-21 18:22:23.907207|Connections Service|Received notification:: id:-1 key:statsNotification.@armadillocoffeesilky operation:update from:@armadillocoffeesilky to:@armadillocoffeesilky
Xcode build done.                                           23.7s
Connecting to VM Service at ws://127.0.0.1:54579[/BVCjBurTiik]()=[/ws]()
flutter: initialiazed notification service
flutter: INFO|2022-02-21 18:30:08.968874|KeyChainUtil|Retrieved atsigns [@armadillocoffeesilky] from Keychain
flutter: initializing storage
flutter: INFO|2022-02-21 18:30:09.041720|HiveBase|commit_log_ad52aeee56c8222e8aaf6a2d172446b3f1a012d0b4db08ecbfc6105f483a73e9 initialized successfully
flutter: AtServer.getHiveSecretFromFile file found
flutter: INFO|2022-02-21 18:30:09.124781|HiveBase|ad52aeee56c8222e8aaf6a2d172446b3f1a012d0b4db08ecbfc6105f483a73e9 initialized successfully
flutter: INFO|2022-02-21 18:30:17.872313|AtLookup|auth success
flutter: INFO|2022-02-21 18:30:17.879295|KeyChainUtil|Retrieved atsigns [@armadillocoffeesilky] from Keychain
flutter: INFO|2022-02-21 18:30:17.896259|At Onboarding Flutter|Onboarding...!
flutter: INFO|2022-02-21 18:30:27.572672|Follows Widget|provider status is null
flutter: SEVERE|2022-02-21 18:30:27.650410|Connections Service|Fetching keys for @mangotangostable throws Exception: cached:public:image.wavi@mangotangostable does not exist in keystore
flutter: SEVERE|2022-02-21 18:30:27.653732|Connections Service|Fetching keys for @capitalistfriedchicken throws Exception: cached:public:image.wavi@capitalistfriedchicken does not exist in keystore
flutter: INFO|2022-02-21 18:30:27.669340|Follows Widget|provider status is Status.loading
flutter: INFO|2022-02-21 18:30:27.951379|Follows Widget|provider status is Status.done
flutter: INFO|2022-02-21 18:30:28.060894|Follows Widget|provider status is Status.done
flutter: INFO|2022-02-21 18:30:28.537594|AtLookup|auth success
flutter: INFO|2022-02-21 18:30:28.869095|SyncService|Returning the serverCommitId 511
flutter: INFO|2022-02-21 18:30:39.009500|Connections Service|Received notification:: id:-1 key:statsNotification.@armadillocoffeesilky operation:update from:@armadillocoffeesilky to:@armadillocoffeesilky

Logs without changes

Launching lib[/main.dart]() on iPhone 12 in debug mode...
lib/main.dart:1
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Xcode build done.                                           24.5s
Connecting to VM Service at ws://127.0.0.1:56773[/31iajWmazrE]()=[/ws]()
flutter: initialiazed notification service
flutter: INFO|2022-02-21 18:41:45.448631|KeyChainUtil|Retrieved atsigns [@armadillocoffeesilky] from Keychain
flutter: initializing storage
flutter: INFO|2022-02-21 18:41:45.485073|HiveBase|commit_log_ad52aeee56c8222e8aaf6a2d172446b3f1a012d0b4db08ecbfc6105f483a73e9 initialized successfully
flutter: AtServer.getHiveSecretFromFile file found
flutter: INFO|2022-02-21 18:41:45.519936|HiveBase|ad52aeee56c8222e8aaf6a2d172446b3f1a012d0b4db08ecbfc6105f483a73e9 initialized successfully
flutter: INFO|2022-02-21 18:41:54.188767|AtLookup|auth success
flutter: INFO|2022-02-21 18:41:54.195292|KeyChainUtil|Retrieved atsigns [@armadillocoffeesilky] from Keychain
flutter: INFO|2022-02-21 18:41:54.213303|At Onboarding Flutter|Onboarding...!
flutter: INFO|2022-02-21 18:42:03.015967|AtLookup|auth success
flutter: INFO|2022-02-21 18:42:03.268166|SyncService|Returning the serverCommitId 511
flutter: INFO|2022-02-21 18:44:48.131906|Follows Widget|provider status is null
flutter: INFO|2022-02-21 18:44:48.254972|Follows Widget|provider status is Status.error
@yahu1031 yahu1031 added the bug Something isn't working label Feb 21, 2022
@yahu1031 yahu1031 changed the title public:image.wavi@follower isn't being cached when we follow some atsigns public:image.wavi@follower isn't being cached when some @sign follow us Feb 21, 2022
@yahu1031 yahu1031 added the duplicate This issue or pull request already exists label Feb 21, 2022
@yahu1031 yahu1031 changed the title public:image.wavi@follower isn't being cached when some @sign follow us at_follows_flutter example fails to load Connections screen due to @Sign profile pics Feb 21, 2022
@yahu1031 yahu1031 added duplicate This issue or pull request already exists and removed duplicate This issue or pull request already exists labels Feb 21, 2022
@yahu1031 yahu1031 added the Fixed Bug fixed by the developer label Mar 7, 2022
@yahu1031
Copy link
Member Author

yahu1031 commented Mar 7, 2022

the main ticket has been closed, So closing this duplicate too.

@yahu1031 yahu1031 closed this as completed Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists Fixed Bug fixed by the developer
Projects
None yet
Development

No branches or pull requests

1 participant