refactor: gate sentry behind build flag
This commit is contained in:
@@ -3,6 +3,9 @@ name: Build
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
SENTRY_DART_DEFINE: ${{ github.repository == 'edde746/plezy' && '--dart-define=ENABLE_SENTRY=true' || '' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-android:
|
build-android:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -58,7 +61,7 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Build APKs
|
- name: Build APKs
|
||||||
run: flutter build apk --release --split-per-abi --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build apk --release --split-per-abi --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
|
|
||||||
- name: Clean up keystore
|
- name: Clean up keystore
|
||||||
if: always()
|
if: always()
|
||||||
@@ -126,7 +129,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build iOS (no codesign)
|
- name: Build iOS (no codesign)
|
||||||
run: flutter build ios --release --no-codesign --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build ios --release --no-codesign --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
|
|
||||||
- name: Create IPA
|
- name: Create IPA
|
||||||
run: |
|
run: |
|
||||||
@@ -184,7 +187,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build macOS
|
- name: Build macOS
|
||||||
run: flutter build macos --release --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build macos --release --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
|
|
||||||
- name: Import Code Signing Certificate
|
- name: Import Code Signing Certificate
|
||||||
env:
|
env:
|
||||||
@@ -335,7 +338,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build Windows x64
|
- name: Build Windows x64
|
||||||
run: flutter build windows --release --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build windows --release --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
|
|
||||||
- name: Upload x64 build
|
- name: Upload x64 build
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -372,7 +375,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build Windows arm64
|
- name: Build Windows arm64
|
||||||
run: flutter build windows --release --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build windows --release --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
|
|
||||||
- name: Upload arm64 build
|
- name: Upload arm64 build
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -516,7 +519,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build Linux x64
|
- name: Build Linux x64
|
||||||
run: flutter build linux --release --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build linux --release --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
env:
|
env:
|
||||||
PKG_CONFIG_PATH: ${{ github.workspace }}/libmpv-prefix/lib/pkgconfig:${{ github.workspace }}/libmpv-prefix/lib/x86_64-linux-gnu/pkgconfig
|
PKG_CONFIG_PATH: ${{ github.workspace }}/libmpv-prefix/lib/pkgconfig:${{ github.workspace }}/libmpv-prefix/lib/x86_64-linux-gnu/pkgconfig
|
||||||
|
|
||||||
@@ -624,7 +627,7 @@ jobs:
|
|||||||
run: flutter pub get
|
run: flutter pub get
|
||||||
|
|
||||||
- name: Build Linux arm64
|
- name: Build Linux arm64
|
||||||
run: flutter build linux --release --dart-define=ENABLE_UPDATE_CHECK=true
|
run: flutter build linux --release --dart-define=ENABLE_UPDATE_CHECK=true ${{ env.SENTRY_DART_DEFINE }}
|
||||||
env:
|
env:
|
||||||
PKG_CONFIG_PATH: ${{ github.workspace }}/libmpv-prefix/lib/pkgconfig:${{ github.workspace }}/libmpv-prefix/lib/aarch64-linux-gnu/pkgconfig
|
PKG_CONFIG_PATH: ${{ github.workspace }}/libmpv-prefix/lib/pkgconfig:${{ github.workspace }}/libmpv-prefix/lib/aarch64-linux-gnu/pkgconfig
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ platform :android do
|
|||||||
debug_info_dir = "./debug-info/#{version_name}+#{version_code}"
|
debug_info_dir = "./debug-info/#{version_name}+#{version_code}"
|
||||||
|
|
||||||
# Build the Flutter app
|
# Build the Flutter app
|
||||||
sh("cd #{ENV['PWD']}/.. && flutter build appbundle --dart-define=ENABLE_IN_APP_REVIEW=true --obfuscate --split-debug-info=#{debug_info_dir}/aab")
|
sh("cd #{ENV['PWD']}/.. && flutter build appbundle --dart-define=ENABLE_IN_APP_REVIEW=true --dart-define=ENABLE_SENTRY=true --obfuscate --split-debug-info=#{debug_info_dir}/aab")
|
||||||
|
|
||||||
upload_to_play_store(
|
upload_to_play_store(
|
||||||
track: "production",
|
track: "production",
|
||||||
@@ -32,7 +32,7 @@ platform :android do
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Build universal APK for Amazon Appstore (doesn't accept AABs, excludes x86 via env var)
|
# Build universal APK for Amazon Appstore (doesn't accept AABs, excludes x86 via env var)
|
||||||
sh("cd #{ENV['PWD']}/.. && AMAZON=1 flutter build apk --release --obfuscate --split-debug-info=#{debug_info_dir}/apk")
|
sh("cd #{ENV['PWD']}/.. && AMAZON=1 flutter build apk --release --dart-define=ENABLE_SENTRY=true --obfuscate --split-debug-info=#{debug_info_dir}/apk")
|
||||||
|
|
||||||
upload_to_amazon_appstore(
|
upload_to_amazon_appstore(
|
||||||
apk_paths: [
|
apk_paths: [
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ platform :ios do
|
|||||||
desc "Build and deploy to App Store"
|
desc "Build and deploy to App Store"
|
||||||
lane :deploy_appstore do
|
lane :deploy_appstore do
|
||||||
# Build the Flutter app
|
# Build the Flutter app
|
||||||
sh("cd #{ENV['PWD']}/.. && flutter build ipa --dart-define=ENABLE_IN_APP_REVIEW=true")
|
sh("cd #{ENV['PWD']}/.. && flutter build ipa --dart-define=ENABLE_IN_APP_REVIEW=true --dart-define=ENABLE_SENTRY=true")
|
||||||
|
|
||||||
# Upload to App Store
|
# Upload to App Store
|
||||||
upload_to_app_store(
|
upload_to_app_store(
|
||||||
|
|||||||
+60
-54
@@ -53,6 +53,8 @@ import 'utils/navigation_transitions.dart';
|
|||||||
import 'utils/log_redaction_manager.dart';
|
import 'utils/log_redaction_manager.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
|
const bool _enableSentry = bool.fromEnvironment('ENABLE_SENTRY', defaultValue: false);
|
||||||
|
|
||||||
// Workaround for Flutter bug #177992: iPadOS 26.1+ misinterprets fake touch events
|
// Workaround for Flutter bug #177992: iPadOS 26.1+ misinterprets fake touch events
|
||||||
// at (0,0) as barrier taps, causing modals to dismiss immediately.
|
// at (0,0) as barrier taps, causing modals to dismiss immediately.
|
||||||
// Remove when Flutter PR #179643 is merged.
|
// Remove when Flutter PR #179643 is merged.
|
||||||
@@ -70,14 +72,14 @@ void _absorbZeroOffsetPointerEvent(PointerEvent event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
_installZeroOffsetPointerGuard(); // Workaround for iPadOS 26.1+ modal dismissal bug
|
_installZeroOffsetPointerGuard(); // Workaround for iPadOS 26.1+ modal dismissal bug
|
||||||
|
|
||||||
final packageInfo = await PackageInfo.fromPlatform();
|
if (_enableSentry) {
|
||||||
|
final packageInfo = await PackageInfo.fromPlatform();
|
||||||
|
|
||||||
await SentryFlutter.init(
|
await SentryFlutter.init((options) {
|
||||||
(options) {
|
|
||||||
options.dsn = 'https://6a1a6ef8c72140099b2798973c1bfb2f@bugs.plezy.app/1';
|
options.dsn = 'https://6a1a6ef8c72140099b2798973c1bfb2f@bugs.plezy.app/1';
|
||||||
options.release = 'plezy@${packageInfo.version}+${packageInfo.buildNumber}';
|
options.release = 'plezy@${packageInfo.version}+${packageInfo.buildNumber}';
|
||||||
options.tracesSampleRate = 0;
|
options.tracesSampleRate = 0;
|
||||||
@@ -86,73 +88,77 @@ void main() async {
|
|||||||
options.recordHttpBreadcrumbs = false;
|
options.recordHttpBreadcrumbs = false;
|
||||||
options.beforeSend = _beforeSend;
|
options.beforeSend = _beforeSend;
|
||||||
options.beforeBreadcrumb = _beforeBreadcrumb;
|
options.beforeBreadcrumb = _beforeBreadcrumb;
|
||||||
},
|
}, appRunner: _bootstrapApp);
|
||||||
appRunner: () async {
|
return;
|
||||||
// Initialize settings first to get saved locale
|
}
|
||||||
final settings = await SettingsService.getInstance();
|
|
||||||
final savedLocale = settings.getAppLocale();
|
|
||||||
|
|
||||||
// Initialize localization with saved locale
|
await _bootstrapApp();
|
||||||
LocaleSettings.setLocale(savedLocale);
|
}
|
||||||
|
|
||||||
// Needed for formatting dates in different locales
|
Future<void> _bootstrapApp() async {
|
||||||
await initializeDateFormatting(savedLocale.languageCode, null);
|
// Initialize settings first to get saved locale
|
||||||
|
final settings = await SettingsService.getInstance();
|
||||||
|
final savedLocale = settings.getAppLocale();
|
||||||
|
|
||||||
// Configure image cache for large libraries
|
// Initialize localization with saved locale
|
||||||
PaintingBinding.instance.imageCache.maximumSize = 2000; // default 1000
|
LocaleSettings.setLocale(savedLocale);
|
||||||
PaintingBinding.instance.imageCache.maximumSizeBytes = 300 << 20; // 300MB
|
|
||||||
|
|
||||||
// Initialize services in parallel where possible
|
// Needed for formatting dates in different locales
|
||||||
final futures = <Future<void>>[];
|
await initializeDateFormatting(savedLocale.languageCode, null);
|
||||||
|
|
||||||
// Initialize window_manager for desktop platforms
|
// Configure image cache for large libraries
|
||||||
if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
PaintingBinding.instance.imageCache.maximumSize = 2000; // default 1000
|
||||||
futures.add(windowManager.ensureInitialized());
|
PaintingBinding.instance.imageCache.maximumSizeBytes = 300 << 20; // 300MB
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize TV detection and PiP service for Android
|
// Initialize services in parallel where possible
|
||||||
if (Platform.isAndroid) {
|
final futures = <Future<void>>[];
|
||||||
futures.add(TvDetectionService.getInstance());
|
|
||||||
// Initialize PiP service to listen for PiP state changes
|
|
||||||
PipService();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Configure macOS window with custom titlebar (depends on window manager)
|
// Initialize window_manager for desktop platforms
|
||||||
futures.add(MacOSWindowService.setupCustomTitlebar());
|
if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
||||||
|
futures.add(windowManager.ensureInitialized());
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize storage service
|
// Initialize TV detection and PiP service for Android
|
||||||
futures.add(StorageService.getInstance());
|
if (Platform.isAndroid) {
|
||||||
|
futures.add(TvDetectionService.getInstance());
|
||||||
|
// Initialize PiP service to listen for PiP state changes
|
||||||
|
PipService();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize language codes for track selection
|
// Configure macOS window with custom titlebar (depends on window manager)
|
||||||
futures.add(LanguageCodes.initialize());
|
futures.add(MacOSWindowService.setupCustomTitlebar());
|
||||||
|
|
||||||
// Wait for all parallel services to complete
|
// Initialize storage service
|
||||||
await Future.wait(futures);
|
futures.add(StorageService.getInstance());
|
||||||
|
|
||||||
// Initialize logger level based on debug setting
|
// Initialize language codes for track selection
|
||||||
final debugEnabled = settings.getEnableDebugLogging();
|
futures.add(LanguageCodes.initialize());
|
||||||
setLoggerLevel(debugEnabled);
|
|
||||||
|
|
||||||
// Initialize download storage service with settings
|
// Wait for all parallel services to complete
|
||||||
await DownloadStorageService.instance.initialize(settings);
|
await Future.wait(futures);
|
||||||
|
|
||||||
// Start global fullscreen state monitoring
|
// Initialize logger level based on debug setting
|
||||||
FullscreenStateManager().startMonitoring();
|
final debugEnabled = settings.getEnableDebugLogging();
|
||||||
|
setLoggerLevel(debugEnabled);
|
||||||
|
|
||||||
// Initialize gamepad service for desktop platforms
|
// Initialize download storage service with settings
|
||||||
if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
await DownloadStorageService.instance.initialize(settings);
|
||||||
GamepadService.instance.start();
|
|
||||||
DiscordRPCService.instance.initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
// DTD service is available for MCP tooling connection if needed
|
// Start global fullscreen state monitoring
|
||||||
|
FullscreenStateManager().startMonitoring();
|
||||||
|
|
||||||
// Register bundled shader licenses
|
// Initialize gamepad service for desktop platforms
|
||||||
_registerShaderLicenses();
|
if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
||||||
|
GamepadService.instance.start();
|
||||||
|
DiscordRPCService.instance.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
runApp(const MainApp());
|
// DTD service is available for MCP tooling connection if needed
|
||||||
},
|
|
||||||
);
|
// Register bundled shader licenses
|
||||||
|
_registerShaderLicenses();
|
||||||
|
|
||||||
|
runApp(const MainApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
Breadcrumb? _beforeBreadcrumb(Breadcrumb? breadcrumb, Hint _) {
|
Breadcrumb? _beforeBreadcrumb(Breadcrumb? breadcrumb, Hint _) {
|
||||||
|
|||||||
Reference in New Issue
Block a user