Skip to content

Commit

Permalink
(version/downloader) Add downloader base
Browse files Browse the repository at this point in the history
  • Loading branch information
violet-dev committed Jul 20, 2020
1 parent 99b2254 commit 7ebf6c8
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ ws.dart
*.o
*.d
# *.so
# p7zip/CPP/ANDROID/7zr/obj/*
# p7zip/CPP/ANDROID/7zr/obj/*
lib/component/download/*
19 changes: 19 additions & 0 deletions lib/component/downloadable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,27 @@ abstract class Session {
}
}

abstract class DownloadTask {
int taskId;
String accept =
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8";
String userAgent =
"Mozilla/5.0 (Android 7.0; Mobile; rv:54.0) Gecko/54.0 Firefox/54.0 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.125 Mobile Safari/603.2.4";
String referer;
bool autoRedirection;
bool retryWhenFail;
int maxRetryCount;
String cookie;
String url;
List<String> failUrls;
Map<String, String> headers;
Map<String, String> query;
String filename;
}

abstract class Downloadable {
bool loginRequire();
Session getSession(String id, String pwd);
bool acceptURL(String url);
Future<List<DownloadTask>> createTask(String url);
}
5 changes: 0 additions & 5 deletions lib/component/pixiv/pixiv.dart

This file was deleted.

8 changes: 5 additions & 3 deletions lib/pages/after_loading/afterloading_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:material_design_icons_flutter/material_design_icons_flutter.dart
import 'package:violet/locale.dart';
import 'package:violet/main.dart';
import 'package:violet/pages/bookmark/bookmark_page.dart';
import 'package:violet/pages/download/download_page.dart';
import 'package:violet/pages/main/main_page.dart';
import 'package:violet/pages/search/search_page.dart';
import 'package:violet/pages/settings/settings_page.dart';
Expand Down Expand Up @@ -82,9 +83,9 @@ class _AfterLoadingPageState extends State<AfterLoadingPage>
// new BottomNavigationBarItem(
// icon: new Icon(MdiIcons.accountGroup),
// title: new Text(Translations.of(context).trans('community'))),
// new BottomNavigationBarItem(
// icon: new Icon(Icons.file_download),
// title: new Text(Translations.of(context).trans('download'))),
new BottomNavigationBarItem(
icon: new Icon(Icons.file_download),
title: new Text(Translations.of(context).trans('download'))),
new BottomNavigationBarItem(
backgroundColor: Settings.themeWhat
? Colors.grey.shade900.withOpacity(0.90)
Expand Down Expand Up @@ -186,6 +187,7 @@ class _AfterLoadingPageState extends State<AfterLoadingPage>
// ),
// ),
// ),
DownloadPage(),
BookmarkPage(),
// new Center(
// child: Padding(
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/download/native_downloader.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// This source code is a part of Project Violet.
// Copyright (C) 2020. violet-team. Licensed under the MIT License.
2 changes: 1 addition & 1 deletion lib/pages/settings/version_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class VersionViewPage extends StatelessWidget {
style: TextStyle(fontSize: 30),
),
Text(
'0.7.6',
'0.7.7',
style: TextStyle(fontSize: 20),
),
Text(''),
Expand Down
2 changes: 1 addition & 1 deletion lib/update_sync.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UpdateSyncManager {
// Current version
static const int majorVersion = 0;
static const int minorVersion = 7;
static const int patchVersion = 6;
static const int patchVersion = 7;

static bool updateRequire = false;
static String version = "";
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A new Flutter project.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 0.7.6+0
version: 0.7.7+0

environment:
sdk: ">=2.2.0 <3.0.0"
Expand All @@ -28,7 +28,7 @@ dependencies:
animations:
async:
auto_animated: any
cached_network_image: ^2.3.0-rc
cached_network_image:
charts_flutter:
circular_check_box: ^1.0.1
cloud_firestore: ^0.13.0+1
Expand Down

0 comments on commit 7ebf6c8

Please sign in to comment.