Skip to content

Commit

Permalink
Optimizaciones
Browse files Browse the repository at this point in the history
  • Loading branch information
yon30c committed Nov 14, 2023
1 parent 8584463 commit 6cc3099
Show file tree
Hide file tree
Showing 64 changed files with 521 additions and 660 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode 17
versionCode 18
versionName flutterVersionName
}

Expand Down
9 changes: 6 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:kimoi/src/config/router/router_controller.dart';
import 'package:kimoi/src/config/router/router_service.dart';
import 'package:kimoi/src/config/source/source_controller.dart';
import 'package:kimoi/src/config/source/source_service.dart';
import 'firebase_options.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:kimoi/src/main_app.dart';
Expand All @@ -15,13 +17,11 @@ import 'src/config/theme/theme.dart';

final themeController = ThemeController(ThemeService());
final routerController = RouterController(RouterService());
final sourceController = SourceController(SourceService());

void main() async {
WidgetsFlutterBinding.ensureInitialized();




if (!Platform.isLinux) {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
Expand All @@ -34,7 +34,10 @@ void main() async {

await ThemeService.init();
await RouterService.init();
await SourceService.init();

await themeController.loadTheme();
await sourceController.loadInitialDatasource();
await routerController.loadInitialLocation();
await dotenv.load(fileName: ".env");

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:kimoi/src/UI/items/rewind_and_forward_layout.dart';
import 'package:kimoi/src/UI/items/ripple_side.dart';
import 'package:kimoi/src/UI/items/transitions.dart';
import 'package:kimoi/src/UI/components/rewind_and_forward_layout.dart';
import 'package:kimoi/src/UI/components/ripple_side.dart';
import 'package:kimoi/src/UI/components/transitions.dart';

import '../../utils/helpers/responsive.dart';

Expand Down
File renamed without changes.
File renamed without changes.
124 changes: 124 additions & 0 deletions lib/src/UI/components/placeholders.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import 'package:flutter/material.dart';

class BannerPlaceholder extends StatelessWidget {
const BannerPlaceholder({Key? key, required this.width, required this.height}) : super(key: key);

final double width;
final double height;

@override
Widget build(BuildContext context) {
return Container(
width: width,
height: height,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(2),
),
);
}
}

class TitlePlaceholder extends StatelessWidget {
final double width;

const TitlePlaceholder({
Key? key,
required this.width,
}) : super(key: key);

@override
Widget build(BuildContext context) {
final color = Theme.of(context).colorScheme;

return Container(
margin: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 4),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: width - 8,
height: 10.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: color.primary,
),
),
const SizedBox(height: 20.0),
Container(
decoration: BoxDecoration(
color: color.primary,
borderRadius: BorderRadius.circular(2)

),
width: width - 8,
height: 10.0,
),
],
),
);
}
}

enum ContentLineType {
twoLines,
threeLines,
}

class ContentPlaceholder extends StatelessWidget {
final ContentLineType lineType;

const ContentPlaceholder({
Key? key,
required this.lineType,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
width: 96.0,
height: 72.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0),
color: Colors.white,
),
),
const SizedBox(width: 12.0),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: double.infinity,
height: 10.0,
color: Colors.white,
margin: const EdgeInsets.only(bottom: 8.0),
),
if (lineType == ContentLineType.threeLines)
Container(
width: double.infinity,
height: 10.0,
color: Colors.white,
margin: const EdgeInsets.only(bottom: 8.0),
),
Container(
width: 100.0,
height: 10.0,
color: Colors.white,
)
],
),
)
],
),
);
}
}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:kimoi/src/UI/providers/providers.dart';
import 'package:kimoi/src/UI/providers/storage/searched_provider.dart';
import 'package:kimoi/src/UI/services/delegates/search_delegate.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,55 +208,10 @@ final fixedServerProvider = StateProvider<FixedServer?>((ref) => null);

final videoServers = StateProvider((ref) async {
final servers = ref.watch(fixedServerProvider);
List<Video> videos = [];
final url = servers!.url;

return extract([url]);

// if (url.contains('yourupload')) {
// final video = await YourUploadExtractor().videoFromUrl(url);
// if (video != null) {
// videos.add(video);
// } else {
// print("optional: ${servers.optional}");
// videos.addAll(await extract(servers.optional!));
// }
// } else if (url.contains('mp4upload')) {
// final video = await Mp4UploadExtractor().videosFromUrl(url);
// if (video.isNotEmpty) {
// videos.addAll(video);
// } else {
// videos.addAll(await extract(servers.optional!));
// }
// } else if (url.contains('ok.ru')) {
// final vid = await OkruExtractor().videosFromUrl(url);
// if (vid.isEmpty) {
// videos.addAll(await extract(servers.optional!));
// } else {
// videos.addAll(vid);
// }
// } else if (url.contains('mixdro')) {
// final video = await MixDropExtractor().videoFromUrl(url);
// if (video.isNotEmpty) {
// videos.addAll(video);
// } else {
// videos.addAll(await extract(servers.optional!));
// }
// } else if (url.contains('voe')) {
// final video = await VoeExtractor().videoFromUrl(url);
// if (video.isNotEmpty) {
// videos.addAll(video);
// } else {
// videos.addAll(await extract(servers.optional!));
// }
// } else if (url.contains("uqload")) {
// final video = await UqloadExtractor().videoFromUrl(url);
// if (video != null) {
// videos.add(video);
// } else {
// videos.addAll(await extract(servers.optional!));
// }
// }
});

