removed new version check

This commit is contained in:
Thibault Deckers 2022-01-18 10:49:45 +09:00
parent 290465ba17
commit 81caf10ebc
19 changed files with 18 additions and 295 deletions

View file

@ -8,6 +8,15 @@ All notable changes to this project will be documented in this file.
- Portuguese translation (thanks Jonatas De Almeida Barros)
### Removed
- new version check
### Fixed
- loading when system locale uses non-western arabic numerals
- handling timestamps provided in 10^-8 s (18 digits)
## <a id="v1.5.10"></a>[v1.5.10] - 2022-01-07
### Added

View file

@ -230,13 +230,6 @@
"aboutLinkLicense": "Lizenz",
"aboutLinkPolicy": "Datenschutzrichtlinie",
"aboutUpdate": "Neue Version verfügbar",
"aboutUpdateLinks1": "Eine neue Version von Aves ist verfügbar unter",
"aboutUpdateLinks2": "und",
"aboutUpdateLinks3": ".",
"aboutUpdateGitHub": "github",
"aboutUpdateGooglePlay": "Google Play",
"aboutBug": "Fehlerbericht",
"aboutBugSaveLogInstruction": "Anwendungsprotokolle in einer Datei speichern",
"aboutBugSaveLogButton": "Speichern",

View file

@ -342,13 +342,6 @@
"aboutLinkLicense": "License",
"aboutLinkPolicy": "Privacy Policy",
"aboutUpdate": "New Version Available",
"aboutUpdateLinks1": "A new version of Aves is available on",
"aboutUpdateLinks2": "and",
"aboutUpdateLinks3": ".",
"aboutUpdateGitHub": "GitHub",
"aboutUpdateGooglePlay": "Google Play",
"aboutBug": "Bug Report",
"aboutBugSaveLogInstruction": "Save app logs to a file",
"aboutBugSaveLogButton": "Save",

View file

@ -231,13 +231,6 @@
"aboutLinkLicense": "Licencia",
"aboutLinkPolicy": "Política de privacidad",
"aboutUpdate": "Nueva versión disponible",
"aboutUpdateLinks1": "Una nueva versión de Aves se encuentra disponible en",
"aboutUpdateLinks2": "y",
"aboutUpdateLinks3": ".",
"aboutUpdateGitHub": "GitHub",
"aboutUpdateGooglePlay": "Google Play",
"aboutBug": "Reporte de errores",
"aboutBugSaveLogInstruction": "Guardar registros de la aplicación a un archivo",
"aboutBugSaveLogButton": "Guardar",

View file

@ -230,13 +230,6 @@
"aboutLinkLicense": "Licence",
"aboutLinkPolicy": "Politique de confidentialité",
"aboutUpdate": "Nouvelle Version",
"aboutUpdateLinks1": "Une nouvelle version dAves est disponible sur",
"aboutUpdateLinks2": "et",
"aboutUpdateLinks3": ".",
"aboutUpdateGitHub": "GitHub",
"aboutUpdateGooglePlay": "Google Play",
"aboutBug": "Rapports derreur",
"aboutBugSaveLogInstruction": "Sauvegarder les logs de lapp vers un fichier",
"aboutBugSaveLogButton": "Sauvegarder",

View file

@ -230,13 +230,6 @@
"aboutLinkLicense": "라이선스",
"aboutLinkPolicy": "개인정보 보호정책",
"aboutUpdate": "업데이트 사용 가능",
"aboutUpdateLinks1": "앱의 최신 버전을",
"aboutUpdateLinks2": "와",
"aboutUpdateLinks3": "에서 다운로드 사용 가능합니다.",
"aboutUpdateGitHub": "깃허브",
"aboutUpdateGooglePlay": "구글 플레이",
"aboutBug": "버그 보고",
"aboutBugSaveLogInstruction": "앱 로그를 파일에 저장하기",
"aboutBugSaveLogButton": "저장",

View file

@ -230,13 +230,6 @@
"aboutLinkLicense": "Licença",
"aboutLinkPolicy": "Política de Privacidade",
"aboutUpdate": "Nova versão disponível",
"aboutUpdateLinks1": "Uma nova versão do Aves está disponível em",
"aboutUpdateLinks2": "e",
"aboutUpdateLinks3": ".",
"aboutUpdateGitHub": "GitHub",
"aboutUpdateGooglePlay": "Google Play",
"aboutBug": "Relatório de erro",
"aboutBugSaveLogInstruction": "Salvar registros de aplicativos em um arquivo",
"aboutBugSaveLogButton": "Salve",

View file

