Skip to content

Commit

Permalink
Merge pull request #185 from gao-sun/v1.5.11
Browse files Browse the repository at this point in the history
v1.5.11
  • Loading branch information
gao-sun authored Feb 12, 2021
2 parents 10efd21 + bde940f commit 5ce9cc0
Show file tree
Hide file tree
Showing 36 changed files with 1,468 additions and 71 deletions.
16 changes: 16 additions & 0 deletions Resource/Assets.xcassets/Upgrade.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "arrow.up.circle.fill.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
7 changes: 7 additions & 0 deletions Resource/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@
"ui.hidden_by_system.open" = "افتح";
"ui.hidden_by_system.dismiss" = "رفض";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Show icon";
Expand Down
7 changes: 7 additions & 0 deletions Resource/cs.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@
"ui.hidden_by_system.open" = "Otevřít";
"ui.hidden_by_system.dismiss" = "Zrušit";
"ui.check_status_item_visibility" = "Zkontrolovat status zobrazení položky";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Zobrazit ikonu";
Expand Down
7 changes: 7 additions & 0 deletions Resource/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Öffnen";
"ui.hidden_by_system.dismiss" = "Ausblenden";
"ui.check_status_item_visibility" = "Sichtbarkeit in Menüleiste prüfen";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Symbol anzeigen";
Expand Down
7 changes: 7 additions & 0 deletions Resource/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Open";
"ui.hidden_by_system.dismiss" = "Dismiss";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Show icon";
Expand Down
7 changes: 7 additions & 0 deletions Resource/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Open";
"ui.hidden_by_system.dismiss" = "Dismiss";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Mostrar icono";
Expand Down
7 changes: 7 additions & 0 deletions Resource/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Ouvrir";
"ui.hidden_by_system.dismiss" = "Ignorer";
"ui.check_status_item_visibility" = "Vérifier la visibilité des composants";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Afficher l'icône";
Expand Down
7 changes: 7 additions & 0 deletions Resource/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@
"ui.hidden_by_system.open" = "Aperto";
"ui.hidden_by_system.dismiss" = "Chiudi";
"ui.check_status_item_visibility" = "Verifica visibilità nella barra dei menù";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Mostra icona";
Expand Down
7 changes: 7 additions & 0 deletions Resource/ja.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "設定を開く";
"ui.hidden_by_system.dismiss" = "閉じる";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "アイコンを表示";
Expand Down
7 changes: 7 additions & 0 deletions Resource/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ battery.timeRemaining = "Time Rem.";
"ui.hidden_by_system.open" = "열기";
"ui.hidden_by_system.dismiss" = "취소";
"ui.check_status_item_visibility" = "상태바 아이템이 보이는지 검사";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "아이콘 보기";
Expand Down
7 changes: 7 additions & 0 deletions Resource/mn.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@
"ui.hidden_by_system.open" = "Нээх";
"ui.hidden_by_system.dismiss" = "Цуцлах";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Аякон харах";
Expand Down
7 changes: 7 additions & 0 deletions Resource/pt.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Open";
"ui.hidden_by_system.dismiss" = "Dismiss";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Mostrar ícone";
Expand Down
7 changes: 7 additions & 0 deletions Resource/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Open";
"ui.hidden_by_system.dismiss" = "Dismiss";
"ui.check_status_item_visibility" = "Check status item visibility";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Показать иконки";
Expand Down
7 changes: 7 additions & 0 deletions Resource/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "Відкрити Налаштування";
"ui.hidden_by_system.dismiss" = "Відхилити";
"ui.check_status_item_visibility" = "Перевіряти видимість в смузі меню";
"ui.upgrade_method" = "Upgrade";
"ui.upgrade_method.none" = "none";
"ui.upgrade_method.none.description" = "eul will not check upgrade";
"ui.upgrade_method.showInStatusBar" = "show in status bar";
"ui.upgrade_method.showInStatusBar.description" = "Show upgrade icon when new version available";
"ui.upgrade_method.autoUpdate" = "auto update";
"ui.upgrade_method.autoUpdate.description" = "Perform upgrade automatically";

// MARK: Component
"component.show_icon" = "Відображати піктограму";
Expand Down
7 changes: 7 additions & 0 deletions Resource/zh-Hans.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@
"ui.hidden_by_system.open" = "打开";
"ui.hidden_by_system.dismiss" = "忽略";
"ui.check_status_item_visibility" = "检查状态栏可见性";
"ui.upgrade_method" = "升级";
"ui.upgrade_method.none" = "无";
"ui.upgrade_method.none.description" = "eul 将不会检查更新";
"ui.upgrade_method.showInStatusBar" = "在状态栏展示";
"ui.upgrade_method.showInStatusBar.description" = "当新版本可用时在状态栏显示图标";
"ui.upgrade_method.autoUpdate" = "自动更新";
"ui.upgrade_method.autoUpdate.description" = "自动进行升级";

// MARK: Component
"component.show_icon" = "显示图标";
Expand Down
97 changes: 97 additions & 0 deletions SelfUpdate/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// AppDelegate.swift
// SelfUpdate
//
// Created by Gao Sun on 2021/2/12.
// Copyright © 2021 Gao Sun. All rights reserved.
//

import Cocoa
import SwiftUI

@main
class AppDelegate: NSObject, NSApplicationDelegate {
var window: NSWindow!
let fileManager = FileManager.default

static func quit() {
NSApplication.shared.terminate(self)
}

func update() {
defer {
AppDelegate.quit()
}

let arguments = CommandLine.arguments
let newAppUrl = URL(fileURLWithPath: arguments[1]).appendingPathComponent("eul.app")
let appUrl = URL(fileURLWithPath: arguments[2]).appendingPathComponent("eul.app")
let pidArg = pid_t(arguments[3])

guard
let pid = pidArg,
let currentApp = NSWorkspace.shared.runningApplications.first(where: { $0.processIdentifier == pid })
else {
print("current app not found with pid", pidArg ?? "N/A")
return
}

var isDirectory: ObjCBool = false

guard fileManager.fileExists(atPath: newAppUrl.path, isDirectory: &isDirectory), isDirectory.boolValue else {
print("new app not found at", newAppUrl)
return
}

print("terminating current app")
guard currentApp.terminate() || currentApp.forceTerminate() else {
print("cannot terminate current app")
return
}

do {
print("removing old app", appUrl)
try fileManager.removeItem(at: appUrl)
print("copying new app from", newAppUrl, "to", appUrl)
try fileManager.copyItem(at: newAppUrl, to: appUrl)
} catch {
print("error when setting up new app", error)
return
}

print("opening app")
guard NSWorkspace.shared.open(appUrl) else {
print("failed to open app")
return
}

print("update fininshed")
}

func applicationDidFinishLaunching(_: Notification) {
update()

guard CommandLine.arguments.contains("--debug") else {
return
}

// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()

// Create the window and set the content view.
window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 480, height: 300),
styleMask: [.titled, .closable, .miniaturizable, .resizable, .fullSizeContentView],
backing: .buffered, defer: false
)
window.isReleasedWhenClosed = false
window.center()
window.setFrameAutosaveName("Main Window")
window.contentView = NSHostingView(rootView: contentView)
window.makeKeyAndOrderFront(nil)
}

func applicationWillTerminate(_: Notification) {
// Insert code here to tear down your application
}
}
11 changes: 11 additions & 0 deletions SelfUpdate/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
58 changes: 58 additions & 0 deletions SelfUpdate/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions SelfUpdate/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading

0 comments on commit 5ce9cc0

Please sign in to comment.