chore: format and cleanup existing changes

- Apply dart format to existing modified files
- Include auth, API service, and widget improvements
- Ensure consistency across codebase

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

+1 -2
lib/config/oauth_config.dart
···
// not double!
// Correct: dev.workers.example:/oauth/callback
// Incorrect: dev.workers.example://oauth/callback
-
static const String customSchemeCallback =
-
'$customScheme:/oauth/callback';
+
static const String customSchemeCallback = '$customScheme:/oauth/callback';
// HTTPS callback (fallback for PDS that don't support custom
// URI schemes)
-10
lib/models/post.dart
···
// /xrpc/social.coves.feed.getDiscover
class TimelineResponse {
-
TimelineResponse({required this.feed, this.cursor});
factory TimelineResponse.fromJson(Map<String, dynamic> json) {
···
}
class FeedViewPost {
-
FeedViewPost({required this.post, this.reason});
factory FeedViewPost.fromJson(Map<String, dynamic> json) {
···
}
class PostView {
-
PostView({
required this.uri,
required this.cid,
···
}
class AuthorView {
-
AuthorView({
required this.did,
required this.handle,
···
}
class CommunityRef {
-
CommunityRef({required this.did, required this.name, this.avatar});
factory CommunityRef.fromJson(Map<String, dynamic> json) {
···
}
class PostStats {
-
PostStats({
required this.upvotes,
required this.downvotes,
···
}
class PostEmbed {
-
PostEmbed({required this.type, this.external, required this.data});
factory PostEmbed.fromJson(Map<String, dynamic> json) {
···
}
class ExternalEmbed {
-
ExternalEmbed({
required this.uri,
this.title,
···
}
class PostFacet {
-
PostFacet({required this.data});
factory PostFacet.fromJson(Map<String, dynamic> json) {
···
}
class FeedReason {
-
FeedReason({required this.type, required this.data});
factory FeedReason.fromJson(Map<String, dynamic> json) {
+1 -2
lib/providers/auth_provider.dart
···
/// ✅ Tokens are stored securely by the package (iOS Keychain / Android EncryptedSharedPreferences)
/// ✅ Automatic token refresh handled by the package
class AuthProvider with ChangeNotifier {
-
/// Constructor with optional OAuthService for dependency injection (testing)
AuthProvider({OAuthService? oauthService})
-
: _oauthService = oauthService ?? OAuthService();
+
: _oauthService = oauthService ?? OAuthService();
final OAuthService _oauthService;
// SharedPreferences keys for storing session info
+2 -1
lib/screens/auth/login_screen.dart
···
onPressed: () {
showDialog(
context: context,
-
builder: (context) => AlertDialog(
+
builder:
+
(context) => AlertDialog(
backgroundColor: const Color(0xFF1A2028),
title: const Text(
'What is a handle?',
+4 -5
lib/services/api_exceptions.dart
···
/// Base class for all API exceptions
class ApiException implements Exception {
-
ApiException(this.message, {this.statusCode, this.originalError});
final String message;
final int? statusCode;
···
/// Token expired, invalid, or missing
class AuthenticationException extends ApiException {
AuthenticationException(super.message, {super.originalError})
-
: super(statusCode: 401);
+
: super(statusCode: 401);
}
/// Resource not found (404)
/// PDS, community, post, or user not found
class NotFoundException extends ApiException {
NotFoundException(super.message, {super.originalError})
-
: super(statusCode: 404);
+
: super(statusCode: 404);
}
/// Server error (500+)
···
/// No internet, connection refused, timeout
class NetworkException extends ApiException {
NetworkException(super.message, {super.originalError})
-
: super(statusCode: null);
+
: super(statusCode: null);
}
/// Federation error
/// atProto PDS unreachable or DID resolution failure
class FederationException extends ApiException {
FederationException(super.message, {super.originalError})
-
: super(statusCode: null);
+
: super(statusCode: null);
}
+1 -5
lib/services/coves_api_service.dart
···
/// rotates tokens automatically (~1 hour expiry), and caching tokens would
/// cause 401 errors after the first token expires.
class CovesApiService {
-
CovesApiService({Future<String?> Function()? tokenGetter})
: _tokenGetter = tokenGetter {
_dio = Dio(
···
case DioExceptionType.cancel:
throw ApiException('Request cancelled', originalError: e);
default:
-
throw ApiException(
-
'Unknown error: ${e.message}',
-
originalError: e,
-
);
+
throw ApiException('Unknown error: ${e.message}', originalError: e);
}
}
+1 -2
lib/services/pds_discovery_service.dart
···
/// Fetch a DID document from the PLC directory
Future<Map<String, dynamic>> _fetchDIDDocument(String did) async {
try {
-
final response =
-
await _dio.get('https://plc.directory/$did');
+
final response = await _dio.get('https://plc.directory/$did');
if (response.statusCode != 200) {
throw Exception('Failed to fetch DID document: ${response.statusCode}');
-1
lib/widgets/logo.dart
···
import 'package:flutter_svg/flutter_svg.dart';
class CovesLogo extends StatelessWidget {
-
const CovesLogo({super.key, this.size = 150, this.useColorVersion = false});
final double size;
final bool useColorVersion;
-1
lib/widgets/primary_button.dart
···
enum ButtonVariant { solid, outline, tertiary }
class PrimaryButton extends StatelessWidget {
-
const PrimaryButton({
super.key,
required this.title,
+6 -11
test/providers/auth_provider_test.dart
···
// Generate mocks for OAuthService and OAuthSession only
@GenerateMocks([OAuthService, OAuthSession])
-
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
···
// that are not exported from atproto_oauth_flutter package.
// These tests would need integration testing or a different approach.
-
test(
-
'should return null when not authenticated '
-
'(skipped - needs integration test)',
-
() async {
+
test('should return null when not authenticated '
+
'(skipped - needs integration test)', () async {
// This test is skipped as it requires mocking internal OAuth classes
// that cannot be mocked with mockito
-
}, skip: true,);
+
}, skip: true);
-
test(
-
'should sign out user if token refresh fails '
-
'(skipped - needs integration test)',
-
() async {
+
test('should sign out user if token refresh fails '
+
'(skipped - needs integration test)', () async {
// This test demonstrates the critical fix for issue #7
// Token refresh failure should trigger sign out
// Skipped as it requires mocking internal OAuth classes
-
}, skip: true,);
+
}, skip: true);
});
group('State Management', () {