[READ ONLY MIRROR] Open Source TikTok alternative built on AT Protocol github.com/sprksocial/client
flutter atproto video dart
10
fork

Configure Feed

Select the types of activity you want to include in your feed.

lint

+7 -206
-172
.cursor/rules/caching.mdc
··· 1 - --- 2 - description: 3 - globs: 4 - alwaysApply: false 5 - --- 6 - # Storage and Cache System 7 - 8 - This directory contains utilities for handling local storage and caching operations in the Spark Social application. 9 - 10 - ## Storage Components 11 - 12 - - **LocalStorageInterface**: Abstract interface defining storage operations. 13 - - **SharedPrefsStorage**: Implementation using SharedPreferences for non-sensitive data. 14 - - **SecureStorage**: Implementation using FlutterSecureStorage for sensitive data. 15 - - **StorageManager**: Provides centralized access to all storage implementations. 16 - - **StorageConstants**: Constants for storage keys used throughout the app. 17 - - **SettingsRepository**: Manages application settings with interface and implementation. 18 - 19 - ## Cache Components 20 - 21 - - **SQLCacheInterface**: Abstract interface for SQL-based cache operations. 22 - - **SQLCacheImpl**: SQLite implementation for persistent caching. 23 - - **CacheManagerInterface**: Abstract interface for cache management operations. 24 - - **CacheManagerImpl**: Implementation of cache manager with SQL backend. 25 - - **DownloadManagerInterface**: Abstract interface for download operations. 26 - - **DownloadManagerImpl**: Handles file downloads and caching. 27 - 28 - ## Usage Examples 29 - 30 - ### Basic Storage Operations 31 - 32 - ```dart 33 - // Access the storage manager from GetIt 34 - final storageManager = GetIt.instance<StorageManager>(); 35 - 36 - // Store a value in preferences (non-sensitive data) 37 - await storageManager.preferences.setString(StorageConstants.username, 'johndoe'); 38 - 39 - // Retrieve a value from preferences 40 - final username = await storageManager.preferences.getString(StorageConstants.username); 41 - 42 - // Store sensitive data in secure storage 43 - await storageManager.secure.setString(StorageConstants.authToken, 'secret-token'); 44 - 45 - // Retrieve sensitive data 46 - final token = await storageManager.secure.getString(StorageConstants.authToken); 47 - ``` 48 - 49 - ### Storing Complex Objects 50 - 51 - ```dart 52 - // Define a User class with freezed 53 - @freezed 54 - class User with _$User { 55 - const factory User({ 56 - required String id, 57 - required String name, 58 - required String email, 59 - }) = _User; 60 - 61 - factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json); 62 - } 63 - 64 - // Store a user object 65 - final user = User(id: '123', name: 'John Doe', email: 'john@example.com'); 66 - await storageManager.preferences.setObject<User>( 67 - StorageConstants.user, 68 - user, 69 - (json) => User.fromJson(json) 70 - ); 71 - 72 - // Retrieve a user object 73 - final retrievedUser = await storageManager.preferences.getObject<User>( 74 - StorageConstants.user, 75 - (json) => User.fromJson(json) 76 - ); 77 - ``` 78 - 79 - ### SQL Cache Operations 80 - 81 - ```dart 82 - // Access the SQL cache from GetIt 83 - final sqlCache = GetIt.instance<SQLCacheInterface>(); 84 - 85 - // Store data in cache 86 - await sqlCache.put('cache_key', {'data': 'value'}); 87 - 88 - // Retrieve data from cache 89 - final cachedData = await sqlCache.get('cache_key'); 90 - 91 - // Check if data exists in cache 92 - final exists = await sqlCache.exists('cache_key'); 93 - 94 - // Remove data from cache 95 - await sqlCache.remove('cache_key'); 96 - 97 - // Clear all cache 98 - await sqlCache.clear(); 99 - ``` 100 - 101 - ### Cache Manager Operations 102 - 103 - ```dart 104 - // Access the cache manager from GetIt 105 - final cacheManager = GetIt.instance<CacheManagerInterface>(); 106 - 107 - // Get a file (from cache if available, or download it) 108 - final file = await cacheManager.getFile('https://example.com/image.jpg'); 109 - 110 - // Store a file in cache 111 - final bytes = await someImage.readAsBytes(); 112 - await cacheManager.putFile('https://example.com/image.jpg', bytes); 113 - 114 - // Get cache size 115 - final cacheSize = await cacheManager.getCacheSize(); 116 - print('Cache size: ${cacheSize / 1024 / 1024} MB'); 117 - 118 - // Clear cache 119 - await cacheManager.clearCache(); 120 - ``` 121 - 122 - ### Download Manager Operations 123 - 124 - ```dart 125 - // Access the download manager from GetIt 126 - final downloadManager = GetIt.instance<DownloadManagerInterface>(); 127 - 128 - // Download a file 129 - final downloadedFile = await downloadManager.downloadFile('https://example.com/file.pdf'); 130 - 131 - // Check download status 132 - final isDownloading = await downloadManager.isDownloading('https://example.com/file.pdf'); 133 - 134 - // Cancel download 135 - await downloadManager.cancelDownload('https://example.com/file.pdf'); 136 - ``` 137 - 138 - ### Settings Repository 139 - 140 - ```dart 141 - // Access settings repository from GetIt 142 - final settingsRepository = GetIt.instance<SettingsRepository>(); 143 - 144 - // Get app settings 145 - final settings = await settingsRepository.getSettings(); 146 - 147 - // Update a setting 148 - await settingsRepository.updateSetting('theme_mode', 'dark'); 149 - 150 - // Reset settings to defaults 151 - await settingsRepository.resetSettings(); 152 - ``` 153 - 154 - ## Available Services in GetIt 155 - 156 - All storage and cache services are registered in the service locator and can be accessed via GetIt: 157 - 158 - - `StorageManager` - Main storage management 159 - - `SQLCacheInterface` - SQL-based cache operations 160 - - `CacheManagerInterface` - File cache management 161 - - `DownloadManagerInterface` - File download operations 162 - - `SettingsRepository` - Application settings 163 - 164 - ## Best Practices 165 - 166 - 1. Always use interfaces when injecting dependencies 167 - 2. Initialize storage manager and SQL cache during app startup 168 - 3. Use appropriate storage type (secure vs. preferences) based on data sensitivity 169 - 4. Cache frequently accessed data using the SQL cache 170 - 5. Use the download manager for large files to avoid memory issues 171 - 6. Monitor cache size and implement cleanup strategies 172 - 7. Handle cache failures gracefully with fallback mechanisms
+1 -1
.cursor/rules/project-overview.mdc
··· 5 5 --- 6 6 # Spark Social - Project Overview 7 7 8 - This is a Flutter application for a social media platform inspired by TikTok, integrated with the Bluesky/AT Protocol. 8 + This is a Flutter application for a social media platform inspired by TikTok, integrated with the AT Protocol. 9 9 10 10 ## Main Entry Points 11 11 - [lib/main.dart](mdc:lib/main.dart) - Main application entry point
-26
.cursor/rules/task.mdc
··· 1 - --- 2 - description: 3 - globs: 4 - alwaysApply: false 5 - --- 6 - # Task Implementation and Tracking Guidelines 7 - 8 - When you are asked to implement a new feature or a set of functionalities, please follow these steps: 9 - 10 - 1. **Create a Detailed Plan Document**: 11 - * Create a new Markdown (`.md`) file in the root of the project or a relevant subdirectory 12 - * Name this file descriptively, for example, `feature_x_implementation_plan.md`. 13 - * In this document, outline all the steps required to implement the feature. Make these steps as detailed as necessary. 14 - * Each step should be a checklist item (e.g., `- [ ] Step 1: Description`). 15 - 16 - 2. **Reference and Update the Plan Document**: 17 - * As you work on implementing the feature, continuously refer back to this plan document. 18 - * When a step or a sub-task is completed, update the document by marking the corresponding checkbox (e.g., `- [x] Step 1: Description`). 19 - * Mention the status of the plan (e.g., "Updated `feature_x_implementation_plan.md`") in your responses at relevant stages, especially after completing a significant part of the task. 20 - 21 - 3. **Final Review**: 22 - * Once all tasks in the plan document are marked as complete, state that the feature implementation is finished according to the plan. 23 - 24 - This process helps in keeping track of progress and ensures all aspects of the feature request are addressed systematically. 25 - 26 -
-2
lib/src/core/design_system/components/molecules/known_interactions_bar.dart
··· 1 - import 'dart:ui'; 2 - 3 1 import 'package:flutter/material.dart'; 4 2 import 'package:gradient_borders/box_borders/gradient_box_border.dart'; 5 3 import 'package:sparksocial/src/core/design_system/components/atoms/avatar_stack.dart';
+1 -1
lib/src/core/design_system/components/organisms/side_action_bar.dart
··· 245 245 vsync: this, 246 246 ); 247 247 _bounceAnimation = TweenSequence<double>([ 248 - TweenSequenceItem(tween: Tween(begin: 1.0, end: 1.3), weight: 40), 248 + TweenSequenceItem(tween: Tween(begin: 1, end: 1.3), weight: 40), 249 249 TweenSequenceItem(tween: Tween(begin: 1.3, end: 0.9), weight: 30), 250 250 TweenSequenceItem(tween: Tween(begin: 0.9, end: 1.05), weight: 30), 251 251 ]).animate(CurvedAnimation(parent: _bounceController, curve: Curves.easeOut));
+5 -4
lib/src/features/comments/ui/widgets/comment_item.dart
··· 1 1 import 'package:atproto/com_atproto_moderation_createreport.dart'; 2 2 import 'package:atproto_core/atproto_core.dart'; 3 3 import 'package:auto_route/auto_route.dart'; 4 - import 'package:sparksocial/src/core/design_system/components/atoms/icons.dart'; 5 4 import 'package:flutter/material.dart'; 6 5 import 'package:flutter_riverpod/flutter_riverpod.dart'; 7 6 import 'package:get_it/get_it.dart'; 8 7 import 'package:sparksocial/src/core/auth/data/repositories/auth_repository.dart'; 8 + import 'package:sparksocial/src/core/design_system/components/atoms/icons.dart'; 9 9 import 'package:sparksocial/src/core/network/atproto/data/models/feed_models.dart'; 10 10 import 'package:sparksocial/src/core/network/atproto/data/repositories/sprk_repository.dart'; 11 11 import 'package:sparksocial/src/core/routing/app_router.dart'; ··· 280 280 onPressed: notifier.toggleLike, 281 281 child: Row( 282 282 children: [ 283 - commentState.isLiked 284 - ? AppIcons.likeFilled(size: 16, color: AppColors.pink) 285 - : AppIcons.like(size: 16, color: secondaryTextColor), 283 + if (commentState.isLiked) 284 + AppIcons.likeFilled(size: 16, color: AppColors.pink) 285 + else 286 + AppIcons.like(size: 16, color: secondaryTextColor), 286 287 const SizedBox(width: 4), 287 288 Text(commentState.likeCount.toString(), style: TextStyle(fontSize: 12, color: secondaryTextColor)), 288 289 ],