Skip to content

Commit

Permalink
V0.1.5 (#35)
Browse files Browse the repository at this point in the history
* version bumped to v0.1.5

* GLobal search bugs fixed

* Added Manga specific filter & fixed bugs RxList

* Icon Changed
  • Loading branch information
DattatreyaReddy authored Apr 8, 2022
1 parent 8ddad42 commit 1e90f07
Show file tree
Hide file tree
Showing 76 changed files with 189 additions and 140 deletions.
Binary file modified android/app/src/main/res/drawable-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-night-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions android/app/src/main/res/values-v31/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<item name="android:forceDarkAllowed">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowSplashScreenBackground">#54C5F8</item>
<item name="android:windowSplashScreenBrandingImage">@drawable/branding</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Expand Down
Binary file modified assets/images/icon.ico
Binary file not shown.
Binary file modified assets/images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/icon_darkT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/icon_darkT_nbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/icon_gradT_nbg.png
Binary file not shown.
Binary file modified assets/images/icon_lightT_nbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion flutter_native_splash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ flutter_native_splash:
# The android, ios and web parameters can be used to disable generating a splash screen on a given
# platform.
#android: false
#ios: false
ios: false
#web: false

# The position of the splash image can be set with android_gravity, ios_content_mode, and
Expand Down
1 change: 0 additions & 1 deletion lib/app/core/values/api_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const String categoryURL = '/api/v1/category';
const String iconIcoURL = "assets/images/icon.ico";
const String iconPngURL = "assets/images/icon.png";
const String iconDarkTextNbgPngURL = "assets/images/icon_darkT_nbg.png";
const String iconGradTextNbgPngURL = "assets/images/icon_gradT_nbg.png";
const String iconLightTextNbgPngURL = "assets/images/icon_lightT_nbg.png";
const String iconDarkTextPngURL = "assets/images/icon_darkT.png";
const String reorderURL = "/reorder";
Expand Down
61 changes: 61 additions & 0 deletions lib/app/data/manga_list_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import 'dart:convert';

import 'package:flutter/foundation.dart';

import 'manga_model.dart';

class MangaListModel {
bool? hasNextPage;
List<Manga>? mangaList;
MangaListModel({
this.hasNextPage,
this.mangaList,
});

MangaListModel copyWith({
bool? hasNextPage,
List<Manga>? mangaList,
}) {
return MangaListModel(
hasNextPage: hasNextPage ?? this.hasNextPage,
mangaList: mangaList ?? this.mangaList,
);
}

Map<String, dynamic> toMap() {
return {
'hasNextPage': hasNextPage,
'mangaList': mangaList?.map((x) => x.toMap()).toList(),
};
}

factory MangaListModel.fromMap(Map<String, dynamic> map) {
return MangaListModel(
hasNextPage: map['hasNextPage'],
mangaList: map['mangaList'] != null
? List<Manga>.from(map['mangaList']?.map((x) => Manga.fromMap(x)))
: null,
);
}

String toJson() => json.encode(toMap());

factory MangaListModel.fromJson(String source) =>
MangaListModel.fromMap(json.decode(source));

@override
String toString() =>
'MangaListModel(hasNextPage: $hasNextPage, mangaList: $mangaList)';

@override
bool operator ==(Object other) {
if (identical(this, other)) return true;

return other is MangaListModel &&
other.hasNextPage == hasNextPage &&
listEquals(other.mangaList, mangaList);
}

@override
int get hashCode => hasNextPage.hashCode ^ mangaList.hashCode;
}
22 changes: 6 additions & 16 deletions lib/app/data/providers/source_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:get/get_connect/http/src/request/request.dart';

import '../../core/values/api_url.dart';
import '../enums/source_type.dart';
import '../manga_model.dart';
import '../manga_list_model.dart';
import '../services/local_storage_service.dart';
import '../source_model.dart';

Expand Down Expand Up @@ -90,39 +90,29 @@ class SourceProvider extends GetConnect {
}));
}
}
//TODO NEED to Fix (Send request as list insted of spamming)
//after version 0.6.2
for (var i in filter) {
await post('/$sourceId/filters', jsonEncode(i));
}
await post('/$sourceId/filters', jsonEncode(filter));
}

