mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-12-04 21:30:39 +00:00
Compare commits
No commits in common. "1e2cd8b5d29f4c8881776d0c53f14aa7711881f2" and "36d7e081f1239c5a52481ebd4d5a5be77ba35cd4" have entirely different histories.
1e2cd8b5d2
...
36d7e081f1
9 changed files with 18 additions and 45 deletions
|
@ -17,7 +17,6 @@ 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';
|
||||
|
@ -28,7 +27,7 @@ import 'utils/expectations.dart';
|
|||
|
||||
@isTest
|
||||
void testE2E(String description) {
|
||||
setUp(() async {
|
||||
setUp(() {
|
||||
SharedPreferences.setMockInitialValues({
|
||||
/// Metering values
|
||||
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
|
||||
|
@ -39,8 +38,6 @@ void testE2E(String description) {
|
|||
MeteringScreenLayoutFeature.filmPicker: true,
|
||||
}.toJson(),
|
||||
),
|
||||
|
||||
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ 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';
|
||||
|
||||
|
@ -23,7 +22,7 @@ void testToggleLayoutFeatures(String description) {
|
|||
group(
|
||||
description,
|
||||
() {
|
||||
setUp(() async {
|
||||
setUp(() {
|
||||
SharedPreferences.setMockInitialValues({
|
||||
/// Metering values
|
||||
UserPreferencesService.evSourceTypeKey: EvSourceType.camera.index,
|
||||
|
@ -34,7 +33,6 @@ void testToggleLayoutFeatures(String description) {
|
|||
MeteringScreenLayoutFeature.filmPicker: true,
|
||||
}.toJson(),
|
||||
),
|
||||
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ 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';
|
||||
|
@ -39,7 +38,6 @@ void testPurchases(String description) {
|
|||
MeteringScreenLayoutFeature.filmPicker: true,
|
||||
}.toJson(),
|
||||
),
|
||||
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
|
||||
});
|
||||
|
||||
await tester.pumpApplication(productStatus: IAPProductStatus.purchasable);
|
||||
|
|
|
@ -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:lightmeter/utils/platform_utils.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class VersionListTile extends StatelessWidget {
|
||||
const VersionListTile({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder<({String buildNumber, String version})>(
|
||||
future: const PlatformUtils().buildVersion,
|
||||
return FutureBuilder<PackageInfo>(
|
||||
future: PackageInfo.fromPlatform(),
|
||||
builder: (context, snapshot) => ListTile(
|
||||
leading: const Icon(Icons.info_outline),
|
||||
title: Text(S.of(context).version),
|
||||
|
|
|
@ -3,23 +3,20 @@ 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:lightmeter/utils/platform_utils.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class ReleaseNotesBloc extends Cubit<ReleaseNotesState> {
|
||||
final UserPreferencesService _userPreferencesService;
|
||||
final PlatformUtils _platformUtils;
|
||||
|
||||
ReleaseNotesBloc(
|
||||
this._userPreferencesService,
|
||||
this._platformUtils,
|
||||
) : super(const HiddenReleaseNotesDialogState()) {
|
||||
ReleaseNotesBloc(this._userPreferencesService) : super(const HiddenReleaseNotesDialogState()) {
|
||||
_showDialogIfNeeded();
|
||||
}
|
||||
|
||||
Future<void> _showDialogIfNeeded() async {
|
||||
_platformUtils.version.then((version) {
|
||||
if (version != _userPreferencesService.seenChangelogVersion) {
|
||||
emit(ShowReleaseNotesDialogState(version));
|
||||
PackageInfo.fromPlatform().then((value) {
|
||||
emit(ShowReleaseNotesDialogState(value.version));
|
||||
if (value.version != _userPreferencesService.seenChangelogVersion) {
|
||||
emit(ShowReleaseNotesDialogState(value.version));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ 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;
|
||||
|
@ -14,10 +13,7 @@ class ReleaseNotesFlow extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => ReleaseNotesBloc(
|
||||
ServicesProvider.of(context).userPreferencesService,
|
||||
const PlatformUtils(),
|
||||
),
|
||||
create: (context) => ReleaseNotesBloc(ServicesProvider.of(context).userPreferencesService),
|
||||
child: BlocListener<ReleaseNotesBloc, ReleaseNotesState>(
|
||||
listener: (context, state) {
|
||||
if (state is ShowReleaseNotesDialogState) {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
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));
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
name: lightmeter
|
||||
description: Lightmeter app inspired by Material 3 design system.
|
||||
publish_to: "none"
|
||||
version: 0.19.0+50
|
||||
version: 0.18.0+49
|
||||
|
||||
environment:
|
||||
sdk: ">=3.0.0 <4.0.0"
|
||||
|
|
|
@ -22,7 +22,6 @@ 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';
|
||||
|
||||
|
@ -43,13 +42,13 @@ void main() {
|
|||
final binding = IntegrationTestWidgetsFlutterBinding();
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
Future<void> mockSharedPrefs({
|
||||
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,
|
||||
|
@ -79,8 +78,6 @@ void main() {
|
|||
UserPreferencesService.themeTypeKey: theme.index,
|
||||
UserPreferencesService.primaryColorKey: color.value,
|
||||
UserPreferencesService.dynamicColorKey: false,
|
||||
|
||||
UserPreferencesService.seenChangelogVersionKey: await const PlatformUtils().version,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -90,7 +87,7 @@ void main() {
|
|||
|
||||
/// Generates several screenshots with the light theme
|
||||
testWidgets('Generate light theme screenshots', (tester) async {
|
||||
await mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
|
||||
mockSharedPrefs(theme: ThemeType.light, color: _lightThemeColor);
|
||||
await tester.pumpApplication(
|
||||
availableFilms: [_mockFilm],
|
||||
filmsInUse: [_mockFilm],
|
||||
|
@ -130,7 +127,7 @@ void main() {
|
|||
testWidgets(
|
||||
'Generate dark theme screenshots',
|
||||
(tester) async {
|
||||
await mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
|
||||
mockSharedPrefs(theme: ThemeType.dark, color: _darkThemeColor);
|
||||
await tester.pumpApplication(
|
||||
availableFilms: [_mockFilm],
|
||||
filmsInUse: [_mockFilm],
|
||||
|
@ -149,7 +146,7 @@ void main() {
|
|||
ApertureValue(16, StopType.full),
|
||||
ShutterSpeedValue(8, false, StopType.full),
|
||||
);
|
||||
await mockSharedPrefs(
|
||||
mockSharedPrefs(
|
||||
iso: 100,
|
||||
nd: 8,
|
||||
calibration: -0.3,
|
||||
|
|
Loading…
Reference in a new issue