diff --git a/packages/package_info_plus/CHANGELOG.md b/packages/package_info_plus/CHANGELOG.md index ab78c8c7a..4bd1911bb 100644 --- a/packages/package_info_plus/CHANGELOG.md +++ b/packages/package_info_plus/CHANGELOG.md @@ -1,3 +1,11 @@ +## 1.1.0 + +* Update package_info_plus to 9.0.1. +* Update package_info_plus_platform_interface to 3.2.1. +* Add support for `PackageInfo.installTime`. +* Update minimum Flutter and Dart version to 3.19 and 3.3. +* Update the example app and integration_test. + ## 1.0.5 * Update the LICENSE file so that it is recognized by pub.dev. diff --git a/packages/package_info_plus/README.md b/packages/package_info_plus/README.md index 82cb44f9a..fd53ea011 100644 --- a/packages/package_info_plus/README.md +++ b/packages/package_info_plus/README.md @@ -10,8 +10,8 @@ This package is not an _endorsed_ implementation of `package_info_plus`. Therefo ```yaml dependencies: - package_info_plus: ^8.0.0 - package_info_plus_tizen: ^1.0.5 + package_info_plus: ^9.0.1 + package_info_plus_tizen: ^1.1.0 ``` Then you can import `package_info_plus` in your Dart code. @@ -30,3 +30,6 @@ For detailed usage, see https://pub.dev/packages/package_info_plus#usage. - [ ] `PackageInfo.buildNumber` - [ ] `PackageInfo.buildSignature` - [ ] `PackageInfo.installerStore` +- [x] `PackageInfo.installTime` // Uses Tizen [`package_info_get_installed_time()`](https://docs.tizen.org/application/native/api/iot-headed/6.0/group__CAPI__PACKAGE__INFO__MODULE.html#gada13d4c9b64e22f1c0a381f80b584835); may reflect last modified time after updates. +- [ ] `PackageInfo.updateTime` + diff --git a/packages/package_info_plus/example/integration_test/package_info_plus_test.dart b/packages/package_info_plus/example/integration_test/package_info_plus_test.dart index 4277e8ddf..92787eac7 100644 --- a/packages/package_info_plus/example/integration_test/package_info_plus_test.dart +++ b/packages/package_info_plus/example/integration_test/package_info_plus_test.dart @@ -16,7 +16,9 @@ void main() { expect(info.appName, 'package_info_plus_tizen_example'); expect(info.buildNumber, isEmpty); expect(info.buildSignature, isEmpty); + expect(info.installTime, isNotNull); expect(info.packageName, 'org.tizen.package_info_plus_tizen_example'); + expect(info.updateTime, isNull); expect(info.version, '1.2.3'); expect(info.installerStore, null); }); @@ -30,5 +32,6 @@ void main() { findsOneWidget, ); expect(find.text('1.2.3'), findsOneWidget); + expect(find.textContaining('Install time'), findsOneWidget); }); } diff --git a/packages/package_info_plus/example/lib/main.dart b/packages/package_info_plus/example/lib/main.dart index d3ccb54f3..ef21b7577 100644 --- a/packages/package_info_plus/example/lib/main.dart +++ b/packages/package_info_plus/example/lib/main.dart @@ -14,7 +14,7 @@ void main() { } class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); + const MyApp({super.key}); @override Widget build(BuildContext context) { @@ -30,7 +30,7 @@ class MyApp extends StatelessWidget { } class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key}) : super(key: key); + const MyHomePage({super.key}); @override State createState() => _MyHomePageState(); @@ -44,6 +44,8 @@ class _MyHomePageState extends State { buildNumber: 'Unknown', buildSignature: 'Unknown', installerStore: 'Unknown', + installTime: null, + updateTime: null, ); @override @@ -84,6 +86,16 @@ class _MyHomePageState extends State { 'Installer store', _packageInfo.installerStore ?? 'not available', ), + _infoTile( + 'Install time', + _packageInfo.installTime?.toIso8601String() ?? + 'Install time not available', + ), + _infoTile( + 'Update time', + _packageInfo.updateTime?.toIso8601String() ?? + 'Update time not available', + ), ], ), ); diff --git a/packages/package_info_plus/example/pubspec.yaml b/packages/package_info_plus/example/pubspec.yaml index dd737eab4..8da1b8e39 100644 --- a/packages/package_info_plus/example/pubspec.yaml +++ b/packages/package_info_plus/example/pubspec.yaml @@ -4,13 +4,13 @@ version: 1.2.3+4 publish_to: "none" environment: - sdk: ">=3.1.0 <4.0.0" - flutter: ">=3.13.0" + sdk: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" dependencies: flutter: sdk: flutter - package_info_plus: ^8.0.0 + package_info_plus: ^9.0.1 package_info_plus_tizen: path: ../ diff --git a/packages/package_info_plus/pubspec.yaml b/packages/package_info_plus/pubspec.yaml index 561d9ac04..40f79c289 100644 --- a/packages/package_info_plus/pubspec.yaml +++ b/packages/package_info_plus/pubspec.yaml @@ -2,11 +2,11 @@ name: package_info_plus_tizen description: Tizen implementation of the package_info_plus plugin. homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/master/packages/package_info_plus -version: 1.0.5 +version: 1.1.0 environment: - sdk: ">=3.1.0 <4.0.0" - flutter: ">=3.13.0" + sdk: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" flutter: plugin: @@ -18,7 +18,7 @@ flutter: dependencies: flutter: sdk: flutter - package_info_plus_platform_interface: ^3.0.0 + package_info_plus_platform_interface: ^3.2.1 dev_dependencies: - flutter_lints: ^2.0.1 + flutter_lints: ^5.0.0 diff --git a/packages/package_info_plus/tizen/src/package_info_plus_tizen_plugin.cc b/packages/package_info_plus/tizen/src/package_info_plus_tizen_plugin.cc index e3e44ec8d..067aa454d 100644 --- a/packages/package_info_plus/tizen/src/package_info_plus_tizen_plugin.cc +++ b/packages/package_info_plus/tizen/src/package_info_plus_tizen_plugin.cc @@ -104,6 +104,19 @@ class PackageInfoPlusTizenPlugin : public flutter::Plugin { map[flutter::EncodableValue("version")] = flutter::EncodableValue(std::string(version)); free(version); + + int installed_time = 0; + ret = package_info_get_installed_time(package_info, &installed_time); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + result->Error(std::to_string(ret), + "Failed to get the package install time.", + flutter::EncodableValue(get_error_message(ret))); + package_info_destroy(package_info); + return; + } + map[flutter::EncodableValue("installTime")] = flutter::EncodableValue( + std::to_string(static_cast(installed_time) * 1000)); + package_info_destroy(package_info); result->Success(flutter::EncodableValue(map));