Skip to content

Commit

Permalink
iOS审核期间隐藏banner
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyaocz committed Oct 22, 2020
1 parent 1586032 commit 7581577
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"battery","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\battery-1.0.7\\\\","dependencies":[]},{"name":"connectivity","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity-0.4.9+5\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\fluttertoast-3.1.3\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\package_info-0.4.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.21\\\\","dependencies":[]},{"name":"screen","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\screen-0.0.5\\\\","dependencies":[]},{"name":"share","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\share-0.6.5+3\\\\","dependencies":[]},{"name":"shared_preferences","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.12+2\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.1+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.7.5\\\\","dependencies":[]},{"name":"webview_flutter","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\webview_flutter-1.0.4\\\\","dependencies":[]}],"android":[{"name":"battery","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\battery-1.0.7\\\\","dependencies":[]},{"name":"connectivity","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity-0.4.9+5\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\fluttertoast-3.1.3\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\package_info-0.4.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.21\\\\","dependencies":[]},{"name":"screen","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\screen-0.0.5\\\\","dependencies":[]},{"name":"share","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\share-0.6.5+3\\\\","dependencies":[]},{"name":"shared_preferences","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.12+2\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.1+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.7.5\\\\","dependencies":[]},{"name":"webview_flutter","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\webview_flutter-1.0.4\\\\","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity_macos-0.1.0+2\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\package_info-0.4.3\\\\","dependencies":[]},{"name":"path_provider_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_macos-0.0.1+6\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.1+2\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_macos-0.0.1+4\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]},{"name":"shared_preferences_linux","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_linux-0.0.2+2\\\\","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_linux-0.0.1+1\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-0.0.4+1\\\\","dependencies":[]},{"name":"shared_preferences_windows","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_windows-0.0.1+1\\\\","dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_windows-0.0.1+1\\\\","dependencies":[]}],"web":[{"name":"connectivity_for_web","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity_for_web-0.3.1+2\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_web-0.1.2+4\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_web-0.1.5\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"battery","dependencies":[]},{"name":"connectivity","dependencies":["connectivity_macos","connectivity_for_web"]},{"name":"connectivity_for_web","dependencies":[]},{"name":"connectivity_macos","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"screen","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"webview_flutter","dependencies":[]}],"date_created":"2020-10-21 12:09:52.029774","version":"1.22.2"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"battery","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\battery-1.0.7\\\\","dependencies":[]},{"name":"connectivity","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity-0.4.9+5\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\fluttertoast-3.1.3\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\package_info-0.4.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.21\\\\","dependencies":[]},{"name":"screen","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\screen-0.0.5\\\\","dependencies":[]},{"name":"share","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\share-0.6.5+3\\\\","dependencies":[]},{"name":"shared_preferences","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.12+2\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.1+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.7.5\\\\","dependencies":[]},{"name":"webview_flutter","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\webview_flutter-1.0.4\\\\","dependencies":[]}],"android":[{"name":"battery","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\battery-1.0.7\\\\","dependencies":[]},{"name":"connectivity","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity-0.4.9+5\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\fluttertoast-3.1.3\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\package_info-0.4.3\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.21\\\\","dependencies":[]},{"name":"screen","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\screen-0.0.5\\\\","dependencies":[]},{"name":"share","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\share-0.6.5+3\\\\","dependencies":[]},{"name":"shared_preferences","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.12+2\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.1+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.7.5\\\\","dependencies":[]},{"name":"webview_flutter","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\webview_flutter-1.0.4\\\\","dependencies":[]}],"macos":[{"name":"connectivity_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity_macos-0.1.0+2\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\package_info-0.4.3\\\\","dependencies":[]},{"name":"path_provider_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"shared_preferences_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_macos-0.0.1+6\\\\","dependencies":[]},{"name":"sqflite","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.1+2\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_macos-0.0.1+4\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_linux-0.0.1+2\\\\","dependencies":[]},{"name":"shared_preferences_linux","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_linux-0.0.2+2\\\\","dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_linux-0.0.1+1\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_windows-0.0.4+1\\\\","dependencies":[]},{"name":"shared_preferences_windows","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_windows-0.0.1+1\\\\","dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_windows-0.0.1+1\\\\","dependencies":[]}],"web":[{"name":"connectivity_for_web","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\connectivity_for_web-0.3.1+2\\\\","dependencies":[]},{"name":"shared_preferences_web","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_web-0.1.2+4\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_web-0.1.5\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"battery","dependencies":[]},{"name":"connectivity","dependencies":["connectivity_macos","connectivity_for_web"]},{"name":"connectivity_for_web","dependencies":[]},{"name":"connectivity_macos","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"screen","dependencies":[]},{"name":"share","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_linux","url_launcher_macos","url_launcher_windows"]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"webview_flutter","dependencies":[]}],"date_created":"2020-10-22 11:22:45.700564","version":"1.22.2"}
4 changes: 4 additions & 0 deletions lib/app/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class Utils {
static EventBus changeComicHomeTabIndex = EventBus();
static EventBus changeNovelHomeTabIndex = EventBus();
static EventBus changHistory = EventBus();
static EventBus changeHideBanner = EventBus();
static void showSnackbarWithAction(
BuildContext context, String content, String action, Function onPressed) {
final snackBar = new SnackBar(
Expand All @@ -53,13 +54,16 @@ class Utils {
Scaffold.of(context).showSnackBar(snackBar);
}

static bool hideBanner = true;
static Future<VersionInfo> checkVersion() async {
try {
var newVersion = await http.get(
"https://pic.nsapps.cn/dmzj_flutter/dmzj_ver.json?ts=" +
DateTime.now().millisecondsSinceEpoch.toString());
var verInfo =
VersionInfo.fromJson(jsonDecode(utf8.decode(newVersion.bodyBytes)));
hideBanner = verInfo.hide_banner;
changeHideBanner.fire(hideBanner);
PackageInfo packageInfo = await PackageInfo.fromPlatform();
if (packageInfo.buildNumber != verInfo.version_code) {
return verInfo;
Expand Down
4 changes: 4 additions & 0 deletions lib/models/version_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ class VersionInfo {
String message;
String android_url;
String ios_url;
bool hide_banner;

VersionInfo({
this.version,
this.version_code,
this.message,
this.android_url,
this.ios_url,
this.hide_banner,
});

factory VersionInfo.fromJson(jsonRes) => jsonRes == null
Expand All @@ -23,13 +25,15 @@ class VersionInfo {
message: jsonRes['message'],
android_url: jsonRes['android_url'],
ios_url: jsonRes['ios_url'],
hide_banner: jsonRes['hide_banner'],
);
Map<String, dynamic> toJson() => {
'version': version,
'version_code': version_code,
'message': message,
'android_url': android_url,
'ios_url': ios_url,
'hide_banner': hide_banner,
};

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/views/comic/comic_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _ComicHomePageState extends State<ComicHomePage>
Tab(child: Text("专题")),
],
indicatorSize: TabBarIndicatorSize.label,
labelPadding: EdgeInsets.all(8),
//labelPadding: EdgeInsets.all(8),
),
actions: <Widget>[
IconButton(
Expand Down
31 changes: 22 additions & 9 deletions lib/views/comic/comic_recommend.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert';
import 'dart:io';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -36,9 +37,18 @@ class ComicRecommendState extends State<ComicRecommend>
List<ComicHomeComicItem> _anime = [];
List<ComicHomeNewItem> _mySub = [];

//如果是IOS,且在审核期间,隐藏Banner
bool _hideBanner = false;

@override
void initState() {
super.initState();
_hideBanner = Utils.hideBanner;
Utils.changeHideBanner.on<bool>().listen((event) {
setState(() {
_hideBanner = event;
});
});
loadData();
}

Expand Down Expand Up @@ -89,15 +99,18 @@ class ComicRecommendState extends State<ComicRecommend>
: CrossAxisAlignment.center,
children: <Widget>[
//banner
AppBanner(
items: _banners
.map<Widget>((i) => BannerImageItem(
pic: i.cover,
title: i.title,
onTaped: () => Utils.openPage(context, i.id, i.type,
url: i.url, title: i.title),
))
.toList()),
(Platform.isIOS && _hideBanner)
? Container()
: AppBanner(
items: _banners
.map<Widget>((i) => BannerImageItem(
pic: i.cover,
title: i.title,
onTaped: () => Utils.openPage(
context, i.id, i.type,
url: i.url, title: i.title),
))
.toList()),
_getItem2(
"我的订阅",
_mySub,
Expand Down
Loading

0 comments on commit 7581577

Please sign in to comment.