Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseMoreville authored Jul 29, 2022
2 parents e0d67fb + 4fbbcb1 commit b74db6f
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 84 deletions.
42 changes: 38 additions & 4 deletions PlayCover.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
objects = {

/* Begin PBXBuildFile section */

28361D5E2892781200B35EDB /* RestoreGenshinUserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28361D5D2892781200B35EDB /* RestoreGenshinUserData.swift */; };
28361D6028927CAC00B35EDB /* SaveGenshinUserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28361D5F28927CAC00B35EDB /* SaveGenshinUserData.swift */; };
28361D6228927D6100B35EDB /* ChangeGenshinAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28361D6128927D6100B35EDB /* ChangeGenshinAccountView.swift */; };
28361D6428927E3300B35EDB /* StoreGenshinAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28361D6328927E3300B35EDB /* StoreGenshinAccountView.swift */; };
28361D662892800200B35EDB /* DeleteStoredGenshinUserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28361D652892800200B35EDB /* DeleteStoredGenshinUserData.swift */; };
28361D68289280A300B35EDB /* DeleteGenshinStoredAccountView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28361D67289280A300B35EDB /* DeleteGenshinStoredAccountView.swift */; };
365AFB0628847B2E008B3542 /* Sparkle in Frameworks */ = {isa = PBXBuildFile; productRef = 365AFB0528847B2E008B3542 /* Sparkle */; };
365AFB0828847B75008B3542 /* Sparkle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 365AFB0728847B75008B3542 /* Sparkle.swift */; };
3665EF8928832400007CF915 /* PlayCoverSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3665EF8828832400007CF915 /* PlayCoverSettingsView.swift */; };
36B26B97288C724600859EFD /* UpdateSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36B26B96288C724600859EFD /* UpdateSettings.swift */; };
5314D1EE26C402EC00A0A727 /* Shell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5314D1ED26C402EC00A0A727 /* Shell.swift */; };
532644DE26E79E56002EA34D /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 532644E026E79E56002EA34D /* Localizable.strings */; };
538AAE7B26CD41E60009C7AC /* ProcessExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538AAE7A26CD41E60009C7AC /* ProcessExtension.swift */; };
538ED92926F40BAF002D73E8 /* Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 538ED92826F40BAF002D73E8 /* Style.swift */; };
53D9DAF326C1849D0071959E /* PlayCoverError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D9DAF226C1849D0071959E /* PlayCoverError.swift */; };
53E3311826F6014D00217197 /* UpdateService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E3311726F6014D00217197 /* UpdateService.swift */; };
53E908E726E51FFC0077B466 /* Colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E908E626E51FFC0077B466 /* Colors.swift */; };
53F3802826EB6F6B00D6B525 /* NotifyService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F3802726EB6F6B00D6B525 /* NotifyService.swift */; };
53F4D29E26C43C040020167C /* UserIntentFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F4D29D26C43C040020167C /* UserIntentFlow.swift */; };
Expand Down Expand Up @@ -76,6 +80,9 @@
28361D6328927E3300B35EDB /* StoreGenshinAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreGenshinAccountView.swift; sourceTree = "<group>"; };
28361D652892800200B35EDB /* DeleteStoredGenshinUserData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteStoredGenshinUserData.swift; sourceTree = "<group>"; };
28361D67289280A300B35EDB /* DeleteGenshinStoredAccountView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeleteGenshinStoredAccountView.swift; sourceTree = "<group>"; };
365AFB0728847B75008B3542 /* Sparkle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Sparkle.swift; sourceTree = "<group>"; };
3665EF8828832400007CF915 /* PlayCoverSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayCoverSettingsView.swift; sourceTree = "<group>"; usesTabs = 0; };
36B26B96288C724600859EFD /* UpdateSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateSettings.swift; sourceTree = "<group>"; };
5314D1ED26C402EC00A0A727 /* Shell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shell.swift; sourceTree = "<group>"; };
531D717926E8313100F4A7AB /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
532644E126E79E5C002EA34D /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
Expand All @@ -91,7 +98,6 @@
538ED92826F40BAF002D73E8 /* Style.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Style.swift; sourceTree = "<group>"; };
53D9DAF226C1849D0071959E /* PlayCoverError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayCoverError.swift; sourceTree = "<group>"; };
53E3311126F574B600217197 /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/Localizable.strings; sourceTree = "<group>"; };
53E3311726F6014D00217197 /* UpdateService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateService.swift; sourceTree = "<group>"; };
53E908E626E51FFC0077B466 /* Colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Colors.swift; sourceTree = "<group>"; };
53F3802526EB6CEA00D6B525 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = "<group>"; };
53F3802726EB6F6B00D6B525 /* NotifyService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotifyService.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -164,6 +170,7 @@
buildActionMask = 2147483647;
files = (
92324086283FBA34006C46DE /* SimplyCoreAudio in Frameworks */,
365AFB0628847B2E008B3542 /* Sparkle in Frameworks */,
AA818CB5287ABEC3000BEE9D /* Yams in Frameworks */,
AA818CB2287ABE9B000BEE9D /* AlertToast in Frameworks */,
);
Expand All @@ -172,9 +179,19 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
36B26B95288C722500859EFD /* Settings */ = {
isa = PBXGroup;
children = (
3665EF8828832400007CF915 /* PlayCoverSettingsView.swift */,
36B26B96288C724600859EFD /* UpdateSettings.swift */,
);
path = Settings;
sourceTree = "<group>";
};
533F664B26C06A500051CB3E /* View */ = {
isa = PBXGroup;
children = (
36B26B95288C722500859EFD /* Settings */,
ABED59822887A32F004D782B /* MenuBarView.swift */,
922ED9B9272DEEDB008CA401 /* MainView.swift */,
8783CFFA26B8C52D00171041 /* PlayCoverApp.swift */,
Expand All @@ -188,6 +205,7 @@
28361D6128927D6100B35EDB /* ChangeGenshinAccountView.swift */,
28361D6328927E3300B35EDB /* StoreGenshinAccountView.swift */,
28361D67289280A300B35EDB /* DeleteGenshinStoredAccountView.swift */,
365AFB0728847B75008B3542 /* Sparkle.swift */,
);
path = View;
sourceTree = "<group>";
Expand All @@ -208,7 +226,6 @@
isa = PBXGroup;
children = (
53F3802726EB6F6B00D6B525 /* NotifyService.swift */,
53E3311726F6014D00217197 /* UpdateService.swift */,
9280871A2824A8D20034C510 /* SoundDeviceService.swift */,
);
path = Services;
Expand Down Expand Up @@ -397,6 +414,7 @@
92324085283FBA34006C46DE /* SimplyCoreAudio */,
AA818CB1287ABE9B000BEE9D /* AlertToast */,
AA818CB4287ABEC3000BEE9D /* Yams */,
365AFB0528847B2E008B3542 /* Sparkle */,
);
productName = PlayCover;
productReference = 8783CFF726B8C52D00171041 /* PlayCover.app */;
Expand Down Expand Up @@ -441,6 +459,7 @@
92324084283FBA34006C46DE /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */,
AA818CB0287ABE9B000BEE9D /* XCRemoteSwiftPackageReference "AlertToast" */,
AA818CB3287ABEC3000BEE9D /* XCRemoteSwiftPackageReference "Yams" */,
365AFB0428847B2E008B3542 /* XCRemoteSwiftPackageReference "Sparkle" */,
);
productRefGroup = 8783CFF826B8C52D00171041 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -532,13 +551,14 @@
files = (
92ECD8A3274E75CD00DB7AC6 /* Installer.swift in Sources */,
92EE06DE274EC09F002C907B /* Entitlements.swift in Sources */,
53E3311826F6014D00217197 /* UpdateService.swift in Sources */,
92ECD8A5274E763700DB7AC6 /* IPA.swift in Sources */,
8783D00D26B8D32700171041 /* InstallSettings.swift in Sources */,
92EE06DC274EB19A002C907B /* StoreAppView.swift in Sources */,
365AFB0828847B75008B3542 /* Sparkle.swift in Sources */,
92B4D38F2737CF3D0001D7BB /* PlayTools.swift in Sources */,
92562209274921E500728698 /* main.m in Sources */,
53E908E726E51FFC0077B466 /* Colors.swift in Sources */,
3665EF8928832400007CF915 /* PlayCoverSettingsView.swift in Sources */,
9280871B2824A8D20034C510 /* SoundDeviceService.swift in Sources */,
92ECD8AE274E787200DB7AC6 /* AppInfo.swift in Sources */,
928C01D9272E162C007EB2DF /* InstallVM.swift in Sources */,
Expand All @@ -562,6 +582,7 @@
92EE06D0274EA433002C907B /* BaseApp.swift in Sources */,
92F8500A27675124005CE6BE /* AppIntegrity.swift in Sources */,
28361D5E2892781200B35EDB /* RestoreGenshinUserData.swift in Sources */,
36B26B97288C724600859EFD /* UpdateSettings.swift in Sources */,
8783CFFB26B8C52D00171041 /* PlayCoverApp.swift in Sources */,
5314D1EE26C402EC00A0A727 /* Shell.swift in Sources */,
8783D00B26B8C9E600171041 /* URLExtensions.swift in Sources */,
Expand Down Expand Up @@ -834,6 +855,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
365AFB0428847B2E008B3542 /* XCRemoteSwiftPackageReference "Sparkle" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sparkle-project/Sparkle";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.0.0;
};
};
92324084283FBA34006C46DE /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/rnine/SimplyCoreAudio.git";
Expand Down Expand Up @@ -862,6 +891,11 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
365AFB0528847B2E008B3542 /* Sparkle */ = {
isa = XCSwiftPackageProductDependency;
package = 365AFB0428847B2E008B3542 /* XCRemoteSwiftPackageReference "Sparkle" */;
productName = Sparkle;
};
92324085283FBA34006C46DE /* SimplyCoreAudio */ = {
isa = XCSwiftPackageProductDependency;
package = 92324084283FBA34006C46DE /* XCRemoteSwiftPackageReference "SimplyCoreAudio" */;
Expand Down
4 changes: 4 additions & 0 deletions PlayCover/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
<string>Copyright © PlayCover Community Edition</string>
<key>NSSystemAdministrationUsageDescription</key>
<string>PlayCover needs to read files to save apps</string>
<key>SUFeedURL</key>
<string>https://playcover.io/updates/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>u08aYwJaZ3F/qAs2NauIA5DGKhS4nRDccvBDNW8sbi4=</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
Expand Down
63 changes: 0 additions & 63 deletions PlayCover/Services/UpdateService.swift

This file was deleted.

12 changes: 0 additions & 12 deletions PlayCover/View/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct SearchView: View {

struct MainView: View {
@Environment(\.openURL) var openURL
@EnvironmentObject var update: UpdateService
@EnvironmentObject var install: InstallVM
@EnvironmentObject var apps: AppsVM
@EnvironmentObject var integrity: AppIntegrity
Expand Down Expand Up @@ -106,15 +105,6 @@ struct MainView: View {
.buttonStyle(.borderedProminent).tint(.accentColor).controlSize(.large)
}
}
if !update.updateLink.isEmpty {
Button(action: { NSWorkspace.shared.open(URL(string: update.updateLink)!) },
label: {
HStack {
Image(systemName: "arrow.down.square.fill")
Text("Update app")
}
}).buttonStyle(UpdateButton()).controlSize(.large)
}
}
Text(StoreApp.notice)
.font(.body)
Expand Down Expand Up @@ -168,15 +158,13 @@ struct Previews_MainView_Previews: PreviewProvider {
static var previews: some View {
MainView(showToast: $showToast)
.padding()
.environmentObject(UpdateService.shared)
.environmentObject(InstallVM.shared)
.environmentObject(AppsVM.shared)
.environmentObject(AppIntegrity())
.frame(minWidth: 600, minHeight: 650)
.onAppear {
UserDefaults.standard.register(defaults: ["ShowLinks": true])
SoundDeviceService.shared.prepareSoundDevice()
UpdateService.shared.checkUpdate()
NotifyService.shared.allowNotify()
}
.padding(-15)
Expand Down
6 changes: 6 additions & 0 deletions PlayCover/View/MenuBarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ struct PlayCoverMenuView: Commands {
}

struct PlayCoverHelpMenuView: Commands {
@ObservedObject var updaterViewModel: UpdaterViewModel

var body: some Commands {
CommandGroup(after: .appInfo) {
CheckForUpdatesView(updaterViewModel: updaterViewModel)
}

CommandGroup(replacing: .help) {
Button("Documentation") {
NSWorkspace.shared.open(URL(string: "https://github.com/PlayCover/PlayCover/wiki")!)
Expand Down
13 changes: 8 additions & 5 deletions PlayCover/View/PlayCoverApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func application(_ application: NSApplication, open urls: [URL]) {
if let url = urls.first {
if url.pathExtension == "ipa"{
if url.pathExtension == "ipa" {
uif.ipaUrl = url
Installer.install(ipaUrl: uif.ipaUrl!, returnCompletion: { (_) in
DispatchQueue.main.async {
Expand Down Expand Up @@ -38,13 +38,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@main
struct PlayCoverApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
@StateObject var updaterViewModel = UpdaterViewModel()

@State var showToast = false

var body: some Scene {
WindowGroup {
MainView(showToast: $showToast)
.padding()
.environmentObject(UpdateService.shared)
.environmentObject(InstallVM.shared)
.environmentObject(AppsVM.shared)
.environmentObject(AppIntegrity())
Expand All @@ -53,7 +54,6 @@ struct PlayCoverApp: App {
NSWindow.allowsAutomaticWindowTabbing = false
UserDefaults.standard.register(defaults: ["ShowLinks": true])
SoundDeviceService.shared.prepareSoundDevice()
UpdateService.shared.checkUpdate()
NotifyService.shared.allowNotify()
}
.padding(-15)
Expand All @@ -65,9 +65,12 @@ struct PlayCoverApp: App {
.handlesExternalEvents(matching: ["{same path of URL?}"]) // create new window if doesn't exist
.commands {
PlayCoverMenuView(showToast: $showToast)
PlayCoverHelpMenuView()
PlayCoverHelpMenuView(updaterViewModel: updaterViewModel)
PlayCoverViewMenuView()
}
}

Settings {
PlayCoverSettingsView(updaterViewModel: updaterViewModel)
}
}
}
27 changes: 27 additions & 0 deletions PlayCover/View/Settings/PlayCoverSettingsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// SettingsView.swift
// PlayCover
//
// Created by Andrew Glaze on 7/16/22.
//

import SwiftUI
import Sparkle

struct PlayCoverSettingsView: View {
@ObservedObject var updaterViewModel: UpdaterViewModel

private enum Tabs: Hashable {
case updates
}

var body: some View {
TabView {
UpdateSettings(updaterViewModel: updaterViewModel)
.tabItem {
Label("Updates", systemImage: "square.and.arrow.down")
}
.tag(Tabs.updates)
}
}
}
33 changes: 33 additions & 0 deletions PlayCover/View/Settings/UpdateSettings.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// UpdateSettings.swift
// PlayCover
//
// Created by Andrew Glaze on 7/23/22.
//

import SwiftUI
import Sparkle

struct UpdateSettings: View {
@ObservedObject var updaterViewModel: UpdaterViewModel
@AppStorage("SUEnableAutomaticChecks") var autoUpdate = false
@AppStorage("nightlyUpdates") var nightlyUpdates = false

var body: some View {
Form {
Toggle("Automatically check for updates", isOn: $autoUpdate)
Toggle("Check for nightly updates", isOn: $nightlyUpdates)
Button("Check for updates now…") {
updaterViewModel.checkForUpdates()
}
}
.padding(20)
.frame(width: 350, height: 100, alignment: .center)
.onChange(of: autoUpdate) { value in
updaterViewModel.automaticallyCheckForUpdates = value
}
.onChange(of: nightlyUpdates) { _ in
updaterViewModel.toggleAllowedChannels()
}
}
}
Loading

0 comments on commit b74db6f

Please sign in to comment.