Future<Map<String, dynamic>?> getSourceMangaList({
Future<MangaListModel?> getSourceMangaList({
required String sourceId,
required int pageNum,
SourceType sourceType = SourceType.popular,
String? query,
bool isFilter = false,
}) async {
final response = await get<Map<String, dynamic>?>(
final response = await get<MangaListModel?>(
"/$sourceId/" +
(((query != null && query.isNotEmpty) || isFilter)
? 'search?pageNum=$pageNum&searchTerm=' + (query ?? "")
: (sourceType.name + "/$pageNum")),
decoder: (map) {
if (map is Map<String, dynamic>) {
return {
"hasNextPage": map['hasNextPage'],
"mangaList": map['mangaList'] != null
? List<Manga>.from(
map['mangaList']?.map((x) => Manga.fromMap(x)))
: <Manga>[],
};
return MangaListModel.fromMap(map);
}
return null;
},
);
if (response.hasError) return {"hasNextPage": true, "mangaList": []};
if (response.hasError) return MangaListModel(hasNextPage: false);
return response.body;
}
}
9 changes: 3 additions & 6 deletions lib/app/modules/about/views/about_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@ class AboutView extends GetView<AboutController> {
body: Obx(
() => ListView(
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: context.height * .05),
child: ImageIcon(
AssetImage(iconLightTextNbgPngURL),
size: context.height * .1,
),
ImageIcon(
AssetImage(iconLightTextNbgPngURL),
size: context.height * .2,
),
Divider(thickness: 2),
ListTile(
Expand Down
10 changes: 3 additions & 7 deletions lib/app/modules/edit_categories/views/edit_categories_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,9 @@ class EditCategoriesView extends GetView<EditCategoriesController> {
header: Column(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding:
EdgeInsets.symmetric(vertical: context.height * .05),
child: ImageIcon(
AssetImage(iconLightTextNbgPngURL),
size: context.height * .1,
),
ImageIcon(
AssetImage(iconLightTextNbgPngURL),
size: context.height * .2,
),
Divider(thickness: 2)
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class ExtensionsController extends GetxController {

Future<void> updateExtensionList() async {
isLoading.value = true;
extensionList.value =
(await repository.getExtensionList()) ?? extensionList;
List<Extension>? extensionList2 = await repository.getExtensionList();
if (extensionList2 != null) extensionList.value = (extensionList2);
await _sourcesController.updateSourceList();
isLoading.value = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class GlobalSearchController extends GetxController {

@override
void onReady() async {
sourceList = (await repository.getSourceList())
?.skipWhile((value) => value.id == '0')
.toList() ??
sourceList;
List<Source>? sourceListTemp = (await repository.getSourceList())
?.skipWhile((value) => value.id == '0')
.toList();
if (sourceListTemp != null) sourceList = sourceListTemp;
// search();
super.onReady();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:get/get.dart';

import '../../../data/manga_list_model.dart';
import '../../../data/providers/source_provider.dart';
import '../../../data/source_model.dart';

Expand All @@ -8,7 +9,7 @@ class GlobalSearchRepository {

Future<List<Source>?> getSourceList() => _sourceProvider.getSourceList();

Future<Map<String, dynamic>?> getSourceMangaList({
Future<MangaListModel?> getSourceMangaList({
required String sourceId,
required String query,
}) =>
Expand Down
2 changes: 2 additions & 0 deletions lib/app/modules/global_search/views/global_search_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ class GlobalSearchView extends GetView<GlobalSearchController> {
String? get tag => Get.parameters["query"];
@override
Widget build(BuildContext context) {
GlobalSearchController controller =
Get.find<GlobalSearchController>(tag: tag);
return Scaffold(
appBar: AppBar(
title: context.width > 600
Expand Down
23 changes: 12 additions & 11 deletions lib/app/modules/global_search/widgets/source_search_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';

import 'package:get/get.dart';

import '../../../data/manga_model.dart';
import '../../../data/manga_list_model.dart';
import '../../../data/source_model.dart';
import '../../../routes/app_pages.dart';
import '../../../widgets/manga_grid_design.dart';
Expand All @@ -25,15 +25,16 @@ class SourceSearchGrid extends StatelessWidget {
bool get isLoading => _isLoading.value;
set isLoading(bool value) => _isLoading.value = value;

final RxList<Manga> _sourceMangaList = <Manga>[].obs;
List<Manga> get sourceMangaList => _sourceMangaList;
set sourceMangaList(List<Manga> value) => _sourceMangaList.value = value;
final Rx<MangaListModel> _sourceMangaListModel = MangaListModel().obs;
MangaListModel get sourceMangaListModel => _sourceMangaListModel.value;
set sourceMangaListModel(MangaListModel value) =>
_sourceMangaListModel.value = value;

void searchQuery() async {
isLoading = true;
sourceMangaList = (await repository.getSourceMangaList(
query: query, sourceId: source.id!))?["mangaList"] ??
sourceMangaList;
sourceMangaListModel = (await repository.getSourceMangaList(
query: query, sourceId: source.id!)) ??
sourceMangaListModel;
isLoading = false;
}

Expand All @@ -52,7 +53,7 @@ class SourceSearchGrid extends StatelessWidget {
),
isLoading
? CircularProgressIndicator()
: sourceMangaList.isNotEmpty
: sourceMangaListModel.mangaList?.isNotEmpty ?? false
? SizedBox(
height: 200,
child: Scrollbar(
Expand All @@ -68,13 +69,13 @@ class SourceSearchGrid extends StatelessWidget {
mainAxisSpacing: 2.0,
childAspectRatio: 1.43,
),
itemCount: (sourceMangaList.length),
itemCount: (sourceMangaListModel.mangaList!.length),
itemBuilder: (BuildContext context, int index) {
return MangaGridDesign(
manga: sourceMangaList[index],
manga: sourceMangaListModel.mangaList![index],
onTap: () => Get.toNamed(
Routes.manga +
"/${sourceMangaList[index].id}",
"/${sourceMangaListModel.mangaList?[index].id}",
),
isLibraryScreen: true,
);
Expand Down
80 changes: 37 additions & 43 deletions lib/app/modules/manga/controllers/manga_controller.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'dart:convert';

import 'package:get/get.dart';

import '../../../core/utils/chapter/apply_chapter_filter.dart';
import '../../../core/utils/chapter/apply_chapter_sort.dart';
import '../../../core/utils/check_if_json.dart';
import '../../../core/values/db_keys.dart';
import '../../../data/category_model.dart';
import '../../../data/chapter_model.dart';
import '../../../data/downloads_model.dart';
Expand Down Expand Up @@ -66,21 +69,20 @@ class MangaController extends GetxController {
fetchFreshData: !(manga.value.freshData ?? true)) ??
manga.value;

// //#TODO Need to fix a bug in Tachidesk-server
// https://github.com/Suwayomi/Tachidesk-Server/issues/313

// print(manga.value.meta);
// chapterFilter =
// manga.value.meta?[chapterFilterKey] != null
// ? jsonDecode(manga.value.meta?[chapterFilterKey])
// .map((key, value) => MapEntry(chapterFilterFromString(key), value))
// : chapterFilter;
// Map? map = manga.value.meta?[chapterSortKey] != null
// ? jsonDecode(manga.value.meta?[chapterSortKey])
// : null;
// chapterSort = map != null
// ? MapEntry(chapterSortfromString(map["key"]), map["value"])
// : chapterSort;
if (manga.value.meta?[chapterFilterKey] != null) {
chapterFilter = jsonDecode(manga.value.meta?[chapterFilterKey])
.map<ChapterFilter, bool?>((String key, dynamic value) => MapEntry(
chapterFilterFromString(key),
value as bool?,
));
}
Map? map = manga.value.meta?[chapterSortKey] != null
? jsonDecode(manga.value.meta?[chapterSortKey])
: null;
if (map != null) {
chapterSort =
MapEntry(chapterSortfromString(map["key"]), map["value"] as bool);
}
}

Future<void> removeMangaFromLibrary() async {
Expand Down Expand Up @@ -162,9 +164,9 @@ class MangaController extends GetxController {
categoryListTemp.removeAt(0);
}
categoryList = categoryListTemp;
mangaCategoryList =
await repository.getMangaCategoryList(manga.value.id!) ??
mangaCategoryList;
var mangaCatListTemp =
await repository.getMangaCategoryList(manga.value.id!);
if (mangaCatListTemp != null) mangaCategoryList = mangaCatListTemp;
}

Future<void> setMangaFilterAsDefault() async {
Expand All @@ -185,34 +187,26 @@ class MangaController extends GetxController {
chapterSort = _localStorageService.chapterSort;
_chapterFilter.listen((val) async {
applyFilter();
await _localStorageService.setChapterFilter(chapterFilter);

// // TODO Need to fix a bug in Tachidesk-server
// https://github.com/Suwayomi/Tachidesk-Server/issues/313
// await repository.patchMangaMeta(
// manga.value,
// MapEntry(
// chapterFilterKey,
// jsonEncode(val.map<String, bool?>(
// (key, value) => MapEntry(key.name, value),
// )),
// ));
await repository.patchMangaMeta(
manga.value,
MapEntry(
chapterFilterKey,
jsonEncode(val.map<String, bool?>(
(key, value) => MapEntry(key.name, value),
)),
));
});
_chapterSort.listen((val) async {
applyFilter();
await _localStorageService.setChapterSort(chapterSort);

// // TODO Need to fix a bug in Tachidesk-server
// https://github.com/Suwayomi/Tachidesk-Server/issues/313
// await repository.patchMangaMeta(
// manga.value,
// MapEntry(
// chapterSortKey,
// jsonEncode(
// {"key": val.key.name, "value": val.value},
// ),
// ),
// );
await repository.patchMangaMeta(
manga.value,
MapEntry(
chapterSortKey,
jsonEncode(
{"key": val.key.name, "value": val.value},
),
),
);
});
isPageLoading.value = true;
await loadManga();
Expand Down
Loading

0 comments on commit 1e90f07

Please sign in to comment.