Skip to content

Commit

Permalink
Merge pull request #248 from edufolly/dev
Browse files Browse the repository at this point in the history
Version 3.5.0.
  • Loading branch information
edufolly authored Nov 2, 2024
2 parents 152480e + 3e6fbeb commit 835944b
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [3.5.0] - 2024-11-02

* Adding package_info_plus to provide version string in AbstractConfig.

## [3.4.1] - 2024-10-27

* Fixing AbstractEdit Navigator pop, by [rilpires](https://github.com/rilpires).
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class MyHomePageState extends State<MyHomePage> {

return Scaffold(
appBar: AppBar(
title: const Text('Folly Fields'),
title: Text('Folly Fields ${Config().version}'),
actions: Config().isMobile
? <PopupMenuButton<MyMenuItem>>[
PopupMenuButton<MyMenuItem>(
Expand Down
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import FlutterMacOS
import Foundation

import connectivity_plus
import package_info_plus
import path_provider_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

publish_to: 'none'

version: 3.4.1+221
version: 3.5.0+222

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down Expand Up @@ -41,7 +41,7 @@ dependencies:

dev_dependencies:
# https://pub.dev/packages/flutter_lints
flutter_lints: ^4.0.0
flutter_lints: ^5.0.0

flutter_test:
sdk: flutter
Expand Down
26 changes: 26 additions & 0 deletions lib/folly_fields.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
import 'package:folly_fields/responsive/responsive.dart';
import 'package:package_info_plus/package_info_plus.dart';

///
///
Expand All @@ -23,6 +24,7 @@ class FollyFields implements _InternalConfig {
FollyDateParse? dateParseUpdate,
FollyDateParse? dateParseDelete,
Connectivity? connectivity,
PackageInfo? packageInfo,
}) =>
FollyFields()._holder = holder
.._start(
Expand All @@ -33,6 +35,7 @@ class FollyFields implements _InternalConfig {
dateParseDelete: dateParseDelete,
responsiveSizes: responsiveSizes,
connectivity: connectivity,
packageInfo: packageInfo,
);

late AbstractConfig _holder;
Expand All @@ -49,6 +52,12 @@ class FollyFields implements _InternalConfig {
///
FollyFields._internal();

///
///
///
@override
String get version => _holder.version;

///
///
///
Expand Down Expand Up @@ -188,6 +197,11 @@ typedef FollyDateParse = int? Function(dynamic value);
///
///
abstract class _InternalConfig {
///
///
///
String get version;

///
///
///
Expand Down Expand Up @@ -269,6 +283,7 @@ abstract class _InternalConfig {
///
abstract class AbstractConfig implements _InternalConfig {
bool _started = false;
String _version = '0.0.0';
bool _online = false;
RunningPlatform _platform = RunningPlatform.unknown;
String _modelIdKey = 'id';
Expand All @@ -278,6 +293,12 @@ abstract class AbstractConfig implements _InternalConfig {
FollyDateParse? _dateParseDelete;
List<double> _responsiveSizes = const <double>[540, 720, 960, 1140];

///
///
///
@override
String get version => _version;

///
///
///
Expand Down Expand Up @@ -380,6 +401,7 @@ abstract class AbstractConfig implements _InternalConfig {
FollyDateParse? dateParseUpdate,
FollyDateParse? dateParseDelete,
Connectivity? connectivity,
PackageInfo? packageInfo,
}) async {
if (_started) {
if (kDebugMode) {
Expand Down Expand Up @@ -416,6 +438,10 @@ abstract class AbstractConfig implements _InternalConfig {
_platform = RunningPlatform.fuchsia;
}

packageInfo ??= await PackageInfo.fromPlatform();

_version = packageInfo.version;

connectivity ??= Connectivity();

List<ConnectivityResult> result = await connectivity.checkConnectivity();
Expand Down
34 changes: 29 additions & 5 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.0"
flutter_localizations:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -209,10 +209,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -245,6 +245,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.5.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: df3eb3e0aed5c1107bb0fdb80a8e82e778114958b1c5ac5644fb1ac9cae8a998
url: "https://pub.dev"
source: hosted
version: "8.1.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: ac1f4a4847f1ade8e6a87d1f39f5d7c67490738642e2542f559ec38c37489a66
url: "https://pub.dev"
source: hosted
version: "3.0.1"
path:
dependency: transitive
description:
Expand Down Expand Up @@ -362,6 +378,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
win32:
dependency: transitive
description:
name: win32
sha256: "84ba388638ed7a8cb3445a320c8273136ab2631cd5f2c57888335504ddab1bc2"
url: "https://pub.dev"
source: hosted
version: "5.8.0"
xml:
dependency: transitive
description:
Expand All @@ -379,5 +403,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.4.0 <4.0.0"
dart: ">=3.5.0 <4.0.0"
flutter: ">=3.22.0"
7 changes: 5 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: folly_fields
description: Basic form fields and utilities.
version: 3.4.1
version: 3.5.0
repository: https://github.com/edufolly/folly_fields/
homepage: https://edufolly.github.io/folly_fields/

Expand Down Expand Up @@ -38,12 +38,15 @@ dependencies:
# https://pub.dev/packages/intl
intl: ^0.19.0

# https://pub.dev/packages/package_info_plus
package_info_plus: ^8.1.0

# https://pub.dev/packages/sprintf
sprintf: ^7.0.0

dev_dependencies:
# https://pub.dev/packages/flutter_lints
flutter_lints: ^4.0.0
flutter_lints: ^5.0.0

# https://flutter.dev/
flutter_test:
Expand Down
47 changes: 47 additions & 0 deletions test/mocks/mock_package_info.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// ignore_for_file: avoid-top-level-members-in-tests

import 'package:package_info_plus/package_info_plus.dart';

///
///
///
// ignore: avoid_implementing_value_types
class MockPackageInfo implements PackageInfo {
@override
final String appName;
@override
final String buildNumber;
@override
final String buildSignature;
@override
final String? installerStore;
@override
final String packageName;
@override
final String version;

///
///
///
MockPackageInfo({
this.appName = 'folly_fields',
this.buildNumber = '0',
this.buildSignature = '',
this.installerStore,
this.packageName = 'folly_fields',
this.version = '0.0.0',
});

///
///
///
@override
Map<String, dynamic> get data => <String, dynamic>{
'appName': appName,
'buildNumber': buildNumber,
'buildSignature': buildSignature,
'installerStore': installerStore,
'packageName': packageName,
'version': version,
};
}
2 changes: 2 additions & 0 deletions test/util/model_utils/from_json_safe_list_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import '../../mocks/crud/mock_string_consumer.dart';
import '../../mocks/crud/mock_string_model.dart';
import '../../mocks/mock_config.dart';
import '../../mocks/mock_connectivity.dart';
import '../../mocks/mock_package_info.dart';

///
///
Expand All @@ -18,6 +19,7 @@ void main() {
FollyFields.start(
MockConfig(),
connectivity: MockConnectivity(),
packageInfo: MockPackageInfo(),
);

const MockStringConsumer consumer = MockStringConsumer();
Expand Down
2 changes: 2 additions & 0 deletions test/util/model_utils/from_json_safe_set_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import '../../mocks/crud/mock_string_consumer.dart';
import '../../mocks/crud/mock_string_model.dart';
import '../../mocks/mock_config.dart';
import '../../mocks/mock_connectivity.dart';
import '../../mocks/mock_package_info.dart';

///
///
Expand All @@ -18,6 +19,7 @@ void main() {
FollyFields.start(
MockConfig(),
connectivity: MockConnectivity(),
packageInfo: MockPackageInfo(),
);

const MockStringConsumer consumer = MockStringConsumer();
Expand Down

0 comments on commit 835944b

Please sign in to comment.