Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge main branch #213

Merged
merged 7 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "flutter"]
path = .flutter
url = https://github.com/flutter/flutter.git
tag = 3.19.6
tag = 3.24.5
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

[中文](./docs/CHANGELOG/zh.md)

## 1.15.3+61

- Upgrade `flutter` version to 3.24.5.
- Upgrade dependencies version.
- Migrate from `file_picker` to `file_selector`.
- Unifying saveFile and shareXFiles across platforms.
- Use "saveFile": Windows / MacOS / Linux.
- Use "shareXFiles": Android / iOS(iPadOS).
- Optimize page return logic implementation.
- Fix TextFiled's text UI sinking on `Frequency` and `Target Days` picker.
- Fix Habits Exporter function in display page on iPadOS.
- Fix serveral Export related functions on Linux.

## 1.14.4+57

- Strip `DependenciesInfo` block from android, resolve [#205](https://github.com/FriesI23/mhabit/issues/205).
Expand Down
44 changes: 24 additions & 20 deletions LICENSE_THIRDPARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -728,32 +728,36 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```

## file_picker
## file_selector

[Pub](https://pub.dev/packages/file_picker)
[Pub](https://pub.dev/packages/file_selector)

```text
MIT License

Copyright (c) 2018 Miguel Ruivo
Copyright 2013 The Flutter Authors. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```

## device_info_plus
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ limitations under the License.
[github-relaese-badge-svg]: https://github.com/FriesI23/mhabit/actions/workflows/app-release.yml/badge.svg
[github-release-page]: https://github.com/FriesI23/mhabit/releases
[app-license]: https://github.com/FriesI23/mhabit/blob/main/LICENSE
[flutter-badge]: https://img.shields.io/badge/_Flutter_-3.19.6-grey.svg?&logo=Flutter&logoColor=white&labelColor=blue
[deps-flutter-version]: https://github.com/flutter/flutter/tree/3.19.6
[flutter-badge]: https://img.shields.io/badge/_Flutter_-3.24.5-grey.svg?&logo=Flutter&logoColor=white&labelColor=blue
[deps-flutter-version]: https://github.com/flutter/flutter/tree/3.24.5
[license-badge]: https://img.shields.io/github/license/FriesI23/mhabit
[app-verison-bage-svg]: https://img.shields.io/github/v/release/FriesI23/mhabit
[app-pre-verison-bage-svg]: https://img.shields.io/github/v/release/FriesI23/mhabit?include_prereleases&label=pre-release
Expand Down
13 changes: 13 additions & 0 deletions docs/CHANGELOG/zh.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# 更新日志

## 1.15.3+61

- 升级 `flutter` 版本到 3.24.5。
- 升级依赖版本。
- 将 `file_picker` 迁移到 `file_selector`。
- 统一跨平台的 `saveFile` 和 `shareXFiles` 功能实现:
- Windows / MacOS / Linux 平台使用 `saveFile`。
- Android / iOS(含 iPadOS)平台使用 `shareXFiles`。
- 优化页面返回逻辑实现。
- 修复 `Frequency` 和 `Target Days` 选项中 `TextField` 文本下沉的问题。
- 修复 iPadOS 中显示页面的习惯导出功能。
- 修复 Linux 上多个与导出相关的功能。

## 1.14.4+57

- 从安卓去除 `DependenciesInfo` 块, 解决 [#205](https://github.com/FriesI23/mhabit/issues/205).
Expand Down
31 changes: 17 additions & 14 deletions docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,21 @@
Title: Pre-Released or Released: v1.2.3+xx
-->

# Released: v1.14.4+57
# Released v1.15.3+61

- Strip `DependenciesInfo` block from android, resolve [#205](https://github.com/FriesI23/mhabit/issues/205).

Change logs below are from v1.14.3+56:

- Add Windows MSIX Installer.
- Add separate error page when app crashes during startup.
- Fix issues with incorrect usage of `Completer`.
- Change debug log path to `Cache` directory.
- Change database path to `Support` directory on non-android platforms.
- Update Ukrainian translation, thank for Максим Горпиніч's contribution on Weblate.

**WARNING**: Because changing database path will involve file migration,
it's strongly recommended to backup (export) habits before upgrading.
- Upgrade `flutter` version to 3.24.5.
- Upgrade breaking dependencies version.
- Upgrade `archive` to v4.
- Upgrade `device_info_plus` to v11.
- Upgrade `flutter_timezone` to v4.
- Upgrade `flutter_lints` to v5.
- Bump iOS/MacOS dependencies version.
- Un-pinned `url_launcher_linux`.
- Migrate from `file_picker` to `file_selector`.
- Unifying saveFile and shareXFiles across platforms.
- Use "saveFile": Windows / MacOS / Linux.
- Use "shareXFiles": Android / iOS(iPadOS).
- Optimize page return logic implementation.
- Fix TextFiled's text UI sinking on `Frequency` and `Target Days` picker.
- Fix Habits Exporter function in display page on iPadOS.
- Fix serveral Export related functions on Linux.
10 changes: 10 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/61.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- Upgrade `flutter` version to 3.24.5.
- Upgrade dependencies version.
- Migrate from `file_picker` to `file_selector`.
- Unifying saveFile and shareXFiles across platforms.
- Use "saveFile": Windows / MacOS / Linux.
- Use "shareXFiles": Android / iOS(iPadOS).
- Optimize page return logic implementation.
- Fix TextFiled's text UI sinking on `Frequency` and `Target Days` picker.
- Fix Habits Exporter function in display page on iPadOS.
- Fix serveral Export related functions on Linux.
10 changes: 10 additions & 0 deletions fastlane/metadata/android/zh-CN/changelogs/61.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- 升级 `flutter` 版本到 3.24.5。
- 升级依赖版本。
- 将 `file_picker` 迁移到 `file_selector`。
- 统一跨平台的 `saveFile` 和 `shareXFiles` 功能实现:
- Windows / MacOS / Linux 平台使用 `saveFile`。
- Android / iOS(含 iPadOS)平台使用 `shareXFiles`。
- 优化页面返回逻辑实现。
- 修复 `Frequency` 和 `Target Days` 选项中 `TextField` 文本下沉的问题。
- 修复 iPadOS 中显示页面的习惯导出功能。
- 修复 Linux 上多个与导出相关的功能。
57 changes: 5 additions & 52 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,39 +1,7 @@
PODS:
- device_info_plus (0.0.1):
- Flutter
- DKImagePickerController/Core (4.3.4):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.4)
- DKImagePickerController/PhotoGallery (4.3.4):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.4)
- DKPhotoGallery (0.0.17):
- DKPhotoGallery/Core (= 0.0.17)
- DKPhotoGallery/Model (= 0.0.17)
- DKPhotoGallery/Preview (= 0.0.17)
- DKPhotoGallery/Resource (= 0.0.17)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.17):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.17):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.17):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- file_selector_ios (0.0.1):
- Flutter
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
Expand All @@ -47,9 +15,6 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- SDWebImage (5.15.5):
- SDWebImage/Core (= 5.15.5)
- SDWebImage/Core (5.15.5)
- share_plus (0.0.1):
- Flutter
- shared_preferences_foundation (0.0.1):
Expand All @@ -58,13 +23,12 @@ PODS:
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.4)
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_selector_ios (from `.symlinks/plugins/file_selector_ios/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`)
Expand All @@ -76,18 +40,11 @@ DEPENDENCIES:
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- SDWebImage
- SwiftyGif

EXTERNAL SOURCES:
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
file_selector_ios:
:path: ".symlinks/plugins/file_selector_ios/ios"
Flutter:
:path: Flutter
flutter_local_notifications:
Expand All @@ -111,20 +68,16 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
file_selector_ios: f0670c1064a8c8450e38145d8043160105d0b97c
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb
open_file_plus: 05737718530c14cf02868e3b7754d7fe4df76d8b
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: 38a5d5ec463a50cc13d7630ab79f450537b24db1
Expand Down
2 changes: 2 additions & 0 deletions lib/view/common/habit_record_number_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ class _HabitRecordCustomNumberPickerDialog
Padding(
padding: const EdgeInsets.only(top: 24, bottom: 12),
child: OverflowBar(
spacing: 8.0,
alignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Expand Down
2 changes: 2 additions & 0 deletions lib/view/common/habit_record_reason_modifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class _HabitRecordReasonModifierDialog
Padding(
padding: const EdgeInsets.only(top: 24, bottom: 12),
child: OverflowBar(
spacing: 8.0,
alignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Expand Down
50 changes: 39 additions & 11 deletions lib/view/common/xshare.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,66 @@

import 'dart:io';

import 'package:file_picker/file_picker.dart';
import 'package:collection/collection.dart';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as path;
import 'package:share_plus/share_plus.dart';

mixin XShare<T extends StatefulWidget> on State<T> {
mixin XShare {
Future<ShareResult> shareXFiles(List<XFile> files,
{BuildContext? context,
String? subject,
String? text,
List<String>? fileNameOverrides}) async {
if (Platform.isIOS) {
final box = (context ?? this.context).findRenderObject() as RenderBox?;
final box = context?.findRenderObject() as RenderBox?;
return Share.shareXFiles(files,
subject: subject,
text: text,
sharePositionOrigin: box!.localToGlobal(Offset.zero) & box.size,
sharePositionOrigin:
box != null ? box.localToGlobal(Offset.zero) & box.size : null,
fileNameOverrides: fileNameOverrides);
} else {
return Share.shareXFiles(files,
subject: subject, text: text, fileNameOverrides: fileNameOverrides);
}
}

Future<bool> pickAndSaveToFile(String savedFile,
Future<bool> saveSingleFile(String savedFile,
{String? fileName, String? subject}) async {
fileName ??= path.basename(savedFile);
final filePath = await FilePicker.platform
.saveFile(fileName: fileName, dialogTitle: subject);
if (filePath == null) return false;
final savedFileFp = File(savedFile);
if (!(await savedFileFp.exists())) return false;
return savedFileFp.copy(filePath).then((value) => value.exists());
final saveLocation = await getSaveLocation(suggestedName: fileName);
if (saveLocation == null) return false;
final savedFileFp = XFile(savedFile);
await savedFileFp.saveTo(saveLocation.path);
return await File(saveLocation.path).exists();
}

Future<bool> trySaveFiles(List<XFile> files, TargetPlatform platform,
{BuildContext? context,
String? subject,
String? text,
List<String>? fileNameOverrides}) =>
switch (platform) {
TargetPlatform.android || TargetPlatform.iOS => shareXFiles(files,
context: context,
subject: subject,
text: text,
fileNameOverrides: fileNameOverrides)
.then((value) => value.status == ShareResultStatus.success),
TargetPlatform.windows ||
TargetPlatform.macOS ||
TargetPlatform.linux =>
Future(() async {
for (final (i, e) in files.mapIndexed((i, e) => (i, e))) {
final r = await saveSingleFile(e.path,
fileName: fileNameOverrides?[i], subject: subject);
if (!r) return r;
}
return true;
}),
_ => throw UnimplementedError(
"trySaveFiles isn't implement on current platform: $platform"),
};
}
1 change: 1 addition & 0 deletions lib/view/for_habit_edit/habit_frequency_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class _HabitFrequencyTextField extends StatelessWidget {
height: textScaler.scale(_kDefaultHabitFreqTextFieldHeight),
width: textScaler.scale(_kDefualtHabitFreqTextFieldWidth),
child: TextField(
decoration: const InputDecoration(hintText: "", isDense: true),
textAlign: TextAlign.center,
controller: controller,
keyboardType: const TextInputType.numberWithOptions(
Expand Down
1 change: 1 addition & 0 deletions lib/view/for_habit_edit/habit_target_days_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class _HabitCustomTargetDaysTile extends StatelessWidget {
height: textScaler.scale(30.0),
width: textScaler.scale(48.0),
child: TextField(
decoration: const InputDecoration(hintText: "", isDense: true),
textAlign: TextAlign.center,
controller: inputController,
keyboardType: const TextInputType.numberWithOptions(
Expand Down
Loading
Loading