diff --git a/README.md b/README.md index 933307f..b113286 100644 --- a/README.md +++ b/README.md @@ -2,26 +2,27 @@ [![Github version](https://img.shields.io/github/v/release/Voklen/daily-diary.svg?logo=github&color=forestgreen)](https://github.com/Voklen/Daily-Diary/releases/latest) [![F-droid version](https://img.shields.io/f-droid/v/com.voklen.daily_diary.svg?logo=F-Droid)](https://f-droid.org/packages/com.voklen.daily_diary/) -[![Flutter](https://img.shields.io/badge/_Flutter_-3.10.6-blue?&logo=Flutter)](https://github.com/flutter/flutter/tree/3.10.6) +[![Flutter](https://img.shields.io/badge/_Flutter_-3.16.7-blue?&logo=Flutter)](https://github.com/flutter/flutter/tree/3.16.7) [![License](https://img.shields.io/github/license/Voklen/Daily-Diary)](LICENCE) -Jot down whatever you want throughout the day and the app will reset the next morning. All previous days are stored in plaintext files which can be exported and moved to a different device. +Jot down whatever you want throughout the day and the app will reset the next morning. All previous +days are stored in plaintext files which can be exported and moved to a different device. Settings are stored in a config.toml file that can also be moved between devices. [Get it on F-Droid](https://f-droid.org/packages/com.voklen.daily_diary/) +alt="Get it on F-Droid" +height="80">](https://f-droid.org/packages/com.voklen.daily_diary/) or get the APK from the [Releases Section](https://github.com/Voklen/Daily-Diary/releases/latest). ## Screenshots -| ![The main diary writing screen with nothing written yet](metadata/en-GB/images/phoneScreenshots/4%20Empty.png) | ![Settings screen](metadata/en-GB/images/phoneScreenshots/1%20Settings.png) | -| :-------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------: | +| ![The main diary writing screen with nothing written yet](metadata/en-GB/images/phoneScreenshots/4.1%20Empty.png) | ![Settings screen](metadata/en-GB/images/phoneScreenshots/1.1%20Settings.png) | +|:-----------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------:| -| ![A screen displaying the previous entries](metadata/en-GB/images/phoneScreenshots/2%20Previous%20entries.png) | ![A previous diary entry displaying sugar consumption](metadata/en-GB/images/phoneScreenshots/3%20Sugar%20tracking.png) | ![An entry from Shakespeare's diary](metadata/en-GB/images/phoneScreenshots/0%20Shakespeare's%20diary.png) | -| :------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------: | +| ![A screen displaying the previous entries](metadata/en-GB/images/phoneScreenshots/2.1%20Previous%20entries.png) | ![A previous diary entry displaying sugar consumption](metadata/en-GB/images/phoneScreenshots/3.1%20Sugar%20tracking.png) | ![An entry from Shakespeare's diary](metadata/en-GB/images/phoneScreenshots/0.1%20Shakespeare's%20diary.png) | +|:----------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------------------:|:------------------------------------------------------------------------------------------------------------:| ## Running diff --git a/lib/backend_classes/storage.dart b/lib/backend_classes/storage.dart index 680023d..c67c4b8 100644 --- a/lib/backend_classes/storage.dart +++ b/lib/backend_classes/storage.dart @@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; import 'package:daily_diary/backend_classes/filenames.dart'; import 'package:daily_diary/backend_classes/path.dart'; +import 'package:daily_diary/screens/home.dart'; import 'package:toml/toml.dart'; @@ -18,11 +19,21 @@ class DiaryStorage { Future get storageFile => path.getChild(filename); Future readFile() async { - return (await storageFile).readAsString(); + try { + MyFile file = await storageFile; + return await file.readAsString(); + } on Exception { + return ''; + } } Future writeFile(String text) async { - return (await storageFile).writeFile(text); + try { + MyFile file = await storageFile; + return await file.writeFile(text); + } on Exception { + return; + } } void recalculateDate() { @@ -168,8 +179,14 @@ class PreviousEntriesStorage { Stream files = await path.list(); Stream asEntryFiles = files.map(EntryFile.create); Stream withoutNull = asEntryFiles.where((s) => s != null).cast(); - List asList = await withoutNull.toList(); + Stream withoutToday = withoutNull.where(_isNotToday); + List asList = await withoutToday.toList(); asList.sort((b, a) => a.compareTo(b)); return asList; } } + +bool _isNotToday(EntryFile date) { + bool isToday = date.entryDate.isSameDate(DateTime.now()); + return !isToday; +} diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 86ca456..6b17457 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -77,7 +77,7 @@ class EntryEditor extends StatefulWidget { class _EntryEditorState extends State with WidgetsBindingObserver { final _textController = TextEditingController(); - bool exiting = false; + bool loaded = false; @override initState() { @@ -89,6 +89,7 @@ class _EntryEditorState extends State with WidgetsBindingObserver { widget.storage.readFile().then((value) { setState(() { _textController.text = value; + loaded = true; }); }); } @@ -102,10 +103,7 @@ class _EntryEditorState extends State with WidgetsBindingObserver { @override didChangeAppLifecycleState(AppLifecycleState state) async { super.didChangeAppLifecycleState(state); - if (exiting) { - return; - } - if (state == AppLifecycleState.paused) { + if (state == AppLifecycleState.inactive) { _updateStorage(); } resetIfNewDay(); @@ -116,6 +114,7 @@ class _EntryEditorState extends State with WidgetsBindingObserver { } void _updateStorage() { + if (!loaded) return; UnsavedChangesAlert.disable(); widget.storage.writeFile(_textController.text); } @@ -150,14 +149,6 @@ class _EntryEditorState extends State with WidgetsBindingObserver { } } - Future saveBeforeExit() async { - exiting = true; - if (Platform.isAndroid || Platform.isIOS) { - _updateStorage(); - } - return true; - } - void resetIfNewDay() { DateTime startWriting = widget.storage.date; DateTime now = DateTime.now(); @@ -173,26 +164,23 @@ class _EntryEditorState extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: saveBeforeExit, - child: RawKeyboardListener( - autofocus: true, - focusNode: FocusNode(), - onKey: keyPressed, - child: Padding( - padding: const EdgeInsets.all(12.0), - child: TextField( - controller: _textController, - onChanged: _textChanged, - expands: true, - maxLines: null, - keyboardType: TextInputType.multiline, - spellCheckConfiguration: _getSpellChecker(widget.settings), - textCapitalization: TextCapitalization.sentences, - style: TextStyle(fontSize: widget.settings.fontSize), - decoration: InputDecoration.collapsed( - hintText: locale(context).startTyping, - ), + return RawKeyboardListener( + autofocus: true, + focusNode: FocusNode(), + onKey: keyPressed, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: TextField( + controller: _textController, + onChanged: _textChanged, + expands: true, + maxLines: null, + keyboardType: TextInputType.multiline, + spellCheckConfiguration: _getSpellChecker(widget.settings), + textCapitalization: TextCapitalization.sentences, + style: TextStyle(fontSize: widget.settings.fontSize), + decoration: InputDecoration.collapsed( + hintText: locale(context).startTyping, ), ), ), diff --git a/lib/screens/previous_entries.dart b/lib/screens/previous_entries.dart index 5d4bfbc..107aad6 100644 --- a/lib/screens/previous_entries.dart +++ b/lib/screens/previous_entries.dart @@ -1,9 +1,8 @@ -import 'package:daily_diary/backend_classes/path.dart'; -import 'package:daily_diary/screens/home.dart'; import 'package:flutter/material.dart'; import 'package:daily_diary/main.dart'; import 'package:daily_diary/backend_classes/localization.dart'; +import 'package:daily_diary/backend_classes/path.dart'; import 'package:daily_diary/backend_classes/storage.dart'; import 'package:daily_diary/screens/view_only.dart'; @@ -13,18 +12,17 @@ class PreviousEntriesScreen extends StatelessWidget { final entries = PreviousEntriesStorage(savePath!); Widget _listBuilder(context, AsyncSnapshot> snapshot) { - List? datesList = snapshot.data; - if (datesList == null) { + List? entryFiles = snapshot.data; + if (entryFiles == null) { return const Scaffold(); } - if (datesList.isEmpty) { + if (entryFiles.isEmpty) { return const NoEntriesYet(); } - return ListView.builder( - itemCount: datesList.length, - itemBuilder: (_, index) => PreviousEntry( - file: datesList[index], - ), + List entryWidgets = + entryFiles.map((e) => PreviousEntry(file: e)).toList(); + return ListView( + children: entryWidgets, ); } @@ -50,26 +48,28 @@ class PreviousEntry extends StatelessWidget { final EntryFile file; + void onPressed(BuildContext context, String humanDate) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return ViewOnlyScreen(title: humanDate, entryFile: file); + }, + ), + ); + } + @override Widget build(BuildContext context) { DateTime date = file.entryDate; - if (date.isSameDate(DateTime.now())) { - return Container(); - } final String humanDate = locale(context).entryDate(date); + return ElevatedButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return ViewOnlyScreen(title: humanDate, entryFile: file); - }, - ), - ); - }, + onPressed: () => onPressed(context, humanDate), style: ElevatedButton.styleFrom( - backgroundColor: Theme.of(context).colorScheme.background, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.0), + ), ), child: SizedBox( width: double.infinity, diff --git a/lib/widgets/quit_handler.dart b/lib/widgets/quit_handler.dart index d3ad6b4..c4033e3 100644 --- a/lib/widgets/quit_handler.dart +++ b/lib/widgets/quit_handler.dart @@ -1,3 +1,4 @@ +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:daily_diary/backend_classes/localization.dart'; @@ -8,12 +9,13 @@ import 'package:flutter_window_close/flutter_window_close.dart'; /// On mobile using this class will have no effect class QuitHandler { static void enable(BuildContext context, void Function() saveAndQuit) { + if (Platform.isAndroid || Platform.isIOS) return; FlutterWindowClose.setWindowShouldCloseHandler( - () => show(context, saveAndQuit), + () => _show(context, saveAndQuit), ); } - static Future show( + static Future _show( BuildContext context, void Function() saveAndQuit, ) async { @@ -54,6 +56,7 @@ class UnsavedChangesAlert extends StatelessWidget { } static void disable() { + if (Platform.isAndroid || Platform.isIOS) return; FlutterWindowClose.setWindowShouldCloseHandler(() async => true); } diff --git a/lib/widgets/themes.dart b/lib/widgets/themes.dart index de2c5e8..ad9d49d 100644 --- a/lib/widgets/themes.dart +++ b/lib/widgets/themes.dart @@ -5,13 +5,29 @@ class Themes { final Color colorSeed; + ThemeData get _baseLightTheme => ThemeData( + colorSchemeSeed: colorSeed, + brightness: Brightness.light, + ); + + ThemeData get _baseDarkTheme => ThemeData( + colorSchemeSeed: colorSeed, + brightness: Brightness.dark, + ); + ThemeData get lightTheme => ThemeData( colorSchemeSeed: colorSeed, brightness: Brightness.light, + appBarTheme: AppBarTheme( + backgroundColor: _baseLightTheme.colorScheme.inversePrimary, + ), ); ThemeData get darkTheme => ThemeData( colorSchemeSeed: colorSeed, brightness: Brightness.dark, + appBarTheme: AppBarTheme( + backgroundColor: _baseDarkTheme.colorScheme.inversePrimary, + ), ); } diff --git a/metadata/en-GB/changelogs/15.txt b/metadata/en-GB/changelogs/15.txt new file mode 100644 index 0000000..4a249df --- /dev/null +++ b/metadata/en-GB/changelogs/15.txt @@ -0,0 +1,3 @@ +‣ Switch to material 3 (but change the code to make it look mostly like material 2) +‣ Fix bug where the app does not save if you close by swiping up (thanks @mgolden356) +‣ Fix bug where it deletes a note if you exit too fast (thanks again @mgolden356) diff --git a/metadata/en-GB/images/phoneScreenshots/0 Shakespeare's diary.png b/metadata/en-GB/images/phoneScreenshots/0 Shakespeare's diary.png deleted file mode 100644 index dcb9574..0000000 Binary files a/metadata/en-GB/images/phoneScreenshots/0 Shakespeare's diary.png and /dev/null differ diff --git a/metadata/en-GB/images/phoneScreenshots/0.1 Shakespeare's diary.png b/metadata/en-GB/images/phoneScreenshots/0.1 Shakespeare's diary.png new file mode 100644 index 0000000..3324215 Binary files /dev/null and b/metadata/en-GB/images/phoneScreenshots/0.1 Shakespeare's diary.png differ diff --git a/metadata/en-GB/images/phoneScreenshots/1 Settings.png b/metadata/en-GB/images/phoneScreenshots/1 Settings.png deleted file mode 100644 index cfe558f..0000000 Binary files a/metadata/en-GB/images/phoneScreenshots/1 Settings.png and /dev/null differ diff --git a/metadata/en-GB/images/phoneScreenshots/1.1 Settings.png b/metadata/en-GB/images/phoneScreenshots/1.1 Settings.png new file mode 100644 index 0000000..5db3e1b Binary files /dev/null and b/metadata/en-GB/images/phoneScreenshots/1.1 Settings.png differ diff --git a/metadata/en-GB/images/phoneScreenshots/2 Previous entries.png b/metadata/en-GB/images/phoneScreenshots/2 Previous entries.png deleted file mode 100644 index 9d4dd66..0000000 Binary files a/metadata/en-GB/images/phoneScreenshots/2 Previous entries.png and /dev/null differ diff --git a/metadata/en-GB/images/phoneScreenshots/2.1 Previous entries.png b/metadata/en-GB/images/phoneScreenshots/2.1 Previous entries.png new file mode 100644 index 0000000..fa68034 Binary files /dev/null and b/metadata/en-GB/images/phoneScreenshots/2.1 Previous entries.png differ diff --git a/metadata/en-GB/images/phoneScreenshots/3 Sugar tracking.png b/metadata/en-GB/images/phoneScreenshots/3 Sugar tracking.png deleted file mode 100644 index 804bcb2..0000000 Binary files a/metadata/en-GB/images/phoneScreenshots/3 Sugar tracking.png and /dev/null differ diff --git a/metadata/en-GB/images/phoneScreenshots/3.1 Sugar tracking.png b/metadata/en-GB/images/phoneScreenshots/3.1 Sugar tracking.png new file mode 100644 index 0000000..6eb2d3b Binary files /dev/null and b/metadata/en-GB/images/phoneScreenshots/3.1 Sugar tracking.png differ diff --git a/metadata/en-GB/images/phoneScreenshots/4 Empty.png b/metadata/en-GB/images/phoneScreenshots/4 Empty.png deleted file mode 100644 index e0dc89a..0000000 Binary files a/metadata/en-GB/images/phoneScreenshots/4 Empty.png and /dev/null differ diff --git a/metadata/en-GB/images/phoneScreenshots/4.1 Empty.png b/metadata/en-GB/images/phoneScreenshots/4.1 Empty.png new file mode 100644 index 0000000..fdc9bb6 Binary files /dev/null and b/metadata/en-GB/images/phoneScreenshots/4.1 Empty.png differ diff --git a/pubspec.lock b/pubspec.lock index 5b68e40..d4fc794 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: "direct main" description: name: archive - sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" url: "https://pub.dev" source: hosted - version: "3.4.9" + version: "3.4.10" async: dependency: transitive description: @@ -45,10 +45,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" convert: dependency: transitive description: @@ -209,10 +209,10 @@ packages: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.10.0" path: dependency: transitive description: @@ -225,26 +225,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" path_provider_linux: dependency: transitive description: @@ -257,10 +257,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -273,26 +273,26 @@ packages: dependency: transitive description: name: petitparser - sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "5.4.0" + version: "6.0.2" platform: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" pointycastle: dependency: transitive description: @@ -321,10 +321,10 @@ packages: dependency: transitive description: name: shared_preferences_foundation - sha256: "7bf53a9f2d007329ee6f3df7268fd498f8373602f943c975598bbb34649b62a7" + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" url: "https://pub.dev" source: hosted - version: "2.3.4" + version: "2.3.5" shared_preferences_linux: dependency: transitive description: @@ -337,18 +337,18 @@ packages: dependency: transitive description: name: shared_preferences_platform_interface - sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.3.2" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: d762709c2bbe80626ecc819143013cc820fa49ca5e363620ee20a8b15a3e3daf + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: @@ -382,18 +382,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" string_scanner: dependency: transitive description: @@ -414,18 +414,18 @@ packages: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" toml: dependency: "direct main" description: name: toml - sha256: "157c5dca5160fced243f3ce984117f729c788bb5e475504f3dbcda881accee44" + sha256: "9968de24e45b632bf1a654fe1ac7b6fe5261c349243df83fd262397799c45a2d" url: "https://pub.dev" source: hosted - version: "0.14.0" + version: "0.15.0" typed_data: dependency: transitive description: @@ -438,34 +438,34 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: b1c9e98774adf8820c96fbc7ae3601231d324a7d5ebd8babe27b6dfac91357ba + sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96 url: "https://pub.dev" source: hosted - version: "6.2.1" + version: "6.2.3" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.2.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3 + sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" url: "https://pub.dev" source: hosted - version: "6.2.1" + version: "6.2.4" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: "9f2d390e096fdbe1e6e6256f97851e51afc2d9c423d3432f1d6a02a8a9a8b9fd" + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" url_launcher_macos: dependency: transitive description: @@ -478,26 +478,26 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: "7754a1ad30ee896b265f8d14078b0513a4dba28d358eabb9d5f339886f4a1adc" + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" vector_math: dependency: transitive description: @@ -510,26 +510,26 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.3.0" win32: dependency: transitive description: name: win32 - sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.2.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" sdks: - dart: ">=3.1.0 <4.0.0" - flutter: ">=3.13.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index 7174310..8408ada 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: daily_diary description: A diary that starts with a blank page every day (while saving the previous ones) publish_to: 'none' -version: 1.4.2+14 +version: 1.4.3+15 environment: sdk: '>=2.23.1 <3.0.0' @@ -16,7 +16,7 @@ dependencies: cupertino_icons: ^1.0.2 path_provider: ^2.0.11 - toml: ^0.14.0 + toml: ^0.15.0 shared_preferences: ^2.0.15 file_picker: ^6.0.0 flutter_window_close: ^1.0.0 diff --git a/tools/Release checklist.md b/tools/Release checklist.md index befef98..b1ee93f 100644 --- a/tools/Release checklist.md +++ b/tools/Release checklist.md @@ -1,13 +1,5 @@ -- [ ] flutter test - [ ] New changelog -- [ ] Bump version -- [ ] git add . && git commit -m "Bump version and update changelog" -- [ ] git push - -- [ ] git checkout releases -- [ ] git merge main -X theirs -m "Release v" -- [ ] ./tools/compile.sh -- [ ] git push +- [ ] ./tools/compile.sh - [ ] Release on GitHub - [ ] Set GitHub tag and title to version number (with 'v' at the start) diff --git a/tools/bump_version.py b/tools/bump_version.py new file mode 100755 index 0000000..f9f86ea --- /dev/null +++ b/tools/bump_version.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +import sys +from ruamel.yaml import YAML + + +def update_pubspec(new_ver): + yaml = YAML() + yaml.preserve_quotes = True + yaml.width = 100 + + with open('pubspec.yaml', 'r') as f: + y = yaml.load(f) + + parts = y['version'].split('+') + build_number = int(parts[1]) + 1 + y['version'] = f'{new_ver}+{build_number}' + + with open('pubspec.yaml', 'w') as f: + yaml.dump(y, f) + + +update_pubspec(sys.argv[1]) diff --git a/tools/compile.sh b/tools/compile.sh deleted file mode 100755 index abe7298..0000000 --- a/tools/compile.sh +++ /dev/null @@ -1,6 +0,0 @@ -flutter build apk -flutter build linux -cp build/app/outputs/flutter-apk/app-release.apk daily_diary_android.apk -cp -r build/linux/x64/release/bundle/ Daily-Diary/ -tar -czf daily_diary_linux.tar.gz Daily-Diary/ -rm -r Daily-Diary/ diff --git a/tools/release.sh b/tools/release.sh new file mode 100755 index 0000000..26bfd37 --- /dev/null +++ b/tools/release.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +flutter test + +python3 tools/bump_version.py "$1" +git add . && git commit -m "Bump version and update changelog" +git push + +git checkout releases +git merge main -X theirs -m "Release v$1" +git submodule init +git submodule update +./submodules/flutter/bin/flutter build apk +./submodules/flutter/bin/flutter build linux +cp build/app/outputs/flutter-apk/app-release.apk daily_diary_android.apk +cp -r build/linux/x64/release/bundle/ Daily-Diary/ +tar -czf daily_diary_linux.tar.gz Daily-Diary/ +rm -r Daily-Diary/ +git push