m3_lightmeter/lib/runner.dart
Vadim f0d707b071
Show Lightmeter Pro price before purchase (#183)
* Upgraded `targetSdkVersion` to 34

* added price to `IAPProduct`

* implemented `ProFeaturesScreen` (wip)

* finalized `ProFeaturesScreen` layout

* replaced `ProFeaturesDialog` with `ProFeaturesScreen`

* added translations

* fixed feature checkbox width calculation

* fixed tests

* separated android & ios features

* NPE

* changed "get pro" tile colors

* unified Lightmeter Pro related naming

* typo

* updated golden tests

* use iap 0.11.0

* revert unrelated changes

This reverts commit bae5ead8f0.

* lint

* adjusted eng translation

* updated goldens
2024-07-23 23:19:41 +02:00

44 lines
1.5 KiB
Dart

import 'dart:async';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/widgets.dart';
import 'package:lightmeter/application.dart';
import 'package:lightmeter/application_wrapper.dart';
import 'package:lightmeter/constants.dart';
import 'package:lightmeter/data/analytics/analytics.dart';
import 'package:lightmeter/data/analytics/api/analytics_firebase.dart';
import 'package:lightmeter/environment.dart';
import 'package:lightmeter/firebase_options.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
const _errorsLogger = LightmeterAnalytics(api: LightmeterAnalyticsFirebase());
Future<void> runLightmeterApp(Environment env) async {
runZonedGuarded(
() async {
WidgetsFlutterBinding.ensureInitialized();
if (env.buildType == BuildType.prod) {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
}
_errorsLogger.init();
final application = ApplicationWrapper(env, child: const Application());
runApp(
env.buildType == BuildType.dev
? IAPProducts(
products: [
IAPProduct(
storeId: IAPProductType.paidFeatures.storeId,
price: '0.0\$',
),
],
child: application,
)
: IAPProductsProvider(
apiUrl: iapServerUrl,
child: application,
),
);
},
_errorsLogger.logCrash,
);
}