Compare commits

...

3 commits

Author SHA1 Message Date
github-actions[bot]
1e2cd8b5d2 Release v0.19.0 2024-05-23 12:07:37 +00:00
Vadim
90bfe7c7b8 Fixed integration tests 2024-05-23 11:34:11 +02:00
Vadim
7f8ea54c6e Fixed duplicate release notes dialog 2024-05-23 09:08:16 +02:00
9 changed files with 45 additions and 18 deletions

View file

@ -17,6 +17,7 @@ import 'package:lightmeter/screens/settings/components/shared/dialog_filter/widg
import 'package:lightmeter/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart';
import 'package:lightmeter/screens/settings/screen_settings.dart';
import 'package:lightmeter/utils/double_to_zoom.dart';
import 'package:lightmeter/utils/platform_utils.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'package:meta/meta.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -27,7 +28,7 @@ import 'utils/expectations.dart';
@isTest
void testE2E(String description) {
setUp(() {
setUp(() async {
SharedPreferences.setMockInitialValues({
/// Metering values
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
@ -38,6 +39,8 @@ void testE2E(String description) {
MeteringScreenLayoutFeature.filmPicker: true,
}.toJson(),
),
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
});
});

View file

@ -10,6 +10,7 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/extreme_exposure_pairs_container/widget_container_extreme_exposure_pairs.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/film_picker/widget_picker_film.dart';
import 'package:lightmeter/screens/settings/screen_settings.dart';
import 'package:lightmeter/utils/platform_utils.dart';
import 'package:meta/meta.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -22,7 +23,7 @@ void testToggleLayoutFeatures(String description) {
group(
description,
() {
setUp(() {
setUp(() async {
SharedPreferences.setMockInitialValues({
/// Metering values
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
@ -33,6 +34,7 @@ void testToggleLayoutFeatures(String description) {
MeteringScreenLayoutFeature.filmPicker: true,
}.toJson(),
),
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
});
});

View file

@ -14,6 +14,7 @@ import 'package:lightmeter/screens/metering/components/shared/readings_container
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/nd_picker/widget_picker_nd.dart';
import 'package:lightmeter/screens/settings/components/shared/disable/widget_disable.dart';
import 'package:lightmeter/screens/settings/screen_settings.dart';
import 'package:lightmeter/utils/platform_utils.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
import 'package:meta/meta.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -38,6 +39,7 @@ void testPurchases(String description) {
MeteringScreenLayoutFeature.filmPicker: true,
}.toJson(),
),
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
});
await tester.pumpApplication(productStatus: IAPProductStatus.purchasable);

View file

@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/widget_dialog_release_notes.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:lightmeter/utils/platform_utils.dart';
class VersionListTile extends StatelessWidget {
const VersionListTile({super.key});
@override
Widget build(BuildContext context) {
return FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
return FutureBuilder<({String buildNumber, String version})>(
future: const PlatformUtils().buildVersion,
builder: (context, snapshot) => ListTile(
leading: const Icon(Icons.info_outline),
title: Text(S.of(context).version),

View file

@ -3,20 +3,23 @@ import 'dart:async';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/state_release_notes.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:lightmeter/utils/platform_utils.dart';
class ReleaseNotesBloc extends Cubit<ReleaseNotesState> {
final UserPreferencesService _userPreferencesService;
final PlatformUtils _platformUtils;
ReleaseNotesBloc(this._userPreferencesService) : super(const HiddenReleaseNotesDialogState()) {
ReleaseNotesBloc(
this._userPreferencesService,
this._platformUtils,
) : super(const HiddenReleaseNotesDialogState()) {
_showDialogIfNeeded();
}
Future<void> _showDialogIfNeeded() async {
PackageInfo.fromPlatform().then((value) {
emit(ShowReleaseNotesDialogState(value.version));
if (value.version != _userPreferencesService.seenChangelogVersion) {
emit(ShowReleaseNotesDialogState(value.version));
_platformUtils.version.then((version) {
if (version != _userPreferencesService.seenChangelogVersion) {
emit(ShowReleaseNotesDialogState(version));
}
});
}

View file

@ -4,6 +4,7 @@ import 'package:lightmeter/providers/services_provider.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/bloc_release_notes.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/state_release_notes.dart';
import 'package:lightmeter/screens/shared/release_notes_dialog/widget_dialog_release_notes.dart';
import 'package:lightmeter/utils/platform_utils.dart';
class ReleaseNotesFlow extends StatelessWidget {
final Widget child;
@ -13,7 +14,10 @@ class ReleaseNotesFlow extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => ReleaseNotesBloc(ServicesProvider.of(context).userPreferencesService),
create: (context) => ReleaseNotesBloc(
ServicesProvider.of(context).userPreferencesService,
const PlatformUtils(),
),
child: BlocListener<ReleaseNotesBloc, ReleaseNotesState>(
listener: (context, state) {
if (state is ShowReleaseNotesDialogState) {

View file

@ -0,0 +1,10 @@
import 'package:package_info_plus/package_info_plus.dart';
class PlatformUtils {
const PlatformUtils();
Future<String> get version async => (await PackageInfo.fromPlatform()).version;
Future<({String version, String buildNumber})> get buildVersion async =>
PackageInfo.fromPlatform().then((value) => (version: value.version, buildNumber: value.buildNumber));
}

View file

@ -1,7 +1,7 @@
name: lightmeter
description: Lightmeter app inspired by Material 3 design system.
publish_to: "none"
version: 0.18.0+49
version: 0.19.0+50
environment:
sdk: ">=3.0.0 <4.0.0"

View file

@ -22,6 +22,7 @@ import 'package:lightmeter/screens/settings/components/metering/components/equip
import 'package:lightmeter/screens/settings/screen_settings.dart';
import 'package:lightmeter/screens/shared/animated_circular_button/widget_button_circular_animated.dart';
import 'package:lightmeter/screens/timer/screen_timer.dart';
import 'package:lightmeter/utils/platform_utils.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -42,13 +43,13 @@ void main() {
final binding = IntegrationTestWidgetsFlutterBinding();
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
void mockSharedPrefs({
Future<void> mockSharedPrefs({
int iso = 400,
int nd = 0,
double calibration = 0.0,
required ThemeType theme,
required Color color,
}) {
}) async {
SharedPreferences.setMockInitialValues({
/// Metering values
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
@ -78,6 +79,8 @@ void main() {
UserPreferencesService.themeTypeKey: theme.index,
UserPreferencesService.primaryColorKey: color.value,
UserPreferencesService.dynamicColorKey: false,
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
});
}
@ -87,7 +90,7 @@ void main() {
/// Generates several screenshots with the light theme
testWidgets('Generate light theme screenshots', (tester) async {
mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
await mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
await tester.pumpApplication(
availableFilms: [_mockFilm],
filmsInUse: [_mockFilm],
@ -127,7 +130,7 @@ void main() {
testWidgets(
'Generate dark theme screenshots',
(tester) async {
mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
await mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
await tester.pumpApplication(
availableFilms: [_mockFilm],
filmsInUse: [_mockFilm],
@ -146,7 +149,7 @@ void main() {
ApertureValue(16, StopType.full),
ShutterSpeedValue(8, false, StopType.full),
);
mockSharedPrefs(
await mockSharedPrefs(
iso: 100,
nd: 8,
calibration: -0.3,