1
1
mirror of https://github.com/bitgapp/eqMac.git synced 2024-11-22 13:07:26 +03:00
This commit is contained in:
Nodeful 2020-10-04 13:58:29 +03:00
parent 430aecc67a
commit 220c4fd947
15 changed files with 50 additions and 101 deletions

6
.gitignore vendored
View File

@ -1,11 +1,7 @@
Pods/
.DS_Store
.DS_Store/
*/.DS_Store
**/*.xcworkspace/xcuserdata*
**/*.xcodeproj/xcuserdata*
native/build
native/build_debug
node_modules
.env
dist

11
native/.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
**/*.xcworkspace/xcuserdata*
**/*.xcodeproj/xcuserdata*
build
build_debug
DerivedData
Pods/
update/*.pkg
update/*.dmg
update/*.app
update/*.zip
update/update-test.xml

View File

@ -81,4 +81,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: a4fdf35b1dcec9414bd0137d36ff00e0ba6eaf99
COCOAPODS: 1.9.1
COCOAPODS: 1.9.3

View File

@ -132,29 +132,6 @@ class Application {
quit()
}
}
} else if (Driver.isOutdated && !Driver.skipCurrentVersion) {
Alert.confirm(
title: "Audio Driver Update",
message: "There is an optional Audio Driver update that should improve user experience. \nIn order to update eqMac will ask for your System Password. \nPlease close any apps playing audio (Spotify, YouTube etc.) otherwise installation might fail.\nVersion change: \(Driver.lastInstalledVersion ?? "1.0.0") -> \(Driver.bundledVersion)",
okText: "Update Driver",
cancelText: "Skip Driver update"
) { update in
if update {
Driver.install(started: {
UI.showLoadingWindow("Updating eqMac audio driver\nIf this process takes too long,\nplease restart your Mac")
}) { success in
if (success) {
UI.hideLoadingWindow()
completion()
} else {
driverFailedToInstallPrompt()
}
}
} else {
Driver.skipCurrentVersion = true
completion()
}
}
} else {
completion()
}

View File

@ -24,7 +24,7 @@ class ApplicationDataBus: DataBus {
"name": host.localizedName as AnyObject,
"model": Sysctl.model as String,
"version": Bundle.main.infoDictionary?["CFBundleVersion"] as Any,
"driverVersion": Driver.lastInstalledVersion
// "driverVersion": Driver.bundledVersion
]
}
@ -61,16 +61,16 @@ class ApplicationDataBus: DataBus {
}
self.on(.GET, "/driver/reinstall/available") { _, res in
return "Yes"
}
self.on(.GET, "/driver/reinstall") { _, res in
Application.reinstallDriver { success in
res.send([ "reinstalled": success ])
}
return nil
return false
}
// self.on(.GET, "/driver/reinstall") { _, res in
// Application.reinstallDriver { success in
// res.send([ "reinstalled": success ])
// }
// return nil
// }
//
self.on(.GET, "/update") { _, _ in
Application.checkForUpdates()
return "Checking for updates."

View File

@ -28,25 +28,16 @@ enum CustomProperties: String {
}
class Driver {
static var legacyIsInstalled: Bool {
get {
for legacyDriverUID in Constants.LEGACY_DRIVER_UIDS {
let device = AudioDevice.getOutputDeviceFromUID(UID: legacyDriverUID)
if (device != nil) { return true }
}
return false
}
}
static var lastInstalledVersion: String? {
get {
return Storage[.lastInstalledDriverVersion]
}
set {
Storage[.lastInstalledDriverVersion] = newValue
}
}
// static var legacyIsInstalled: Bool {
// get {
// for legacyDriverUID in Constants.LEGACY_DRIVER_UIDS {
// let device = AudioDevice.getOutputDeviceFromUID(UID: legacyDriverUID)
// if (device != nil) { return true }
// }
// return false
// }
// }
//
static var pluginId: AudioObjectID? {
return AudioDevice.lookupIDByPluginBundleID(by: Constants.DRIVER_BUNDLE_ID)
}
@ -56,39 +47,21 @@ class Driver {
return self.device != nil || self.pluginId != nil
}
}
static var info: Dictionary<String, Any> {
return NSDictionary(contentsOfFile: Bundle.main.path(forResource: "Info", ofType: "plist", inDirectory: "Embedded/eqMac.driver/Contents")!) as! Dictionary<String, Any>
}
static var bundledVersion: String {
return info["CFBundleVersion"] as! String
}
static var lastSkippedDriverVersion: String? {
get {
return Storage[.lastSkippedDriverVersion]
}
set {
Storage[.lastSkippedDriverVersion] = newValue
}
}
static var skipCurrentVersion: Bool {
get {
return lastSkippedDriverVersion == bundledVersion
}
set {
lastSkippedDriverVersion = newValue ? bundledVersion : nil
}
}
static var isOutdated: Bool {
get {
return bundledVersion != lastInstalledVersion
}
}
//
// static var info: Dictionary<String, Any> {
// return NSDictionary(contentsOfFile: Bundle.main.path(forResource: "Info", ofType: "plist", inDirectory: "Embedded/eqMac.driver/Contents")!) as! Dictionary<String, Any>
// }
//
// static var bundledVersion: String {
// return info["CFBundleVersion"] as! String
// }
//
// static var isOutdated: Bool {
// get {
// return bundledVersion != lastInstalledVersion
// }
// }
//
static var sampleRates: [Double] {
return [
8_000,
@ -249,18 +222,12 @@ class Driver {
static func install (started: (() -> Void)? = nil, _ finished: @escaping (Bool) -> Void) {
Script.sudo("install_driver", started: started, { success in
if (success) {
lastInstalledVersion = bundledVersion
}
finished(success)
})
}
static func uninstall (started: (() -> Void)? = nil, _ finished: @escaping (Bool) -> Void) {
Script.sudo("uninstall_driver", started: started, { success in
if (success) {
lastInstalledVersion = nil
}
finished(success)
})
}

View File

@ -26,8 +26,6 @@ extension DefaultsKeys {
// Effects - Equalizer - Advanced
static let advancedEqualizerPresets = DefaultsKey<[AdvancedEqualizerPreset]?>("advancedEqualizerPresets")
static let lastInstalledDriverVersion = DefaultsKey<String?>("lastInstalledDriverVersion")
static let lastSkippedDriverVersion = DefaultsKey<String?>("lastSkippedDriverVersion")
}
let Storage = Defaults

View File

@ -1,2 +0,0 @@
#!/bin/sh
gsutil -m cp -z js,css,html -r ./* gs://update.eqmac.app

2
native/update/deploy.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
gsutil -m -h "Cache-Control:no-cache, max-age=0" cp -z js,css,html -r ./* gs://update.eqmac.app

View File

@ -2,5 +2,5 @@
<div fxLayout="row" fxLayoutAlign="space-around center">
<eqm-label style="margin-top: 10px;">UI Version: {{uiVersion}}</eqm-label>
<eqm-label *ngIf="info" style="margin-top: 10px;">App Version: {{info.version}}</eqm-label>
<eqm-label style="margin-top: 10px;">Driver Version: {{info.driverVersion || '1.0.0'}}</eqm-label>
<eqm-label *ngIf="info && info.driverVersion" style="margin-top: 10px;">Driver Version: {{info.driverVersion || '1.0.0'}}</eqm-label>
</div>