@ -230,13 +230,6 @@
"aboutLinkLicense": "Лицензия",
"aboutLinkPolicy": "Политика конфиденциальности",
"aboutUpdate": "Доступна новая версия",
"aboutUpdateLinks1": "Новая версия Aves доступна на",
"aboutUpdateLinks2": "и",
"aboutUpdateLinks3": ".",
"aboutUpdateGitHub": "GitHub",
"aboutUpdateGooglePlay": "Play Маркет",
"aboutBug": "Отчет об ошибке",
"aboutBugSaveLogInstruction": "Сохраните логи приложения в файл",
"aboutBugSaveLogButton": "Сохранить",

View file

@ -1,12 +1,7 @@
import 'package:aves/model/device.dart';
import 'package:aves/model/settings/settings.dart';
import 'package:aves/theme/durations.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:github/github.dart';
import 'package:google_api_availability/google_api_availability.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:version/version.dart';
abstract class AvesAvailability {
void onResume();
@ -18,12 +13,10 @@ abstract class AvesAvailability {
Future<bool> get canLocatePlaces;
Future<bool> get canUseGoogleMaps;
Future<bool> get isNewVersionAvailable;
}
class LiveAvesAvailability implements AvesAvailability {
bool? _isConnected, _hasPlayServices, _isNewVersionAvailable;
bool? _isConnected, _hasPlayServices;
LiveAvesAvailability() {
Connectivity().onConnectivityChanged.listen(_updateConnectivityFromResult);
@ -63,30 +56,4 @@ class LiveAvesAvailability implements AvesAvailability {
@override
Future<bool> get canUseGoogleMaps async => device.canRenderGoogleMaps && await hasPlayServices;
@override
Future<bool> get isNewVersionAvailable async {
if (_isNewVersionAvailable != null) return SynchronousFuture(_isNewVersionAvailable!);
final now = DateTime.now();
final dueDate = settings.lastVersionCheckDate.add(Durations.lastVersionCheckInterval);
if (now.isBefore(dueDate)) {
_isNewVersionAvailable = false;
return SynchronousFuture(_isNewVersionAvailable!);
}
if (!(await isConnected)) return false;
Version version(String s) => Version.parse(s.replaceFirst('v', ''));
final currentTag = (await PackageInfo.fromPlatform()).version;
final latestTag = (await GitHub().repositories.getLatestRelease(RepositorySlug('deckerst', 'aves'))).tagName!;
_isNewVersionAvailable = version(latestTag) > version(currentTag);
if (_isNewVersionAvailable!) {
debugPrint('Aves $latestTag is available on github');
} else {
debugPrint('Aves $currentTag is the latest version');
settings.lastVersionCheckDate = now;
}
return _isNewVersionAvailable!;
}
}

View file

@ -35,7 +35,6 @@ class Settings extends ChangeNotifier {
catalogTimeZoneKey,
videoShowRawTimedTextKey,
searchHistoryKey,
lastVersionCheckDateKey,
};
// app
@ -116,9 +115,6 @@ class Settings extends ChangeNotifier {
static const accessibilityAnimationsKey = 'accessibility_animations';
static const timeToTakeActionKey = 'time_to_take_action';
// version
static const lastVersionCheckDateKey = 'last_version_check_date';
// file picker
static const filePickerShowHiddenFilesKey = 'file_picker_show_hidden_files';
@ -478,12 +474,6 @@ class Settings extends ChangeNotifier {
set timeToTakeAction(AccessibilityTimeout newValue) => setAndNotify(timeToTakeActionKey, newValue.toString());
// version
DateTime get lastVersionCheckDate => DateTime.fromMillisecondsSinceEpoch(_prefs!.getInt(lastVersionCheckDateKey) ?? 0);
set lastVersionCheckDate(DateTime newValue) => setAndNotify(lastVersionCheckDateKey, newValue.millisecondsSinceEpoch);
// file picker
bool get filePickerShowHiddenFiles => getBoolOrDefault(filePickerShowHiddenFilesKey, SettingsDefaults.filePickerShowHiddenFiles);

View file

@ -20,9 +20,6 @@ class Durations {
static const appBarTitleAnimation = Duration(milliseconds: 300);
static const appBarActionChangeAnimation = Duration(milliseconds: 200);
// drawer
static const newsBadgeAnimation = Duration(milliseconds: 200);
// filter grids animations
static const chipDecorationAnimation = Duration(milliseconds: 200);
static const highlightScrollAnimationMinMillis = 400;
@ -68,9 +65,6 @@ class Durations {
static const contentChangeDebounceDelay = Duration(milliseconds: 1000);
static const mapInfoDebounceDelay = Duration(milliseconds: 150);
static const mapIdleDebounceDelay = Duration(milliseconds: 100);
// app life
static const lastVersionCheckInterval = Duration(days: 7);
}
class DurationsProvider extends StatelessWidget {

View file

@ -296,11 +296,6 @@ class Constants {
license: 'MIT',
sourceUrl: 'https://github.com/fluttercommunity/get_it',
),
Dependency(
name: 'GitHub',
license: 'MIT',
sourceUrl: 'https://github.com/SpinlockLabs/github.dart',
),
Dependency(
name: 'Intl',
license: 'BSD 3-Clause',
@ -331,11 +326,6 @@ class Constants {
license: 'BSD 2-Clause',
sourceUrl: 'https://github.com/google/tuple.dart',
),
Dependency(
name: 'Version',
license: 'BSD 3-Clause',
sourceUrl: 'https://github.com/dartninja/version',
),
Dependency(
name: 'XML',
license: 'MIT',

View file

@ -2,7 +2,6 @@ import 'package:aves/widgets/about/app_ref.dart';
import 'package:aves/widgets/about/bug_report.dart';
import 'package:aves/widgets/about/credits.dart';
import 'package:aves/widgets/about/licenses.dart';
import 'package:aves/widgets/about/update.dart';
import 'package:aves/widgets/common/extensions/build_context.dart';
import 'package:flutter/material.dart';
@ -27,7 +26,6 @@ class AboutPage extends StatelessWidget {
const [
AppReference(),
Divider(),
AboutUpdate(),
BugReport(),
Divider(),
AboutCredits(),

View file

@ -1,14 +0,0 @@
import 'package:flutter/material.dart';
class AboutNewsBadge extends StatelessWidget {
const AboutNewsBadge({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const Icon(
Icons.circle,
size: 12,
color: Colors.red,
);
}
}

View file

@ -1,93 +0,0 @@
import 'package:aves/services/common/services.dart';
import 'package:aves/utils/constants.dart';
import 'package:aves/widgets/about/news_badge.dart';
import 'package:aves/widgets/common/basic/link_chip.dart';
import 'package:aves/widgets/common/extensions/build_context.dart';
import 'package:flutter/material.dart';
class AboutUpdate extends StatefulWidget {
const AboutUpdate({Key? key}) : super(key: key);
@override
_AboutUpdateState createState() => _AboutUpdateState();
}
class _AboutUpdateState extends State<AboutUpdate> {
late Future<bool> _updateChecker;
@override
void initState() {
super.initState();
_updateChecker = availability.isNewVersionAvailable;
}
@override
Widget build(BuildContext context) {
return FutureBuilder<bool>(
future: _updateChecker,
builder: (context, snapshot) {
final newVersionAvailable = snapshot.data == true;
if (!newVersionAvailable) return const SizedBox();
return Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ConstrainedBox(
constraints: const BoxConstraints(minHeight: 48),
child: Align(
alignment: AlignmentDirectional.centerStart,
child: Text.rich(
TextSpan(
children: [
const WidgetSpan(
child: Padding(
padding: EdgeInsetsDirectional.only(end: 8),
child: AboutNewsBadge(),
),
alignment: PlaceholderAlignment.middle,
),
TextSpan(text: context.l10n.aboutUpdate, style: Constants.titleTextStyle),
],
),
),
),
),
Text.rich(
TextSpan(
children: [
TextSpan(text: context.l10n.aboutUpdateLinks1),
WidgetSpan(
child: LinkChip(
text: context.l10n.aboutUpdateGitHub,
url: '${Constants.avesGithub}/releases',
textStyle: const TextStyle(fontWeight: FontWeight.bold),
),
alignment: PlaceholderAlignment.middle,
),
TextSpan(text: context.l10n.aboutUpdateLinks2),
WidgetSpan(
child: LinkChip(
text: context.l10n.aboutUpdateGooglePlay,
url: 'https://play.google.com/store/apps/details?id=deckers.thibault.aves',
textStyle: const TextStyle(fontWeight: FontWeight.bold),
),
alignment: PlaceholderAlignment.middle,
),
TextSpan(text: context.l10n.aboutUpdateLinks3),
],
),
),
const SizedBox(height: 16),
],
),
),
const Divider(),
],
);
},
);
}
}

View file

@ -66,7 +66,6 @@ class DebugSettingsSection extends StatelessWidget {
'pinnedFilters': toMultiline(settings.pinnedFilters),
'hiddenFilters': toMultiline(settings.hiddenFilters),
'searchHistory': toMultiline(settings.searchHistory),
'lastVersionCheckDate': '${settings.lastVersionCheckDate}',
'locale': '${settings.locale}',
'systemLocales': '${WidgetsBinding.instance!.window.locales}',
},

View file

@ -5,7 +5,6 @@ import 'package:aves/model/source/album.dart';
import 'package:aves/model/source/collection_source.dart';
import 'package:aves/model/source/location.dart';
import 'package:aves/model/source/tag.dart';
import 'package:aves/services/common/services.dart';
import 'package:aves/theme/durations.dart';
import 'package:aves/theme/icons.dart';
import 'package:aves/utils/android_file_utils.dart';
@ -25,12 +24,9 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class AppDrawer extends StatefulWidget {
class AppDrawer extends StatelessWidget {
const AppDrawer({Key? key}) : super(key: key);
@override
_AppDrawerState createState() => _AppDrawerState();
static List<String> getDefaultAlbums(BuildContext context) {
final source = context.read<CollectionSource>();
final specialAlbums = source.rawAlbums.where((album) {
@ -40,26 +36,14 @@ class AppDrawer extends StatefulWidget {
..sort(source.compareAlbumsByName);
return specialAlbums;
}
}
class _AppDrawerState extends State<AppDrawer> {
late Future<bool> _newVersionLoader;
CollectionSource get source => context.read<CollectionSource>();
@override
void initState() {
super.initState();
_newVersionLoader = availability.isNewVersionAvailable;
}
@override
Widget build(BuildContext context) {
final drawerItems = <Widget>[
_buildHeader(context),
..._buildTypeLinks(),
_buildAlbumLinks(),
..._buildPageLinks(),
_buildAlbumLinks(context),
..._buildPageLinks(context),
if (!kReleaseMode) ...[
const Divider(),
debugTile,
@ -148,38 +132,7 @@ class _AppDrawerState extends State<AppDrawer> {
key: const Key('drawer-about-button'),
onPressed: () => goTo(AboutPage.routeName, (_) => const AboutPage()),
icon: const Icon(AIcons.info),
label: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(context.l10n.aboutPageTitle),
FutureBuilder<bool>(
future: _newVersionLoader,
builder: (context, snapshot) {
final newVersion = snapshot.data == true;
final badgeSize = 8.0 * MediaQuery.textScaleFactorOf(context);
return AnimatedOpacity(
duration: Durations.newsBadgeAnimation,
opacity: newVersion ? 1 : 0,
child: Padding(
padding: const EdgeInsetsDirectional.only(start: 2),
child: DecoratedBox(
decoration: BoxDecoration(
border: const Border.fromBorderSide(BorderSide(color: Colors.white70)),
borderRadius: BorderRadius.all(Radius.circular(badgeSize)),
),
child: Icon(
Icons.circle,
size: badgeSize,
color: Colors.red,
),
),
),
);
},
),
],
),
label: Text(context.l10n.aboutPageTitle),
),
OutlinedButton.icon(
// key is expected by test driver
@ -212,7 +165,8 @@ class _AppDrawerState extends State<AppDrawer> {
.toList();
}
Widget _buildAlbumLinks() {
Widget _buildAlbumLinks(BuildContext context) {
final source = context.read<CollectionSource>();
return StreamBuilder(
stream: source.eventBus.on<AlbumsChangedEvent>(),
builder: (context, snapshot) {
@ -227,10 +181,11 @@ class _AppDrawerState extends State<AppDrawer> {
});
}
List<Widget> _buildPageLinks() {
List<Widget> _buildPageLinks(BuildContext context) {
final pageBookmarks = settings.drawerPageBookmarks;
if (pageBookmarks.isEmpty) return [];
final source = context.read<CollectionSource>();
return [
const Divider(),
...pageBookmarks.map((route) {

View file

@ -441,13 +441,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "7.2.0"
github:
dependency: "direct main"
description:
name: github
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.0"
glob:
dependency: transitive
description:
@ -532,13 +525,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3"
json_annotation:
dependency: transitive
description:
name: json_annotation
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
latlong2:
dependency: "direct main"
description:
@ -1183,13 +1169,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version:
dependency: "direct main"
description:
name: version
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
vm_service:
dependency: transitive
description:

View file

@ -41,7 +41,6 @@ dependencies:
flutter_markdown:
flutter_staggered_animations:
get_it:
github:
google_api_availability:
google_maps_flutter:
intl:
@ -66,7 +65,6 @@ dependencies:
transparent_image:
tuple:
url_launcher:
version:
xml:
dev_dependencies: