Skip to content

Commit

Permalink
Update for 0.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tattn committed Sep 18, 2023
1 parent 0b905f5 commit b7b9b9d
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 7 deletions.
1 change: 1 addition & 0 deletions app/xcode/Sources/VCamData/UserDefaultsKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public extension UserDefaults.Key {
static var useVowelEstimation: Key<Bool> { .init("vc_use_vowel_estimation", default: false) }
static var locale: Key<String> { .init("vc_locale", default: "") }
static var pluginVersion: Key<String> { .init("vc_plugin_ver", default: "") }
static var alwaysOnTopEnabled: Key<Bool> { .init("vc_alwaysontop_enabled", default: false) }
}
30 changes: 28 additions & 2 deletions app/xcode/Sources/VCamLocalization/Generated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public enum L10n {
public static func allowFor(_ p1: Any) -> ArgumentsLocalizedString {
ArgumentsLocalizedString("allowFor %@", "allowFor \(String(describing: p1))", String(describing: p1))
}
/// Always on Top
public static let alwaysOnTop = LocalizedString(lookupKey: "alwaysOnTop")
/// Ambient light color
public static let ambientLightColor = LocalizedString(lookupKey: "ambientLightColor")
/// Ambient light intensity
Expand Down Expand Up @@ -56,6 +58,12 @@ public enum L10n {
public static let camera = LocalizedString(lookupKey: "camera")
/// Camera Exposure (EV)
public static let cameraExposure = LocalizedString(lookupKey: "cameraExposure")
/// The virtual camera is not allowed. Please allow it from the 'Privacy & Security' section in the settings app.
public static let cameraExtensionAwaitingUserApproval = LocalizedString(lookupKey: "cameraExtensionAwaitingUserApproval")
/// The virtual camera is NOT working.
public static let cameraExtensionNotWorking = LocalizedString(lookupKey: "cameraExtensionNotWorking")
/// The virtual camera is working.
public static let cameraExtensionWorking = LocalizedString(lookupKey: "cameraExtensionWorking")
/// Cancel
public static let cancel = LocalizedString(lookupKey: "cancel")
/// Capture Preference
Expand Down Expand Up @@ -100,6 +108,10 @@ public enum L10n {
public static let cut = LocalizedString(lookupKey: "cut")
/// Default
public static let `default` = LocalizedString(lookupKey: "default")
/// Delete the Old Virtual Camera
public static let deleteOldDALPlugin = LocalizedString(lookupKey: "deleteOldDALPlugin")
/// The old virtual camera is no longer supported, so it'll be deleted now.
public static let deleteOldDALPluginMessage = LocalizedString(lookupKey: "deleteOldDALPluginMessage")
/// Delete %@
public static func deleteOne(_ p1: Any) -> ArgumentsLocalizedString {
ArgumentsLocalizedString("deleteOne %@", "deleteOne \(String(describing: p1))", String(describing: p1))
Expand Down Expand Up @@ -142,8 +154,6 @@ public enum L10n {
public static let enable = LocalizedString(lookupKey: "enable")
/// Convert VRM 0.x to VRM 1.x
public static let enableAutoConvertingToVRM1 = LocalizedString(lookupKey: "enableAutoConvertingToVRM1")
/// Use the new virtual camera (macOS 12.3 and above)
public static let enableNewCameraExtension = LocalizedString(lookupKey: "enableNewCameraExtension")
/// Enable VSync
public static let enableVSync = LocalizedString(lookupKey: "enableVSync")
/// English
Expand All @@ -164,6 +174,8 @@ public enum L10n {
public static let experimentDisclaimer = LocalizedString(lookupKey: "experimentDisclaimer")
/// These features are available for our supporters, thank you for your supporting!
public static let experimentThanks = LocalizedString(lookupKey: "experimentThanks")
/// Installing the virtual camera.\nClick on 'Open Security Preferences' and then click 'Allow'.
public static let explainAboutInstallingCameraExtension = LocalizedString(lookupKey: "explainAboutInstallingCameraExtension")
/// Horizontal sensitivity
public static let eyesHorizontalSensitivity = LocalizedString(lookupKey: "eyesHorizontalSensitivity")
/// Vertical sensitivity
Expand All @@ -172,6 +184,10 @@ public enum L10n {
public static let faceEyeMouth = LocalizedString(lookupKey: "faceEyeMouth")
/// Facial Expression
public static let facialExpression = LocalizedString(lookupKey: "facialExpression")
/// The installation of the virtual camera failed. Please install it from the VCam settings if you want to use it.
public static let failedToInstallCameraExtension = LocalizedString(lookupKey: "failedToInstallCameraExtension")
/// Failed to install the virtual camera. Please reinstall the virtual camera in VCam settings.
public static let failedToInstallCameraPlugin = LocalizedString(lookupKey: "failedToInstallCameraPlugin")
/// Failure
public static let failure = LocalizedString(lookupKey: "failure")
/// File
Expand Down Expand Up @@ -220,6 +236,8 @@ public enum L10n {
public static func installPlugin(_ p1: Any) -> ArgumentsLocalizedString {
ArgumentsLocalizedString("installPlugin %@", "installPlugin \(String(describing: p1))", String(describing: p1))
}
/// Install the Virtual Camera
public static let installVirtualCamera = LocalizedString(lookupKey: "installVirtualCamera")
/// Integration
public static let integration = LocalizedString(lookupKey: "integration")
/// Intensity
Expand Down Expand Up @@ -270,6 +288,10 @@ public enum L10n {
public static let micOrCamera = LocalizedString(lookupKey: "micOrCamera")
/// Sync offset for mic [ms]
public static let micSyncOffset = LocalizedString(lookupKey: "micSyncOffset")
/// Migrate to New Virtual Camera
public static let migrateToNewVirtualCamera = LocalizedString(lookupKey: "migrateToNewVirtualCamera")
/// VCam will migrate to a virtual camera optimized for the latest macOS.\nPlease follow the instructions to delete the old plugin and install the new virtual camera.
public static let migrateToNewVirtualCameraMessage = LocalizedString(lookupKey: "migrateToNewVirtualCameraMessage")
/// Motion
public static let motion = LocalizedString(lookupKey: "motion")
/// Reset position
Expand Down Expand Up @@ -302,6 +324,8 @@ public enum L10n {
public static let pick = LocalizedString(lookupKey: "pick")
/// Play idle motions
public static let playIdleMotions = LocalizedString(lookupKey: "playIdleMotions")
/// Restarting Mac may resolve the issue.
public static let pleaseRestartMacToFix = LocalizedString(lookupKey: "pleaseRestartMacToFix")
/// Pose
public static let pose = LocalizedString(lookupKey: "pose")
/// Preset
Expand Down Expand Up @@ -402,6 +426,8 @@ public enum L10n {
public static let stopRecording = LocalizedString(lookupKey: "stopRecording")
/// Success
public static let success = LocalizedString(lookupKey: "success")
/// The virtual camera was successfully installed. It's recommended to restart VCam once.
public static let successToInstallCameraExtension = LocalizedString(lookupKey: "successToInstallCameraExtension")
/// Elbow offset
public static let swivelOffset = LocalizedString(lookupKey: "swivelOffset")
/// Take a photo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@
"experimentThanks" = "These features are available for our supporters, thank you for your supporting!";
"experimentAdvertisement" = "The supporter version of the app can be downloaded from the following link:";
"enableVSync" = "Enable VSync";
"enableNewCameraExtension" = "Use the new virtual camera (macOS 12.3 and above)";
"installVirtualCamera" = "Install the Virtual Camera";
"explainAboutInstallingCameraExtension" = "Installing the virtual camera.\nClick on 'Open Security Preferences' and then click 'Allow'.";
"noteEnableNewCameraExtension" = "Restart VCam once after installation.";
"cameraExtensionWorking" = "The virtual camera is working.";
"cameraExtensionNotWorking" = "The virtual camera is NOT working.";
"pleaseRestartMacToFix" = "Restarting Mac may resolve the issue.";
"cameraExtensionAwaitingUserApproval" = "The virtual camera is not allowed. Please allow it from the 'Privacy & Security' section in the settings app.";
"successToInstallCameraExtension" = "The virtual camera was successfully installed. It's recommended to restart VCam once.";
"failedToInstallCameraExtension" = "The installation of the virtual camera failed. Please install it from the VCam settings if you want to use it.";

// MARK: - Tracking

Expand Down Expand Up @@ -245,6 +252,7 @@
"loadVRMFile" = "Load VRM file";
"loadOnVRoidHub" = "Load Avatar on VRoid Hub";
"resetAvatarPosition" = "Reset Avatar Position";
"alwaysOnTop" = "Always on Top";
"help" = "Help";
"anyProblem" = "Any problem?";
"quitVCam" = "Quit VCam";
Expand Down Expand Up @@ -274,6 +282,14 @@
"upToDate" = "You're up-to-date!";
"upToDateMessage %@" = "%@ is currently the latest version";

// MARK: - Migration

"failedToInstallCameraPlugin" = "Failed to install the virtual camera. Please reinstall the virtual camera in VCam settings.";
"deleteOldDALPlugin" = "Delete the Old Virtual Camera";
"deleteOldDALPluginMessage" = "The old virtual camera is no longer supported, so it'll be deleted now.";
"migrateToNewVirtualCamera" = "Migrate to New Virtual Camera";
"migrateToNewVirtualCameraMessage" = "VCam will migrate to a virtual camera optimized for the latest macOS.\nPlease follow the instructions to delete the old plugin and install the new virtual camera.";

// MARK: - Shortcut

"createShortcut" = "Create Shortcut";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,15 @@
"experimentThanks" = "これらの機能はサポーター向けに提供しています。VCamのサポート、ありがとうございます!";
"experimentAdvertisement" = "これらの機能はサポーター向けに提供しています。サポーター版は以下からDLできます。";
"enableVSync" = "VSyncを有効にする";
"enableNewCameraExtension" = "新しい仮想カメラを使用する (macOS 12.3以降)";
"installVirtualCamera" = "仮想カメラのインストール";
"explainAboutInstallingCameraExtension" = "仮想カメラをインストールします。\n「システム設定を開く」をクリックして、「許可」をクリックしてください。";
"noteEnableNewCameraExtension" = "インストール後は一度VCamを再起動してください";
"cameraExtensionWorking" = "仮想カメラは動作しています。";
"cameraExtensionNotWorking" = "仮想カメラは動作していません。";
"pleaseRestartMacToFix" = "Macを再起動すると不具合が改善される場合があります。";
"cameraExtensionAwaitingUserApproval" = "仮想カメラが許可されていません。設定アプリの「プライバシーとセキュリティ」から許可してください。";
"successToInstallCameraExtension" = "仮想カメラのインストールに成功しました。一度VCamを再起動することをおすすめします。";
"failedToInstallCameraExtension" = "仮想カメラのインストールに失敗しました。利用する場合はVCamの設定からインストールしてください。";

// MARK: - Tracking

Expand Down Expand Up @@ -245,6 +252,7 @@
"loadVRMFile" = "VRMファイルを読み込む";
"loadOnVRoidHub" = "VRoid Hubからアバターを選ぶ";
"resetAvatarPosition" = "アバターの位置をリセット";
"alwaysOnTop" = "ウィンドウを常に最前面にする";
"help" = "ヘルプ";
"anyProblem" = "困った時は?";
"quitVCam" = "VCamを終了";
Expand Down Expand Up @@ -274,6 +282,14 @@
"upToDate" = "最新版です";
"upToDateMessage %@" = "%@ は最新バージョンです。";

// MARK: - Migration

"failedToInstallCameraPlugin" = "仮想カメラのインストールに失敗しました。VCamの設定で仮想カメラを再インストールしてください。";
"deleteOldDALPlugin" = "古い仮想カメラの削除";
"deleteOldDALPluginMessage" = "古い仮想カメラはサポート終了となりましたので、削除します。";
"migrateToNewVirtualCamera" = "新しい仮想カメラへの移行";
"migrateToNewVirtualCameraMessage" = "最新のmacOSに最適化した仮想カメラへ移行します。\n古いプラグインを削除し、新しい仮想カメラをインストールしてください。";

// MARK: - Shortcut

"createShortcut" = "ショートカット作成";
Expand Down
10 changes: 7 additions & 3 deletions app/xcode/Sources/VCamUI/LegacyPluginHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ public struct LegacyPluginHelper {
return plist?["CFBundleShortVersionString"] as? String ?? ""
}

public static func isPluginInstalled() -> Bool {
FileManager.default.fileExists(atPath: pluginPath.path)
}

@MainActor
public static func checkUpdate() async {
let pluginInstalled = FileManager.default.fileExists(atPath: pluginPath.path)
let pluginInstalled = isPluginInstalled()
var pluginUpdateNeeded = false

if pluginInstalled {
Expand Down Expand Up @@ -62,8 +66,8 @@ public struct LegacyPluginHelper {
}

@MainActor
public static func uninstallPlugin() async {
guard await VCamAlert.showModal(title: L10n.deletePlugin.text, message: L10n.deleteOne(pluginPath).text, canCancel: true) == .ok else {
public static func uninstallPlugin(canCancel: Bool = true) async {
guard await VCamAlert.showModal(title: L10n.deletePlugin.text, message: L10n.deleteOne(pluginPath).text, canCancel: canCancel) == .ok else {
return
}
do {
Expand Down
1 change: 1 addition & 0 deletions app/xcode/Sources/VCamUI/PasteboardObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public final class PasteboardObserver: ObservableObject {
}

public func observe() {
timer?.invalidate()
timer = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { _ in
if self.lastChangeCount != self.pasteboard.changeCount {
self.lastChangeCount = self.pasteboard.changeCount
Expand Down
2 changes: 2 additions & 0 deletions app/xcode/Sources/VCamUI/UIComponent/VCamAlert.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public struct VCamAlert: View {
public static func showModal(title: String, message: String, canCancel: Bool, okTitle: String = "OK") async -> Result {
return await withCheckedContinuation { continuation in
let alert = VCamAlert(windowTitle: title, message: message, canCancel: canCancel, okTitle: okTitle) {
NSApp.vcamWindow?.becomeMain()
continuation.resume(returning: .ok)
} onCancel: {
NSApp.vcamWindow?.becomeMain()
continuation.resume(returning: .cancel)
}
MacWindowManager.shared.open(alert)
Expand Down

0 comments on commit b7b9b9d

Please sign in to comment.