diff --git a/lib/di_initialization.dart b/lib/di_initialization.dart index 5c1bbc5..3418071 100644 --- a/lib/di_initialization.dart +++ b/lib/di_initialization.dart @@ -53,7 +53,6 @@ Future dependencyInjectionInitialization() async { () => MediaUploadAttachmentHelper()); getIt.registerLazySingleton( () => NotificationsManager()); - galleryService.getGalleries(); getIt.registerLazySingleton( () => DirectMessageService()); getIt.registerLazySingleton( diff --git a/lib/screens/image_viewer_screen.dart b/lib/screens/image_viewer_screen.dart index c649d44..0241ce1 100644 --- a/lib/screens/image_viewer_screen.dart +++ b/lib/screens/image_viewer_screen.dart @@ -44,10 +44,8 @@ class _ImageViewerScreenState extends State { buildSnackbar(context, 'Downloading full image to save locally'); final appsDir = await getApplicationDocumentsDirectory(); final filename = p.basename(attachment.fullFileUri.path); - final bytesResult = await getIt() - .currentClient - .value - .getFileBytes(attachment.uri); + final bytesResult = + await getIt().currentClient.getFileBytes(attachment.uri); if (bytesResult.isFailure && mounted) { buildSnackbar(context, 'Error getting full size version of file: ${bytesResult.error}'); diff --git a/lib/screens/profile_screen.dart b/lib/screens/profile_screen.dart index ef9a5a7..dc79cbd 100644 --- a/lib/screens/profile_screen.dart +++ b/lib/screens/profile_screen.dart @@ -21,8 +21,7 @@ class _ProfileScreenState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - 'Profile: ${authService.currentClient.fold(onSuccess: (client) => client.credentials.handle, onError: (error) => 'Error Getting Profile')}'), + Text('Profile: ${authService.currentClient.credentials.handle}'), ], ), ), diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart index 3535b54..10ec5b8 100644 --- a/lib/services/auth_service.dart +++ b/lib/services/auth_service.dart @@ -13,19 +13,10 @@ class AuthService extends ChangeNotifier { FriendicaClient? _friendicaClient; bool _loggedIn = false; - Result get currentClient { - if (_friendicaClient == null) { - return Result.error(ExecError( - type: ErrorType.authentication, - message: 'Not logged in', - )); - } - - return Result.ok(_friendicaClient!); - } - bool get loggedIn => _loggedIn && _friendicaClient != null; + FriendicaClient get currentClient => _friendicaClient!; + String get currentId => _friendicaClient?.credentials.userId ?? ''; String get currentHandle => _friendicaClient?.credentials.handle ?? ''; diff --git a/lib/services/connections_manager.dart b/lib/services/connections_manager.dart index b05b77a..1cf43e3 100644 --- a/lib/services/connections_manager.dart +++ b/lib/services/connections_manager.dart @@ -43,10 +43,7 @@ class ConnectionsManager extends ChangeNotifier { Future acceptFollowRequest(Connection connection) async { _logger.finest( 'Attempting to accept follow request ${connection.name}: ${connection.status}'); - await getIt() - .currentClient - .andThenAsync((client) => client.acceptFollow(connection)) - .match( + await getIt().currentClient.acceptFollow(connection).match( onSuccess: (update) { _logger .finest('Successfully followed ${update.name}: ${update.status}'); @@ -62,10 +59,7 @@ class ConnectionsManager extends ChangeNotifier { Future rejectFollowRequest(Connection connection) async { _logger.finest( 'Attempting to accept follow request ${connection.name}: ${connection.status}'); - await getIt() - .currentClient - .andThenAsync((client) => client.rejectFollow(connection)) - .match( + await getIt().currentClient.rejectFollow(connection).match( onSuccess: (update) { _logger .finest('Successfully followed ${update.name}: ${update.status}'); @@ -81,10 +75,7 @@ class ConnectionsManager extends ChangeNotifier { Future ignoreFollowRequest(Connection connection) async { _logger.finest( 'Attempting to accept follow request ${connection.name}: ${connection.status}'); - await getIt() - .currentClient - .andThenAsync((client) => client.ignoreFollow(connection)) - .match( + await getIt().currentClient.ignoreFollow(connection).match( onSuccess: (update) { _logger .finest('Successfully followed ${update.name}: ${update.status}'); @@ -100,10 +91,7 @@ class ConnectionsManager extends ChangeNotifier { Future follow(Connection connection) async { _logger.finest( 'Attempting to follow ${connection.name}: ${connection.status}'); - await getIt() - .currentClient - .andThenAsync((client) => client.followConnection(connection)) - .match( + await getIt().currentClient.followConnection(connection).match( onSuccess: (update) { _logger .finest('Successfully followed ${update.name}: ${update.status}'); @@ -121,7 +109,7 @@ class ConnectionsManager extends ChangeNotifier { 'Attempting to unfollow ${connection.name}: ${connection.status}'); await getIt() .currentClient - .andThenAsync((client) => client.unFollowConnection(connection)) + .unFollowConnection(connection) .match( onSuccess: (update) { _logger @@ -141,13 +129,7 @@ class ConnectionsManager extends ChangeNotifier { Future updateAllContacts() async { _logger.fine('Updating all contacts'); - final clientResult = getIt().currentClient; - if (clientResult.isFailure) { - _logger.severe( - 'Unable to update contacts due to client error: ${clientResult.error}'); - return; - } - final client = clientResult.value; + final client = getIt().currentClient; final results = {}; var moreResults = true; var maxId = -1; @@ -224,8 +206,9 @@ class ConnectionsManager extends ChangeNotifier { FutureResult addUserToGroup( GroupData group, Connection connection) async { _logger.finest('Adding ${connection.name} to group: ${group.name}'); - final result = await getIt().currentClient.andThenAsync( - (client) => client.addConnectionToGroup(group, connection)); + final result = await getIt() + .currentClient + .addConnectionToGroup(group, connection); result.match( onSuccess: (_) => _refreshGroupListData(connection.id, true), onError: (error) { @@ -240,8 +223,9 @@ class ConnectionsManager extends ChangeNotifier { FutureResult removeUserFromGroup( GroupData group, Connection connection) async { _logger.finest('Removing ${connection.name} from group: ${group.name}'); - final result = await getIt().currentClient.andThenAsync( - (client) => client.removeConnectionFromGroup(group, connection)); + final result = await getIt() + .currentClient + .removeConnectionFromGroup(group, connection); result.match( onSuccess: (_) => _refreshGroupListData(connection.id, true), onError: (error) { @@ -291,7 +275,7 @@ class ConnectionsManager extends ChangeNotifier { _logger.finest('Refreshing member list data for Connection $id'); await getIt() .currentClient - .andThenAsync((client) => client.getMemberGroupsForConnection(id)) + .getMemberGroupsForConnection(id) .match( onSuccess: (groups) { groupsRepo.updateConnectionGroupData(id, groups); @@ -310,7 +294,7 @@ class ConnectionsManager extends ChangeNotifier { _logger.finest('Refreshing connection data for ${connection.name}'); await getIt() .currentClient - .andThenAsync((client) => client.getConnectionWithStatus(connection)) + .getConnectionWithStatus(connection) .match( onSuccess: (update) { updateConnection(update); @@ -326,10 +310,7 @@ class ConnectionsManager extends ChangeNotifier { Future _updateMyGroups(bool withNotification) async { _logger.finest('Refreshing my groups list'); - await getIt() - .currentClient - .andThenAsync((client) => client.getGroups()) - .match( + await getIt().currentClient.getGroups().match( onSuccess: (groups) { _logger.finest('Got updated groups:${groups.map((e) => e.name)}'); groupsRepo.clearGroups(); diff --git a/lib/services/direct_message_service.dart b/lib/services/direct_message_service.dart index 68dbe7a..dbf0235 100644 --- a/lib/services/direct_message_service.dart +++ b/lib/services/direct_message_service.dart @@ -38,7 +38,7 @@ class DirectMessageService extends ChangeNotifier { Future updateThreads() async { await getIt() .currentClient - .andThenAsync((client) => client.getDirectMessages(PagingData())) + .getDirectMessages(PagingData()) .match( onSuccess: (update) { final newThreads = DirectMessageThread.createThreads(update); @@ -61,13 +61,11 @@ class DirectMessageService extends ChangeNotifier { FutureResult newThread( Connection receiver, String text) async { - final result = await getIt() - .currentClient - .andThenAsync((client) => client.postDirectMessage( - null, - receiver.id, - text, - )); + final result = await getIt().currentClient.postDirectMessage( + null, + receiver.id, + text, + ); result.match(onSuccess: (newMessage) { DirectMessageThread.createThreads([newMessage]).forEach((thread) { _threads[thread.parentUri] = thread; @@ -101,13 +99,11 @@ class DirectMessageService extends ChangeNotifier { ); } - final result = await getIt() - .currentClient - .andThenAsync((client) => client.postDirectMessage( - original.id, - original.senderId, - text, - )); + final result = await getIt().currentClient.postDirectMessage( + original.id, + original.senderId, + text, + ); result.match(onSuccess: (newMessage) { thread.messages.add(newMessage); notifyListeners(); @@ -130,10 +126,7 @@ class DirectMessageService extends ChangeNotifier { return; } - await getIt() - .currentClient - .andThenAsync((client) => client.markDirectMessageRead(m)) - .match( + await getIt().currentClient.markDirectMessageRead(m).match( onSuccess: (update) { thread.messages.removeAt(oldIndex); thread.messages.insert(oldIndex, update); diff --git a/lib/services/entry_manager_service.dart b/lib/services/entry_manager_service.dart index cad902b..90460be 100644 --- a/lib/services/entry_manager_service.dart +++ b/lib/services/entry_manager_service.dart @@ -68,15 +68,7 @@ class EntryManagerService extends ChangeNotifier { FutureResult deleteEntryById(String id) async { _logger.finest('Delete entry: $id'); - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final result = await client.deleteEntryById(id); + final result = await getIt().currentClient.deleteEntryById(id); if (result.isFailure) { return result.errorCast(); } @@ -86,23 +78,14 @@ class EntryManagerService extends ChangeNotifier { return Result.ok(true); } - FutureResult createNewStatus( - String text, { + FutureResult createNewStatus(String text, { String spoilerText = '', String inReplyToId = '', required NewEntryMediaItems mediaItems, required List existingMediaItems, }) async { _logger.finest('Creating new post: $text'); - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - + final client = getIt().currentClient; final mediaIds = existingMediaItems.map((m) => m.scales.first.id).toList(); for (final item in mediaItems.attachments) { if (item.isExistingServerItem) { @@ -124,10 +107,11 @@ class EntryManagerService extends ChangeNotifier { } final uploadResult = - await MediaUploadAttachmentHelper.getUploadableImageBytes( + await MediaUploadAttachmentHelper.getUploadableImageBytes( item.localFilePath, ).andThenAsync( - (imageBytes) async => await client.uploadFileAsAttachment( + (imageBytes) async => + await client.uploadFileAsAttachment( bytes: imageBytes, album: mediaItems.albumName, description: item.description, @@ -145,10 +129,10 @@ class EntryManagerService extends ChangeNotifier { final result = await client .createNewStatus( - text: text, - spoilerText: spoilerText, - inReplyToId: inReplyToId, - mediaIds: mediaIds) + text: text, + spoilerText: spoilerText, + inReplyToId: inReplyToId, + mediaIds: mediaIds) .andThenSuccessAsync((item) async { await processNewItems([item], client.credentials.username, null); return item; @@ -169,7 +153,7 @@ class EntryManagerService extends ChangeNotifier { _logger.finest('${status.id} status created'); return true; }).mapError( - (error) { + (error) { _logger.finest('Error creating post: $error'); return ExecError( type: ErrorType.localError, @@ -182,14 +166,7 @@ class EntryManagerService extends ChangeNotifier { FutureResult, ExecError> updateTimeline( TimelineIdentifiers type, int maxId, int sinceId) async { _logger.fine(() => 'Updating timeline'); - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; + final client = getIt().currentClient; final itemsResult = await client.getTimeline( type: type, page: PagingData( @@ -203,10 +180,12 @@ class EntryManagerService extends ChangeNotifier { } itemsResult.value.sort((t1, t2) => t1.id.compareTo(t2.id)); - final updatedPosts = - await processNewItems(itemsResult.value, auth.currentId, client); + final updatedPosts = await processNewItems( + itemsResult.value, client.credentials.userId, client); _logger.finest(() { - final postCount = _entries.values.where((e) => e.parentId.isEmpty).length; + final postCount = _entries.values + .where((e) => e.parentId.isEmpty) + .length; final commentCount = _entries.length - postCount; final orphanCount = _entries.values .where( @@ -217,11 +196,9 @@ class EntryManagerService extends ChangeNotifier { return Result.ok(updatedPosts); } - Future> processNewItems( - List items, - String currentId, - FriendicaClient? client, - ) async { + Future> processNewItems(List items, + String currentId, + FriendicaClient? client,) async { items.sort((i1, i2) => int.parse(i1.id).compareTo(int.parse(i2.id))); final allSeenItems = [...items]; for (final item in items) { @@ -248,7 +225,9 @@ class EntryManagerService extends ChangeNotifier { await client ?.getPostOrComment(o.id, fullContext: true) .andThenSuccessAsync((items) async { - final parentPostId = items.firstWhere((e) => e.parentId.isEmpty).id; + final parentPostId = items + .firstWhere((e) => e.parentId.isEmpty) + .id; _parentPostIds[o.id] = parentPostId; allSeenItems.addAll(items); for (final item in items) { @@ -276,7 +255,7 @@ class EntryManagerService extends ChangeNotifier { for (final item in seenItemsCopy) { if (item.parentId.isEmpty) { final postNode = - _postNodes.putIfAbsent(item.id, () => _Node(item.id)); + _postNodes.putIfAbsent(item.id, () => _Node(item.id)); postNodesToReturn.add(postNode); allSeenItems.remove(item); } else { @@ -318,35 +297,31 @@ class EntryManagerService extends ChangeNotifier { .toList(); _logger.finest( - 'Completed processing new items ${client == null ? 'sub level' : 'top level'}'); + 'Completed processing new items ${client == null + ? 'sub level' + : 'top level'}'); return updatedPosts; } FutureResult refreshStatusChain(String id) async { _logger.finest('Refreshing post: $id'); - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; + final client = getIt().currentClient; final result = await client .getPostOrComment(id, fullContext: false) - .andThenAsync((rootItems) async => await client - .getPostOrComment(id, fullContext: true) - .andThenSuccessAsync( - (contextItems) async => [...rootItems, ...contextItems])) + .andThenAsync((rootItems) async => + await client + .getPostOrComment(id, fullContext: true) + .andThenSuccessAsync( + (contextItems) async => [...rootItems, ...contextItems])) .andThenSuccessAsync((items) async { await processNewItems(items, client.credentials.username, null); }); return result.mapValue((_) { _logger.finest('$id post updated'); - return _nodeToTreeItem(_getPostRootNode(id)!, auth.currentId); + return _nodeToTreeItem(_getPostRootNode(id)!, client.credentials.userId); }).mapError( - (error) { + (error) { _logger.finest('$id error updating: $error'); return ExecError( type: ErrorType.localError, @@ -358,24 +333,17 @@ class EntryManagerService extends ChangeNotifier { FutureResult resharePost(String id) async { _logger.finest('Resharing post: $id'); - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; + final client = getIt().currentClient; final result = - await client.resharePost(id).andThenSuccessAsync((item) async { + await client.resharePost(id).andThenSuccessAsync((item) async { await processNewItems([item], client.credentials.username, null); }); return result.mapValue((_) { _logger.finest('$id post updated after reshare'); - return _nodeToTreeItem(_postNodes[id]!, auth.currentId); + return _nodeToTreeItem(_postNodes[id]!, client.credentials.userId); }).mapError( - (error) { + (error) { _logger.finest('$id error updating: $error'); return ExecError( type: ErrorType.localError, @@ -387,16 +355,11 @@ class EntryManagerService extends ChangeNotifier { FutureResult unResharePost(String id) async { _logger.finest('Unresharing post: $id'); - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final result = - await client.unResharePost(id).andThenSuccessAsync((item) async { + final client = getIt() + .currentClient; + final result = await client + .unResharePost(id) + .andThenSuccessAsync((item) async { await processNewItems([item], client.credentials.username, null); }); @@ -410,16 +373,12 @@ class EntryManagerService extends ChangeNotifier { return Result.ok(true); } - FutureResult toggleFavorited( - String id, bool newStatus) async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - final client = clientResult.value; - final result = await client.changeFavoriteStatus(id, newStatus); + FutureResult toggleFavorited(String id, + bool newStatus) async { + final client = getIt() + .currentClient; + final result = await client + .changeFavoriteStatus(id, newStatus); if (result.isFailure) { return result.errorCast(); } @@ -431,7 +390,7 @@ class EntryManagerService extends ChangeNotifier { : _postNodes[update.parentId]!.getChildById(update.id)!; notifyListeners(); - return Result.ok(_nodeToTreeItem(node, auth.currentId)); + return Result.ok(_nodeToTreeItem(node, client.credentials.userId)); } EntryTreeItem _nodeToTreeItem(_Node node, String currentId) { @@ -508,7 +467,7 @@ class _Node { @override bool operator ==(Object other) => identical(this, other) || - other is _Node && runtimeType == other.runtimeType && id == other.id; + other is _Node && runtimeType == other.runtimeType && id == other.id; @override int get hashCode => id.hashCode; diff --git a/lib/services/gallery_service.dart b/lib/services/gallery_service.dart index 81726fa..4c23cdc 100644 --- a/lib/services/gallery_service.dart +++ b/lib/services/gallery_service.dart @@ -1,5 +1,4 @@ import 'package:flutter/foundation.dart'; -import 'package:logging/logging.dart'; import 'package:result_monad/result_monad.dart'; import '../friendica_client/paging_data.dart'; @@ -11,7 +10,6 @@ import 'auth_service.dart'; class GalleryService extends ChangeNotifier { static const IMAGES_PER_PAGE = 50; - static final _logger = Logger('$GalleryService'); final _galleries = {}; final _galleryPages = >{}; final _images = >{}; @@ -41,15 +39,7 @@ class GalleryService extends ChangeNotifier { } FutureResult, ExecError> updateGalleries() async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final result = await client.getGalleryData(); + final result = await getIt().currentClient.getGalleryData(); if (result.isFailure) { return result.errorCast(); } @@ -86,13 +76,6 @@ class GalleryService extends ChangeNotifier { {required String galleryName, required bool withNextPage, bool nextPageOnly = true}) async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - final pages = _galleryPages.putIfAbsent(galleryName, () => []); if (pages.isEmpty) { pages.add(PagingData(offset: 0, limit: IMAGES_PER_PAGE)); @@ -101,12 +84,13 @@ class GalleryService extends ChangeNotifier { pages.add(PagingData(offset: offset, limit: IMAGES_PER_PAGE)); } - final client = clientResult.value; final imageSet = _images.putIfAbsent(galleryName, () => {}); final pagesToUse = nextPageOnly ? [pages.last] : pages; for (final page in pagesToUse) { - final result = await client.getGalleryImages(galleryName, page); + final result = await getIt() + .currentClient + .getGalleryImages(galleryName, page); if (result.isFailure) { return result.errorCast(); } diff --git a/lib/services/interactions_manager.dart b/lib/services/interactions_manager.dart index dd5ddb7..e6761e2 100644 --- a/lib/services/interactions_manager.dart +++ b/lib/services/interactions_manager.dart @@ -1,5 +1,4 @@ import 'package:flutter/foundation.dart'; -import 'package:logging/logging.dart'; import 'package:result_monad/result_monad.dart'; import '../globals.dart'; @@ -8,7 +7,6 @@ import '../models/exec_error.dart'; import 'auth_service.dart'; class InteractionsManager extends ChangeNotifier { - static final _logger = Logger('$InteractionsManager'); final _likesByStatusId = >{}; final _resharesByStatusId = >{}; @@ -32,15 +30,8 @@ class InteractionsManager extends ChangeNotifier { FutureResult, ExecError> updateLikesForStatus( String statusId) async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final likesResult = await client.getLikes(statusId); + final likesResult = + await getIt().currentClient.getLikes(statusId); if (likesResult.isSuccess) { _likesByStatusId[statusId] = likesResult.value; notifyListeners(); @@ -50,15 +41,8 @@ class InteractionsManager extends ChangeNotifier { FutureResult, ExecError> updateResharesForStatus( String statusId) async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final resharesResult = await client.getReshares(statusId); + final resharesResult = + await getIt().currentClient.getReshares(statusId); if (resharesResult.isSuccess) { _resharesByStatusId[statusId] = resharesResult.value; notifyListeners(); diff --git a/lib/services/notifications_manager.dart b/lib/services/notifications_manager.dart index 3855be3..f6e74c9 100644 --- a/lib/services/notifications_manager.dart +++ b/lib/services/notifications_manager.dart @@ -127,15 +127,9 @@ class NotificationsManager extends ChangeNotifier { } FutureResult markSeen(UserNotification notification) async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final result = await client.clearNotification(notification); + final result = await getIt() + .currentClient + .clearNotification(notification); if (result.isSuccess) { notifyListeners(); } @@ -145,15 +139,8 @@ class NotificationsManager extends ChangeNotifier { } FutureResult, ExecError> markAllAsRead() async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final result = await client.clearNotifications(); + final result = + await getIt().currentClient.clearNotifications(); if (result.isFailure) { return result.errorCast(); } @@ -188,15 +175,8 @@ class NotificationsManager extends ChangeNotifier { static FutureResult>, ExecError> _clientGetNotificationsRequest(PagingData page) async { - final auth = getIt(); - final clientResult = auth.currentClient; - if (clientResult.isFailure) { - _logger.severe('Error getting Friendica client: ${clientResult.error}'); - return clientResult.errorCast(); - } - - final client = clientResult.value; - final result = await client.getNotifications(page); + final result = + await getIt().currentClient.getNotifications(page); return result; } } diff --git a/lib/services/timeline_manager.dart b/lib/services/timeline_manager.dart index 02baf3a..42fb888 100644 --- a/lib/services/timeline_manager.dart +++ b/lib/services/timeline_manager.dart @@ -45,10 +45,7 @@ class TimelineManager extends ChangeNotifier { Future _refreshGroupData() async { _logger.finest('Refreshing member group data '); - await getIt() - .currentClient - .andThenAsync((client) => client.getGroups()) - .match( + await getIt().currentClient.getGroups().match( onSuccess: (groups) { _groups.clear(); for (final group in groups) {