class FixedServer {
Expand All @@ -281,11 +236,7 @@ Future<List<Video>> extract(List<String> servers) async {
} else if (url.contains('ok.ru')) {
videos.addAll(await OkruExtractor().videosFromUrl(url));
if (videos.isNotEmpty) return videos;
} /* else if (url.contains('solid')) {
final videos = await SolidFilesExtractor().videoFromUrl(url);
if (videos.isNotEmpty) videos.addAll(videos);
} */
else if (url.contains('mixdro')) {
} else if (url.contains('mixdro')) {
final video = await MixDropExtractor().videoFromUrl(url);
if (video.isNotEmpty) videos.addAll(video);
if (videos.isNotEmpty) return videos;
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion lib/src/UI/providers/animes/anime_directory_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:hooks_riverpod/hooks_riverpod.dart';

import '../../../domain/domain.dart';
import '../providers.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/UI/providers/animes/anime_filter_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:kimoi/src/UI/screens/home/home.dart';

final estadoProvider = StateProvider((ref) => 0);
Expand Down
3 changes: 1 addition & 2 deletions lib/src/UI/providers/animes/anime_info_provider.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:kimoi/src/infrastructure/models/extra_data.dart';

import '../../../domain/domain.dart';
Expand Down Expand Up @@ -62,7 +62,6 @@ class ChapterInfoNotifier extends StateNotifier<List<Chapter>> {
bool isLoading = false;

Future<void> getVideos(String url) async {
print(url);
if (isLoading) return;
isLoading = true;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/UI/providers/animes/anime_mac_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:kimoi/src/UI/providers/animes/anime_repository_provider.dart';

import '../../../domain/entities/anime.dart';
Expand Down
6 changes: 4 additions & 2 deletions lib/src/UI/providers/animes/anime_repository_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:kimoi/main.dart';
import 'package:riverpod/riverpod.dart';

import '../../../infrastructure/infrastructure.dart';

final animeRepositoryProvider =
Provider((ref) => AnimeRepositoryImpl(MonoschinosDatasource()));
Provider((ref) => AnimeRepositoryImpl(sourceController.initialDatasource));
3 changes: 2 additions & 1 deletion lib/src/UI/providers/animes/initial_loading_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:hooks_riverpod/hooks_riverpod.dart';

import '../news/news_provider.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import 'dart:convert';

import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:html/dom.dart';
import 'package:html/parser.dart';
import 'package:kimoi/src/UI/items/servers_dialog.dart';
import 'package:kimoi/src/UI/components/servers_dialog.dart';
import 'package:kimoi/src/domain/domain.dart';
import 'package:kimoi/src/utils/extensions/extension.dart';

Expand Down
3 changes: 2 additions & 1 deletion lib/src/UI/providers/animes/search_anime_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:riverpod/riverpod.dart';

import '../../../domain/domain.dart';
import '../providers.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/UI/providers/jikan/jikan_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:kimoi/src/UI/providers/jikan/jikan_repo_provider.dart';
import 'package:kimoi/src/infrastructure/models/jikan_upcoming.dart' as jk;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/UI/providers/jikan/jikan_repo_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:kimoi/src/infrastructure/datasources/jikan_datasource_impl.dart';
import 'package:kimoi/src/infrastructure/repositories/jikan_repository_impl.dart';
import 'package:riverpod/riverpod.dart';

final jikanRepoProvider =
Provider((ref) => JikanRepositoryImpl(JikanDatasourceImpl()));
2 changes: 1 addition & 1 deletion lib/src/UI/providers/news/news_provider.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:kimoi/src/UI/providers/news/news_repository_provider.dart';
import 'package:riverpod/riverpod.dart';

import '../../../infrastructure/models/article_info.dart';

Expand Down
2 changes: 1 addition & 1 deletion lib/src/UI/providers/news/news_repository_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:kimoi/src/infrastructure/datasources/kudasai_news_datasource.dart';
import 'package:kimoi/src/infrastructure/repositories/news_repository_impl.dart';
import 'package:riverpod/riverpod.dart';

final newsRepositoryProvider =
Provider((ref) => NewRepositoryImpl(KudasaiNewsDatasource()));
3 changes: 2 additions & 1 deletion lib/src/UI/providers/size/size_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';

import 'package:riverpod/riverpod.dart';

final portraitWidth = StateProvider<double>((ref) => 0.0);
final landScapeWidth = StateProvider<double>((ref) => 0.0);
Loading

0 comments on commit 6cc3099

Please sign in to comment.