Skip to content

Commit

Permalink
Manually check for updates and display message in status bar if updat…
Browse files Browse the repository at this point in the history
…e required. also enable Sparkle automatic updates. Also add the warning ⚠️ emoji
  • Loading branch information
aviwad committed Apr 11, 2024
1 parent 682b60f commit 7c560cc
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
8 changes: 4 additions & 4 deletions Lyric Fever.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions SpotifyLyricsInMenubar/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SUAutomaticallyUpdate</key>
<true/>
<key>SUAllowsAutomaticUpdates</key>
<true/>
<key>SUEnableAutomaticChecks</key>
<true/>
<key>SUEnableDownloaderService</key>
<false/>
<key>SUEnableInstallerLauncherService</key>
Expand Down
2 changes: 1 addition & 1 deletion SpotifyLyricsInMenubar/OnboardingWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct OnboardingWindow: View {

NavigationLink("Next", destination: ZeroView())
.buttonStyle(.borderedProminent)
Text("Email me at [[email protected]](mailto:[email protected]) 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 [[email protected]](mailto:[email protected]) 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)
Expand Down
2 changes: 1 addition & 1 deletion SpotifyLyricsInMenubar/SpotifyLyricsInMenubarApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions SpotifyLyricsInMenubar/viewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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")
}
}
}
}


Expand Down

0 comments on commit 7c560cc

Please sign in to comment.