mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10:39 +00:00
Compare commits
No commits in common. "ddc7ec8c8b2be7f0fb38f7ea5833599da1d26985" and "3bb3f12641398dc9274cc6f1fc9374f786ed1fce" have entirely different histories.
ddc7ec8c8b
...
3bb3f12641
5 changed files with 9 additions and 22 deletions
|
@ -24,6 +24,7 @@ class RemoteConfigService {
|
||||||
await remoteConfig.setDefaults(featuresDefaultValues.map((key, value) => MapEntry(key.name, value)));
|
await remoteConfig.setDefaults(featuresDefaultValues.map((key, value) => MapEntry(key.name, value)));
|
||||||
await remoteConfig.activate();
|
await remoteConfig.activate();
|
||||||
await remoteConfig.ensureInitialized();
|
await remoteConfig.ensureInitialized();
|
||||||
|
unawaited(remoteConfig.fetch());
|
||||||
|
|
||||||
log('Firebase remote config initialized successfully');
|
log('Firebase remote config initialized successfully');
|
||||||
} on FirebaseException catch (e) {
|
} on FirebaseException catch (e) {
|
||||||
|
@ -33,12 +34,6 @@ class RemoteConfigService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> fetchConfig() async {
|
|
||||||
// https://github.com/firebase/flutterfire/issues/6196#issuecomment-927751667
|
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
|
||||||
await FirebaseRemoteConfig.instance.fetch();
|
|
||||||
}
|
|
||||||
|
|
||||||
dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature);
|
dynamic getValue(Feature feature) => FirebaseRemoteConfig.instance.getValue(feature.name).toValue(feature);
|
||||||
|
|
||||||
Map<Feature, dynamic> getAll() {
|
Map<Feature, dynamic> getAll() {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lightmeter/data/models/feature.dart';
|
import 'package:lightmeter/data/models/feature.dart';
|
||||||
|
@ -26,11 +25,7 @@ class RemoteConfigProviderState extends State<RemoteConfigProvider> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
widget.remoteConfigService.fetchConfig();
|
_updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen(_updateFeatures);
|
||||||
_updatesSubscription = widget.remoteConfigService.onConfigUpdated().listen(
|
|
||||||
_updateFeatures,
|
|
||||||
onError: (e) => log(e.toString()),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -18,14 +18,12 @@ class BuyProListTile extends StatelessWidget {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
leading: const Icon(Icons.star),
|
leading: const Icon(Icons.star),
|
||||||
title: Text(unlockFeaturesEnabled ? S.of(context).unlockProFeatures : S.of(context).buyLightmeterPro),
|
title: Text(unlockFeaturesEnabled ? S.of(context).unlockProFeatures : S.of(context).buyLightmeterPro),
|
||||||
onTap: !isPending
|
onTap: () {
|
||||||
? () {
|
showBuyProDialog(context);
|
||||||
showBuyProDialog(context);
|
ServicesProvider.of(context)
|
||||||
ServicesProvider.of(context)
|
.analytics
|
||||||
.analytics
|
.logUnlockProFeatures(unlockFeaturesEnabled ? 'Unlock Pro features' : 'Buy Lightmeter Pro');
|
||||||
.logUnlockProFeatures(unlockFeaturesEnabled ? 'Unlock Pro features' : 'Buy Lightmeter Pro');
|
},
|
||||||
}
|
|
||||||
: null,
|
|
||||||
trailing: isPending
|
trailing: isPending
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
height: Dimens.grid24,
|
height: Dimens.grid24,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: lightmeter
|
name: lightmeter
|
||||||
description: Lightmeter app inspired by Material 3 design system.
|
description: Lightmeter app inspired by Material 3 design system.
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 0.15.3+44
|
version: 0.15.2+43
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
|
@ -18,7 +18,6 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
when(() => mockRemoteConfigService.fetchConfig()).thenAnswer((_) async {});
|
|
||||||
when(() => mockRemoteConfigService.getValue(Feature.unlockProFeaturesText)).thenReturn(false);
|
when(() => mockRemoteConfigService.getValue(Feature.unlockProFeaturesText)).thenReturn(false);
|
||||||
when(() => mockRemoteConfigService.getAll()).thenReturn({Feature.unlockProFeaturesText: false});
|
when(() => mockRemoteConfigService.getAll()).thenReturn({Feature.unlockProFeaturesText: false});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue