generated from nventive/Template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
config: integrate bugsee in flutter template and update build pipelin…
…e job
- Loading branch information
Showing
9 changed files
with
128 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,3 +34,5 @@ app.*.map.json | |
|
||
# Localization related | ||
lib/l10n/gen_l10n/* | ||
|
||
.bugsee.dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:bugsee_flutter/bugsee_flutter.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
import 'package:logger/logger.dart'; | ||
import 'package:logger/web.dart'; | ||
|
||
abstract interface class BugseeManager { | ||
factory BugseeManager({ | ||
required Logger logger, | ||
}) = _BugseeManager; | ||
|
||
Future<void> initialize({required VoidCallback runApp}); | ||
} | ||
|
||
final class _BugseeManager implements BugseeManager { | ||
final Logger logger; | ||
|
||
late BugseeLaunchOptions launchOptions; | ||
String? bugseeAccessToken; | ||
|
||
_BugseeManager({required this.logger}); | ||
|
||
@override | ||
Future<void> initialize({ | ||
required VoidCallback runApp, | ||
}) async { | ||
await initializeTokensAndOptions(); | ||
if (kDebugMode) { | ||
runApp(); | ||
return; | ||
} | ||
|
||
if (bugseeAccessToken == null) { | ||
logger.i("bugsee token is null, bugsee won't be initialized"); | ||
} | ||
HttpOverrides.global = Bugsee.defaultHttpOverrides; | ||
Bugsee.launch( | ||
bugseeAccessToken ?? '', | ||
appRunCallback: (isBugseeLaunched) { | ||
if (!isBugseeLaunched) { | ||
logger.e("bugsee is not initialized, verify bugsee token config"); | ||
} | ||
runApp(); | ||
}, | ||
launchOptions: launchOptions, | ||
); | ||
} | ||
|
||
Future initializeTokensAndOptions() async { | ||
if (Platform.isAndroid) { | ||
launchOptions = AndroidLaunchOptions(); | ||
bugseeAccessToken = dotenv.env['BUGSEE_ANDROID_TOKEN']; | ||
} else if (Platform.isIOS) { | ||
launchOptions = IOSLaunchOptions(); | ||
bugseeAccessToken = dotenv.env['BUGSEE_IOS_TOKEN']; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters