From 7c560cc7b53bb7a12d9a34f53aa655e498c99149 Mon Sep 17 00:00:00 2001 From: Avi Wadhwa Date: Thu, 11 Apr 2024 14:23:23 -0700 Subject: [PATCH] =?UTF-8?q?Manually=20check=20for=20updates=20and=20displa?= =?UTF-8?q?y=20message=20in=20status=20bar=20if=20update=20required.=20als?= =?UTF-8?q?o=20enable=20Sparkle=20automatic=20updates.=20Also=20add=20the?= =?UTF-8?q?=20warning=20=E2=9A=A0=EF=B8=8F=20emoji?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lyric Fever.xcodeproj/project.pbxproj | 8 ++++---- SpotifyLyricsInMenubar/Info.plist | 6 ++++++ SpotifyLyricsInMenubar/OnboardingWindow.swift | 2 +- .../SpotifyLyricsInMenubarApp.swift | 2 +- SpotifyLyricsInMenubar/viewModel.swift | 15 +++++++++++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Lyric Fever.xcodeproj/project.pbxproj b/Lyric Fever.xcodeproj/project.pbxproj index 6eabcc1..cc6d30b 100644 --- a/Lyric Fever.xcodeproj/project.pbxproj +++ b/Lyric Fever.xcodeproj/project.pbxproj @@ -336,7 +336,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.7; + CURRENT_PROJECT_VERSION = 1.8; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 38TP6LZLJ5; ENABLE_APP_SANDBOX = YES; @@ -355,7 +355,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.7; + MARKETING_VERSION = 1.8; PRODUCT_BUNDLE_IDENTIFIER = com.aviwadhwa.SpotifyLyricsInMenubar; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; @@ -372,7 +372,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.7; + CURRENT_PROJECT_VERSION = 1.8; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = 38TP6LZLJ5; ENABLE_APP_SANDBOX = YES; @@ -391,7 +391,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 13.0; - MARKETING_VERSION = 1.7; + MARKETING_VERSION = 1.8; PRODUCT_BUNDLE_IDENTIFIER = com.aviwadhwa.SpotifyLyricsInMenubar; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_EMIT_LOC_STRINGS = YES; diff --git a/SpotifyLyricsInMenubar/Info.plist b/SpotifyLyricsInMenubar/Info.plist index 41fc039..bc5a423 100644 --- a/SpotifyLyricsInMenubar/Info.plist +++ b/SpotifyLyricsInMenubar/Info.plist @@ -2,6 +2,12 @@ + SUAutomaticallyUpdate + + SUAllowsAutomaticUpdates + + SUEnableAutomaticChecks + SUEnableDownloaderService SUEnableInstallerLauncherService diff --git a/SpotifyLyricsInMenubar/OnboardingWindow.swift b/SpotifyLyricsInMenubar/OnboardingWindow.swift index 78203f0..a1168e2 100644 --- a/SpotifyLyricsInMenubar/OnboardingWindow.swift +++ b/SpotifyLyricsInMenubar/OnboardingWindow.swift @@ -35,7 +35,7 @@ struct OnboardingWindow: View { NavigationLink("Next", destination: ZeroView()) .buttonStyle(.borderedProminent) - Text("Email me at [aviwad@gmail.com](mailto:aviwad@gmail.com) for any support\n⚠️ Disclaimer: I do not own the rights to Spotify or the lyric content presented.\nMusixmatch and Spotify own all rights to the lyrics.\nVersion 1.7") + Text("Email me at [aviwad@gmail.com](mailto:aviwad@gmail.com) for any support\n⚠️ Disclaimer: I do not own the rights to Spotify or the lyric content presented.\nMusixmatch and Spotify own all rights to the lyrics.\nVersion 1.8") .multilineTextAlignment(.center) .font(.callout) .padding(.top, 10) diff --git a/SpotifyLyricsInMenubar/SpotifyLyricsInMenubarApp.swift b/SpotifyLyricsInMenubar/SpotifyLyricsInMenubarApp.swift index 0e3dc07..96b8d13 100644 --- a/SpotifyLyricsInMenubar/SpotifyLyricsInMenubarApp.swift +++ b/SpotifyLyricsInMenubar/SpotifyLyricsInMenubarApp.swift @@ -102,7 +102,7 @@ struct SpotifyLyricsInMenubarApp: App { NSApplication.shared.terminate(nil) }.keyboardShortcut("q") } , label: { - Text(hasOnboarded ? menuBarTitle : "Please Complete Onboarding Process (Click Help)") + Text(viewmodel.mustUpdateUrgent ? "⚠️ Please Update (Click Check Updates)".trunc(length: truncationLength) : (hasOnboarded ? menuBarTitle : "⚠️ Please Complete Onboarding Process (Click Help)")) .onAppear { if viewmodel.cookie.count == 0 { hasOnboarded = false diff --git a/SpotifyLyricsInMenubar/viewModel.swift b/SpotifyLyricsInMenubar/viewModel.swift index b8f77ba..7a4fa34 100644 --- a/SpotifyLyricsInMenubar/viewModel.swift +++ b/SpotifyLyricsInMenubar/viewModel.swift @@ -57,6 +57,8 @@ import MediaPlayer let fakeSpotifyUserAgentconfig = URLSessionConfiguration.default let fakeSpotifyUserAgentSession: URLSession + @Published var mustUpdateUrgent: Bool = false + init() { // Load framework let bundle = CFBundleCreate(kCFAllocatorDefault, NSURL(fileURLWithPath: "/System/Library/PrivateFrameworks/MediaRemote.framework")) @@ -84,6 +86,19 @@ import MediaPlayer status = await MusicAuthorization.request() print(status) } + Task { + if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String, let url = URL(string: "https://raw.githubusercontent.com/aviwad/LyricFeverHomepage/master/urgentUpdateVersion.md") { + var request = URLRequest(url: url) + let urlResponseAndData = try await URLSession(configuration: .ephemeral).data(for: request) + print("Our version is \(version) and the latest is \(String(bytes:urlResponseAndData.0, encoding: .utf8))") + if String(bytes:urlResponseAndData.0, encoding: .utf8) != version { + print("NOT EQUAL") + mustUpdateUrgent = true + } else { + print("EQUAL") + } + } + } }