mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 01:58:50 +05:00
Compare commits
21 Commits
8179b39aa4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 748bf975ca | |||
| 87dc2795ef | |||
| 06bd83278b | |||
|
|
dfebd7f9e6 | ||
|
|
6b59750621 | ||
|
|
02c2abd5fb | ||
|
|
1e5451859f | ||
|
|
93ce51e02a | ||
| c8ee6d75b2 | |||
|
|
1f0cf828da | ||
|
|
fa88fd20c8 | ||
| c9ea5527a8 | |||
|
|
1a610b8d8f | ||
| 499896b3dd | |||
|
|
3e664d726b | ||
|
|
0acf59ddd7 | ||
|
|
94b001e782 | ||
| 7828b378d7 | |||
|
|
23943f5206 | ||
|
|
78c321b0f0 | ||
|
|
9b84492db4 |
75
.github/workflows/release.yml
vendored
75
.github/workflows/release.yml
vendored
@@ -66,6 +66,14 @@ jobs:
|
|||||||
channel: 'stable'
|
channel: 'stable'
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
|
- name: Update version from tag
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: |
|
||||||
|
VERSION_NAME=${GITHUB_REF#refs/tags/v}
|
||||||
|
BUILD_NUMBER=$(echo $VERSION_NAME | sed 's/[^0-9]//g')
|
||||||
|
echo "Updating version to $VERSION_NAME+$BUILD_NUMBER"
|
||||||
|
sed -i "s/^version: .*/version: $VERSION_NAME+$BUILD_NUMBER/" pubspec.yaml
|
||||||
|
|
||||||
- name: Get dependencies
|
- name: Get dependencies
|
||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
@@ -182,17 +190,6 @@ jobs:
|
|||||||
### What's Changed
|
### What's Changed
|
||||||
See the [full commit history](${{ github.server_url }}/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.sha }})
|
See the [full commit history](${{ github.server_url }}/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.sha }})
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Delete previous release if exists
|
|
||||||
run: |
|
|
||||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ steps.version.outputs.version }}" \
|
|
||||||
| jq -r '.id // empty')
|
|
||||||
if [ ! -z "$RELEASE_ID" ]; then
|
|
||||||
echo "Deleting previous release $RELEASE_ID"
|
|
||||||
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID"
|
|
||||||
fi
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
@@ -212,12 +209,68 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Publish to Telegram
|
||||||
|
run: |
|
||||||
|
# Prepare Telegram message
|
||||||
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
|
COMMIT_SHA="${{ github.sha }}"
|
||||||
|
BRANCH="${{ github.ref_name }}"
|
||||||
|
RUN_NUMBER="${{ github.run_number }}"
|
||||||
|
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
|
||||||
|
|
||||||
|
# Create message text
|
||||||
|
MESSAGE="🚀 *NeoMovies Mobile ${VERSION}*
|
||||||
|
|
||||||
|
📋 *Build Info:*
|
||||||
|
• Commit: \`${COMMIT_SHA:0:7}\`
|
||||||
|
• Branch: \`${BRANCH}\`
|
||||||
|
• Workflow Run: [#${RUN_NUMBER}](${REPO_URL}/actions/runs/${{ github.run_id }})
|
||||||
|
|
||||||
|
📦 *Downloads:*
|
||||||
|
• *ARM64 (arm64-v8a)*: ${{ steps.sizes.outputs.arm64_size }} - Recommended for modern devices
|
||||||
|
• *ARM32 (armeabi-v7a)*: ${{ steps.sizes.outputs.arm32_size }} - For older devices
|
||||||
|
• *x86_64*: ${{ steps.sizes.outputs.x64_size }} - For emulators
|
||||||
|
|
||||||
|
🔗 [View Release](${REPO_URL}/releases/tag/${VERSION})"
|
||||||
|
|
||||||
|
# Send message to Telegram
|
||||||
|
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendMessage" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{
|
||||||
|
\"chat_id\": \"${{ secrets.TELEGRAM_CHAT_ID }}\",
|
||||||
|
\"text\": \"$MESSAGE\",
|
||||||
|
\"parse_mode\": \"Markdown\",
|
||||||
|
\"disable_web_page_preview\": true
|
||||||
|
}"
|
||||||
|
|
||||||
|
# Send APK files
|
||||||
|
echo "Uploading ARM64 APK to Telegram..."
|
||||||
|
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \
|
||||||
|
-F "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \
|
||||||
|
-F "document=@./apks/app-arm64-v8a-release.apk" \
|
||||||
|
-F "caption=📱 NeoMovies ${VERSION} - ARM64 (Recommended)"
|
||||||
|
|
||||||
|
echo "Uploading ARM32 APK to Telegram..."
|
||||||
|
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \
|
||||||
|
-F "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \
|
||||||
|
-F "document=@./apks/app-armeabi-v7a-release.apk" \
|
||||||
|
-F "caption=📱 NeoMovies ${VERSION} - ARM32 (For older devices)"
|
||||||
|
|
||||||
|
echo "Uploading x86_64 APK to Telegram..."
|
||||||
|
curl -s -X POST "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/sendDocument" \
|
||||||
|
-F "chat_id=${{ secrets.TELEGRAM_CHAT_ID }}" \
|
||||||
|
-F "document=@./apks/app-x86_64-release.apk" \
|
||||||
|
-F "caption=📱 NeoMovies ${VERSION} - x86_64 (For emulators)"
|
||||||
|
|
||||||
|
echo "Telegram notification sent successfully!"
|
||||||
|
|
||||||
- name: Summary
|
- name: Summary
|
||||||
run: |
|
run: |
|
||||||
echo "## Release Created Successfully!" >> $GITHUB_STEP_SUMMARY
|
echo "## Release Created Successfully!" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Release URL:** ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
echo "**Release URL:** ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "**Telegram:** Published to channel" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "### APK Files:" >> $GITHUB_STEP_SUMMARY
|
echo "### APK Files:" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "- ARM64: ${{ steps.sizes.outputs.arm64_size }}" >> $GITHUB_STEP_SUMMARY
|
echo "- ARM64: ${{ steps.sizes.outputs.arm64_size }}" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
@@ -1,16 +1,49 @@
|
|||||||
stages:
|
stages:
|
||||||
|
- test
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
FLUTTER_VERSION: "stable"
|
FLUTTER_VERSION: "stable"
|
||||||
|
# Optimize for RAM usage
|
||||||
|
FLUTTER_BUILD_FLAGS: "--split-debug-info=./debug-symbols --obfuscate --dart-define=dart.vm.profile=false"
|
||||||
|
PUB_CACHE: "${CI_PROJECT_DIR}/.pub-cache"
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .pub-cache/
|
||||||
|
|
||||||
|
# Test stage - runs first to catch issues early
|
||||||
|
test:dart:
|
||||||
|
stage: test
|
||||||
|
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
||||||
|
script:
|
||||||
|
- flutter --version
|
||||||
|
- flutter pub get
|
||||||
|
- flutter analyze --fatal-warnings
|
||||||
|
- flutter test --coverage
|
||||||
|
- flutter build web --release --dart-define=dart.vm.profile=false
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage/cobertura.xml
|
||||||
|
paths:
|
||||||
|
- coverage/
|
||||||
|
- build/web/
|
||||||
|
expire_in: 7 days
|
||||||
|
rules:
|
||||||
|
- if: $CI_MERGE_REQUEST_IID
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
|
||||||
build:apk:arm64:
|
build:apk:arm64:
|
||||||
stage: build
|
stage: build
|
||||||
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
||||||
script:
|
script:
|
||||||
- flutter pub get
|
- flutter pub get
|
||||||
- flutter build apk --release --target-platform android-arm64 --split-per-abi
|
- mkdir -p debug-symbols
|
||||||
|
- flutter build apk --release --target-platform android-arm64 --split-per-abi ${FLUTTER_BUILD_FLAGS}
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
- build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
||||||
@@ -24,9 +57,19 @@ build:apk:arm64:
|
|||||||
build:apk:arm:
|
build:apk:arm:
|
||||||
stage: build
|
stage: build
|
||||||
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
||||||
|
before_script:
|
||||||
|
# Update version from tag if present
|
||||||
|
- |
|
||||||
|
if [ -n "$CI_COMMIT_TAG" ]; then
|
||||||
|
VERSION_NAME="${CI_COMMIT_TAG#v}"
|
||||||
|
BUILD_NUMBER=$(echo $CI_COMMIT_TAG | sed 's/[^0-9]//g')
|
||||||
|
echo "Updating version to $VERSION_NAME+$BUILD_NUMBER"
|
||||||
|
sed -i "s/^version: .*/version: $VERSION_NAME+$BUILD_NUMBER/" pubspec.yaml
|
||||||
|
fi
|
||||||
script:
|
script:
|
||||||
- flutter pub get
|
- flutter pub get
|
||||||
- flutter build apk --release --target-platform android-arm --split-per-abi
|
- mkdir -p debug-symbols
|
||||||
|
- flutter build apk --release --target-platform android-arm --split-per-abi ${FLUTTER_BUILD_FLAGS}
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
|
- build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
|
||||||
@@ -42,7 +85,8 @@ build:apk:x64:
|
|||||||
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
image: ghcr.io/cirruslabs/flutter:${FLUTTER_VERSION}
|
||||||
script:
|
script:
|
||||||
- flutter pub get
|
- flutter pub get
|
||||||
- flutter build apk --release --target-platform android-x64 --split-per-abi
|
- mkdir -p debug-symbols
|
||||||
|
- flutter build apk --release --target-platform android-x64 --split-per-abi ${FLUTTER_BUILD_FLAGS}
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- build/app/outputs/flutter-apk/app-x86_64-release.apk
|
- build/app/outputs/flutter-apk/app-x86_64-release.apk
|
||||||
|
|||||||
44
README.md
44
README.md
@@ -4,26 +4,6 @@
|
|||||||
|
|
||||||
[](https://github.com/Neo-Open-Source/neomovies-mobile/releases/latest)
|
[](https://github.com/Neo-Open-Source/neomovies-mobile/releases/latest)
|
||||||
|
|
||||||
## Возможности
|
|
||||||
|
|
||||||
- 📱 Кроссплатформенное приложение (Android/iOS(пока не реализовано))
|
|
||||||
- 🎥 Просмотр фильмов и сериалов через WebView
|
|
||||||
- 🌙 Поддержка динамической темы
|
|
||||||
- 💾 Локальное кэширование данных
|
|
||||||
- 🔒 Безопасное хранение данных
|
|
||||||
- 🚀 Быстрая загрузка контента
|
|
||||||
- 🎨 Современный Material Design интерфейс
|
|
||||||
|
|
||||||
## Технологии
|
|
||||||
|
|
||||||
- **Flutter** - основной фреймворк
|
|
||||||
- **Provider** - управление состоянием
|
|
||||||
- **Hive** - локальная база данных
|
|
||||||
- **HTTP** - сетевые запросы
|
|
||||||
- **WebView** - воспроизведение видео
|
|
||||||
- **Cached Network Image** - кэширование изображений
|
|
||||||
- **Google Fonts** - красивые шрифты
|
|
||||||
|
|
||||||
## Установка
|
## Установка
|
||||||
|
|
||||||
1. Клонируйте репозиторий:
|
1. Клонируйте репозиторий:
|
||||||
@@ -39,7 +19,7 @@ flutter pub get
|
|||||||
|
|
||||||
3. Создайте файл `.env` в корне проекта:
|
3. Создайте файл `.env` в корне проекта:
|
||||||
```
|
```
|
||||||
API_URL=your_api_url_here
|
API_URL=api.neomovies.ru
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Запустите приложение:
|
4. Запустите приложение:
|
||||||
@@ -54,11 +34,6 @@ flutter run
|
|||||||
flutter build apk --release
|
flutter build apk --release
|
||||||
```
|
```
|
||||||
|
|
||||||
### iOS
|
|
||||||
```bash
|
|
||||||
flutter build ios --release
|
|
||||||
```
|
|
||||||
|
|
||||||
## Структура проекта
|
## Структура проекта
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -77,20 +52,15 @@ lib/
|
|||||||
- **Flutter SDK**: 3.8.1+
|
- **Flutter SDK**: 3.8.1+
|
||||||
- **Dart**: 3.8.1+
|
- **Dart**: 3.8.1+
|
||||||
- **Android**: API 21+ (Android 5.0+)
|
- **Android**: API 21+ (Android 5.0+)
|
||||||
- **iOS**: iOS 11.0+
|
|
||||||
|
|
||||||
## Участие в разработке
|
|
||||||
|
|
||||||
1. Форкните репозиторий
|
|
||||||
2. Создайте ветку для новой функции (`git checkout -b feature/amazing-feature`)
|
|
||||||
3. Внесите изменения и закоммитьте (`git commit -m 'Add amazing feature'`)
|
|
||||||
4. Отправьте изменения в ветку (`git push origin feature/amazing-feature`)
|
|
||||||
5. Создайте Pull Request
|
|
||||||
|
|
||||||
## Лицензия
|
## Лицензия
|
||||||
|
|
||||||
Этот проект лицензирован под Apache 2.0 License - подробности в файле [LICENSE](LICENSE).
|
Apache 2.0 License - [LICENSE](LICENSE).
|
||||||
|
|
||||||
## Контакты
|
## Контакты
|
||||||
|
|
||||||
Если у вас есть вопросы или предложения, создайте issue в этом репозитории.
|
neo.movies.mail@gmail.com
|
||||||
|
|
||||||
|
## Благодарность
|
||||||
|
|
||||||
|
Огромная благодарность создателям проекта [LAMPAC](https://github.com/immisterio/Lampac)
|
||||||
@@ -8,7 +8,7 @@ plugins {
|
|||||||
android {
|
android {
|
||||||
namespace = "com.neo.neomovies_mobile"
|
namespace = "com.neo.neomovies_mobile"
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
ndkVersion = "27.0.12077973"
|
// ndkVersion = "27.0.12077973" // Commented out to avoid license issues
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
@@ -48,7 +48,7 @@ dependencies {
|
|||||||
implementation(project(":torrentengine"))
|
implementation(project(":torrentengine"))
|
||||||
|
|
||||||
// Kotlin Coroutines
|
// Kotlin Coroutines
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
|
||||||
|
|
||||||
// Gson для JSON сериализации
|
// Gson для JSON сериализации
|
||||||
implementation("com.google.code.gson:gson:2.11.0")
|
implementation("com.google.code.gson:gson:2.11.0")
|
||||||
|
|||||||
33
android/settings.gradle
Normal file
33
android/settings.gradle
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
// Legacy settings.gradle file for CI compatibility
|
||||||
|
// Main configuration is in settings.gradle.kts
|
||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
def flutterSdkPath = {
|
||||||
|
def properties = new Properties()
|
||||||
|
file("local.properties").withInputStream { properties.load(it) }
|
||||||
|
def flutterSdkPath = properties.getProperty("flutter.sdk")
|
||||||
|
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
|
||||||
|
return flutterSdkPath
|
||||||
|
}()
|
||||||
|
|
||||||
|
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
|
id "com.android.application" version "8.7.3" apply false
|
||||||
|
id "com.android.library" version "8.7.3" apply false
|
||||||
|
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
|
||||||
|
}
|
||||||
|
|
||||||
|
include ":app"
|
||||||
|
project(":app").projectDir = file("app")
|
||||||
|
|
||||||
|
include ":torrentengine"
|
||||||
|
project(":torrentengine").projectDir = file("torrentengine")
|
||||||
@@ -28,7 +28,7 @@ plugins {
|
|||||||
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
|
||||||
id("com.android.application") version "8.7.3" apply false
|
id("com.android.application") version "8.7.3" apply false
|
||||||
id("com.android.library") version "8.7.3" apply false
|
id("com.android.library") version "8.7.3" apply false
|
||||||
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
|
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
include(":app")
|
include(":app")
|
||||||
|
|||||||
@@ -34,6 +34,12 @@ android {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "17"
|
jvmTarget = "17"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// KAPT configuration for Kotlin 2.1.0 compatibility
|
||||||
|
kapt {
|
||||||
|
correctErrorTypes = true
|
||||||
|
useBuildCache = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -43,17 +49,17 @@ dependencies {
|
|||||||
implementation("com.google.android.material:material:1.12.0")
|
implementation("com.google.android.material:material:1.12.0")
|
||||||
|
|
||||||
// Coroutines for async operations
|
// Coroutines for async operations
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
|
||||||
|
|
||||||
// Lifecycle components
|
// Lifecycle components
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
|
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
|
||||||
implementation("androidx.lifecycle:lifecycle-service:2.8.7")
|
implementation("androidx.lifecycle:lifecycle-service:2.8.7")
|
||||||
|
|
||||||
// Room database for torrent state persistence
|
// Room database for torrent state persistence - updated for Kotlin 2.1.0
|
||||||
implementation("androidx.room:room-runtime:2.6.1")
|
implementation("androidx.room:room-runtime:2.7.0-alpha09")
|
||||||
implementation("androidx.room:room-ktx:2.6.1")
|
implementation("androidx.room:room-ktx:2.7.0-alpha09")
|
||||||
kapt("androidx.room:room-compiler:2.6.1")
|
kapt("androidx.room:room-compiler:2.7.0-alpha09")
|
||||||
|
|
||||||
// WorkManager for background tasks
|
// WorkManager for background tasks
|
||||||
implementation("androidx.work:work-runtime-ktx:2.10.0")
|
implementation("androidx.work:work-runtime-ktx:2.10.0")
|
||||||
|
|||||||
@@ -102,10 +102,7 @@ class ApiClient {
|
|||||||
|
|
||||||
// ---- External IDs (IMDb) ----
|
// ---- External IDs (IMDb) ----
|
||||||
Future<String?> getImdbId(String mediaId, String mediaType) async {
|
Future<String?> getImdbId(String mediaId, String mediaType) async {
|
||||||
// This would need to be implemented in NeoMoviesApiClient
|
return _neoClient.getExternalIds(mediaId, mediaType);
|
||||||
// For now, return null or implement a stub
|
|
||||||
// TODO: Add getExternalIds endpoint to backend
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Auth ----
|
// ---- Auth ----
|
||||||
|
|||||||
@@ -186,17 +186,28 @@ class NeoMoviesApiClient {
|
|||||||
/// Get movie by ID
|
/// Get movie by ID
|
||||||
Future<Movie> getMovieById(String id) async {
|
Future<Movie> getMovieById(String id) async {
|
||||||
final uri = Uri.parse('$apiUrl/movies/$id');
|
final uri = Uri.parse('$apiUrl/movies/$id');
|
||||||
|
print('Fetching movie from: $uri');
|
||||||
final response = await _client.get(uri);
|
final response = await _client.get(uri);
|
||||||
|
|
||||||
|
print('Response status: ${response.statusCode}');
|
||||||
|
print('Response body: ${response.body.substring(0, response.body.length > 500 ? 500 : response.body.length)}...');
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final apiResponse = json.decode(response.body);
|
final apiResponse = json.decode(response.body);
|
||||||
|
print('Decoded API response type: ${apiResponse.runtimeType}');
|
||||||
|
print('API response keys: ${apiResponse is Map ? apiResponse.keys.toList() : 'Not a map'}');
|
||||||
|
|
||||||
// API returns: {"success": true, "data": {...}}
|
// API returns: {"success": true, "data": {...}}
|
||||||
final movieData = (apiResponse is Map && apiResponse['data'] != null)
|
final movieData = (apiResponse is Map && apiResponse['data'] != null)
|
||||||
? apiResponse['data']
|
? apiResponse['data']
|
||||||
: apiResponse;
|
: apiResponse;
|
||||||
|
|
||||||
|
print('Movie data keys: ${movieData is Map ? movieData.keys.toList() : 'Not a map'}');
|
||||||
|
print('Movie data: $movieData');
|
||||||
|
|
||||||
return Movie.fromJson(movieData);
|
return Movie.fromJson(movieData);
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Failed to load movie: ${response.statusCode}');
|
throw Exception('Failed to load movie: ${response.statusCode} - ${response.body}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,17 +238,28 @@ class NeoMoviesApiClient {
|
|||||||
/// Get TV show by ID
|
/// Get TV show by ID
|
||||||
Future<Movie> getTvShowById(String id) async {
|
Future<Movie> getTvShowById(String id) async {
|
||||||
final uri = Uri.parse('$apiUrl/tv/$id');
|
final uri = Uri.parse('$apiUrl/tv/$id');
|
||||||
|
print('Fetching TV show from: $uri');
|
||||||
final response = await _client.get(uri);
|
final response = await _client.get(uri);
|
||||||
|
|
||||||
|
print('Response status: ${response.statusCode}');
|
||||||
|
print('Response body: ${response.body.substring(0, response.body.length > 500 ? 500 : response.body.length)}...');
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
final apiResponse = json.decode(response.body);
|
final apiResponse = json.decode(response.body);
|
||||||
|
print('Decoded API response type: ${apiResponse.runtimeType}');
|
||||||
|
print('API response keys: ${apiResponse is Map ? apiResponse.keys.toList() : 'Not a map'}');
|
||||||
|
|
||||||
// API returns: {"success": true, "data": {...}}
|
// API returns: {"success": true, "data": {...}}
|
||||||
final tvData = (apiResponse is Map && apiResponse['data'] != null)
|
final tvData = (apiResponse is Map && apiResponse['data'] != null)
|
||||||
? apiResponse['data']
|
? apiResponse['data']
|
||||||
: apiResponse;
|
: apiResponse;
|
||||||
|
|
||||||
|
print('TV data keys: ${tvData is Map ? tvData.keys.toList() : 'Not a map'}');
|
||||||
|
print('TV data: $tvData');
|
||||||
|
|
||||||
return Movie.fromJson(tvData);
|
return Movie.fromJson(tvData);
|
||||||
} else {
|
} else {
|
||||||
throw Exception('Failed to load TV show: ${response.statusCode}');
|
throw Exception('Failed to load TV show: ${response.statusCode} - ${response.body}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,6 +273,30 @@ class NeoMoviesApiClient {
|
|||||||
return _fetchMovies('/tv/search', page: page, query: query);
|
return _fetchMovies('/tv/search', page: page, query: query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================
|
||||||
|
// External IDs (IMDb, TVDB, etc.)
|
||||||
|
// ============================================
|
||||||
|
|
||||||
|
/// Get external IDs (IMDb, TVDB) for a movie or TV show
|
||||||
|
Future<String?> getExternalIds(String mediaId, String mediaType) async {
|
||||||
|
try {
|
||||||
|
final uri = Uri.parse('$apiUrl/${mediaType}s/$mediaId/external-ids');
|
||||||
|
final response = await _client.get(uri);
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final apiResponse = json.decode(response.body);
|
||||||
|
final data = (apiResponse is Map && apiResponse['data'] != null)
|
||||||
|
? apiResponse['data']
|
||||||
|
: apiResponse;
|
||||||
|
return data['imdb_id'] as String?;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
} catch (e) {
|
||||||
|
print('Error getting external IDs: $e');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================
|
// ============================================
|
||||||
// Unified Search
|
// Unified Search
|
||||||
// ============================================
|
// ============================================
|
||||||
|
|||||||
@@ -8,10 +8,13 @@ class AuthResponse {
|
|||||||
AuthResponse({required this.token, required this.user, required this.verified});
|
AuthResponse({required this.token, required this.user, required this.verified});
|
||||||
|
|
||||||
factory AuthResponse.fromJson(Map<String, dynamic> json) {
|
factory AuthResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
// Handle wrapped response with "data" field
|
||||||
|
final data = json['data'] ?? json;
|
||||||
|
|
||||||
return AuthResponse(
|
return AuthResponse(
|
||||||
token: json['token'] as String,
|
token: data['token'] as String,
|
||||||
user: User.fromJson(json['user'] as Map<String, dynamic>),
|
user: User.fromJson(data['user'] as Map<String, dynamic>),
|
||||||
verified: (json['verified'] as bool?) ?? (json['user']?['verified'] as bool? ?? true),
|
verified: (data['verified'] as bool?) ?? (data['user']?['verified'] as bool? ?? true),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,30 +67,79 @@ class Movie extends HiveObject {
|
|||||||
});
|
});
|
||||||
|
|
||||||
factory Movie.fromJson(Map<String, dynamic> json) {
|
factory Movie.fromJson(Map<String, dynamic> json) {
|
||||||
return Movie(
|
try {
|
||||||
id: (json['id'] as num).toString(), // Ensure id is a string
|
print('Parsing Movie from JSON: ${json.keys.toList()}');
|
||||||
title: (json['title'] ?? json['name'] ?? '') as String,
|
|
||||||
posterPath: json['poster_path'] as String?,
|
// Parse genres safely - API returns: [{"id": 18, "name": "Drama"}]
|
||||||
backdropPath: json['backdrop_path'] as String?,
|
List<String> genresList = [];
|
||||||
overview: json['overview'] as String?,
|
if (json['genres'] != null && json['genres'] is List) {
|
||||||
releaseDate: json['release_date'] != null && json['release_date'].isNotEmpty
|
genresList = (json['genres'] as List)
|
||||||
? DateTime.tryParse(json['release_date'] as String)
|
.map((g) {
|
||||||
: json['first_air_date'] != null && json['first_air_date'].isNotEmpty
|
if (g is Map && g.containsKey('name')) {
|
||||||
? DateTime.tryParse(json['first_air_date'] as String)
|
return g['name'] as String? ?? '';
|
||||||
: null,
|
}
|
||||||
genres: List<String>.from(json['genres']?.map((g) => g['name']) ?? []),
|
return '';
|
||||||
voteAverage: (json['vote_average'] as num?)?.toDouble() ?? 0.0,
|
})
|
||||||
popularity: (json['popularity'] as num?)?.toDouble() ?? 0.0,
|
.where((name) => name.isNotEmpty)
|
||||||
runtime: json['runtime'] is num
|
.toList();
|
||||||
? (json['runtime'] as num).toInt()
|
print('Parsed genres: $genresList');
|
||||||
: (json['episode_run_time'] is List && (json['episode_run_time'] as List).isNotEmpty)
|
}
|
||||||
? ((json['episode_run_time'] as List).first as num).toInt()
|
|
||||||
: null,
|
// Parse dates safely
|
||||||
seasonsCount: json['number_of_seasons'] as int?,
|
DateTime? parsedDate;
|
||||||
episodesCount: json['number_of_episodes'] as int?,
|
final releaseDate = json['release_date'];
|
||||||
tagline: json['tagline'] as String?,
|
final firstAirDate = json['first_air_date'];
|
||||||
mediaType: (json['media_type'] ?? (json['title'] != null ? 'movie' : 'tv')) as String,
|
|
||||||
);
|
if (releaseDate != null && releaseDate.toString().isNotEmpty && releaseDate.toString() != 'null') {
|
||||||
|
parsedDate = DateTime.tryParse(releaseDate.toString());
|
||||||
|
} else if (firstAirDate != null && firstAirDate.toString().isNotEmpty && firstAirDate.toString() != 'null') {
|
||||||
|
parsedDate = DateTime.tryParse(firstAirDate.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse runtime (movie) or episode_run_time (TV)
|
||||||
|
int? runtimeValue;
|
||||||
|
if (json['runtime'] != null && json['runtime'] is num && (json['runtime'] as num) > 0) {
|
||||||
|
runtimeValue = (json['runtime'] as num).toInt();
|
||||||
|
} else if (json['episode_run_time'] != null && json['episode_run_time'] is List) {
|
||||||
|
final episodeRunTime = json['episode_run_time'] as List;
|
||||||
|
if (episodeRunTime.isNotEmpty && episodeRunTime.first is num) {
|
||||||
|
runtimeValue = (episodeRunTime.first as num).toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Determine media type
|
||||||
|
String mediaTypeValue = 'movie';
|
||||||
|
if (json.containsKey('media_type') && json['media_type'] != null) {
|
||||||
|
mediaTypeValue = json['media_type'] as String;
|
||||||
|
} else if (json.containsKey('name') || json.containsKey('first_air_date')) {
|
||||||
|
mediaTypeValue = 'tv';
|
||||||
|
}
|
||||||
|
|
||||||
|
final movie = Movie(
|
||||||
|
id: (json['id'] as num).toString(),
|
||||||
|
title: (json['title'] ?? json['name'] ?? 'Untitled') as String,
|
||||||
|
posterPath: json['poster_path'] as String?,
|
||||||
|
backdropPath: json['backdrop_path'] as String?,
|
||||||
|
overview: json['overview'] as String?,
|
||||||
|
releaseDate: parsedDate,
|
||||||
|
genres: genresList,
|
||||||
|
voteAverage: (json['vote_average'] as num?)?.toDouble() ?? 0.0,
|
||||||
|
popularity: (json['popularity'] as num?)?.toDouble() ?? 0.0,
|
||||||
|
runtime: runtimeValue,
|
||||||
|
seasonsCount: json['number_of_seasons'] as int?,
|
||||||
|
episodesCount: json['number_of_episodes'] as int?,
|
||||||
|
tagline: json['tagline'] as String?,
|
||||||
|
mediaType: mediaTypeValue,
|
||||||
|
);
|
||||||
|
|
||||||
|
print('Successfully parsed movie: ${movie.title}');
|
||||||
|
return movie;
|
||||||
|
} catch (e, stackTrace) {
|
||||||
|
print('❌ Error parsing Movie from JSON: $e');
|
||||||
|
print('Stack trace: $stackTrace');
|
||||||
|
print('JSON data: $json');
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => _$MovieToJson(this);
|
Map<String, dynamic> toJson() => _$MovieToJson(this);
|
||||||
|
|||||||
@@ -2,14 +2,30 @@ class User {
|
|||||||
final String id;
|
final String id;
|
||||||
final String name;
|
final String name;
|
||||||
final String email;
|
final String email;
|
||||||
|
final bool verified;
|
||||||
|
|
||||||
User({required this.id, required this.name, required this.email});
|
User({
|
||||||
|
required this.id,
|
||||||
|
required this.name,
|
||||||
|
required this.email,
|
||||||
|
this.verified = true,
|
||||||
|
});
|
||||||
|
|
||||||
factory User.fromJson(Map<String, dynamic> json) {
|
factory User.fromJson(Map<String, dynamic> json) {
|
||||||
return User(
|
return User(
|
||||||
id: json['_id'] as String? ?? '',
|
id: (json['_id'] ?? json['id'] ?? '') as String,
|
||||||
name: json['name'] as String? ?? '',
|
name: json['name'] as String? ?? '',
|
||||||
email: json['email'] as String? ?? '',
|
email: json['email'] as String? ?? '',
|
||||||
|
verified: json['verified'] as bool? ?? true,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'_id': id,
|
||||||
|
'name': name,
|
||||||
|
'email': email,
|
||||||
|
'verified': verified,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -594,4 +594,3 @@ class TorrentPlatformService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import 'package:neomovies_mobile/presentation/providers/favorites_provider.dart'
|
|||||||
import 'package:neomovies_mobile/presentation/providers/home_provider.dart';
|
import 'package:neomovies_mobile/presentation/providers/home_provider.dart';
|
||||||
import 'package:neomovies_mobile/presentation/providers/movie_detail_provider.dart';
|
import 'package:neomovies_mobile/presentation/providers/movie_detail_provider.dart';
|
||||||
import 'package:neomovies_mobile/presentation/providers/reactions_provider.dart';
|
import 'package:neomovies_mobile/presentation/providers/reactions_provider.dart';
|
||||||
|
import 'package:neomovies_mobile/presentation/providers/downloads_provider.dart';
|
||||||
import 'package:neomovies_mobile/presentation/screens/main_screen.dart';
|
import 'package:neomovies_mobile/presentation/screens/main_screen.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,12 @@ class DownloadsProvider with ChangeNotifier {
|
|||||||
Timer? _progressTimer;
|
Timer? _progressTimer;
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
String? _error;
|
String? _error;
|
||||||
|
String? _stackTrace;
|
||||||
|
|
||||||
List<TorrentInfo> get torrents => List.unmodifiable(_torrents);
|
List<TorrentInfo> get torrents => List.unmodifiable(_torrents);
|
||||||
bool get isLoading => _isLoading;
|
bool get isLoading => _isLoading;
|
||||||
String? get error => _error;
|
String? get error => _error;
|
||||||
|
String? get stackTrace => _stackTrace;
|
||||||
|
|
||||||
DownloadsProvider() {
|
DownloadsProvider() {
|
||||||
_startProgressUpdates();
|
_startProgressUpdates();
|
||||||
@@ -164,8 +166,9 @@ class DownloadsProvider with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setError(String? error) {
|
void _setError(String? error, [String? stackTrace]) {
|
||||||
_error = error;
|
_error = error;
|
||||||
|
_stackTrace = stackTrace;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,9 @@ class MovieDetailProvider with ChangeNotifier {
|
|||||||
String? _error;
|
String? _error;
|
||||||
String? get error => _error;
|
String? get error => _error;
|
||||||
|
|
||||||
|
String? _stackTrace;
|
||||||
|
String? get stackTrace => _stackTrace;
|
||||||
|
|
||||||
Future<void> loadMedia(int mediaId, String mediaType) async {
|
Future<void> loadMedia(int mediaId, String mediaType) async {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
_isImdbLoading = true;
|
_isImdbLoading = true;
|
||||||
@@ -33,11 +36,15 @@ class MovieDetailProvider with ChangeNotifier {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
print('Loading media: ID=$mediaId, type=$mediaType');
|
||||||
|
|
||||||
// Load movie/TV details
|
// Load movie/TV details
|
||||||
if (mediaType == 'movie') {
|
if (mediaType == 'movie') {
|
||||||
_movie = await _movieRepository.getMovieById(mediaId.toString());
|
_movie = await _movieRepository.getMovieById(mediaId.toString());
|
||||||
|
print('Movie loaded successfully: ${_movie?.title}');
|
||||||
} else {
|
} else {
|
||||||
_movie = await _movieRepository.getTvById(mediaId.toString());
|
_movie = await _movieRepository.getTvById(mediaId.toString());
|
||||||
|
print('TV show loaded successfully: ${_movie?.title}');
|
||||||
}
|
}
|
||||||
|
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
@@ -46,16 +53,20 @@ class MovieDetailProvider with ChangeNotifier {
|
|||||||
// Try to load IMDb ID (non-blocking)
|
// Try to load IMDb ID (non-blocking)
|
||||||
if (_movie != null) {
|
if (_movie != null) {
|
||||||
try {
|
try {
|
||||||
|
print('Loading IMDb ID for $mediaType $mediaId');
|
||||||
_imdbId = await _apiClient.getImdbId(mediaId.toString(), mediaType);
|
_imdbId = await _apiClient.getImdbId(mediaId.toString(), mediaType);
|
||||||
|
print('IMDb ID loaded: $_imdbId');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// IMDb ID loading failed, but don't fail the whole screen
|
// IMDb ID loading failed, but don't fail the whole screen
|
||||||
print('Failed to load IMDb ID: $e');
|
print('Failed to load IMDb ID: $e');
|
||||||
_imdbId = null;
|
_imdbId = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e, stackTrace) {
|
||||||
print('Error loading media: $e');
|
print('Error loading media: $e');
|
||||||
|
print('Stack trace: $stackTrace');
|
||||||
_error = e.toString();
|
_error = e.toString();
|
||||||
|
_stackTrace = stackTrace.toString();
|
||||||
_isLoading = false;
|
_isLoading = false;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:chewie/chewie.dart';
|
|||||||
import 'package:neomovies_mobile/data/models/player/video_source.dart';
|
import 'package:neomovies_mobile/data/models/player/video_source.dart';
|
||||||
import 'package:neomovies_mobile/data/models/player/video_quality.dart';
|
import 'package:neomovies_mobile/data/models/player/video_quality.dart';
|
||||||
import 'package:neomovies_mobile/data/models/player/audio_track.dart';
|
import 'package:neomovies_mobile/data/models/player/audio_track.dart';
|
||||||
import 'package:neomovies_mobile/data/models/player/subtitle.dart';
|
import 'package:neomovies_mobile/data/models/player/subtitle.dart' as local_subtitle;
|
||||||
import 'package:neomovies_mobile/data/models/player/player_settings.dart';
|
import 'package:neomovies_mobile/data/models/player/player_settings.dart';
|
||||||
|
|
||||||
class PlayerProvider with ChangeNotifier {
|
class PlayerProvider with ChangeNotifier {
|
||||||
@@ -37,13 +37,13 @@ class PlayerProvider with ChangeNotifier {
|
|||||||
List<VideoSource> _sources = [];
|
List<VideoSource> _sources = [];
|
||||||
List<VideoQuality> _qualities = [];
|
List<VideoQuality> _qualities = [];
|
||||||
List<AudioTrack> _audioTracks = [];
|
List<AudioTrack> _audioTracks = [];
|
||||||
List<Subtitle> _subtitles = [];
|
List<local_subtitle.Subtitle> _subtitles = [];
|
||||||
|
|
||||||
// Selected options
|
// Selected options
|
||||||
VideoSource? _selectedSource;
|
VideoSource? _selectedSource;
|
||||||
VideoQuality? _selectedQuality;
|
VideoQuality? _selectedQuality;
|
||||||
AudioTrack? _selectedAudioTrack;
|
AudioTrack? _selectedAudioTrack;
|
||||||
Subtitle? _selectedSubtitle;
|
local_subtitle.Subtitle? _selectedSubtitle;
|
||||||
|
|
||||||
// Playback state
|
// Playback state
|
||||||
double _volume = 1.0;
|
double _volume = 1.0;
|
||||||
@@ -67,11 +67,11 @@ class PlayerProvider with ChangeNotifier {
|
|||||||
List<VideoSource> get sources => _sources;
|
List<VideoSource> get sources => _sources;
|
||||||
List<VideoQuality> get qualities => _qualities;
|
List<VideoQuality> get qualities => _qualities;
|
||||||
List<AudioTrack> get audioTracks => _audioTracks;
|
List<AudioTrack> get audioTracks => _audioTracks;
|
||||||
List<Subtitle> get subtitles => _subtitles;
|
List<local_subtitle.Subtitle> get subtitles => _subtitles;
|
||||||
VideoSource? get selectedSource => _selectedSource;
|
VideoSource? get selectedSource => _selectedSource;
|
||||||
VideoQuality? get selectedQuality => _selectedQuality;
|
VideoQuality? get selectedQuality => _selectedQuality;
|
||||||
AudioTrack? get selectedAudioTrack => _selectedAudioTrack;
|
AudioTrack? get selectedAudioTrack => _selectedAudioTrack;
|
||||||
Subtitle? get selectedSubtitle => _selectedSubtitle;
|
local_subtitle.Subtitle? get selectedSubtitle => _selectedSubtitle;
|
||||||
double get volume => _volume;
|
double get volume => _volume;
|
||||||
bool get isMuted => _isMuted;
|
bool get isMuted => _isMuted;
|
||||||
double get playbackSpeed => _playbackSpeed;
|
double get playbackSpeed => _playbackSpeed;
|
||||||
@@ -94,7 +94,7 @@ class PlayerProvider with ChangeNotifier {
|
|||||||
List<VideoSource>? sources,
|
List<VideoSource>? sources,
|
||||||
List<VideoQuality>? qualities,
|
List<VideoQuality>? qualities,
|
||||||
List<AudioTrack>? audioTracks,
|
List<AudioTrack>? audioTracks,
|
||||||
List<Subtitle>? subtitles,
|
List<local_subtitle.Subtitle>? subtitles,
|
||||||
}) async {
|
}) async {
|
||||||
_mediaId = mediaId;
|
_mediaId = mediaId;
|
||||||
_mediaType = mediaType;
|
_mediaType = mediaType;
|
||||||
@@ -305,7 +305,7 @@ class PlayerProvider with ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change subtitle
|
// Change subtitle
|
||||||
void setSubtitle(Subtitle subtitle) {
|
void setSubtitle(local_subtitle.Subtitle subtitle) {
|
||||||
if (_selectedSubtitle == subtitle) return;
|
if (_selectedSubtitle == subtitle) return;
|
||||||
|
|
||||||
_selectedSubtitle = subtitle;
|
_selectedSubtitle = subtitle;
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import '../../providers/downloads_provider.dart';
|
import '../../providers/downloads_provider.dart';
|
||||||
|
import '../../widgets/error_display.dart';
|
||||||
import '../../../data/models/torrent_info.dart';
|
import '../../../data/models/torrent_info.dart';
|
||||||
import 'torrent_detail_screen.dart';
|
import 'torrent_detail_screen.dart';
|
||||||
import 'package:auto_route/auto_route.dart';
|
|
||||||
|
|
||||||
@RoutePage()
|
|
||||||
class DownloadsScreen extends StatefulWidget {
|
class DownloadsScreen extends StatefulWidget {
|
||||||
const DownloadsScreen({super.key});
|
const DownloadsScreen({super.key});
|
||||||
|
|
||||||
@@ -48,37 +47,13 @@ class _DownloadsScreenState extends State<DownloadsScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (provider.error != null) {
|
if (provider.error != null) {
|
||||||
return Center(
|
return ErrorDisplay(
|
||||||
child: Column(
|
title: 'Ошибка загрузки торрентов',
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
error: provider.error!,
|
||||||
children: [
|
stackTrace: provider.stackTrace,
|
||||||
Icon(
|
onRetry: () {
|
||||||
Icons.error_outline,
|
provider.refreshDownloads();
|
||||||
size: 64,
|
},
|
||||||
color: Colors.red.shade300,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
Text(
|
|
||||||
'Ошибка загрузки',
|
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
Text(
|
|
||||||
provider.error!,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
||||||
color: Colors.grey.shade600,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
provider.refreshDownloads();
|
|
||||||
},
|
|
||||||
child: const Text('Попробовать снова'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:neomovies_mobile/presentation/screens/auth/profile_screen.dart';
|
|||||||
import 'package:neomovies_mobile/presentation/screens/favorites/favorites_screen.dart';
|
import 'package:neomovies_mobile/presentation/screens/favorites/favorites_screen.dart';
|
||||||
import 'package:neomovies_mobile/presentation/screens/search/search_screen.dart';
|
import 'package:neomovies_mobile/presentation/screens/search/search_screen.dart';
|
||||||
import 'package:neomovies_mobile/presentation/screens/home/home_screen.dart';
|
import 'package:neomovies_mobile/presentation/screens/home/home_screen.dart';
|
||||||
|
import 'package:neomovies_mobile/presentation/screens/downloads/downloads_screen.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MainScreen extends StatefulWidget {
|
class MainScreen extends StatefulWidget {
|
||||||
@@ -30,7 +31,7 @@ class _MainScreenState extends State<MainScreen> {
|
|||||||
HomeScreen(),
|
HomeScreen(),
|
||||||
SearchScreen(),
|
SearchScreen(),
|
||||||
FavoritesScreen(),
|
FavoritesScreen(),
|
||||||
Center(child: Text('Downloads Page')),
|
DownloadsScreen(),
|
||||||
ProfileScreen(),
|
ProfileScreen(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:neomovies_mobile/presentation/providers/reactions_provider.dart'
|
|||||||
import 'package:neomovies_mobile/presentation/providers/movie_detail_provider.dart';
|
import 'package:neomovies_mobile/presentation/providers/movie_detail_provider.dart';
|
||||||
import 'package:neomovies_mobile/presentation/screens/player/video_player_screen.dart';
|
import 'package:neomovies_mobile/presentation/screens/player/video_player_screen.dart';
|
||||||
import 'package:neomovies_mobile/presentation/screens/torrent_selector/torrent_selector_screen.dart';
|
import 'package:neomovies_mobile/presentation/screens/torrent_selector/torrent_selector_screen.dart';
|
||||||
|
import 'package:neomovies_mobile/presentation/widgets/error_display.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MovieDetailScreen extends StatefulWidget {
|
class MovieDetailScreen extends StatefulWidget {
|
||||||
@@ -63,13 +64,11 @@ class _MovieDetailScreenState extends State<MovieDetailScreen> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigator.of(context).push(
|
// TODO: Implement proper player navigation with mediaId
|
||||||
MaterialPageRoute(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
builder: (context) => VideoPlayerScreen(
|
SnackBar(
|
||||||
mediaId: imdbId,
|
content: Text('Player feature will be implemented. Media ID: $imdbId'),
|
||||||
mediaType: widget.mediaType,
|
duration: Duration(seconds: 2),
|
||||||
title: title,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -91,7 +90,15 @@ class _MovieDetailScreenState extends State<MovieDetailScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (provider.error != null) {
|
if (provider.error != null) {
|
||||||
return Center(child: Text('Error: ${provider.error}'));
|
return ErrorDisplay(
|
||||||
|
title: 'Ошибка загрузки ${widget.mediaType == 'movie' ? 'фильма' : 'сериала'}',
|
||||||
|
error: provider.error!,
|
||||||
|
stackTrace: provider.stackTrace,
|
||||||
|
onRetry: () {
|
||||||
|
Provider.of<MovieDetailProvider>(context, listen: false)
|
||||||
|
.loadMedia(int.parse(widget.movieId), widget.mediaType);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (provider.movie == null) {
|
if (provider.movie == null) {
|
||||||
|
|||||||
254
lib/presentation/widgets/error_display.dart
Normal file
254
lib/presentation/widgets/error_display.dart
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
/// Widget that displays detailed error information for debugging
|
||||||
|
class ErrorDisplay extends StatelessWidget {
|
||||||
|
final String title;
|
||||||
|
final String error;
|
||||||
|
final String? stackTrace;
|
||||||
|
final VoidCallback? onRetry;
|
||||||
|
|
||||||
|
const ErrorDisplay({
|
||||||
|
super.key,
|
||||||
|
this.title = 'Произошла ошибка',
|
||||||
|
required this.error,
|
||||||
|
this.stackTrace,
|
||||||
|
this.onRetry,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
// Error icon and title
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(
|
||||||
|
Icons.error_outline,
|
||||||
|
size: 48,
|
||||||
|
color: Colors.red.shade400,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
|
||||||
|
// Title
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: Theme.of(context).textTheme.headlineSmall?.copyWith(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.red.shade700,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
|
||||||
|
// Error message card
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.red.shade50,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(color: Colors.red.shade200),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.info_outline, size: 20, color: Colors.red.shade700),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Сообщение об ошибке:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.red.shade700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
SelectableText(
|
||||||
|
error,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: OutlinedButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: error));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Ошибка скопирована в буфер обмена'),
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.copy, size: 18),
|
||||||
|
label: const Text('Копировать ошибку'),
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
foregroundColor: Colors.red.shade700,
|
||||||
|
side: BorderSide(color: Colors.red.shade300),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Stack trace (if available)
|
||||||
|
if (stackTrace != null && stackTrace!.isNotEmpty) ...[
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
ExpansionTile(
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.bug_report, size: 20, color: Colors.orange.shade700),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Stack Trace (для разработчиков)',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.orange.shade700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.orange.shade50,
|
||||||
|
collapsedBackgroundColor: Colors.orange.shade50,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
side: BorderSide(color: Colors.orange.shade200),
|
||||||
|
),
|
||||||
|
collapsedShape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
side: BorderSide(color: Colors.orange.shade200),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey.shade900,
|
||||||
|
borderRadius: const BorderRadius.only(
|
||||||
|
bottomLeft: Radius.circular(8),
|
||||||
|
bottomRight: Radius.circular(8),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SelectableText(
|
||||||
|
stackTrace!,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
fontSize: 11,
|
||||||
|
color: Colors.greenAccent,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
OutlinedButton.icon(
|
||||||
|
onPressed: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: stackTrace!));
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
const SnackBar(
|
||||||
|
content: Text('Stack trace скопирован в буфер обмена'),
|
||||||
|
duration: Duration(seconds: 2),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.copy, size: 18),
|
||||||
|
label: const Text('Копировать stack trace'),
|
||||||
|
style: OutlinedButton.styleFrom(
|
||||||
|
foregroundColor: Colors.greenAccent,
|
||||||
|
side: const BorderSide(color: Colors.greenAccent),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
// Retry button
|
||||||
|
if (onRetry != null) ...[
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton.icon(
|
||||||
|
onPressed: onRetry,
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
label: const Text('Попробовать снова'),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||||
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
|
foregroundColor: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
|
||||||
|
// Debug tips
|
||||||
|
const SizedBox(height: 24),
|
||||||
|
Container(
|
||||||
|
width: double.infinity,
|
||||||
|
padding: const EdgeInsets.all(12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.blue.shade50,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
border: Border.all(color: Colors.blue.shade200),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.lightbulb_outline, size: 20, color: Colors.blue.shade700),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
'Советы по отладке:',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Colors.blue.shade700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'• Скопируйте ошибку и отправьте разработчику\n'
|
||||||
|
'• Проверьте соединение с интернетом\n'
|
||||||
|
'• Проверьте логи Flutter в консоли\n'
|
||||||
|
'• Попробуйте перезапустить приложение',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.blue.shade900,
|
||||||
|
height: 1.5,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
218
pubspec.lock
218
pubspec.lock
@@ -41,6 +41,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.13.0"
|
version: "2.13.0"
|
||||||
|
auto_route:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: auto_route
|
||||||
|
sha256: a9001a90539ca3effc168f7e1029a5885c7326b9032c09ac895e303c1d137704
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.3.0"
|
||||||
|
auto_route_generator:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: auto_route_generator
|
||||||
|
sha256: a21d7a936c917488653c972f62d884d8adcf8c5d37acc7cd24da33cf784546c0
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.1.0"
|
||||||
bloc:
|
bloc:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -117,18 +133,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: built_value
|
name: built_value
|
||||||
sha256: "082001b5c3dc495d4a42f1d5789990505df20d8547d42507c29050af6933ee27"
|
sha256: a30f0a0e38671e89a492c44d005b5545b830a961575bbd8336d42869ff71066d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.10.1"
|
version: "8.12.0"
|
||||||
cached_network_image:
|
cached_network_image:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: cached_network_image
|
name: cached_network_image
|
||||||
sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916"
|
sha256: "4a5d8d2c728b0f3d0245f69f921d7be90cae4c2fd5288f773088672c0893f819"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.4.1"
|
version: "3.4.0"
|
||||||
cached_network_image_platform_interface:
|
cached_network_image_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -141,10 +157,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: cached_network_image_web
|
name: cached_network_image_web
|
||||||
sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062"
|
sha256: "6322dde7a5ad92202e64df659241104a43db20ed594c41ca18de1014598d7996"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.1"
|
version: "1.3.0"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -165,10 +181,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: chewie
|
name: chewie
|
||||||
sha256: "19b93a1e60e4ba640a792208a6543f1c7d5b124d011ce0199e2f18802199d984"
|
sha256: "44bcfc5f0dfd1de290c87c9d86a61308b3282a70b63435d5557cfd60f54a69ca"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.12.1"
|
version: "1.13.0"
|
||||||
cli_util:
|
cli_util:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -189,10 +205,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: code_builder
|
name: code_builder
|
||||||
sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e"
|
sha256: "11654819532ba94c34de52ff5feb52bd81cba1de00ef2ed622fd50295f9d4243"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.10.1"
|
version: "4.11.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -249,6 +265,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.11"
|
version: "0.7.11"
|
||||||
|
dio:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dio
|
||||||
|
sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "5.9.0"
|
||||||
|
dio_web_adapter:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: dio_web_adapter
|
||||||
|
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.1.1"
|
||||||
dynamic_color:
|
dynamic_color:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -436,10 +468,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: google_fonts
|
name: google_fonts
|
||||||
sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82
|
sha256: "517b20870220c48752eafa0ba1a797a092fb22df0d89535fd9991e86ee2cdd9c"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.2.1"
|
version: "6.3.2"
|
||||||
graphs:
|
graphs:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -484,10 +516,18 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: http
|
name: http
|
||||||
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
|
sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.5.0"
|
||||||
|
http_mock_adapter:
|
||||||
|
dependency: "direct dev"
|
||||||
|
description:
|
||||||
|
name: http_mock_adapter
|
||||||
|
sha256: "46399c78bd4a0af071978edd8c502d7aeeed73b5fb9860bca86b5ed647a63c1b"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.1"
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -584,6 +624,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.1.1"
|
version: "5.1.1"
|
||||||
|
logger:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: logger
|
||||||
|
sha256: "55d6c23a6c15db14920e037fe7e0dc32e7cdaf3b64b4b25df2d541b5b6b81c0c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.6.1"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -652,18 +700,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: package_info_plus
|
name: package_info_plus
|
||||||
sha256: "7976bfe4c583170d6cdc7077e3237560b364149fcd268b5f53d95a991963b191"
|
sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "8.3.0"
|
version: "9.0.0"
|
||||||
package_info_plus_platform_interface:
|
package_info_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: package_info_plus_platform_interface
|
name: package_info_plus_platform_interface
|
||||||
sha256: "6c935fb612dff8e3cc9632c2b301720c77450a126114126ffaafe28d2e87956c"
|
sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.0"
|
version: "3.2.1"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -673,7 +721,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.1"
|
version: "1.9.1"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
|
sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd"
|
||||||
@@ -684,18 +732,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_android
|
name: path_provider_android
|
||||||
sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9
|
sha256: "993381400e94d18469750e5b9dcb8206f15bc09f9da86b9e44a9b0092a0066db"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.17"
|
version: "2.2.18"
|
||||||
path_provider_foundation:
|
path_provider_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_foundation
|
name: path_provider_foundation
|
||||||
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
|
sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "2.4.2"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -720,14 +768,62 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
version: "2.3.0"
|
||||||
|
permission_handler:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: permission_handler
|
||||||
|
sha256: "59adad729136f01ea9e35a48f5d1395e25cba6cea552249ddbe9cf950f5d7849"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "11.4.0"
|
||||||
|
permission_handler_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_android
|
||||||
|
sha256: d3971dcdd76182a0c198c096b5db2f0884b0d4196723d21a866fc4cdea057ebc
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "12.1.0"
|
||||||
|
permission_handler_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_apple
|
||||||
|
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "9.4.7"
|
||||||
|
permission_handler_html:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_html
|
||||||
|
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3+5"
|
||||||
|
permission_handler_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_platform_interface
|
||||||
|
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.3.0"
|
||||||
|
permission_handler_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_windows
|
||||||
|
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1"
|
||||||
petitparser:
|
petitparser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: petitparser
|
name: petitparser
|
||||||
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
|
sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.0"
|
version: "7.0.1"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -748,10 +844,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pool
|
name: pool
|
||||||
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.5.1"
|
version: "1.5.2"
|
||||||
posix:
|
posix:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -764,10 +860,10 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: provider
|
name: provider
|
||||||
sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84"
|
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.1.5"
|
version: "6.1.5+1"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -804,10 +900,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shared_preferences_android
|
name: shared_preferences_android
|
||||||
sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac"
|
sha256: "0b0f98d535319cb5cdd4f65783c2a54ee6d417a2f093dbb18be3e36e4c3d181f"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.10"
|
version: "2.4.14"
|
||||||
shared_preferences_foundation:
|
shared_preferences_foundation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -913,18 +1009,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sqflite_android
|
name: sqflite_android
|
||||||
sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b"
|
sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.1"
|
version: "2.4.2+2"
|
||||||
sqflite_common:
|
sqflite_common:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: sqflite_common
|
name: sqflite_common
|
||||||
sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b"
|
sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.5"
|
version: "2.5.6"
|
||||||
sqflite_darwin:
|
sqflite_darwin:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1025,18 +1121,18 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_android
|
name: url_launcher_android
|
||||||
sha256: "8582d7f6fe14d2652b4c45c9b6c14c0b678c2af2d083a11b604caeba51930d79"
|
sha256: c0fb544b9ac7efa10254efaf00a951615c362d1ea1877472f8f6c0fa00fcf15b
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.3.16"
|
version: "6.3.23"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_ios
|
name: url_launcher_ios
|
||||||
sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb"
|
sha256: d80b3f567a617cb923546034cc94bfe44eb15f989fe670b37f26abdb9d939cb7
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.3.3"
|
version: "6.3.4"
|
||||||
url_launcher_linux:
|
url_launcher_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1049,10 +1145,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_macos
|
name: url_launcher_macos
|
||||||
sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
|
sha256: c043a77d6600ac9c38300567f33ef12b0ef4f4783a2c1f00231d2b1941fea13f
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.2.2"
|
version: "3.2.3"
|
||||||
url_launcher_platform_interface:
|
url_launcher_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1137,42 +1233,42 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "15.0.0"
|
version: "15.0.2"
|
||||||
wakelock_plus:
|
wakelock_plus:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: wakelock_plus
|
name: wakelock_plus
|
||||||
sha256: a474e314c3e8fb5adef1f9ae2d247e57467ad557fa7483a2b895bc1b421c5678
|
sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.2"
|
version: "1.4.0"
|
||||||
wakelock_plus_platform_interface:
|
wakelock_plus_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: wakelock_plus_platform_interface
|
name: wakelock_plus_platform_interface
|
||||||
sha256: e10444072e50dbc4999d7316fd303f7ea53d31c824aa5eb05d7ccbdd98985207
|
sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.3"
|
version: "1.3.0"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: watcher
|
name: watcher
|
||||||
sha256: "0b7fd4a0bbc4b92641dbf20adfd7e3fd1398fe17102d94b674234563e110088a"
|
sha256: "592ab6e2892f67760543fb712ff0177f4ec76c031f02f5b4ff8d3fc5eb9fb61a"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.2"
|
version: "1.1.4"
|
||||||
web:
|
web:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: web
|
name: web
|
||||||
sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a"
|
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "0.5.1"
|
||||||
web_socket:
|
web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1201,26 +1297,26 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_android
|
name: webview_flutter_android
|
||||||
sha256: f6e6afef6e234801da77170f7a1847ded8450778caf2fe13979d140484be3678
|
sha256: "21507ea5a326ceeba4d29dea19e37d92d53d9959cfc746317b9f9f7a57418d87"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.7.0"
|
version: "4.10.3"
|
||||||
webview_flutter_platform_interface:
|
webview_flutter_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_platform_interface
|
name: webview_flutter_platform_interface
|
||||||
sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147
|
sha256: "63d26ee3aca7256a83ccb576a50272edd7cfc80573a4305caa98985feb493ee0"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.13.1"
|
version: "2.14.0"
|
||||||
webview_flutter_wkwebview:
|
webview_flutter_wkwebview:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webview_flutter_wkwebview
|
name: webview_flutter_wkwebview
|
||||||
sha256: a3d461fe3467014e05f3ac4962e5fdde2a4bf44c561cb53e9ae5c586600fdbc3
|
sha256: fea63576b3b7e02b2df8b78ba92b48ed66caec2bb041e9a0b1cbd586d5d80bfd
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.22.0"
|
version: "3.23.1"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1241,10 +1337,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: xml
|
name: xml
|
||||||
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.5.0"
|
version: "6.6.1"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1254,5 +1350,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.3"
|
version: "3.1.3"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.8.1 <4.0.0"
|
dart: ">=3.9.0 <4.0.0"
|
||||||
flutter: ">=3.29.0"
|
flutter: ">=3.35.0"
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ dependencies:
|
|||||||
# Utils
|
# Utils
|
||||||
equatable: ^2.0.5
|
equatable: ^2.0.5
|
||||||
url_launcher: ^6.3.2
|
url_launcher: ^6.3.2
|
||||||
auto_route: ^8.1.0
|
auto_route: ^8.3.0
|
||||||
# File operations and path management
|
# File operations and path management
|
||||||
path_provider: ^2.1.4
|
path_provider: ^2.1.4
|
||||||
permission_handler: ^11.3.1
|
permission_handler: ^11.3.1
|
||||||
@@ -67,7 +67,7 @@ dev_dependencies:
|
|||||||
freezed: ^2.4.5
|
freezed: ^2.4.5
|
||||||
json_serializable: ^6.7.1
|
json_serializable: ^6.7.1
|
||||||
hive_generator: ^2.0.1
|
hive_generator: ^2.0.1
|
||||||
auto_route_generator: ^8.3.0
|
auto_route_generator: ^8.1.0
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^5.0.0
|
flutter_lints: ^5.0.0
|
||||||
|
|||||||
@@ -1,346 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
import 'package:neomovies_mobile/data/models/torrent_info.dart';
|
|
||||||
import 'package:neomovies_mobile/data/services/torrent_platform_service.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
group('Torrent Integration Tests', () {
|
|
||||||
late TorrentPlatformService service;
|
|
||||||
late List<MethodCall> methodCalls;
|
|
||||||
|
|
||||||
// Sintel - открытый короткометражный фильм от Blender Foundation
|
|
||||||
// Официально доступен под Creative Commons лицензией
|
|
||||||
const sintelMagnetLink = 'magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10'
|
|
||||||
'&dn=Sintel&tr=udp%3A%2F%2Fexplodie.org%3A6969'
|
|
||||||
'&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969'
|
|
||||||
'&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337'
|
|
||||||
'&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969'
|
|
||||||
'&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337'
|
|
||||||
'&tr=wss%3A%2F%2Ftracker.btorrent.xyz'
|
|
||||||
'&tr=wss%3A%2F%2Ftracker.fastcast.nz'
|
|
||||||
'&tr=wss%3A%2F%2Ftracker.openwebtorrent.com'
|
|
||||||
'&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F'
|
|
||||||
'&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fsintel.torrent';
|
|
||||||
|
|
||||||
const expectedTorrentHash = '08ada5a7a6183aae1e09d831df6748d566095a10';
|
|
||||||
|
|
||||||
setUp(() {
|
|
||||||
service = TorrentPlatformService();
|
|
||||||
methodCalls = [];
|
|
||||||
|
|
||||||
// Mock platform channel для симуляции Android ответов
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
(MethodCall methodCall) async {
|
|
||||||
methodCalls.add(methodCall);
|
|
||||||
return _handleSintelMethodCall(methodCall);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
tearDown(() {
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Real Magnet Link Tests', () {
|
|
||||||
test('should parse Sintel magnet link correctly', () {
|
|
||||||
// Проверяем, что магнет ссылка содержит правильные компоненты
|
|
||||||
expect(sintelMagnetLink, contains('urn:btih:$expectedTorrentHash'));
|
|
||||||
expect(sintelMagnetLink, contains('Sintel'));
|
|
||||||
expect(sintelMagnetLink, contains('tracker.opentrackr.org'));
|
|
||||||
|
|
||||||
// Проверяем, что это действительно magnet ссылка
|
|
||||||
expect(sintelMagnetLink, startsWith('magnet:?xt=urn:btih:'));
|
|
||||||
|
|
||||||
// Извлекаем hash из магнет ссылки
|
|
||||||
final hashMatch = RegExp(r'urn:btih:([a-fA-F0-9]{40})').firstMatch(sintelMagnetLink);
|
|
||||||
expect(hashMatch, isNotNull);
|
|
||||||
expect(hashMatch!.group(1)?.toLowerCase(), expectedTorrentHash);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should add Sintel torrent successfully', () async {
|
|
||||||
const downloadPath = '/storage/emulated/0/Download/Torrents';
|
|
||||||
|
|
||||||
final result = await service.addTorrent(sintelMagnetLink, downloadPath);
|
|
||||||
|
|
||||||
// Проверяем, что метод был вызван с правильными параметрами
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'addTorrent');
|
|
||||||
expect(methodCalls.first.arguments['magnetUri'], sintelMagnetLink);
|
|
||||||
expect(methodCalls.first.arguments['downloadPath'], downloadPath);
|
|
||||||
|
|
||||||
// Проверяем результат
|
|
||||||
expect(result, isA<Map<String, dynamic>>());
|
|
||||||
expect(result['success'], isTrue);
|
|
||||||
expect(result['torrentHash'], expectedTorrentHash);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should retrieve Sintel torrent info', () async {
|
|
||||||
// Добавляем торрент
|
|
||||||
await service.addTorrent(sintelMagnetLink, '/storage/emulated/0/Download/Torrents');
|
|
||||||
methodCalls.clear(); // Очищаем предыдущие вызовы
|
|
||||||
|
|
||||||
// Получаем информацию о торренте
|
|
||||||
final torrentInfo = await service.getTorrentInfo(expectedTorrentHash);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'getTorrentInfo');
|
|
||||||
expect(methodCalls.first.arguments['torrentHash'], expectedTorrentHash);
|
|
||||||
|
|
||||||
expect(torrentInfo, isNotNull);
|
|
||||||
expect(torrentInfo!.infoHash, expectedTorrentHash);
|
|
||||||
expect(torrentInfo.name, contains('Sintel'));
|
|
||||||
|
|
||||||
// Проверяем, что обнаружены видео файлы
|
|
||||||
final videoFiles = torrentInfo.videoFiles;
|
|
||||||
expect(videoFiles.isNotEmpty, isTrue);
|
|
||||||
|
|
||||||
final mainFile = torrentInfo.mainVideoFile;
|
|
||||||
expect(mainFile, isNotNull);
|
|
||||||
expect(mainFile!.name.toLowerCase(), anyOf(
|
|
||||||
contains('.mp4'),
|
|
||||||
contains('.mkv'),
|
|
||||||
contains('.avi'),
|
|
||||||
contains('.webm'),
|
|
||||||
));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should handle torrent operations on Sintel', () async {
|
|
||||||
// Добавляем торрент
|
|
||||||
await service.addTorrent(sintelMagnetLink, '/storage/emulated/0/Download/Torrents');
|
|
||||||
|
|
||||||
// Тестируем все операции
|
|
||||||
await service.pauseTorrent(expectedTorrentHash);
|
|
||||||
await service.resumeTorrent(expectedTorrentHash);
|
|
||||||
|
|
||||||
// Проверяем приоритеты файлов
|
|
||||||
final priorities = await service.getFilePriorities(expectedTorrentHash);
|
|
||||||
expect(priorities, isA<List<FilePriority>>());
|
|
||||||
expect(priorities.isNotEmpty, isTrue);
|
|
||||||
|
|
||||||
// Устанавливаем высокий приоритет для первого файла
|
|
||||||
await service.setFilePriority(expectedTorrentHash, 0, FilePriority.high);
|
|
||||||
|
|
||||||
// Получаем список всех торрентов
|
|
||||||
final allTorrents = await service.getAllTorrents();
|
|
||||||
expect(allTorrents.any((t) => t.infoHash == expectedTorrentHash), isTrue);
|
|
||||||
|
|
||||||
// Удаляем торрент
|
|
||||||
await service.removeTorrent(expectedTorrentHash);
|
|
||||||
|
|
||||||
// Проверяем все вызовы методов
|
|
||||||
final expectedMethods = ['addTorrent', 'pauseTorrent', 'resumeTorrent',
|
|
||||||
'getFilePriorities', 'setFilePriority', 'getAllTorrents', 'removeTorrent'];
|
|
||||||
final actualMethods = methodCalls.map((call) => call.method).toList();
|
|
||||||
|
|
||||||
for (final method in expectedMethods) {
|
|
||||||
expect(actualMethods, contains(method));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Network and Environment Tests', () {
|
|
||||||
test('should work in GitHub Actions environment', () async {
|
|
||||||
// Проверяем переменные окружения GitHub Actions
|
|
||||||
final isGitHubActions = Platform.environment['GITHUB_ACTIONS'] == 'true';
|
|
||||||
final isCI = Platform.environment['CI'] == 'true';
|
|
||||||
|
|
||||||
if (isGitHubActions || isCI) {
|
|
||||||
print('Running in CI/GitHub Actions environment');
|
|
||||||
|
|
||||||
// В CI окружении используем более короткие таймауты
|
|
||||||
// и дополнительные проверки
|
|
||||||
expect(Platform.environment['RUNNER_OS'], isNotNull);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Тест должен работать в любом окружении
|
|
||||||
final result = await service.addTorrent(sintelMagnetLink, '/tmp/test');
|
|
||||||
expect(result['success'], isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should handle network timeouts gracefully', () async {
|
|
||||||
// Симулируем медленную сеть
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
(MethodCall methodCall) async {
|
|
||||||
if (methodCall.method == 'addTorrent') {
|
|
||||||
// Симулируем задержку сети
|
|
||||||
await Future.delayed(const Duration(milliseconds: 100));
|
|
||||||
return _handleSintelMethodCall(methodCall);
|
|
||||||
}
|
|
||||||
return _handleSintelMethodCall(methodCall);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
final stopwatch = Stopwatch()..start();
|
|
||||||
final result = await service.addTorrent(sintelMagnetLink, '/tmp/test');
|
|
||||||
stopwatch.stop();
|
|
||||||
|
|
||||||
expect(result['success'], isTrue);
|
|
||||||
expect(stopwatch.elapsedMilliseconds, lessThan(5000)); // Максимум 5 секунд
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should validate magnet link format', () {
|
|
||||||
// Проверяем различные форматы магнет ссылок
|
|
||||||
const validMagnets = [
|
|
||||||
sintelMagnetLink,
|
|
||||||
'magnet:?xt=urn:btih:1234567890abcdef1234567890abcdef12345678&dn=test',
|
|
||||||
];
|
|
||||||
|
|
||||||
const invalidMagnets = [
|
|
||||||
'not-a-magnet-link',
|
|
||||||
'http://example.com/torrent',
|
|
||||||
'magnet:invalid',
|
|
||||||
'',
|
|
||||||
];
|
|
||||||
|
|
||||||
for (final magnet in validMagnets) {
|
|
||||||
expect(_isValidMagnetLink(magnet), isTrue, reason: 'Should accept valid magnet: $magnet');
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final magnet in invalidMagnets) {
|
|
||||||
expect(_isValidMagnetLink(magnet), isFalse, reason: 'Should reject invalid magnet: $magnet');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Performance Tests', () {
|
|
||||||
test('should handle multiple concurrent operations', () async {
|
|
||||||
// Тестируем параллельные операции
|
|
||||||
final futures = <Future>[];
|
|
||||||
|
|
||||||
// Параллельно выполняем несколько операций
|
|
||||||
futures.add(service.addTorrent(sintelMagnetLink, '/tmp/test1'));
|
|
||||||
futures.add(service.getAllTorrents());
|
|
||||||
futures.add(service.getTorrentInfo(expectedTorrentHash));
|
|
||||||
|
|
||||||
final results = await Future.wait(futures);
|
|
||||||
|
|
||||||
expect(results.length, 3);
|
|
||||||
expect(results[0], isA<Map<String, dynamic>>()); // addTorrent result
|
|
||||||
expect(results[1], isA<List<TorrentInfo>>()); // getAllTorrents result
|
|
||||||
expect(results[2], anyOf(isA<TorrentInfo>(), isNull)); // getTorrentInfo result
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should complete operations within reasonable time', () async {
|
|
||||||
final stopwatch = Stopwatch()..start();
|
|
||||||
|
|
||||||
await service.addTorrent(sintelMagnetLink, '/tmp/test');
|
|
||||||
await service.getAllTorrents();
|
|
||||||
await service.removeTorrent(expectedTorrentHash);
|
|
||||||
|
|
||||||
stopwatch.stop();
|
|
||||||
|
|
||||||
// Все операции должны завершиться быстро (меньше 1 секунды в тестах)
|
|
||||||
expect(stopwatch.elapsedMilliseconds, lessThan(1000));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Проверяет, является ли строка валидной магнет ссылкой
|
|
||||||
bool _isValidMagnetLink(String link) {
|
|
||||||
if (!link.startsWith('magnet:?')) return false;
|
|
||||||
|
|
||||||
// Проверяем наличие xt параметра с BitTorrent hash
|
|
||||||
final btihPattern = RegExp(r'xt=urn:btih:[a-fA-F0-9]{40}');
|
|
||||||
return btihPattern.hasMatch(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Mock обработчик для Sintel торрента
|
|
||||||
dynamic _handleSintelMethodCall(MethodCall methodCall) {
|
|
||||||
switch (methodCall.method) {
|
|
||||||
case 'addTorrent':
|
|
||||||
final magnetUri = methodCall.arguments['magnetUri'] as String;
|
|
||||||
if (magnetUri.contains('08ada5a7a6183aae1e09d831df6748d566095a10')) {
|
|
||||||
return {
|
|
||||||
'success': true,
|
|
||||||
'torrentHash': '08ada5a7a6183aae1e09d831df6748d566095a10',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return {'success': false, 'error': 'Invalid magnet link'};
|
|
||||||
|
|
||||||
case 'getTorrentInfo':
|
|
||||||
final hash = methodCall.arguments['torrentHash'] as String;
|
|
||||||
if (hash == '08ada5a7a6183aae1e09d831df6748d566095a10') {
|
|
||||||
return _getSintelTorrentData();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
case 'getAllTorrents':
|
|
||||||
return [_getSintelTorrentData()];
|
|
||||||
|
|
||||||
case 'pauseTorrent':
|
|
||||||
case 'resumeTorrent':
|
|
||||||
case 'removeTorrent':
|
|
||||||
return {'success': true};
|
|
||||||
|
|
||||||
case 'setFilePriority':
|
|
||||||
return {'success': true};
|
|
||||||
|
|
||||||
case 'getFilePriorities':
|
|
||||||
return [
|
|
||||||
FilePriority.high.value,
|
|
||||||
FilePriority.normal.value,
|
|
||||||
FilePriority.low.value,
|
|
||||||
];
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw PlatformException(
|
|
||||||
code: 'UNIMPLEMENTED',
|
|
||||||
message: 'Method ${methodCall.method} not implemented in mock',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Возвращает mock данные для Sintel торрента
|
|
||||||
Map<String, dynamic> _getSintelTorrentData() {
|
|
||||||
return {
|
|
||||||
'name': 'Sintel (2010) [1080p]',
|
|
||||||
'infoHash': '08ada5a7a6183aae1e09d831df6748d566095a10',
|
|
||||||
'state': 'downloading',
|
|
||||||
'progress': 0.15, // 15% загружено
|
|
||||||
'downloadSpeed': 1500000, // 1.5 MB/s
|
|
||||||
'uploadSpeed': 200000, // 200 KB/s
|
|
||||||
'totalSize': 734003200, // ~700 MB
|
|
||||||
'downloadedSize': 110100480, // ~105 MB
|
|
||||||
'seeders': 45,
|
|
||||||
'leechers': 12,
|
|
||||||
'ratio': 0.8,
|
|
||||||
'addedTime': DateTime.now().subtract(const Duration(minutes: 30)).millisecondsSinceEpoch,
|
|
||||||
'files': [
|
|
||||||
{
|
|
||||||
'name': 'Sintel.2010.1080p.mkv',
|
|
||||||
'size': 734003200,
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/Sintel/Sintel.2010.1080p.mkv',
|
|
||||||
'priority': FilePriority.high.value,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'Sintel.2010.720p.mp4',
|
|
||||||
'size': 367001600, // ~350 MB
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/Sintel/Sintel.2010.720p.mp4',
|
|
||||||
'priority': FilePriority.normal.value,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'subtitles/Sintel.srt',
|
|
||||||
'size': 52428, // ~51 KB
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/Sintel/subtitles/Sintel.srt',
|
|
||||||
'priority': FilePriority.normal.value,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'README.txt',
|
|
||||||
'size': 2048,
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/Sintel/README.txt',
|
|
||||||
'priority': FilePriority.low.value,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:neomovies_mobile/presentation/providers/downloads_provider.dart';
|
import 'package:neomovies_mobile/presentation/providers/downloads_provider.dart';
|
||||||
|
|
||||||
|
|||||||
111
test/services/torrent_platform_service_simple_test.dart
Normal file
111
test/services/torrent_platform_service_simple_test.dart
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:neomovies_mobile/data/services/torrent_platform_service.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
group('TorrentPlatformService Tests', () {
|
||||||
|
late List<MethodCall> methodCalls;
|
||||||
|
|
||||||
|
setUp(() {
|
||||||
|
methodCalls = [];
|
||||||
|
|
||||||
|
// Mock the platform channel
|
||||||
|
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||||
|
.setMockMethodCallHandler(
|
||||||
|
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
||||||
|
(MethodCall methodCall) async {
|
||||||
|
methodCalls.add(methodCall);
|
||||||
|
return _handleMethodCall(methodCall);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
tearDown(() {
|
||||||
|
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||||
|
.setMockMethodCallHandler(
|
||||||
|
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
||||||
|
null,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('addTorrent should call platform method with correct parameters', () async {
|
||||||
|
const magnetUri = 'magnet:?xt=urn:btih:test123&dn=test.movie.mkv';
|
||||||
|
const savePath = '/storage/emulated/0/Download/Torrents';
|
||||||
|
|
||||||
|
final result = await TorrentPlatformService.addTorrent(
|
||||||
|
magnetUri: magnetUri,
|
||||||
|
savePath: savePath
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(methodCalls.length, 1);
|
||||||
|
expect(methodCalls.first.method, 'addTorrent');
|
||||||
|
expect(methodCalls.first.arguments, {
|
||||||
|
'magnetUri': magnetUri,
|
||||||
|
'savePath': savePath,
|
||||||
|
});
|
||||||
|
expect(result, 'test-hash-123');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('parseMagnetBasicInfo should parse magnet URI correctly', () async {
|
||||||
|
const magnetUri = 'magnet:?xt=urn:btih:abc123&dn=test%20movie&tr=http%3A//tracker.example.com%3A8080/announce';
|
||||||
|
|
||||||
|
final result = await TorrentPlatformService.parseMagnetBasicInfo(magnetUri);
|
||||||
|
|
||||||
|
expect(result.name, 'test movie');
|
||||||
|
expect(result.infoHash, 'abc123');
|
||||||
|
expect(result.trackers.length, 1);
|
||||||
|
expect(result.trackers.first, 'http://tracker.example.com:8080/announce');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Mock method call handler for torrent platform channel
|
||||||
|
dynamic _handleMethodCall(MethodCall methodCall) {
|
||||||
|
switch (methodCall.method) {
|
||||||
|
case 'addTorrent':
|
||||||
|
return 'test-hash-123';
|
||||||
|
|
||||||
|
case 'getTorrents':
|
||||||
|
return jsonEncode([
|
||||||
|
{
|
||||||
|
'infoHash': 'test-hash-123',
|
||||||
|
'progress': 0.5,
|
||||||
|
'downloadSpeed': 1024000,
|
||||||
|
'uploadSpeed': 512000,
|
||||||
|
'numSeeds': 5,
|
||||||
|
'numPeers': 10,
|
||||||
|
'state': 'downloading',
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
|
case 'getTorrent':
|
||||||
|
return jsonEncode({
|
||||||
|
'name': 'Test Movie',
|
||||||
|
'infoHash': 'test-hash-123',
|
||||||
|
'totalSize': 1073741824,
|
||||||
|
'files': [
|
||||||
|
{
|
||||||
|
'path': 'Test Movie.mkv',
|
||||||
|
'size': 1073741824,
|
||||||
|
'priority': 4,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'downloadedSize': 536870912,
|
||||||
|
'downloadSpeed': 1024000,
|
||||||
|
'uploadSpeed': 512000,
|
||||||
|
'state': 'downloading',
|
||||||
|
'progress': 0.5,
|
||||||
|
'numSeeds': 5,
|
||||||
|
'numPeers': 10,
|
||||||
|
'addedTime': DateTime.now().millisecondsSinceEpoch,
|
||||||
|
'ratio': 0.8,
|
||||||
|
});
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,331 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
import 'package:neomovies_mobile/data/models/torrent_info.dart';
|
|
||||||
import 'package:neomovies_mobile/data/services/torrent_platform_service.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
group('TorrentPlatformService Tests', () {
|
|
||||||
late TorrentPlatformService service;
|
|
||||||
late List<MethodCall> methodCalls;
|
|
||||||
|
|
||||||
setUp(() {
|
|
||||||
service = TorrentPlatformService();
|
|
||||||
methodCalls = [];
|
|
||||||
|
|
||||||
// Mock the platform channel
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
(MethodCall methodCall) async {
|
|
||||||
methodCalls.add(methodCall);
|
|
||||||
return _handleMethodCall(methodCall);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
tearDown(() {
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Torrent Management', () {
|
|
||||||
test('addTorrent should call Android method with correct parameters', () async {
|
|
||||||
const magnetUri = 'magnet:?xt=urn:btih:test123&dn=test.movie.mkv';
|
|
||||||
const downloadPath = '/storage/emulated/0/Download/Torrents';
|
|
||||||
|
|
||||||
await service.addTorrent(magnetUri, downloadPath);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'addTorrent');
|
|
||||||
expect(methodCalls.first.arguments, {
|
|
||||||
'magnetUri': magnetUri,
|
|
||||||
'downloadPath': downloadPath,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('removeTorrent should call Android method with torrent hash', () async {
|
|
||||||
const torrentHash = 'abc123def456';
|
|
||||||
|
|
||||||
await service.removeTorrent(torrentHash);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'removeTorrent');
|
|
||||||
expect(methodCalls.first.arguments, {'torrentHash': torrentHash});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('pauseTorrent should call Android method with torrent hash', () async {
|
|
||||||
const torrentHash = 'abc123def456';
|
|
||||||
|
|
||||||
await service.pauseTorrent(torrentHash);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'pauseTorrent');
|
|
||||||
expect(methodCalls.first.arguments, {'torrentHash': torrentHash});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('resumeTorrent should call Android method with torrent hash', () async {
|
|
||||||
const torrentHash = 'abc123def456';
|
|
||||||
|
|
||||||
await service.resumeTorrent(torrentHash);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'resumeTorrent');
|
|
||||||
expect(methodCalls.first.arguments, {'torrentHash': torrentHash});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Torrent Information', () {
|
|
||||||
test('getAllTorrents should return list of TorrentInfo objects', () async {
|
|
||||||
final torrents = await service.getAllTorrents();
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'getAllTorrents');
|
|
||||||
expect(torrents, isA<List<TorrentInfo>>());
|
|
||||||
expect(torrents.length, 2); // Based on mock data
|
|
||||||
|
|
||||||
final firstTorrent = torrents.first;
|
|
||||||
expect(firstTorrent.name, 'Test Movie 1080p.mkv');
|
|
||||||
expect(firstTorrent.infoHash, 'abc123def456');
|
|
||||||
expect(firstTorrent.state, 'downloading');
|
|
||||||
expect(firstTorrent.progress, 0.65);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('getTorrentInfo should return specific torrent information', () async {
|
|
||||||
const torrentHash = 'abc123def456';
|
|
||||||
|
|
||||||
final torrent = await service.getTorrentInfo(torrentHash);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'getTorrentInfo');
|
|
||||||
expect(methodCalls.first.arguments, {'torrentHash': torrentHash});
|
|
||||||
expect(torrent, isA<TorrentInfo>());
|
|
||||||
expect(torrent?.infoHash, torrentHash);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('File Priority Management', () {
|
|
||||||
test('setFilePriority should call Android method with correct parameters', () async {
|
|
||||||
const torrentHash = 'abc123def456';
|
|
||||||
const fileIndex = 0;
|
|
||||||
const priority = FilePriority.high;
|
|
||||||
|
|
||||||
await service.setFilePriority(torrentHash, fileIndex, priority);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'setFilePriority');
|
|
||||||
expect(methodCalls.first.arguments, {
|
|
||||||
'torrentHash': torrentHash,
|
|
||||||
'fileIndex': fileIndex,
|
|
||||||
'priority': priority.value,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('getFilePriorities should return list of priorities', () async {
|
|
||||||
const torrentHash = 'abc123def456';
|
|
||||||
|
|
||||||
final priorities = await service.getFilePriorities(torrentHash);
|
|
||||||
|
|
||||||
expect(methodCalls.length, 1);
|
|
||||||
expect(methodCalls.first.method, 'getFilePriorities');
|
|
||||||
expect(methodCalls.first.arguments, {'torrentHash': torrentHash});
|
|
||||||
expect(priorities, isA<List<FilePriority>>());
|
|
||||||
expect(priorities.length, 3); // Based on mock data
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Error Handling', () {
|
|
||||||
test('should handle PlatformException gracefully', () async {
|
|
||||||
// Override mock to throw exception
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
(MethodCall methodCall) async {
|
|
||||||
throw PlatformException(
|
|
||||||
code: 'TORRENT_ERROR',
|
|
||||||
message: 'Failed to add torrent',
|
|
||||||
details: 'Invalid magnet URI',
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(
|
|
||||||
() => service.addTorrent('invalid-magnet', '/path'),
|
|
||||||
throwsA(isA<PlatformException>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should handle null response from platform', () async {
|
|
||||||
// Override mock to return null
|
|
||||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
||||||
.setMockMethodCallHandler(
|
|
||||||
const MethodChannel('com.neo.neomovies_mobile/torrent'),
|
|
||||||
(MethodCall methodCall) async => null,
|
|
||||||
);
|
|
||||||
|
|
||||||
final result = await service.getTorrentInfo('nonexistent');
|
|
||||||
expect(result, isNull);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('State Management', () {
|
|
||||||
test('torrent states should be correctly identified', () async {
|
|
||||||
final torrents = await service.getAllTorrents();
|
|
||||||
|
|
||||||
// Find torrents with different states
|
|
||||||
final downloadingTorrent = torrents.firstWhere(
|
|
||||||
(t) => t.state == 'downloading',
|
|
||||||
);
|
|
||||||
final seedingTorrent = torrents.firstWhere(
|
|
||||||
(t) => t.state == 'seeding',
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(downloadingTorrent.isDownloading, isTrue);
|
|
||||||
expect(downloadingTorrent.isSeeding, isFalse);
|
|
||||||
expect(downloadingTorrent.isCompleted, isFalse);
|
|
||||||
|
|
||||||
expect(seedingTorrent.isDownloading, isFalse);
|
|
||||||
expect(seedingTorrent.isSeeding, isTrue);
|
|
||||||
expect(seedingTorrent.isCompleted, isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('progress calculation should be accurate', () async {
|
|
||||||
final torrents = await service.getAllTorrents();
|
|
||||||
final torrent = torrents.first;
|
|
||||||
|
|
||||||
expect(torrent.progress, inInclusiveRange(0.0, 1.0));
|
|
||||||
expect(torrent.formattedProgress, '65%');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
group('Video File Detection', () {
|
|
||||||
test('should identify video files correctly', () async {
|
|
||||||
final torrents = await service.getAllTorrents();
|
|
||||||
final torrent = torrents.first;
|
|
||||||
|
|
||||||
final videoFiles = torrent.videoFiles;
|
|
||||||
expect(videoFiles.isNotEmpty, isTrue);
|
|
||||||
|
|
||||||
final videoFile = videoFiles.first;
|
|
||||||
expect(videoFile.name.toLowerCase(), contains('.mkv'));
|
|
||||||
expect(videoFile.isVideo, isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should find main video file', () async {
|
|
||||||
final torrents = await service.getAllTorrents();
|
|
||||||
final torrent = torrents.first;
|
|
||||||
|
|
||||||
final mainFile = torrent.mainVideoFile;
|
|
||||||
expect(mainFile, isNotNull);
|
|
||||||
expect(mainFile!.isVideo, isTrue);
|
|
||||||
expect(mainFile.size, greaterThan(0));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Mock method call handler for torrent platform channel
|
|
||||||
dynamic _handleMethodCall(MethodCall methodCall) {
|
|
||||||
switch (methodCall.method) {
|
|
||||||
case 'addTorrent':
|
|
||||||
return {'success': true, 'torrentHash': 'abc123def456'};
|
|
||||||
|
|
||||||
case 'removeTorrent':
|
|
||||||
case 'pauseTorrent':
|
|
||||||
case 'resumeTorrent':
|
|
||||||
return {'success': true};
|
|
||||||
|
|
||||||
case 'getAllTorrents':
|
|
||||||
return _getMockTorrentsData();
|
|
||||||
|
|
||||||
case 'getTorrentInfo':
|
|
||||||
final hash = methodCall.arguments['torrentHash'] as String;
|
|
||||||
final torrents = _getMockTorrentsData();
|
|
||||||
return torrents.firstWhere(
|
|
||||||
(t) => t['infoHash'] == hash,
|
|
||||||
orElse: () => null,
|
|
||||||
);
|
|
||||||
|
|
||||||
case 'setFilePriority':
|
|
||||||
return {'success': true};
|
|
||||||
|
|
||||||
case 'getFilePriorities':
|
|
||||||
return [
|
|
||||||
FilePriority.high.value,
|
|
||||||
FilePriority.normal.value,
|
|
||||||
FilePriority.low.value,
|
|
||||||
];
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw PlatformException(
|
|
||||||
code: 'UNIMPLEMENTED',
|
|
||||||
message: 'Method ${methodCall.method} not implemented',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Mock torrents data for testing
|
|
||||||
List<Map<String, dynamic>> _getMockTorrentsData() {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
'name': 'Test Movie 1080p.mkv',
|
|
||||||
'infoHash': 'abc123def456',
|
|
||||||
'state': 'downloading',
|
|
||||||
'progress': 0.65,
|
|
||||||
'downloadSpeed': 2500000, // 2.5 MB/s
|
|
||||||
'uploadSpeed': 800000, // 800 KB/s
|
|
||||||
'totalSize': 4294967296, // 4 GB
|
|
||||||
'downloadedSize': 2791728742, // ~2.6 GB
|
|
||||||
'seeders': 15,
|
|
||||||
'leechers': 8,
|
|
||||||
'ratio': 1.2,
|
|
||||||
'addedTime': DateTime.now().subtract(const Duration(hours: 2)).millisecondsSinceEpoch,
|
|
||||||
'files': [
|
|
||||||
{
|
|
||||||
'name': 'Test Movie 1080p.mkv',
|
|
||||||
'size': 4294967296,
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/Test Movie 1080p.mkv',
|
|
||||||
'priority': FilePriority.high.value,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'subtitle.srt',
|
|
||||||
'size': 65536,
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/subtitle.srt',
|
|
||||||
'priority': FilePriority.normal.value,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'NFO.txt',
|
|
||||||
'size': 2048,
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/NFO.txt',
|
|
||||||
'priority': FilePriority.low.value,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'name': 'Another Movie 720p',
|
|
||||||
'infoHash': 'def456ghi789',
|
|
||||||
'state': 'seeding',
|
|
||||||
'progress': 1.0,
|
|
||||||
'downloadSpeed': 0,
|
|
||||||
'uploadSpeed': 500000, // 500 KB/s
|
|
||||||
'totalSize': 2147483648, // 2 GB
|
|
||||||
'downloadedSize': 2147483648,
|
|
||||||
'seeders': 25,
|
|
||||||
'leechers': 3,
|
|
||||||
'ratio': 2.5,
|
|
||||||
'addedTime': DateTime.now().subtract(const Duration(days: 1)).millisecondsSinceEpoch,
|
|
||||||
'files': [
|
|
||||||
{
|
|
||||||
'name': 'Another Movie 720p.mp4',
|
|
||||||
'size': 2147483648,
|
|
||||||
'path': '/storage/emulated/0/Download/Torrents/Another Movie 720p.mp4',
|
|
||||||
'priority': FilePriority.high.value,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
#include <dynamic_color/dynamic_color_plugin_c_api.h>
|
||||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||||
|
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||||
#include <url_launcher_windows/url_launcher_windows.h>
|
#include <url_launcher_windows/url_launcher_windows.h>
|
||||||
|
|
||||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||||
@@ -15,6 +16,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||||||
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
registry->GetRegistrarForPlugin("DynamicColorPluginCApi"));
|
||||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
|
||||||
|
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
|
||||||
UrlLauncherWindowsRegisterWithRegistrar(
|
UrlLauncherWindowsRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
dynamic_color
|
dynamic_color
|
||||||
flutter_secure_storage_windows
|
flutter_secure_storage_windows
|
||||||
|
permission_handler_windows
|
||||||
url_launcher_windows
|
url_launcher_windows
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user