diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..6d6e04a --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,55 @@ +PODS: + - app_links (7.0.0): + - Flutter + - Flutter (1.0.0) + - flutter_secure_storage_darwin (10.0.0): + - Flutter + - FlutterMacOS + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - spotify_sdk (0.0.1): + - Flutter + - sqflite_darwin (0.0.4): + - Flutter + - FlutterMacOS + - url_launcher_ios (0.0.1): + - Flutter + +DEPENDENCIES: + - app_links (from `.symlinks/plugins/app_links/ios`) + - Flutter (from `Flutter`) + - flutter_secure_storage_darwin (from `.symlinks/plugins/flutter_secure_storage_darwin/darwin`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - spotify_sdk (from `.symlinks/plugins/spotify_sdk/ios`) + - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + +EXTERNAL SOURCES: + app_links: + :path: ".symlinks/plugins/app_links/ios" + Flutter: + :path: Flutter + flutter_secure_storage_darwin: + :path: ".symlinks/plugins/flutter_secure_storage_darwin/darwin" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + spotify_sdk: + :path: ".symlinks/plugins/spotify_sdk/ios" + sqflite_darwin: + :path: ".symlinks/plugins/sqflite_darwin/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + +SPEC CHECKSUMS: + app_links: a754cbec3c255bd4bbb4d236ecc06f28cd9a7ce8 + Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 + flutter_secure_storage_darwin: acdb3f316ed05a3e68f856e0353b133eec373a23 + shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb + spotify_sdk: a48400bb29f70c4fe251ebfdc9135c37097ac5ca + sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0 + url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b + +PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e + +COCOAPODS: 1.16.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index a62119b..40c003a 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + A2021DC1B7284D2C69839B6C /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F3CAF09727BEF831B3AF24B2 /* Pods_RunnerTests.framework */; }; + A231E255DAFC93985D32CC16 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B6939E6897ADA58EE8E4F472 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -40,14 +42,18 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0961F34970F2FEC717BEAFA8 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; + 148CD5D4A69B9F27B9DA0819 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 15C43898D1D1B4D5BFB5911B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7B99B563A73BE476DAA29329 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -55,19 +61,46 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + B210B33BA58DD6753A041AB1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + B6939E6897ADA58EE8E4F472 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F3CAF09727BEF831B3AF24B2 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FE7B63600F8EFB8C21B1FF3C /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ + 08FEAEEA364BF0F0FDFDBF79 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A2021DC1B7284D2C69839B6C /* Pods_RunnerTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + A231E255DAFC93985D32CC16 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 20995821EB80E742ABB4326C /* Pods */ = { + isa = PBXGroup; + children = ( + B210B33BA58DD6753A041AB1 /* Pods-Runner.debug.xcconfig */, + 148CD5D4A69B9F27B9DA0819 /* Pods-Runner.release.xcconfig */, + 15C43898D1D1B4D5BFB5911B /* Pods-Runner.profile.xcconfig */, + 0961F34970F2FEC717BEAFA8 /* Pods-RunnerTests.debug.xcconfig */, + 7B99B563A73BE476DAA29329 /* Pods-RunnerTests.release.xcconfig */, + FE7B63600F8EFB8C21B1FF3C /* Pods-RunnerTests.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; 331C8082294A63A400263BE5 /* RunnerTests */ = { isa = PBXGroup; children = ( @@ -76,6 +109,15 @@ path = RunnerTests; sourceTree = ""; }; + 65E3F38A3BA0B9C5BEA50885 /* Frameworks */ = { + isa = PBXGroup; + children = ( + B6939E6897ADA58EE8E4F472 /* Pods_Runner.framework */, + F3CAF09727BEF831B3AF24B2 /* Pods_RunnerTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -94,6 +136,8 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, + 20995821EB80E742ABB4326C /* Pods */, + 65E3F38A3BA0B9C5BEA50885 /* Frameworks */, ); sourceTree = ""; }; @@ -128,8 +172,10 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( + 6DF5193FC56601E40ABEA4EA /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, + 08FEAEEA364BF0F0FDFDBF79 /* Frameworks */, ); buildRules = ( ); @@ -145,12 +191,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + BBD1E40B5975676416149401 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 0133CC4DA5EC9366314FC870 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -222,6 +270,23 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ + 0133CC4DA5EC9366314FC870 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -238,6 +303,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 6DF5193FC56601E40ABEA4EA /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -253,6 +340,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + BBD1E40B5975676416149401 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -378,6 +487,7 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 0961F34970F2FEC717BEAFA8 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -395,6 +505,7 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 7B99B563A73BE476DAA29329 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; @@ -410,6 +521,7 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = FE7B63600F8EFB8C21B1FF3C /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 6266644..c30b367 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -2,12 +2,15 @@ import Flutter import UIKit @main -@objc class AppDelegate: FlutterAppDelegate { +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { - GeneratedPluginRegistrant.register(with: self) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } } diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 3dce246..1dba770 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -28,6 +28,27 @@ LaunchScreen UIMainStoryboardFile Main + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneDelegateClassName + FlutterSceneDelegate + UISceneConfigurationName + flutter + UISceneStoryboardFile + Main + + + + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/lib/app.dart b/lib/app.dart index 4fc7d9f..72838ad 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -4,6 +4,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:window_manager/window_manager.dart'; import 'l10n/app_localizations.dart'; +import 'application/di/core_providers.dart' show sharedPrefsProvider; import 'application/providers/auth_provider.dart'; import 'application/providers/credentials_provider.dart'; import 'application/providers/locale_provider.dart'; @@ -38,6 +39,19 @@ class SpotifyFocusSomeoneApp extends ConsumerWidget { GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], + // On macOS with fullSizeContentView, inform Scaffold about the + // title bar area so AppBar adds internal top padding automatically. + builder: Platform.isMacOS + ? (context, child) { + final mq = MediaQuery.of(context); + return MediaQuery( + data: mq.copyWith( + padding: mq.padding.copyWith(top: mq.padding.top + 28), + ), + child: child!, + ); + } + : null, home: const _AppShell(), ); } @@ -251,19 +265,32 @@ class _AuthWrapper extends ConsumerStatefulWidget { } class _AuthWrapperState extends ConsumerState<_AuthWrapper> { - @override - void initState() { - super.initState(); - // Check auth status when credentials are ready - WidgetsBinding.instance.addPostFrameCallback((_) { - ref.read(authProvider.notifier).checkAuthStatus(); - }); - } + bool _hasCheckedAuth = false; @override Widget build(BuildContext context) { final authState = ref.watch(authProvider); + // On macOS/iOS, wait for SharedPreferences to be ready before checking auth. + // Without this, the placeholder data source returns null tokens and + // checkAuthStatus() always concludes "unauthenticated". + if (Platform.isMacOS || Platform.isIOS) { + final prefsReady = ref.watch(sharedPrefsProvider).hasValue; + if (!prefsReady) { + return const Scaffold( + body: Center(child: CircularProgressIndicator()), + ); + } + } + + // Trigger auth check once when data sources are ready + if (!_hasCheckedAuth) { + _hasCheckedAuth = true; + WidgetsBinding.instance.addPostFrameCallback((_) { + ref.read(authProvider.notifier).checkAuthStatus(); + }); + } + return switch (authState.status) { // Only show loading spinner for initial state (checking stored tokens) AuthStatus.initial => const Scaffold( diff --git a/lib/core/services/system_tray_service.dart b/lib/core/services/system_tray_service.dart index 844b948..2f3dbd3 100644 --- a/lib/core/services/system_tray_service.dart +++ b/lib/core/services/system_tray_service.dart @@ -140,7 +140,7 @@ class SystemTrayService { } await _systemTray.initSystemTray( - title: _localizedStrings.tooltip, + title: '', iconPath: iconPath, toolTip: _localizedStrings.tooltip, ); @@ -256,10 +256,19 @@ class SystemTrayService { if (!playingChanged && !trackChanged) return; try { - // Update tooltip only when track changes + // Update title and tooltip when track changes if (trackChanged) { final tooltip = newTrackName ?? 'FullStop'; await _systemTray.setToolTip(tooltip); + // Show track info next to tray icon when playing, hide when idle + final title = (isPlaying && newTrackName != null) ? newTrackName : ''; + await _systemTray.setTitle(title); + } + + // Update title visibility when play state changes (track same) + if (playingChanged && !trackChanged) { + final title = (isPlaying && newTrackName != null) ? newTrackName : ''; + await _systemTray.setTitle(title); } // Update state diff --git a/lib/presentation/screens/create_session_screen.dart b/lib/presentation/screens/create_session_screen.dart index beefb17..16b0e6e 100644 --- a/lib/presentation/screens/create_session_screen.dart +++ b/lib/presentation/screens/create_session_screen.dart @@ -70,10 +70,12 @@ class _CreateSessionScreenState extends ConsumerState { // Bottom sheet (only show when artists are selected) if (createState.selectedArtists.isNotEmpty) - SessionSettingsBottomSheet( - key: _bottomSheetKey, - onStartPressed: _createSession, - isCreating: createState.isCreating, + Flexible( + child: SessionSettingsBottomSheet( + key: _bottomSheetKey, + onStartPressed: _createSession, + isCreating: createState.isCreating, + ), ), ], ), diff --git a/lib/presentation/widgets/create_session/session_settings_bottom_sheet.dart b/lib/presentation/widgets/create_session/session_settings_bottom_sheet.dart index 54f03ed..42ad398 100644 --- a/lib/presentation/widgets/create_session/session_settings_bottom_sheet.dart +++ b/lib/presentation/widgets/create_session/session_settings_bottom_sheet.dart @@ -1,3 +1,4 @@ +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../../../application/providers/create_session_provider.dart'; @@ -26,6 +27,9 @@ class SessionSettingsBottomSheet extends ConsumerStatefulWidget { class SessionSettingsBottomSheetState extends ConsumerState { + static final bool _isDesktop = + Platform.isMacOS || Platform.isWindows || Platform.isLinux; + bool _trueShuffle = true; RepeatMode _repeatMode = RepeatMode.context; bool _isExpanded = false; @@ -114,22 +118,28 @@ class SessionSettingsBottomSheetState const SizedBox(height: 8), // Collapsible content with animation - AnimatedCrossFade( - duration: const Duration(milliseconds: 250), - crossFadeState: _isExpanded - ? CrossFadeState.showSecond - : CrossFadeState.showFirst, - sizeCurve: Curves.easeInOut, - firstChild: _buildCollapsedContent(l10n, createState), - secondChild: _buildExpandedContent(l10n, createState), + Flexible( + child: AnimatedCrossFade( + duration: const Duration(milliseconds: 250), + crossFadeState: _isExpanded + ? CrossFadeState.showSecond + : CrossFadeState.showFirst, + sizeCurve: Curves.easeInOut, + firstChild: _buildCollapsedContent(l10n, createState), + secondChild: SingleChildScrollView( + child: _buildExpandedContent(l10n, createState), + ), + ), ), // Start button (always visible) Padding( - padding: const EdgeInsets.fromLTRB(20, 12, 20, 16), + padding: _isDesktop + ? const EdgeInsets.fromLTRB(20, 8, 20, 12) + : const EdgeInsets.fromLTRB(20, 12, 20, 16), child: SizedBox( width: double.infinity, - height: 56, + height: _isDesktop ? 40 : 56, child: ElevatedButton( onPressed: createState.canCreate && !widget.isCreating ? widget.onStartPressed @@ -140,22 +150,22 @@ class SessionSettingsBottomSheetState disabledBackgroundColor: AppTheme.spotifyLightGray .withValues(alpha: 0.3), shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(28), + borderRadius: BorderRadius.circular(_isDesktop ? 20 : 28), ), ), child: widget.isCreating - ? const SizedBox( - width: 24, - height: 24, - child: CircularProgressIndicator( + ? SizedBox( + width: _isDesktop ? 20 : 24, + height: _isDesktop ? 20 : 24, + child: const CircularProgressIndicator( strokeWidth: 2, color: Colors.black, ), ) : Text( l10n.play.toUpperCase(), - style: const TextStyle( - fontSize: 16, + style: TextStyle( + fontSize: _isDesktop ? 13 : 16, fontWeight: FontWeight.bold, letterSpacing: 1.2, ), diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift index fd4b880..11294d1 100644 --- a/macos/Runner/AppDelegate.swift +++ b/macos/Runner/AppDelegate.swift @@ -5,6 +5,18 @@ import app_links @main class AppDelegate: FlutterAppDelegate { override func applicationWillFinishLaunching(_ notification: Notification) { + // Single-instance guard: if another instance is already running, activate it and quit + let bundleID = Bundle.main.bundleIdentifier ?? "com.sfo.fullstop" + let runningApps = NSRunningApplication.runningApplications(withBundleIdentifier: bundleID) + if runningApps.count > 1 { + for app in runningApps where app != NSRunningApplication.current { + app.activate() + } + print("AppDelegate: Another instance is already running, terminating.") + NSApp.terminate(nil) + return + } + // Register for URL scheme events before the app finishes launching NSAppleEventManager.shared().setEventHandler( self, @@ -20,6 +32,17 @@ class AppDelegate: FlutterAppDelegate { return false } + override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { + // When the user clicks the Dock icon and the window is hidden (minimized to tray), + // bring the existing window back to the foreground + if !flag { + for window in sender.windows { + window.makeKeyAndOrderFront(self) + } + } + return true + } + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift index 3cc05eb..2004dd2 100644 --- a/macos/Runner/MainFlutterWindow.swift +++ b/macos/Runner/MainFlutterWindow.swift @@ -8,6 +8,15 @@ class MainFlutterWindow: NSWindow { self.contentViewController = flutterViewController self.setFrame(windowFrame, display: true) + // Make the title bar transparent and blend with content + self.titlebarAppearsTransparent = true + self.titleVisibility = .hidden + self.styleMask.insert(.fullSizeContentView) + + // Match the app's dark background + self.backgroundColor = NSColor(red: 0.07, green: 0.07, blue: 0.07, alpha: 1.0) + self.isOpaque = true + RegisterGeneratedPlugins(registry: flutterViewController) super.awakeFromNib()