From f31eb62e2e643b697d54e9f1c3b974479fa5a273 Mon Sep 17 00:00:00 2001 From: Roscoe Rubin-Rottenberg Date: Sat, 9 May 2026 22:42:37 -0400 Subject: [PATCH] refactor: poptart migration --- .../data/models/aip_session_response.dart | 3 +- .../data/models/onboarding_screen_state.dart | 2 +- .../data/repositories/auth_repository.dart | 13 +- .../repositories/auth_repository_impl.dart | 27 ++--- .../identity_repository_impl.dart | 15 ++- .../repositories/onboarding_repository.dart | 2 +- .../onboarding_repository_impl.dart | 51 +++++--- .../data/adapters/bsky/actor_adapter.dart | 23 +++- .../data/adapters/bsky/feed_adapter.dart | 12 +- .../data/adapters/bsky/repo_adapter.dart | 2 +- .../atproto/data/models/actor_models.dart | 6 +- .../atproto/data/models/feed_models.dart | 6 +- .../atproto/data/models/labeler_models.dart | 4 +- .../data/models/notification_models.dart | 4 +- .../atproto/data/models/pref_models.dart | 2 +- .../atproto/data/models/record_models.dart | 6 +- .../atproto/data/models/sound_models.dart | 4 +- .../data/repositories/actor_repository.dart | 2 +- .../repositories/actor_repository_impl.dart | 23 ++-- .../data/repositories/feed_repository.dart | 6 +- .../repositories/feed_repository_impl.dart | 91 ++++++++------ .../data/repositories/graph_repository.dart | 2 +- .../repositories/graph_repository_impl.dart | 23 ++-- .../repositories/labeler_repository_impl.dart | 2 +- .../notification_repository_impl.dart | 2 +- .../repositories/pref_repository_impl.dart | 2 +- .../data/repositories/repo_repository.dart | 9 +- .../repositories/repo_repository_impl.dart | 110 +++++++++++------ .../data/repositories/sound_repository.dart | 4 +- .../repositories/sound_repository_impl.dart | 4 +- .../data/repositories/story_repository.dart | 6 +- .../repositories/story_repository_impl.dart | 6 +- .../network/xrpc/service_auth_helper.dart | 17 ++- .../models/sound_audio_track.dart | 4 +- .../models/video_editor_result.dart | 2 +- .../ui/video_editor_grounded_page.dart | 2 +- lib/src/core/routing/app_router.dart | 2 +- .../cache/download_manager_interface.dart | 2 +- lib/src/core/ui/widgets/report_dialog.dart | 8 +- lib/src/core/utils/label_utils.dart | 2 +- .../auth/providers/auth_providers.dart | 17 ++- .../features/auth/providers/auth_state.dart | 4 +- .../auth/providers/onboarding_providers.dart | 2 +- .../features/auth/ui/pages/register_page.dart | 2 +- .../providers/comment_input_provider.dart | 2 +- .../providers/comments_page_provider.dart | 2 +- .../comments/ui/pages/comments_page.dart | 2 +- .../ui/pages/crosspost_comments_page.dart | 2 +- .../comments/ui/pages/replies_page.dart | 2 +- .../comments/ui/widgets/comment_item.dart | 4 +- .../feed/providers/feed_provider.dart | 4 +- .../features/feed/providers/feed_state.dart | 4 +- .../features/feed/providers/like_post.dart | 4 +- .../features/feed/providers/repost_post.dart | 4 +- .../feed/ui/pages/standalone_post_page.dart | 2 +- .../action_buttons/side_action_bar.dart | 2 +- .../ui/widgets/post/feed_post_widget.dart | 2 +- .../feed/ui/widgets/post/post_overlay.dart | 2 +- .../messages/ui/widgets/messages_list.dart | 2 +- .../posting/providers/post_story.dart | 4 +- .../providers/video_upload_provider.dart | 6 +- .../posting/ui/pages/image_review_page.dart | 4 +- .../posting/ui/pages/story_post_page.dart | 2 +- .../posting/ui/pages/video_review_page.dart | 4 +- .../posting/utils/story_direct_post.dart | 2 +- .../providers/edit_profile_provider.dart | 24 ++-- .../providers/profile_feed_provider.dart | 2 +- .../profile/providers/profile_feed_state.dart | 4 +- .../providers/profile_likes_provider.dart | 2 +- .../profile/providers/profile_provider.dart | 8 +- .../providers/profile_reposts_provider.dart | 2 +- .../profile/providers/user_list_provider.dart | 2 +- .../profile/ui/pages/profile_page.dart | 2 +- .../ui/pages/standalone_likes_feed_page.dart | 2 +- .../pages/standalone_profile_feed_page.dart | 2 +- .../pages/standalone_reposts_feed_page.dart | 2 +- .../ui/widgets/profile_feed_post_widget.dart | 2 +- .../profile/ui/widgets/profile_grid_tab.dart | 2 +- .../ui/widgets/profile_grid_widget.dart | 2 +- .../profile/ui/widgets/profile_likes_tab.dart | 2 +- .../ui/widgets/profile_reposts_tab.dart | 2 +- .../providers/post_search_provider.dart | 36 ++++-- .../search/providers/search_provider.dart | 2 +- .../search/ui/pages/user_results.dart | 2 +- .../settings/providers/settings_provider.dart | 2 +- .../ui/pages/labeler_label_settings_page.dart | 2 +- .../sound/providers/sound_page_provider.dart | 2 +- .../features/sound/ui/pages/sound_page.dart | 2 +- .../providers/story_auto_delete_provider.dart | 17 ++- .../providers/story_manager_provider.dart | 17 ++- pubspec.lock | 114 +++++++++--------- pubspec.yaml | 19 +-- .../data/models/story_embed_models_test.dart | 2 +- .../ui/widgets/mention_input_field_test.dart | 2 +- .../auth_repository_impl_test.dart | 69 ++++++----- test/src/core/utils/label_utils_test.dart | 2 +- .../providers/conversation_provider_test.dart | 6 +- .../models/grouped_notification_test.dart | 2 +- 98 files changed, 537 insertions(+), 423 deletions(-) diff --git a/lib/src/core/auth/data/models/aip_session_response.dart b/lib/src/core/auth/data/models/aip_session_response.dart index 8730a02..0c8bc89 100644 --- a/lib/src/core/auth/data/models/aip_session_response.dart +++ b/lib/src/core/auth/data/models/aip_session_response.dart @@ -1,8 +1,7 @@ import 'dart:convert'; import 'dart:typed_data'; -import 'package:atproto_core/atproto_core.dart' show restoreOAuthSession; -import 'package:atproto_oauth/atproto_oauth.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/auth/data/models/auth_snapshot.dart'; class AipAtprotocolSessionResponse { diff --git a/lib/src/core/auth/data/models/onboarding_screen_state.dart b/lib/src/core/auth/data/models/onboarding_screen_state.dart index cd3ce5a..f6c42d0 100644 --- a/lib/src/core/auth/data/models/onboarding_screen_state.dart +++ b/lib/src/core/auth/data/models/onboarding_screen_state.dart @@ -1,6 +1,6 @@ import 'dart:typed_data'; -import 'package:bluesky/app_bsky_actor_profile.dart'; +import 'package:poptart_lex/app/bsky/actor/profile.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'onboarding_screen_state.freezed.dart'; diff --git a/lib/src/core/auth/data/repositories/auth_repository.dart b/lib/src/core/auth/data/repositories/auth_repository.dart index 1c9c646..00abb35 100644 --- a/lib/src/core/auth/data/repositories/auth_repository.dart +++ b/lib/src/core/auth/data/repositories/auth_repository.dart @@ -1,4 +1,4 @@ -import 'package:atproto/atproto.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/auth/data/models/login_result.dart'; /// Authentication repository interface for AT Protocol using OAuth @@ -22,7 +22,7 @@ abstract class AuthRepository { String? get pdsEndpoint; /// Gets the AT Protocol client - ATProto? get atproto; + PoptartClient? get atproto; /// Initiates the OAuth flow for the given handle /// @@ -31,13 +31,10 @@ abstract class AuthRepository { /// Returns the authorization URL that the user should be redirected to Future initiateOAuth(String handle); - /// Initiates the OAuth flow without a handle. + /// Initiates the OAuth flow without a login hint. /// - /// [service] is retained as a compatibility parameter and is ignored in - /// AIP-backed auth mode. - /// - /// Returns the authorization URL that the user should be redirected to - Future initiateOAuthWithService(String service); + /// Returns the authorization URL that the user should be redirected to. + Future initiateOAuthWithoutLoginHint(); /// Completes the OAuth flow after receiving the callback /// diff --git a/lib/src/core/auth/data/repositories/auth_repository_impl.dart b/lib/src/core/auth/data/repositories/auth_repository_impl.dart index 605d8ee..d3617b2 100644 --- a/lib/src/core/auth/data/repositories/auth_repository_impl.dart +++ b/lib/src/core/auth/data/repositories/auth_repository_impl.dart @@ -2,8 +2,9 @@ import 'dart:async'; import 'dart:convert'; import 'dart:math'; -import 'package:atproto/atproto.dart'; -import 'package:atproto_oauth/atproto_oauth.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/com/atproto/server/get_session.dart' + as server_get_session; import 'package:get_it/get_it.dart'; import 'package:http/http.dart' as http; import 'package:oauth2/oauth2.dart' as oauth2; @@ -17,7 +18,7 @@ import 'package:spark/src/core/utils/logging/log_service.dart'; import 'package:spark/src/core/utils/logging/logger.dart'; typedef AtprotoSessionFetcher = - Future<({String did, String handle})> Function(ATProto atproto); + Future<({String did, String handle})> Function(PoptartClient atproto); const String _redirectUriValue = 'sprk://oauth-callback'; const String _clientName = 'Spark Mobile App'; @@ -67,7 +68,7 @@ class AuthRepositoryImpl implements AuthRepository { int _authGeneration = 0; AuthSnapshot? _snapshot; OAuthSession? _oauthSession; - ATProto? _atProto; + PoptartClient? _atProto; String? _did; String? _handle; String? _pdsEndpoint; @@ -92,7 +93,7 @@ class AuthRepositoryImpl implements AuthRepository { String? get pdsEndpoint => _pdsEndpoint; @override - ATProto? get atproto => _atProto; + PoptartClient? get atproto => _atProto; Future _initialize() async { try { @@ -191,7 +192,7 @@ class AuthRepositoryImpl implements AuthRepository { _did = normalizedCache.did; _handle = normalizedCache.handle; _pdsEndpoint = normalizedCache.pdsEndpoint; - _atProto = ATProto.fromOAuthSession( + _atProto = PoptartClient.fromOAuthSession( _oauthSession!, service: Uri.parse(normalizedCache.pdsEndpoint).host, ); @@ -437,13 +438,7 @@ class AuthRepositoryImpl implements AuthRepository { } @override - Future initiateOAuthWithService(String service) async { - if (service.isNotEmpty) { - _logger.d( - 'Ignoring initiateOAuthWithService service hint in AIP auth mode: $service', - ); - } - + Future initiateOAuthWithoutLoginHint() async { return _startOAuthFlow(); } @@ -824,9 +819,11 @@ class AuthRepositoryImpl implements AuthRepository { } Future<({String did, String handle})> _defaultFetchSessionInfo( - ATProto atproto, + PoptartClient atproto, ) async { - final sessionResponse = await atproto.server.getSession(); + final sessionResponse = await atproto.call( + server_get_session.comAtprotoServerGetSession, + ); return (did: sessionResponse.data.did, handle: sessionResponse.data.handle); } diff --git a/lib/src/core/auth/data/repositories/identity_repository_impl.dart b/lib/src/core/auth/data/repositories/identity_repository_impl.dart index 78a6c4b..499911f 100644 --- a/lib/src/core/auth/data/repositories/identity_repository_impl.dart +++ b/lib/src/core/auth/data/repositories/identity_repository_impl.dart @@ -1,7 +1,9 @@ import 'dart:async'; import 'dart:convert'; -import 'package:atproto/atproto.dart'; +import 'package:poptart_lex/com/atproto/identity/resolve_handle.dart' + as identity_resolve_handle; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:http/http.dart' as http; @@ -243,9 +245,14 @@ class IdentityRepositoryImpl implements IdentityRepository { } Future _fetchAndCacheDid(String handle) async { - final atProto = ATProto.anonymous(service: 'public.api.bsky.app'); - - final resolveResult = await atProto.identity.resolveHandle(handle: handle); + final atProto = PoptartClient.anonymous(service: 'public.api.bsky.app'); + + final resolveResult = await atProto.call( + identity_resolve_handle.comAtprotoIdentityResolveHandle, + parameters: identity_resolve_handle.IdentityResolveHandleInput( + handle: handle, + ), + ); final did = resolveResult.data.did; _handleToDidCache[handle] = did; diff --git a/lib/src/core/auth/data/repositories/onboarding_repository.dart b/lib/src/core/auth/data/repositories/onboarding_repository.dart index c9c7ffb..c67ebab 100644 --- a/lib/src/core/auth/data/repositories/onboarding_repository.dart +++ b/lib/src/core/auth/data/repositories/onboarding_repository.dart @@ -1,4 +1,4 @@ -import 'package:bluesky/app_bsky_actor_profile.dart'; +import 'package:poptart_lex/app/bsky/actor/profile.dart'; import 'package:spark/src/core/network/atproto/data/models/graph_models.dart'; abstract class OnboardingRepository { diff --git a/lib/src/core/auth/data/repositories/onboarding_repository_impl.dart b/lib/src/core/auth/data/repositories/onboarding_repository_impl.dart index 633ea02..7235021 100644 --- a/lib/src/core/auth/data/repositories/onboarding_repository_impl.dart +++ b/lib/src/core/auth/data/repositories/onboarding_repository_impl.dart @@ -1,9 +1,13 @@ import 'dart:typed_data'; +import 'package:poptart_lex/app/bsky/actor/get_profile.dart' + as bsky_actor_get_profile; +import 'package:poptart_lex/app/bsky/graph/get_follows.dart' + as bsky_graph_get_follows; +import 'package:poptart_lex/com/atproto/repo/get_record.dart' + as repo_get_record; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/app/bsky/actor/profile.dart'; -import 'package:atproto/atproto.dart'; -import 'package:atproto/core.dart'; -import 'package:bluesky/app_bsky_actor_profile.dart'; -import 'package:bluesky/bluesky.dart' as bs; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; import 'package:spark/src/core/auth/data/repositories/onboarding_repository.dart'; @@ -26,7 +30,7 @@ class OnboardingRepositoryImpl implements OnboardingRepository { ); String? get _did => _authRepository.did; - ATProto? get _atproto => _authRepository.atproto; + PoptartClient? get _atproto => _authRepository.atproto; @override Future hasSparkProfile() async { @@ -68,10 +72,13 @@ class OnboardingRepositoryImpl implements OnboardingRepository { } final uri = AtUri.parse('at://$_did/app.bsky.actor.profile/self'); - final response = await atproto.repo.getRecord( - repo: uri.hostname, - collection: uri.collection.toString(), - rkey: uri.rkey, + final response = await atproto.call( + repo_get_record.comAtprotoRepoGetRecord, + parameters: repo_get_record.RepoGetRecordInput( + repo: uri.hostname, + collection: uri.collection.toString(), + rkey: uri.rkey, + ), ); return ActorProfileRecord.fromJson(response.data.value); @@ -100,8 +107,11 @@ class OnboardingRepositoryImpl implements OnboardingRepository { return null; } - final bluesky = bs.Bluesky.fromOAuthSession(oauthSession); - final profile = await bluesky.actor.getProfile(actor: _did!); + final bluesky = PoptartClient.fromOAuthSession(oauthSession); + final profile = await bluesky.call( + bsky_actor_get_profile.appBskyActorGetProfile, + parameters: bsky_actor_get_profile.ActorGetProfileInput(actor: _did!), + ); return profile.data.avatar; } catch (e, s) { @@ -167,15 +177,18 @@ class OnboardingRepositoryImpl implements OnboardingRepository { throw Exception('Not authenticated'); } - // Use the ATProto client's OAuth session if available, otherwise anonymous + // Use the PoptartClient client's OAuth session if available, otherwise anonymous final bsky = _atproto!.oAuthSession != null - ? bs.Bluesky.fromOAuthSession(_atproto!.oAuthSession!) - : bs.Bluesky.anonymous(); - - final response = await bsky.graph.getFollows( - actor: _did!, - limit: 100, - cursor: cursor, + ? PoptartClient.fromOAuthSession(_atproto!.oAuthSession!) + : PoptartClient.anonymous(); + + final response = await bsky.call( + bsky_graph_get_follows.appBskyGraphGetFollows, + parameters: bsky_graph_get_follows.GraphGetFollowsInput( + actor: _did!, + limit: 100, + cursor: cursor, + ), ); // Convert raw data to our structured model diff --git a/lib/src/core/network/atproto/data/adapters/bsky/actor_adapter.dart b/lib/src/core/network/atproto/data/adapters/bsky/actor_adapter.dart index 5eac069..d9ce30f 100644 --- a/lib/src/core/network/atproto/data/adapters/bsky/actor_adapter.dart +++ b/lib/src/core/network/atproto/data/adapters/bsky/actor_adapter.dart @@ -1,4 +1,9 @@ -import 'package:bluesky/bluesky.dart' as bsky; +import 'package:poptart_lex/app/bsky/actor/get_profile.dart' + as bsky_actor_get_profile; +import 'package:poptart_lex/app/bsky/actor/get_profiles.dart' + as bsky_actor_get_profiles; +import 'package:poptart/poptart.dart'; + import 'package:spark/src/core/network/atproto/data/models/models.dart'; /// Adapter for Bluesky actor models <-> Spark actor models @@ -14,19 +19,25 @@ class BskyActorAdapter { /// Get a single profile from Bluesky and convert to Spark format Future getProfileFromBluesky( - bsky.Bluesky bluesky, + PoptartClient bluesky, String did, ) async { - final profile = await bluesky.actor.getProfile(actor: did); + final profile = await bluesky.call( + bsky_actor_get_profile.appBskyActorGetProfile, + parameters: bsky_actor_get_profile.ActorGetProfileInput(actor: did), + ); return convertBskyProfileToSpark(profile.data.toJson()); } /// Get multiple profiles from Bluesky and convert to Spark format Future> getProfilesFromBluesky( - bsky.Bluesky bluesky, + PoptartClient bluesky, List dids, ) async { - final profiles = await bluesky.actor.getProfiles(actors: dids); + final profiles = await bluesky.call( + bsky_actor_get_profiles.appBskyActorGetProfiles, + parameters: bsky_actor_get_profiles.ActorGetProfilesInput(actors: dids), + ); return profiles.data.profiles .map((p) => convertBskyProfileToSpark(p.toJson())) .toList(); @@ -59,7 +70,7 @@ class BskyActorAdapter { /// /// Use this instance for all actor/profile model conversions: /// ```dart -/// final bluesky = Bluesky.fromSession(session); +/// final bluesky = PoptartClient.fromOAuthSession(session); /// final profile = await bskyActorAdapter.getProfileFromBluesky(bluesky, did); /// ``` const bskyActorAdapter = BskyActorAdapter(); diff --git a/lib/src/core/network/atproto/data/adapters/bsky/feed_adapter.dart b/lib/src/core/network/atproto/data/adapters/bsky/feed_adapter.dart index c4383d5..b4b06b7 100644 --- a/lib/src/core/network/atproto/data/adapters/bsky/feed_adapter.dart +++ b/lib/src/core/network/atproto/data/adapters/bsky/feed_adapter.dart @@ -1,11 +1,11 @@ import 'dart:convert'; -import 'package:atproto_core/atproto_core.dart'; -import 'package:bluesky/app_bsky_embed_images.dart'; -import 'package:bluesky/app_bsky_feed_defs.dart' as bsky_defs; -import 'package:bluesky/app_bsky_feed_getpostthread.dart'; -import 'package:bluesky/app_bsky_feed_post.dart'; -import 'package:bluesky/app_bsky_richtext_facet.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/app/bsky/embed/images.dart'; +import 'package:poptart_lex/app/bsky/feed/defs.dart' as bsky_defs; +import 'package:poptart_lex/app/bsky/feed/get_post_thread.dart'; +import 'package:poptart_lex/app/bsky/feed/post.dart'; +import 'package:poptart_lex/app/bsky/richtext/facet.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart' hide ReplyRef; import 'package:spark/src/core/utils/json_utils.dart'; diff --git a/lib/src/core/network/atproto/data/adapters/bsky/repo_adapter.dart b/lib/src/core/network/atproto/data/adapters/bsky/repo_adapter.dart index 4fbbcb4..a1b9999 100644 --- a/lib/src/core/network/atproto/data/adapters/bsky/repo_adapter.dart +++ b/lib/src/core/network/atproto/data/adapters/bsky/repo_adapter.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; /// Callback type for deleting a record typedef DeleteRecordCallback = diff --git a/lib/src/core/network/atproto/data/models/actor_models.dart b/lib/src/core/network/atproto/data/models/actor_models.dart index 731ca94..43c5826 100644 --- a/lib/src/core/network/atproto/data/models/actor_models.dart +++ b/lib/src/core/network/atproto/data/models/actor_models.dart @@ -1,6 +1,6 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/utils/uri_converter.dart'; diff --git a/lib/src/core/network/atproto/data/models/feed_models.dart b/lib/src/core/network/atproto/data/models/feed_models.dart index 3777475..a10a5ef 100644 --- a/lib/src/core/network/atproto/data/models/feed_models.dart +++ b/lib/src/core/network/atproto/data/models/feed_models.dart @@ -1,6 +1,6 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto_core/atproto_core.dart'; -import 'package:bluesky/app_bsky_feed_getpostthread.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/app/bsky/feed/get_post_thread.dart'; import 'package:flutter/foundation.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/adapters/bsky/feed_adapter.dart'; diff --git a/lib/src/core/network/atproto/data/models/labeler_models.dart b/lib/src/core/network/atproto/data/models/labeler_models.dart index 4ca11d6..88125c9 100644 --- a/lib/src/core/network/atproto/data/models/labeler_models.dart +++ b/lib/src/core/network/atproto/data/models/labeler_models.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/actor_models.dart'; diff --git a/lib/src/core/network/atproto/data/models/notification_models.dart b/lib/src/core/network/atproto/data/models/notification_models.dart index 84bc7d6..795be52 100644 --- a/lib/src/core/network/atproto/data/models/notification_models.dart +++ b/lib/src/core/network/atproto/data/models/notification_models.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/actor_models.dart'; diff --git a/lib/src/core/network/atproto/data/models/pref_models.dart b/lib/src/core/network/atproto/data/models/pref_models.dart index e5dce17..87693ad 100644 --- a/lib/src/core/network/atproto/data/models/pref_models.dart +++ b/lib/src/core/network/atproto/data/models/pref_models.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'pref_models.freezed.dart'; diff --git a/lib/src/core/network/atproto/data/models/record_models.dart b/lib/src/core/network/atproto/data/models/record_models.dart index 5a8421c..9d08d27 100644 --- a/lib/src/core/network/atproto/data/models/record_models.dart +++ b/lib/src/core/network/atproto/data/models/record_models.dart @@ -1,6 +1,6 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/core/network/atproto/data/models/sound_models.dart b/lib/src/core/network/atproto/data/models/sound_models.dart index 16363bf..832ad5c 100644 --- a/lib/src/core/network/atproto/data/models/sound_models.dart +++ b/lib/src/core/network/atproto/data/models/sound_models.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; import 'package:spark/src/core/utils/uri_converter.dart'; diff --git a/lib/src/core/network/atproto/data/repositories/actor_repository.dart b/lib/src/core/network/atproto/data/repositories/actor_repository.dart index 9cff9ae..a3521b2 100644 --- a/lib/src/core/network/atproto/data/repositories/actor_repository.dart +++ b/lib/src/core/network/atproto/data/repositories/actor_repository.dart @@ -1,4 +1,4 @@ -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/actor_models.dart'; /// Interface for Actor-related API endpoints diff --git a/lib/src/core/network/atproto/data/repositories/actor_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/actor_repository_impl.dart index 3274ba1..ca47bd5 100644 --- a/lib/src/core/network/atproto/data/repositories/actor_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/actor_repository_impl.dart @@ -1,7 +1,9 @@ import 'dart:convert'; -import 'package:atproto/core.dart'; -import 'package:bluesky/bluesky.dart' as bsky; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/com/atproto/repo/put_record.dart' + as repo_put_record; + import 'package:get_it/get_it.dart'; import 'package:http/http.dart' as http; import 'package:spark/src/core/config/app_config.dart'; @@ -46,7 +48,7 @@ class ActorRepositoryImpl implements ActorRepository { if (oauthSession == null) { throw Exception('No OAuth session available'); } - final blueskyClient = bsky.Bluesky.fromOAuthSession(oauthSession); + final blueskyClient = PoptartClient.fromOAuthSession(oauthSession); final profile = await bskyActorAdapter.getProfileFromBluesky( blueskyClient, did, @@ -207,11 +209,14 @@ class ActorRepositoryImpl implements ActorRepository { throw Exception('User DID not available'); } - await atproto.repo.putRecord( - repo: did, - collection: 'so.sprk.actor.profile', - rkey: 'self', - record: record.toJson(), + await atproto.call( + repo_put_record.comAtprotoRepoPutRecord, + input: repo_put_record.RepoPutRecordInput( + repo: did, + collection: 'so.sprk.actor.profile', + rkey: 'self', + record: record.toJson(), + ), ); } @@ -271,7 +276,7 @@ class ActorRepositoryImpl implements ActorRepository { if (oauthSession == null) { throw Exception('No OAuth session available'); } - final blueskyClient = bsky.Bluesky.fromOAuthSession(oauthSession); + final blueskyClient = PoptartClient.fromOAuthSession(oauthSession); final profiles = await bskyActorAdapter.getProfilesFromBluesky( blueskyClient, dids, diff --git a/lib/src/core/network/atproto/data/repositories/feed_repository.dart b/lib/src/core/network/atproto/data/repositories/feed_repository.dart index 6bba7d3..eba6f45 100644 --- a/lib/src/core/network/atproto/data/repositories/feed_repository.dart +++ b/lib/src/core/network/atproto/data/repositories/feed_repository.dart @@ -1,6 +1,6 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:image_picker/image_picker.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/core/network/atproto/data/repositories/feed_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/feed_repository_impl.dart index 9147eee..a9969ca 100644 --- a/lib/src/core/network/atproto/data/repositories/feed_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/feed_repository_impl.dart @@ -4,13 +4,21 @@ import 'dart:io'; import 'dart:typed_data'; import 'dart:ui' as ui; -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/atproto.dart'; -import 'package:atproto/core.dart'; -import 'package:bluesky/app_bsky_feed_getauthorfeed.dart'; -import 'package:bluesky/app_bsky_richtext_facet.dart'; -import 'package:bluesky/bluesky.dart' as bsky; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/app/bsky/feed/get_author_feed.dart' + as bsky_feed_get_author_feed; +import 'package:poptart_lex/app/bsky/feed/get_posts.dart' + as bsky_feed_get_posts; +import 'package:poptart_lex/app/bsky/feed/get_post_thread.dart' + as bsky_feed_get_post_thread; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart_lex/com/atproto/repo/upload_blob.dart' + as repo_upload_blob; +import 'package:poptart_lex/com/atproto/server/get_service_auth.dart' + as server_get_service_auth; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/app/bsky/richtext/facet.dart'; + import 'package:get_it/get_it.dart'; import 'package:http/http.dart' as http; import 'package:image/image.dart' as img; @@ -167,8 +175,11 @@ class FeedRepositoryImpl implements FeedRepository { if (oauthSession == null) { throw Exception('No OAuth session available'); } - final blueskyClient = bsky.Bluesky.fromOAuthSession(oauthSession); - final posts = await blueskyClient.feed.getPosts(uris: uris); + final blueskyClient = PoptartClient.fromOAuthSession(oauthSession); + final posts = await blueskyClient.call( + bsky_feed_get_posts.appBskyFeedGetPosts, + parameters: bsky_feed_get_posts.FeedGetPostsInput(uris: uris), + ); // Use adapter to process Bluesky posts return bskyFeedAdapter.processBskyPosts( @@ -342,14 +353,17 @@ class FeedRepositoryImpl implements FeedRepository { if (oauthSession == null) { throw Exception('No OAuth session available'); } - final resultBsky = await bsky.Bluesky.fromOAuthSession(oauthSession) - .feed - .getAuthorFeed( - actor: actorUri.hostname, - limit: limit, - cursor: cursor, - filter: FeedGetAuthorFeedFilter.valueOf( - videosOnly ? 'posts_with_video' : 'posts_with_media', + final resultBsky = await PoptartClient.fromOAuthSession(oauthSession) + .call( + bsky_feed_get_author_feed.appBskyFeedGetAuthorFeed, + parameters: bsky_feed_get_author_feed.FeedGetAuthorFeedInput( + actor: actorUri.hostname, + limit: limit, + cursor: cursor, + filter: + bsky_feed_get_author_feed.FeedGetAuthorFeedFilter.valueOf( + videosOnly ? 'posts_with_video' : 'posts_with_media', + ), ), ); @@ -1089,8 +1103,11 @@ class FeedRepositoryImpl implements FeedRepository { _logger.e('AtProto not initialized'); throw Exception('AtProto not initialized'); case final atproto: - final response = await atproto.repo.uploadBlob( - bytes: processedBytes, + final response = await atproto.post( + repo_upload_blob.comAtprotoRepoUploadBlob.nsid, + body: processedBytes, + to: const repo_upload_blob.RepoUploadBlobOutputConverter() + .fromJson, ); switch (response.status.code) { @@ -1510,16 +1527,19 @@ class FeedRepositoryImpl implements FeedRepository { } } - Future _requestVideoServiceAuthToken(ATProto atproto) async { - final serviceTokenRes = await atproto.server.getServiceAuth( - aud: 'did:web:${atproto.service}', - lxm: 'com.atproto.repo.uploadBlob', - exp: - DateTime.now() - .toUtc() - .add(const Duration(minutes: 5)) - .millisecondsSinceEpoch ~/ - 1000, + Future _requestVideoServiceAuthToken(PoptartClient atproto) async { + final serviceTokenRes = await atproto.call( + server_get_service_auth.comAtprotoServerGetServiceAuth, + parameters: server_get_service_auth.ServerGetServiceAuthInput( + aud: 'did:web:${atproto.service}', + lxm: 'com.atproto.repo.uploadBlob', + exp: + DateTime.now() + .toUtc() + .add(const Duration(minutes: 5)) + .millisecondsSinceEpoch ~/ + 1000, + ), ); return serviceTokenRes.data.token; @@ -1678,11 +1698,14 @@ class FeedRepositoryImpl implements FeedRepository { if (oauthSession == null) { throw Exception('No OAuth session available'); } - final bluesky = bsky.Bluesky.fromOAuthSession(oauthSession); - final response = await bluesky.feed.getPostThread( - uri: uri, - depth: depth, - parentHeight: parentHeight, + final bluesky = PoptartClient.fromOAuthSession(oauthSession); + final response = await bluesky.call( + bsky_feed_get_post_thread.appBskyFeedGetPostThread, + parameters: bsky_feed_get_post_thread.FeedGetPostThreadInput( + uri: uri, + depth: depth, + parentHeight: parentHeight, + ), ); // Use adapter to convert Bluesky thread to Spark thread return bskyFeedAdapter.convertBskyThreadToSparkThread( diff --git a/lib/src/core/network/atproto/data/repositories/graph_repository.dart b/lib/src/core/network/atproto/data/repositories/graph_repository.dart index 9556dc9..4962f6f 100644 --- a/lib/src/core/network/atproto/data/repositories/graph_repository.dart +++ b/lib/src/core/network/atproto/data/repositories/graph_repository.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/graph_models.dart'; /// Interface for Graph-related API endpoints diff --git a/lib/src/core/network/atproto/data/repositories/graph_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/graph_repository_impl.dart index f466df2..3a1e6b7 100644 --- a/lib/src/core/network/atproto/data/repositories/graph_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/graph_repository_impl.dart @@ -1,6 +1,7 @@ import 'dart:convert'; - -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/com/atproto/repo/list_records.dart' + as repo_list_records; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/network/atproto/data/models/graph_models.dart'; import 'package:spark/src/core/network/atproto/data/repositories/graph_repository.dart'; @@ -159,9 +160,12 @@ class GraphRepositoryImpl implements GraphRepository { try { _logger.d('Checking if already following user: $did'); - final existingFollows = await atproto.repo.listRecords( - repo: sessionDid, - collection: collection, + final existingFollows = await atproto.call( + repo_list_records.comAtprotoRepoListRecords, + parameters: repo_list_records.RepoListRecordsInput( + repo: sessionDid, + collection: collection, + ), ); final isAlreadyFollowing = existingFollows.data.records.any( @@ -294,9 +298,12 @@ class GraphRepositoryImpl implements GraphRepository { try { _logger.d('Checking if already blocking user: $did'); - final existingBlocks = await atproto.repo.listRecords( - repo: sessionDid, - collection: collection, + final existingBlocks = await atproto.call( + repo_list_records.comAtprotoRepoListRecords, + parameters: repo_list_records.RepoListRecordsInput( + repo: sessionDid, + collection: collection, + ), ); final isAlreadyBlocking = existingBlocks.data.records.any( diff --git a/lib/src/core/network/atproto/data/repositories/labeler_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/labeler_repository_impl.dart index e2111f6..8d692b7 100644 --- a/lib/src/core/network/atproto/data/repositories/labeler_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/labeler_repository_impl.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/network/atproto/data/models/labeler_models.dart'; import 'package:spark/src/core/network/atproto/data/repositories/labeler_repository.dart'; diff --git a/lib/src/core/network/atproto/data/repositories/notification_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/notification_repository_impl.dart index 26ea59f..ee0d625 100644 --- a/lib/src/core/network/atproto/data/repositories/notification_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/notification_repository_impl.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/network/atproto/data/models/notification_models.dart'; import 'package:spark/src/core/network/atproto/data/repositories/notification_repository.dart'; diff --git a/lib/src/core/network/atproto/data/repositories/pref_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/pref_repository_impl.dart index 394dc33..20b9333 100644 --- a/lib/src/core/network/atproto/data/repositories/pref_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/pref_repository_impl.dart @@ -1,5 +1,5 @@ import 'dart:convert'; -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/network/atproto/data/models/pref_models.dart'; diff --git a/lib/src/core/network/atproto/data/repositories/repo_repository.dart b/lib/src/core/network/atproto/data/repositories/repo_repository.dart index bc181c3..09c8f79 100644 --- a/lib/src/core/network/atproto/data/repositories/repo_repository.dart +++ b/lib/src/core/network/atproto/data/repositories/repo_repository.dart @@ -1,8 +1,7 @@ import 'dart:typed_data'; -import 'package:atproto/com_atproto_moderation_createreport.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/com_atproto_services.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/moderation/create_report.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/record_models.dart'; /// Interface for Repository-related API endpoints @@ -70,6 +69,6 @@ abstract class RepoRepository { /// Returns true if the report was successfully created Future createReport({ required ModerationCreateReportInput input, - ModerationService? service, + dynamic service, }); } diff --git a/lib/src/core/network/atproto/data/repositories/repo_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/repo_repository_impl.dart index c17af92..9b58c73 100644 --- a/lib/src/core/network/atproto/data/repositories/repo_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/repo_repository_impl.dart @@ -1,9 +1,19 @@ import 'dart:typed_data'; - -import 'package:atproto/com_atproto_moderation_createreport.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/com_atproto_services.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/moderation/create_report.dart'; +import 'package:poptart_lex/com/atproto/repo/create_record.dart' + as repo_create_record; +import 'package:poptart_lex/com/atproto/repo/delete_record.dart' + as repo_delete_record; +import 'package:poptart_lex/com/atproto/repo/get_record.dart' + as repo_get_record; +import 'package:poptart_lex/com/atproto/repo/list_records.dart' + as repo_list_records; +import 'package:poptart_lex/com/atproto/repo/put_record.dart' + as repo_put_record; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart_lex/com/atproto/repo/upload_blob.dart' + as repo_upload_blob; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/network/atproto/data/adapters/bsky/repo_adapter.dart'; import 'package:spark/src/core/network/atproto/data/models/record_models.dart'; @@ -35,10 +45,13 @@ class RepoRepositoryImpl implements RepoRepository { _logger.e('AtProto not initialized'); throw Exception('AtProto not initialized'); } - final result = await atproto.repo.getRecord( - repo: uri.hostname, - collection: uri.collection.toString(), - rkey: uri.rkey, + final result = await atproto.call( + repo_get_record.comAtprotoRepoGetRecord, + parameters: repo_get_record.RepoGetRecordInput( + repo: uri.hostname, + collection: uri.collection.toString(), + rkey: uri.rkey, + ), ); _logger.d('Record retrieved successfully'); return ( @@ -67,11 +80,14 @@ class RepoRepositoryImpl implements RepoRepository { _logger.e('AtProto not initialized'); throw Exception('AtProto not initialized'); } - final result = await atproto.repo.putRecord( - repo: uri.hostname, - collection: uri.collection.toString(), - rkey: uri.rkey, - record: record.toJson(), + final result = await atproto.call( + repo_put_record.comAtprotoRepoPutRecord, + input: repo_put_record.RepoPutRecordInput( + repo: uri.hostname, + collection: uri.collection.toString(), + rkey: uri.rkey, + record: record.toJson(), + ), ); _logger.d('Record edited successfully'); return RepoStrongRef(uri: result.data.uri, cid: result.data.cid); @@ -100,11 +116,14 @@ class RepoRepositoryImpl implements RepoRepository { throw Exception('User session DID not available'); } - final result = await atproto.repo.createRecord( - repo: repoDid, - collection: collection, - record: record, - rkey: rkey, + final result = await atproto.call( + repo_create_record.comAtprotoRepoCreateRecord, + input: repo_create_record.RepoCreateRecordInput( + repo: repoDid, + collection: collection, + record: record, + rkey: rkey, + ), ); _logger.d('Record created successfully'); return RepoStrongRef(uri: result.data.uri, cid: result.data.cid); @@ -124,10 +143,13 @@ class RepoRepositoryImpl implements RepoRepository { throw Exception('AtProto not initialized'); } - await atproto.repo.deleteRecord( - repo: uri.hostname, - collection: uri.collection.toString(), - rkey: uri.rkey, + await atproto.call( + repo_delete_record.comAtprotoRepoDeleteRecord, + input: repo_delete_record.RepoDeleteRecordInput( + repo: uri.hostname, + collection: uri.collection.toString(), + rkey: uri.rkey, + ), ); _logger.d('Record deleted successfully'); @@ -136,11 +158,20 @@ class RepoRepositoryImpl implements RepoRepository { final blueskyUri = bskyRepoAdapter.buildBlueskyCounterpartUri(uri); _logger.d('Attempting to delete Bluesky counterpart post: $blueskyUri'); - final deleted = await bskyRepoAdapter.deleteBlueskyCounterpart( - ({required repo, required collection, required rkey}) => atproto.repo - .deleteRecord(repo: repo, collection: collection, rkey: rkey), - uri, - ); + final deleted = await bskyRepoAdapter.deleteBlueskyCounterpart(({ + required repo, + required collection, + required rkey, + }) async { + await atproto.call( + repo_delete_record.comAtprotoRepoDeleteRecord, + input: repo_delete_record.RepoDeleteRecordInput( + repo: repo, + collection: collection, + rkey: rkey, + ), + ); + }, uri); if (deleted) { _logger.d('Bluesky counterpart post deleted successfully'); @@ -166,7 +197,11 @@ class RepoRepositoryImpl implements RepoRepository { throw Exception('AtProto not initialized'); } - final result = await atproto.repo.uploadBlob(bytes: data); + final result = await atproto.post( + repo_upload_blob.comAtprotoRepoUploadBlob.nsid, + body: data, + to: const repo_upload_blob.RepoUploadBlobOutputConverter().fromJson, + ); _logger.d('Blob uploaded successfully'); return result.data.blob; @@ -194,12 +229,15 @@ class RepoRepositoryImpl implements RepoRepository { throw Exception('AtProto not initialized'); } - final result = await atproto.repo.listRecords( - repo: repo, - collection: collection, - cursor: cursor, - limit: limit, - reverse: reverse, + final result = await atproto.call( + repo_list_records.comAtprotoRepoListRecords, + parameters: repo_list_records.RepoListRecordsInput( + repo: repo, + collection: collection, + cursor: cursor, + limit: limit ?? 50, + reverse: reverse ?? false, + ), ); _logger.d('Records listed successfully'); @@ -215,7 +253,7 @@ class RepoRepositoryImpl implements RepoRepository { @override Future createReport({ required ModerationCreateReportInput input, - ModerationService? service, + dynamic service, }) async { _logger.i('Creating moderation report for reason: ${input.reasonType}'); diff --git a/lib/src/core/network/atproto/data/repositories/sound_repository.dart b/lib/src/core/network/atproto/data/repositories/sound_repository.dart index 5bdd549..44c59d1 100644 --- a/lib/src/core/network/atproto/data/repositories/sound_repository.dart +++ b/lib/src/core/network/atproto/data/repositories/sound_repository.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; abstract class SoundRepository { diff --git a/lib/src/core/network/atproto/data/repositories/sound_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/sound_repository_impl.dart index 62b2501..574c0d7 100644 --- a/lib/src/core/network/atproto/data/repositories/sound_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/sound_repository_impl.dart @@ -1,7 +1,7 @@ import 'dart:convert'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; import 'package:spark/src/core/network/atproto/data/repositories/sound_repository.dart'; diff --git a/lib/src/core/network/atproto/data/repositories/story_repository.dart b/lib/src/core/network/atproto/data/repositories/story_repository.dart index 0163208..b38c7c4 100644 --- a/lib/src/core/network/atproto/data/repositories/story_repository.dart +++ b/lib/src/core/network/atproto/data/repositories/story_repository.dart @@ -1,6 +1,6 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; /// Interface for Story-related API endpoints diff --git a/lib/src/core/network/atproto/data/repositories/story_repository_impl.dart b/lib/src/core/network/atproto/data/repositories/story_repository_impl.dart index 3dabf2f..bd6ec66 100644 --- a/lib/src/core/network/atproto/data/repositories/story_repository_impl.dart +++ b/lib/src/core/network/atproto/data/repositories/story_repository_impl.dart @@ -1,6 +1,6 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; import 'package:spark/src/core/network/atproto/data/repositories/sprk_repository.dart'; import 'package:spark/src/core/network/atproto/data/repositories/story_repository.dart'; diff --git a/lib/src/core/network/xrpc/service_auth_helper.dart b/lib/src/core/network/xrpc/service_auth_helper.dart index 3d90fa8..eba0d83 100644 --- a/lib/src/core/network/xrpc/service_auth_helper.dart +++ b/lib/src/core/network/xrpc/service_auth_helper.dart @@ -1,4 +1,6 @@ import 'package:get_it/get_it.dart'; +import 'package:poptart_lex/com/atproto/server/get_service_auth.dart' + as server_get_service_auth; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; import 'package:spark/src/core/config/app_config.dart'; import 'package:spark/src/core/utils/logging/log_service.dart'; @@ -47,7 +49,9 @@ class ServiceAuthHelper { try { final atproto = _authRepository.atproto; if (atproto == null) { - throw Exception('Not authenticated - ATProto client not available'); + throw Exception( + 'Not authenticated - PoptartClient client not available', + ); } // Calculate expiration (60 seconds from now) @@ -58,10 +62,13 @@ class ServiceAuthHelper { 1000; // Use official atproto API to request service auth - final res = await atproto.server.getServiceAuth( - aud: serviceDid, - lxm: nsid, - exp: exp, + final res = await atproto.call( + server_get_service_auth.comAtprotoServerGetServiceAuth, + parameters: server_get_service_auth.ServerGetServiceAuthInput( + aud: serviceDid, + lxm: nsid, + exp: exp, + ), ); final token = res.data.token; diff --git a/lib/src/core/pro_video_editor/models/sound_audio_track.dart b/lib/src/core/pro_video_editor/models/sound_audio_track.dart index 9129a05..88d9fb3 100644 --- a/lib/src/core/pro_video_editor/models/sound_audio_track.dart +++ b/lib/src/core/pro_video_editor/models/sound_audio_track.dart @@ -1,7 +1,7 @@ import 'dart:convert'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:pro_image_editor/pro_image_editor.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/core/pro_video_editor/models/video_editor_result.dart b/lib/src/core/pro_video_editor/models/video_editor_result.dart index fc1e485..46dfa28 100644 --- a/lib/src/core/pro_video_editor/models/video_editor_result.dart +++ b/lib/src/core/pro_video_editor/models/video_editor_result.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:image_picker/image_picker.dart'; import 'package:spark/src/core/network/atproto/data/models/story_embed_models.dart'; diff --git a/lib/src/core/pro_video_editor/ui/video_editor_grounded_page.dart b/lib/src/core/pro_video_editor/ui/video_editor_grounded_page.dart index 5ef2f05..80e1444 100644 --- a/lib/src/core/pro_video_editor/ui/video_editor_grounded_page.dart +++ b/lib/src/core/pro_video_editor/ui/video_editor_grounded_page.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:math' as math; -import 'package:atproto/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart' hide ColorFilter; diff --git a/lib/src/core/routing/app_router.dart b/lib/src/core/routing/app_router.dart index cb69e1f..c29a4d5 100644 --- a/lib/src/core/routing/app_router.dart +++ b/lib/src/core/routing/app_router.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:auto_route/auto_route.dart'; import 'package:collection/collection.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/core/storage/cache/download_manager_interface.dart b/lib/src/core/storage/cache/download_manager_interface.dart index ac7b892..e5d0f6f 100644 --- a/lib/src/core/storage/cache/download_manager_interface.dart +++ b/lib/src/core/storage/cache/download_manager_interface.dart @@ -1,4 +1,4 @@ -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:spark/src/core/network/atproto/data/models/feed_models.dart'; // For PostView, Feed const int activeFeedPriority = 1; diff --git a/lib/src/core/ui/widgets/report_dialog.dart b/lib/src/core/ui/widgets/report_dialog.dart index 0856c73..8a912a6 100644 --- a/lib/src/core/ui/widgets/report_dialog.dart +++ b/lib/src/core/ui/widgets/report_dialog.dart @@ -1,8 +1,8 @@ -import 'package:atproto/com_atproto_moderation_createreport.dart'; -import 'package:atproto/com_atproto_moderation_defs.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/moderation/create_report.dart'; +import 'package:poptart_lex/com/atproto/moderation/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; -import 'package:bluesky/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get_it/get_it.dart'; diff --git a/lib/src/core/utils/label_utils.dart b/lib/src/core/utils/label_utils.dart index 38c6bfa..a9c81e5 100644 --- a/lib/src/core/utils/label_utils.dart +++ b/lib/src/core/utils/label_utils.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_label_defs.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; import 'package:spark/src/core/network/atproto/data/models/labeler_models.dart'; import 'package:spark/src/core/network/atproto/data/models/pref_models.dart'; diff --git a/lib/src/features/auth/providers/auth_providers.dart b/lib/src/features/auth/providers/auth_providers.dart index fdf670d..31d6796 100644 --- a/lib/src/features/auth/providers/auth_providers.dart +++ b/lib/src/features/auth/providers/auth_providers.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:atproto/atproto.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/auth/data/models/login_result.dart'; @@ -90,17 +90,14 @@ class Auth extends _$Auth { } } - /// Initiates the OAuth flow without a handle. + /// Initiates the OAuth flow without a login hint. /// - /// [service] is retained as a compatibility parameter and is ignored in - /// AIP-backed auth mode. - /// - /// Returns the authorization URL that the user should be redirected to - Future initiateOAuthWithService(String service) async { + /// Returns the authorization URL that the user should be redirected to. + Future initiateOAuthWithoutLoginHint() async { state = state.copyWith(isLoading: true, error: null); try { - final authUrl = await _authRepository.initiateOAuthWithService(service); + final authUrl = await _authRepository.initiateOAuthWithoutLoginHint(); // Don't set isLoading to false here - we're waiting for the callback return authUrl; } catch (e, stackTrace) { @@ -351,9 +348,9 @@ String? currentHandle(Ref ref) { return authState.handle; } -/// Convenience provider for accessing the ATProto client +/// Convenience provider for accessing the Poptart client @riverpod -ATProto? atproto(Ref ref) { +PoptartClient? atproto(Ref ref) { final authState = ref.watch(authProvider); return authState.atproto; } diff --git a/lib/src/features/auth/providers/auth_state.dart b/lib/src/features/auth/providers/auth_state.dart index 0e974e6..11db9b8 100644 --- a/lib/src/features/auth/providers/auth_state.dart +++ b/lib/src/features/auth/providers/auth_state.dart @@ -1,4 +1,4 @@ -import 'package:atproto/atproto.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; part 'auth_state.freezed.dart'; @@ -11,7 +11,7 @@ abstract class AuthState with _$AuthState { String? did, String? handle, String? dmAccessToken, - ATProto? atproto, + PoptartClient? atproto, @Default(false) bool isLoading, String? error, }) = _AuthState; diff --git a/lib/src/features/auth/providers/onboarding_providers.dart b/lib/src/features/auth/providers/onboarding_providers.dart index d60e1e6..9d3f59d 100644 --- a/lib/src/features/auth/providers/onboarding_providers.dart +++ b/lib/src/features/auth/providers/onboarding_providers.dart @@ -1,4 +1,4 @@ -import 'package:bluesky/app_bsky_actor_profile.dart'; +import 'package:poptart_lex/app/bsky/actor/profile.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; diff --git a/lib/src/features/auth/ui/pages/register_page.dart b/lib/src/features/auth/ui/pages/register_page.dart index 4b9f338..1c93c99 100644 --- a/lib/src/features/auth/ui/pages/register_page.dart +++ b/lib/src/features/auth/ui/pages/register_page.dart @@ -30,7 +30,7 @@ class _RegisterPageState extends ConsumerState { try { // Start the AIP OAuth flow without a login hint for account creation. - final authUrl = await authNotifier.initiateOAuthWithService(''); + final authUrl = await authNotifier.initiateOAuthWithoutLoginHint(); if (!mounted) return; diff --git a/lib/src/features/comments/providers/comment_input_provider.dart b/lib/src/features/comments/providers/comment_input_provider.dart index 77364c8..92014ba 100644 --- a/lib/src/features/comments/providers/comment_input_provider.dart +++ b/lib/src/features/comments/providers/comment_input_provider.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:image_picker/image_picker.dart'; diff --git a/lib/src/features/comments/providers/comments_page_provider.dart b/lib/src/features/comments/providers/comments_page_provider.dart index c65a83e..21a3e4c 100644 --- a/lib/src/features/comments/providers/comments_page_provider.dart +++ b/lib/src/features/comments/providers/comments_page_provider.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:image_picker/image_picker.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; diff --git a/lib/src/features/comments/ui/pages/comments_page.dart b/lib/src/features/comments/ui/pages/comments_page.dart index b66e0c9..f5339a3 100644 --- a/lib/src/features/comments/ui/pages/comments_page.dart +++ b/lib/src/features/comments/ui/pages/comments_page.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:fluentui_system_icons/fluentui_system_icons.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/features/comments/ui/pages/crosspost_comments_page.dart b/lib/src/features/comments/ui/pages/crosspost_comments_page.dart index 6156249..dcb942b 100644 --- a/lib/src/features/comments/ui/pages/crosspost_comments_page.dart +++ b/lib/src/features/comments/ui/pages/crosspost_comments_page.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:fluentui_system_icons/fluentui_system_icons.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/features/comments/ui/pages/replies_page.dart b/lib/src/features/comments/ui/pages/replies_page.dart index 536cb26..fc05d26 100644 --- a/lib/src/features/comments/ui/pages/replies_page.dart +++ b/lib/src/features/comments/ui/pages/replies_page.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/comments/ui/widgets/comment_item.dart b/lib/src/features/comments/ui/widgets/comment_item.dart index d9c6de4..0d3453e 100644 --- a/lib/src/features/comments/ui/widgets/comment_item.dart +++ b/lib/src/features/comments/ui/widgets/comment_item.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_moderation_createreport.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/moderation/create_report.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/feed/providers/feed_provider.dart b/lib/src/features/feed/providers/feed_provider.dart index 405cf4b..fee9554 100644 --- a/lib/src/features/feed/providers/feed_provider.dart +++ b/lib/src/features/feed/providers/feed_provider.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:collection'; -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/feed_models.dart'; diff --git a/lib/src/features/feed/providers/feed_state.dart b/lib/src/features/feed/providers/feed_state.dart index 4572cf1..3a07ef0 100644 --- a/lib/src/features/feed/providers/feed_state.dart +++ b/lib/src/features/feed/providers/feed_state.dart @@ -1,7 +1,7 @@ import 'dart:collection'; -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/feed_models.dart'; diff --git a/lib/src/features/feed/providers/like_post.dart b/lib/src/features/feed/providers/like_post.dart index 661eaa7..d8837a2 100644 --- a/lib/src/features/feed/providers/like_post.dart +++ b/lib/src/features/feed/providers/like_post.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/atproto.dart'; diff --git a/lib/src/features/feed/providers/repost_post.dart b/lib/src/features/feed/providers/repost_post.dart index c2d1fed..4fb5936 100644 --- a/lib/src/features/feed/providers/repost_post.dart +++ b/lib/src/features/feed/providers/repost_post.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/atproto.dart'; diff --git a/lib/src/features/feed/ui/pages/standalone_post_page.dart b/lib/src/features/feed/ui/pages/standalone_post_page.dart index f623e1c..37de8db 100644 --- a/lib/src/features/feed/ui/pages/standalone_post_page.dart +++ b/lib/src/features/feed/ui/pages/standalone_post_page.dart @@ -1,5 +1,5 @@ import 'dart:ui'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/features/feed/ui/widgets/action_buttons/side_action_bar.dart b/lib/src/features/feed/ui/widgets/action_buttons/side_action_bar.dart index 8eb26ef..a183fbe 100644 --- a/lib/src/features/feed/ui/widgets/action_buttons/side_action_bar.dart +++ b/lib/src/features/feed/ui/widgets/action_buttons/side_action_bar.dart @@ -1,4 +1,4 @@ -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/src/features/feed/ui/widgets/post/feed_post_widget.dart b/lib/src/features/feed/ui/widgets/post/feed_post_widget.dart index 0e4f563..f7f7385 100644 --- a/lib/src/features/feed/ui/widgets/post/feed_post_widget.dart +++ b/lib/src/features/feed/ui/widgets/post/feed_post_widget.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_label_defs.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/src/features/feed/ui/widgets/post/post_overlay.dart b/lib/src/features/feed/ui/widgets/post/post_overlay.dart index 6855a71..ed59996 100644 --- a/lib/src/features/feed/ui/widgets/post/post_overlay.dart +++ b/lib/src/features/feed/ui/widgets/post/post_overlay.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_label_defs.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:spark/src/core/design_system/components/molecules/known_interactions_bar.dart'; diff --git a/lib/src/features/messages/ui/widgets/messages_list.dart b/lib/src/features/messages/ui/widgets/messages_list.dart index ce983ed..1f2b169 100644 --- a/lib/src/features/messages/ui/widgets/messages_list.dart +++ b/lib/src/features/messages/ui/widgets/messages_list.dart @@ -1,7 +1,7 @@ import 'dart:math' as math; import 'package:any_link_preview/any_link_preview.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:fluentui_system_icons/fluentui_system_icons.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/features/posting/providers/post_story.dart b/lib/src/features/posting/providers/post_story.dart index 9978be2..84aab03 100644 --- a/lib/src/features/posting/providers/post_story.dart +++ b/lib/src/features/posting/providers/post_story.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/atproto.dart'; diff --git a/lib/src/features/posting/providers/video_upload_provider.dart b/lib/src/features/posting/providers/video_upload_provider.dart index 032ac10..7b28e11 100644 --- a/lib/src/features/posting/providers/video_upload_provider.dart +++ b/lib/src/features/posting/providers/video_upload_provider.dart @@ -1,6 +1,6 @@ -import 'package:atproto/core.dart'; -import 'package:bluesky/app_bsky_richtext_facet.dart'; -import 'package:bluesky/com_atproto_repo_strongref.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/app/bsky/richtext/facet.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/atproto.dart'; diff --git a/lib/src/features/posting/ui/pages/image_review_page.dart b/lib/src/features/posting/ui/pages/image_review_page.dart index cf0bd45..b4730ca 100644 --- a/lib/src/features/posting/ui/pages/image_review_page.dart +++ b/lib/src/features/posting/ui/pages/image_review_page.dart @@ -1,5 +1,5 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart' hide Image; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/posting/ui/pages/story_post_page.dart b/lib/src/features/posting/ui/pages/story_post_page.dart index c8ad634..3c78d91 100644 --- a/lib/src/features/posting/ui/pages/story_post_page.dart +++ b/lib/src/features/posting/ui/pages/story_post_page.dart @@ -1,5 +1,5 @@ import 'package:auto_route/auto_route.dart'; -import 'package:atproto/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get_it/get_it.dart'; diff --git a/lib/src/features/posting/ui/pages/video_review_page.dart b/lib/src/features/posting/ui/pages/video_review_page.dart index 4ec3ce3..385da64 100644 --- a/lib/src/features/posting/ui/pages/video_review_page.dart +++ b/lib/src/features/posting/ui/pages/video_review_page.dart @@ -1,8 +1,8 @@ import 'dart:async'; import 'dart:io'; -import 'package:atproto/com_atproto_repo_strongref.dart'; -import 'package:atproto/core.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/posting/utils/story_direct_post.dart b/lib/src/features/posting/utils/story_direct_post.dart index 56e1c0e..b31beb4 100644 --- a/lib/src/features/posting/utils/story_direct_post.dart +++ b/lib/src/features/posting/utils/story_direct_post.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_repo_strongref.dart'; +import 'package:poptart_lex/com/atproto/repo/strong_ref.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:get_it/get_it.dart'; diff --git a/lib/src/features/profile/providers/edit_profile_provider.dart b/lib/src/features/profile/providers/edit_profile_provider.dart index f54eda3..37bc7f4 100644 --- a/lib/src/features/profile/providers/edit_profile_provider.dart +++ b/lib/src/features/profile/providers/edit_profile_provider.dart @@ -1,6 +1,9 @@ import 'dart:typed_data'; - -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/com/atproto/repo/get_record.dart' + as repo_get_record; +import 'package:poptart_lex/com/atproto/repo/upload_blob.dart' + as repo_upload_blob; import 'package:get_it/get_it.dart'; import 'package:image_picker/image_picker.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -79,8 +82,10 @@ class EditProfile extends _$EditProfile { if (state.localAvatar is Uint8List) { // A new avatar image was picked, upload it as a blob. - final respBlob = await atprotoClient.repo.uploadBlob( - bytes: state.localAvatar as Uint8List, + final respBlob = await atprotoClient.post( + repo_upload_blob.comAtprotoRepoUploadBlob.nsid, + body: state.localAvatar as Uint8List, + to: const repo_upload_blob.RepoUploadBlobOutputConverter().fromJson, ); if (respBlob.status.code != 200) { throw Exception('Failed to upload avatar blob'); @@ -99,10 +104,13 @@ class EditProfile extends _$EditProfile { final uri = AtUri.parse( 'at://${state.profile.did}/so.sprk.actor.profile/self', ); - final recRes = await atprotoClient.repo.getRecord( - collection: uri.collection.toString(), - repo: uri.hostname, - rkey: uri.rkey, + final recRes = await atprotoClient.call( + repo_get_record.comAtprotoRepoGetRecord, + parameters: repo_get_record.RepoGetRecordInput( + repo: uri.hostname, + collection: uri.collection.toString(), + rkey: uri.rkey, + ), ); final recordData = recRes.data.value; diff --git a/lib/src/features/profile/providers/profile_feed_provider.dart b/lib/src/features/profile/providers/profile_feed_provider.dart index 4ad62ba..d0b836d 100644 --- a/lib/src/features/profile/providers/profile_feed_provider.dart +++ b/lib/src/features/profile/providers/profile_feed_provider.dart @@ -1,6 +1,6 @@ import 'dart:collection'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/features/profile/providers/profile_feed_state.dart b/lib/src/features/profile/providers/profile_feed_state.dart index 268cd04..27b2843 100644 --- a/lib/src/features/profile/providers/profile_feed_state.dart +++ b/lib/src/features/profile/providers/profile_feed_state.dart @@ -1,7 +1,7 @@ import 'dart:collection'; -import 'package:atproto/com_atproto_label_defs.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/feed_models.dart'; diff --git a/lib/src/features/profile/providers/profile_likes_provider.dart b/lib/src/features/profile/providers/profile_likes_provider.dart index 4f5248d..bf14329 100644 --- a/lib/src/features/profile/providers/profile_likes_provider.dart +++ b/lib/src/features/profile/providers/profile_likes_provider.dart @@ -1,6 +1,6 @@ import 'dart:collection'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/features/profile/providers/profile_provider.dart b/lib/src/features/profile/providers/profile_provider.dart index e0ca712..2c1cd80 100644 --- a/lib/src/features/profile/providers/profile_provider.dart +++ b/lib/src/features/profile/providers/profile_provider.dart @@ -1,9 +1,9 @@ import 'dart:async'; -import 'package:atproto/com_atproto_admin_defs.dart'; -import 'package:atproto/com_atproto_moderation_createreport.dart'; -import 'package:atproto/com_atproto_moderation_defs.dart'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart_lex/com/atproto/admin/defs.dart'; +import 'package:poptart_lex/com/atproto/moderation/create_report.dart'; +import 'package:poptart_lex/com/atproto/moderation/defs.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; diff --git a/lib/src/features/profile/providers/profile_reposts_provider.dart b/lib/src/features/profile/providers/profile_reposts_provider.dart index 5ae9396..82d76b3 100644 --- a/lib/src/features/profile/providers/profile_reposts_provider.dart +++ b/lib/src/features/profile/providers/profile_reposts_provider.dart @@ -1,6 +1,6 @@ import 'dart:collection'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/features/profile/providers/user_list_provider.dart b/lib/src/features/profile/providers/user_list_provider.dart index e98e106..cbe508e 100644 --- a/lib/src/features/profile/providers/user_list_provider.dart +++ b/lib/src/features/profile/providers/user_list_provider.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; import 'package:spark/src/core/di/service_locator.dart'; diff --git a/lib/src/features/profile/ui/pages/profile_page.dart b/lib/src/features/profile/ui/pages/profile_page.dart index 9a51369..de3dd3c 100644 --- a/lib/src/features/profile/ui/pages/profile_page.dart +++ b/lib/src/features/profile/ui/pages/profile_page.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/pages/standalone_likes_feed_page.dart b/lib/src/features/profile/ui/pages/standalone_likes_feed_page.dart index ea23aa2..c67ad26 100644 --- a/lib/src/features/profile/ui/pages/standalone_likes_feed_page.dart +++ b/lib/src/features/profile/ui/pages/standalone_likes_feed_page.dart @@ -1,6 +1,6 @@ import 'dart:ui'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/pages/standalone_profile_feed_page.dart b/lib/src/features/profile/ui/pages/standalone_profile_feed_page.dart index febc504..f268a7a 100644 --- a/lib/src/features/profile/ui/pages/standalone_profile_feed_page.dart +++ b/lib/src/features/profile/ui/pages/standalone_profile_feed_page.dart @@ -1,6 +1,6 @@ import 'dart:ui'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/pages/standalone_reposts_feed_page.dart b/lib/src/features/profile/ui/pages/standalone_reposts_feed_page.dart index 297b208..c6151ac 100644 --- a/lib/src/features/profile/ui/pages/standalone_reposts_feed_page.dart +++ b/lib/src/features/profile/ui/pages/standalone_reposts_feed_page.dart @@ -1,6 +1,6 @@ import 'dart:ui'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/widgets/profile_feed_post_widget.dart b/lib/src/features/profile/ui/widgets/profile_feed_post_widget.dart index 6297cf7..9c42d5d 100644 --- a/lib/src/features/profile/ui/widgets/profile_feed_post_widget.dart +++ b/lib/src/features/profile/ui/widgets/profile_feed_post_widget.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/widgets/profile_grid_tab.dart b/lib/src/features/profile/ui/widgets/profile_grid_tab.dart index d68e630..436cc3e 100644 --- a/lib/src/features/profile/ui/widgets/profile_grid_tab.dart +++ b/lib/src/features/profile/ui/widgets/profile_grid_tab.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/widgets/profile_grid_widget.dart b/lib/src/features/profile/ui/widgets/profile_grid_widget.dart index b4b24be..d5a42a6 100644 --- a/lib/src/features/profile/ui/widgets/profile_grid_widget.dart +++ b/lib/src/features/profile/ui/widgets/profile_grid_widget.dart @@ -1,4 +1,4 @@ -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:fluentui_system_icons/fluentui_system_icons.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/widgets/profile_likes_tab.dart b/lib/src/features/profile/ui/widgets/profile_likes_tab.dart index ed33bf6..df9b121 100644 --- a/lib/src/features/profile/ui/widgets/profile_likes_tab.dart +++ b/lib/src/features/profile/ui/widgets/profile_likes_tab.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/profile/ui/widgets/profile_reposts_tab.dart b/lib/src/features/profile/ui/widgets/profile_reposts_tab.dart index 867fd87..e30fc5a 100644 --- a/lib/src/features/profile/ui/widgets/profile_reposts_tab.dart +++ b/lib/src/features/profile/ui/widgets/profile_reposts_tab.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/search/providers/post_search_provider.dart b/lib/src/features/search/providers/post_search_provider.dart index f3a3226..29b4f65 100644 --- a/lib/src/features/search/providers/post_search_provider.dart +++ b/lib/src/features/search/providers/post_search_provider.dart @@ -1,8 +1,8 @@ import 'dart:async'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/app/bsky/feed/search_posts.dart' + as bsky_feed_search_posts; -import 'package:atproto_core/atproto_core.dart'; -import 'package:bluesky/app_bsky_feed_searchposts.dart'; -import 'package:bluesky/bluesky.dart' as bsky; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; @@ -106,11 +106,14 @@ class PostSearch extends _$PostSearch { return; } - final bskyApi = bsky.Bluesky.fromOAuthSession(atproto.oAuthSession!); + final bskyApi = PoptartClient.fromOAuthSession(atproto.oAuthSession!); final sprkSearch = _feedRepository.searchPosts(query); - final bskySearch = bskyApi.feed.searchPosts( - q: query, - sort: const FeedSearchPostsSort.unknown(data: 'top'), + final bskySearch = bskyApi.call( + bsky_feed_search_posts.appBskyFeedSearchPosts, + parameters: bsky_feed_search_posts.FeedSearchPostsInput( + q: query, + sort: bsky_feed_search_posts.FeedSearchPostsSort.unknown(data: 'top'), + ), ); final results = await Future.wait([sprkSearch, bskySearch]); @@ -123,7 +126,9 @@ class PostSearch extends _$PostSearch { final sprkResponse = results[0] as ({String? cursor, List posts}); - final bskyResponse = results[1] as XRPCResponse; + final bskyResponse = + results[1] + as XRPCResponse; final bskyPosts = bskyResponse.data.posts .asMap() @@ -252,11 +257,16 @@ class PostSearch extends _$PostSearch { if (atproto == null || atproto.oAuthSession == null) { return; } - final bskyApi = bsky.Bluesky.fromOAuthSession(atproto.oAuthSession!); - final response = await bskyApi.feed.searchPosts( - q: query, - sort: const FeedSearchPostsSort.unknown(data: 'latest'), - cursor: bskyCursor, + final bskyApi = PoptartClient.fromOAuthSession(atproto.oAuthSession!); + final response = await bskyApi.call( + bsky_feed_search_posts.appBskyFeedSearchPosts, + parameters: bsky_feed_search_posts.FeedSearchPostsInput( + q: query, + sort: const bsky_feed_search_posts.FeedSearchPostsSort.unknown( + data: 'latest', + ), + cursor: bskyCursor, + ), ); if (!ref.mounted || diff --git a/lib/src/features/search/providers/search_provider.dart b/lib/src/features/search/providers/search_provider.dart index 7876e49..9ed9657 100644 --- a/lib/src/features/search/providers/search_provider.dart +++ b/lib/src/features/search/providers/search_provider.dart @@ -1,6 +1,6 @@ import 'dart:async'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/auth/data/repositories/auth_repository.dart'; diff --git a/lib/src/features/search/ui/pages/user_results.dart b/lib/src/features/search/ui/pages/user_results.dart index e6bda76..f872c6a 100644 --- a/lib/src/features/search/ui/pages/user_results.dart +++ b/lib/src/features/search/ui/pages/user_results.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/lib/src/features/settings/providers/settings_provider.dart b/lib/src/features/settings/providers/settings_provider.dart index d848c30..2c0e079 100644 --- a/lib/src/features/settings/providers/settings_provider.dart +++ b/lib/src/features/settings/providers/settings_provider.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/models/models.dart'; diff --git a/lib/src/features/settings/ui/pages/labeler_label_settings_page.dart b/lib/src/features/settings/ui/pages/labeler_label_settings_page.dart index 8c3478b..2dbfb9a 100644 --- a/lib/src/features/settings/ui/pages/labeler_label_settings_page.dart +++ b/lib/src/features/settings/ui/pages/labeler_label_settings_page.dart @@ -1,6 +1,6 @@ import 'dart:convert'; -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/features/sound/providers/sound_page_provider.dart b/lib/src/features/sound/providers/sound_page_provider.dart index fa89761..3a69ca6 100644 --- a/lib/src/features/sound/providers/sound_page_provider.dart +++ b/lib/src/features/sound/providers/sound_page_provider.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/repositories/sound_repository.dart'; diff --git a/lib/src/features/sound/ui/pages/sound_page.dart b/lib/src/features/sound/ui/pages/sound_page.dart index ca27991..197ecc3 100644 --- a/lib/src/features/sound/ui/pages/sound_page.dart +++ b/lib/src/features/sound/ui/pages/sound_page.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:auto_route/auto_route.dart'; import 'package:fluentui_system_icons/fluentui_system_icons.dart'; import 'package:flutter/material.dart'; diff --git a/lib/src/features/stories/providers/story_auto_delete_provider.dart b/lib/src/features/stories/providers/story_auto_delete_provider.dart index a37f017..07b0cf2 100644 --- a/lib/src/features/stories/providers/story_auto_delete_provider.dart +++ b/lib/src/features/stories/providers/story_auto_delete_provider.dart @@ -1,4 +1,6 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/com/atproto/repo/list_records.dart' + as repo_list_records; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/data/repositories/sprk_repository.dart'; @@ -50,11 +52,14 @@ Future storyAutoDeleteExecutor(Ref ref) async { final expiredUris = []; final now = DateTime.now().toUtc(); do { - final page = await atproto.repo.listRecords( - repo: did, - collection: collection, - cursor: cursor, - limit: 100, + final page = await atproto.call( + repo_list_records.comAtprotoRepoListRecords, + parameters: repo_list_records.RepoListRecordsInput( + repo: did, + collection: collection, + cursor: cursor, + limit: 100, + ), ); for (final rec in page.data.records) { final createdAt = rec.value['createdAt']; diff --git a/lib/src/features/stories/providers/story_manager_provider.dart b/lib/src/features/stories/providers/story_manager_provider.dart index e7cc40a..69e537d 100644 --- a/lib/src/features/stories/providers/story_manager_provider.dart +++ b/lib/src/features/stories/providers/story_manager_provider.dart @@ -1,4 +1,6 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; +import 'package:poptart_lex/com/atproto/repo/list_records.dart' + as repo_list_records; import 'package:get_it/get_it.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; import 'package:spark/src/core/network/atproto/atproto.dart'; @@ -65,11 +67,14 @@ class StoryManager extends _$StoryManager { String? cursor; final uris = []; do { - final result = await atproto.repo.listRecords( - repo: did, - collection: collection, - cursor: cursor, - limit: 100, + final result = await atproto.call( + repo_list_records.comAtprotoRepoListRecords, + parameters: repo_list_records.RepoListRecordsInput( + repo: did, + collection: collection, + cursor: cursor, + limit: 100, + ), ); for (final record in result.data.records) { uris.add(record.uri); diff --git a/pubspec.lock b/pubspec.lock index 00927cf..2434a17 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -89,40 +89,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.13.1" - at_primitives: - dependency: transitive - description: - name: at_primitives - sha256: "016ffaa419b01befe6f5c6869c84d570060a5388655354a25668dbb1ad8ade3f" - url: "https://pub.dev" - source: hosted - version: "1.0.0" - atproto: - dependency: "direct main" - description: - name: atproto - sha256: "115944b8e4859bdaa0fe0d5162725ddf80269f14e79a33ab7ee05db972932ef9" - url: "https://pub.dev" - source: hosted - version: "1.4.1" - atproto_core: - dependency: "direct main" - description: - path: "packages/atproto_core" - ref: oauth-client-id - resolved-ref: aafa5dfb0c67c4e7cbe2ea286500bf5891a9bfe6 - url: "https://github.com/knotbin/atproto.dart.git" - source: git - version: "1.2.0" - atproto_oauth: - dependency: "direct main" - description: - path: "packages/atproto_oauth" - ref: oauth-client-id - resolved-ref: aafa5dfb0c67c4e7cbe2ea286500bf5891a9bfe6 - url: "https://github.com/knotbin/atproto.dart.git" - source: git - version: "0.2.0" audio_waveforms: dependency: "direct main" description: @@ -219,14 +185,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.5" - bluesky: - dependency: "direct main" - description: - name: bluesky - sha256: "21539161860842fde4f03094d2e3f117624808b606c6a6f5905bf1238683dc4f" - url: "https://pub.dev" - source: hosted - version: "1.4.1" boolean_selector: dependency: transitive description: @@ -1119,14 +1077,6 @@ packages: url: "https://pub.dev" source: hosted version: "5.6.4" - multiformats: - dependency: transitive - description: - name: multiformats - sha256: a6e85f37aa228e82b5644fc68d28f76622fe894d9191ebd1f994296325a89482 - url: "https://pub.dev" - source: hosted - version: "1.0.2" nanoid: dependency: transitive description: @@ -1319,6 +1269,62 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.2" + poptart: + dependency: "direct main" + description: + name: poptart + sha256: "5631a6e4a1ffa25101db2aa76b82e2410941fa5fec4d4c18ea2c2c7d95b70f0b" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + poptart_core: + dependency: transitive + description: + name: poptart_core + sha256: "4401f47c4e7f6d1f5142a207aa7e543408f83c43b5aaabdf6d4f60ef8f00ad84" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + poptart_lex: + dependency: "direct main" + description: + name: poptart_lex + sha256: d26ad7869e03cb70a724cac0b7f1b07eddc3cd7f36151b59e0fad3678017976f + url: "https://pub.dev" + source: hosted + version: "0.1.0" + poptart_multiformats: + dependency: transitive + description: + name: poptart_multiformats + sha256: "37931daf50f600656942ee4bbe72727980de92d4d2b902a641486b00c75cd1ae" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + poptart_oauth: + dependency: transitive + description: + name: poptart_oauth + sha256: e268a6947833aab9368dfd67069888962fdea91a0158609b1680faee95e4f8f0 + url: "https://pub.dev" + source: hosted + version: "0.1.0" + poptart_primitives: + dependency: transitive + description: + name: poptart_primitives + sha256: "3bb32c3269964a7c40b2e7b185b9dcbb2f7e297b78cfbe27fae141474476dd27" + url: "https://pub.dev" + source: hosted + version: "0.1.0" + poptart_xrpc: + dependency: transitive + description: + name: poptart_xrpc + sha256: b54f94fab23d21666ce88a442f22c146f7ec6b4ba54ccd8857063e60cfb62d0a + url: "https://pub.dev" + source: hosted + version: "0.1.0" posix: dependency: transitive description: @@ -1980,14 +1986,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.6.1" - xrpc: - dependency: transitive - description: - name: xrpc - sha256: ccaaf5224d1037a196bdfd03059027961bed3980718c9ce956be39d6bce152df - url: "https://pub.dev" - source: hosted - version: "1.0.3" xxh3: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c9157b5..58bc53a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,14 +15,12 @@ dependencies: app_badge_plus: ^1.2.7 assets: path: assets - atproto: ^1.4.1 - atproto_core: ^1.2.0 - atproto_oauth: ^0.2.0 audio_waveforms: ^2.0.2 audioplayers: ^6.6.0 auto_route: ^11.1.0 better_player_plus: ^1.1.5 - bluesky: ^1.4.1 + poptart: ^0.1.0 + poptart_lex: ^0.1.0 cached_network_image: ^3.4.1 camera: ^0.12.0+1 collection: ^1.19.1 @@ -80,19 +78,6 @@ dev_dependencies: json_serializable: ^6.13.0 riverpod_generator: ^4.0.3 -# Temporary overrides, waiting for https://github.com/myConsciousness/atproto.dart/pull/2277 to be merged -dependency_overrides: - atproto_core: - git: - url: https://github.com/knotbin/atproto.dart.git - path: packages/atproto_core - ref: oauth-client-id - atproto_oauth: - git: - url: https://github.com/knotbin/atproto.dart.git - path: packages/atproto_oauth - ref: oauth-client-id - flutter_launcher_icons: android: true ios: true diff --git a/test/core/network/atproto/data/models/story_embed_models_test.dart b/test/core/network/atproto/data/models/story_embed_models_test.dart index 51df25d..d982102 100644 --- a/test/core/network/atproto/data/models/story_embed_models_test.dart +++ b/test/core/network/atproto/data/models/story_embed_models_test.dart @@ -1,4 +1,4 @@ -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:spark/src/core/network/atproto/data/models/feed_models.dart'; import 'package:spark/src/core/network/atproto/data/models/record_models.dart'; diff --git a/test/features/posting/ui/widgets/mention_input_field_test.dart b/test/features/posting/ui/widgets/mention_input_field_test.dart index 08cf763..4d79196 100644 --- a/test/features/posting/ui/widgets/mention_input_field_test.dart +++ b/test/features/posting/ui/widgets/mention_input_field_test.dart @@ -1,4 +1,4 @@ -import 'package:atproto/core.dart'; +import 'package:poptart/poptart.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; diff --git a/test/src/core/auth/data/repositories/auth_repository_impl_test.dart b/test/src/core/auth/data/repositories/auth_repository_impl_test.dart index 5a2a53d..87e96a0 100644 --- a/test/src/core/auth/data/repositories/auth_repository_impl_test.dart +++ b/test/src/core/auth/data/repositories/auth_repository_impl_test.dart @@ -877,42 +877,45 @@ void main() { }, ); - test('initiateOAuthWithService omits login_hint in AIP mode', () async { - final storage = _InMemoryStorage(); - final client = MockClient((request) async { - switch (request.url.path) { - case '/.well-known/oauth-authorization-server': - return http.Response( - json.encode({ - 'authorization_endpoint': - 'https://auth.sprk.so/oauth/authorize', - 'token_endpoint': 'https://auth.sprk.so/oauth/token', - 'registration_endpoint': - 'https://auth.sprk.so/oauth/clients/register', - }), - 200, - ); - case '/oauth/clients/register': - return http.Response(json.encode({'client_id': 'client-1'}), 201); - default: - return http.Response('unexpected request', 500); - } - }); + test( + 'initiateOAuthWithoutLoginHint omits login_hint in AIP mode', + () async { + final storage = _InMemoryStorage(); + final client = MockClient((request) async { + switch (request.url.path) { + case '/.well-known/oauth-authorization-server': + return http.Response( + json.encode({ + 'authorization_endpoint': + 'https://auth.sprk.so/oauth/authorize', + 'token_endpoint': 'https://auth.sprk.so/oauth/token', + 'registration_endpoint': + 'https://auth.sprk.so/oauth/clients/register', + }), + 200, + ); + case '/oauth/clients/register': + return http.Response(json.encode({'client_id': 'client-1'}), 201); + default: + return http.Response('unexpected request', 500); + } + }); - final repository = AuthRepositoryImpl( - secureStorage: storage, - httpClient: client, - logger: SparkLogger(name: 'AuthRepositoryTest'), - ); + final repository = AuthRepositoryImpl( + secureStorage: storage, + httpClient: client, + logger: SparkLogger(name: 'AuthRepositoryTest'), + ); - await repository.initializationComplete; - final authUrl = await repository.initiateOAuthWithService('pds.sprk.so'); + await repository.initializationComplete; + final authUrl = await repository.initiateOAuthWithoutLoginHint(); - expect( - Uri.parse(authUrl).queryParameters.containsKey('login_hint'), - isFalse, - ); - }); + expect( + Uri.parse(authUrl).queryParameters.containsKey('login_hint'), + isFalse, + ); + }, + ); }); } diff --git a/test/src/core/utils/label_utils_test.dart b/test/src/core/utils/label_utils_test.dart index 5fa9415..97b8281 100644 --- a/test/src/core/utils/label_utils_test.dart +++ b/test/src/core/utils/label_utils_test.dart @@ -1,4 +1,4 @@ -import 'package:atproto/com_atproto_label_defs.dart'; +import 'package:poptart_lex/com/atproto/label/defs.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:spark/src/core/network/atproto/data/models/labeler_models.dart'; import 'package:spark/src/core/network/atproto/data/models/pref_models.dart'; diff --git a/test/src/features/messages/providers/conversation_provider_test.dart b/test/src/features/messages/providers/conversation_provider_test.dart index d26d77e..17cd2e9 100644 --- a/test/src/features/messages/providers/conversation_provider_test.dart +++ b/test/src/features/messages/providers/conversation_provider_test.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'dart:collection'; -import 'package:atproto/atproto.dart'; +import 'package:poptart/poptart.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:get_it/get_it.dart'; @@ -193,7 +193,7 @@ class _FakeMessagesRepository implements MessagesRepository { class _FakeAuthRepository implements AuthRepository { @override - ATProto? get atproto => null; + PoptartClient? get atproto => null; @override String? get did => 'did:me'; @@ -224,7 +224,7 @@ class _FakeAuthRepository implements AuthRepository { } @override - Future initiateOAuthWithService(String service) async { + Future initiateOAuthWithoutLoginHint() async { throw UnimplementedError(); } diff --git a/test/src/features/notifications/models/grouped_notification_test.dart b/test/src/features/notifications/models/grouped_notification_test.dart index 879711e..6fc7c88 100644 --- a/test/src/features/notifications/models/grouped_notification_test.dart +++ b/test/src/features/notifications/models/grouped_notification_test.dart @@ -1,4 +1,4 @@ -import 'package:atproto_core/atproto_core.dart'; +import 'package:poptart/poptart.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:spark/src/core/network/atproto/data/models/actor_models.dart'; import 'package:spark/src/core/network/atproto/data/models/notification_models.dart'; -- 2.51.2