2024-01-27 22:20:53 +00:00
|
|
|
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';
|
2024-02-21 11:33:25 +00:00
|
|
|
import 'package:lightmeter/constants.dart';
|
2024-01-27 22:20:53 +00:00
|
|
|
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(
|
2024-07-23 21:19:41 +00:00
|
|
|
products: [
|
|
|
|
IAPProduct(
|
|
|
|
storeId: IAPProductType.paidFeatures.storeId,
|
|
|
|
price: '0.0\$',
|
|
|
|
),
|
|
|
|
],
|
2024-01-27 22:20:53 +00:00
|
|
|
child: application,
|
|
|
|
)
|
2024-02-21 11:33:25 +00:00
|
|
|
: IAPProductsProvider(
|
|
|
|
apiUrl: iapServerUrl,
|
|
|
|
child: application,
|
|
|
|
),
|
2024-01-27 22:20:53 +00:00
|
|
|
);
|
|
|
|
},
|
|
|
|
_errorsLogger.logCrash,
|
|
|
|
);
|
|
|
|
}
|