Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Sources/LocalShare/Lang.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ enum L: CaseIterable {

// 设置 —— 更新
case autoUpdate, autoUpdateDescOn, autoUpdateDescOff
case manualUpdate, manualUpdateDescOn, manualUpdateDescOff

// 设置 —— 命令行工具
case cliHintAvailable, cliHintUnavailable
Expand Down Expand Up @@ -289,9 +290,14 @@ enum L: CaseIterable {
case .resetWindowDesc: return ("把窗口还原成默认大小", "Restore the window to its default size")

case .autoUpdate: return ("自动更新", "Automatic Updates")
case .autoUpdateDescOn: return ("关闭后不自动更新、不弹提示;仍可在菜单「检查更新…」手动检查",
"When off, no auto-updates or prompts; you can still check manually via the menu")
case .autoUpdateDescOn: return ("关闭后不自动检查、不弹提示;仍可手动检查",
"When off, no automatic checks or prompts; manual checks still work")
case .autoUpdateDescOff: return ("开发构建未启用更新,正式版生效", "Updates are disabled in dev builds; active in release")
case .manualUpdate: return ("手动检查更新", "Manual Update Check")
case .manualUpdateDescOn: return ("立刻检查是否有新版,有更新时按提示安装",
"Check for a new version now and install when prompted")
case .manualUpdateDescOff: return ("开发构建未启用更新,正式版可手动检查",
"Updates are disabled in dev builds; active in release")

case .cliHintAvailable: return ("在终端用 localshare 分享文件", "Use localshare in the terminal to share files")
case .cliHintUnavailable: return ("以 app 包运行时可安装", "Installable when run as an app bundle")
Expand Down
11 changes: 11 additions & 0 deletions Sources/LocalShare/SettingsScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ struct SettingsScreen: View {
updater.setAutomaticChecks(!updater.automaticChecks)
}
}
settingRow(top: true,
title: L.manualUpdate(lang),
desc: updater.isActive
? L.manualUpdateDescOn(lang)
: L.manualUpdateDescOff(lang)) {
GhostButton(t: t, title: L.checkForUpdates(lang), systemImage: "arrow.clockwise") {
updater.checkForUpdates()
}
.disabled(!updater.canCheckForUpdates)
.opacity(updater.canCheckForUpdates ? 1 : 0.5)
}
}

// MARK: 命令行工具
Expand Down
14 changes: 13 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,21 @@ cp "$EXT_BIN_PATH" "$EXT/Contents/MacOS/$EXT_BINARY"
cp "$ROOT/bundle/ShareExtensionInfo.plist" "$EXT/Contents/Info.plist"
cp "$ROOT/bundle/AppIcon.icns" "$EXT/Contents/Resources/AppIcon.icns"

# 扩展版本号与宿主 app 保持一致;release workflow 会在 build.sh 前改写 bundle/Info.plist。
# 本地构建时 bundle/Info.plist 仍是占位版本;CI release 会在 build.sh 前按 tag 改写,
# 因此这里只在占位值仍存在时,用最近的 vX.Y.Z tag 生成一个可用的本地版本号。
APP_SHORT_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist")"
APP_BUILD_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$APP/Contents/Info.plist")"
if [ "$APP_SHORT_VERSION" = "0.2.0" ] && git -C "$ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
GIT_VERSION="$(git -C "$ROOT" describe --tags --match 'v[0-9]*' --abbrev=0 2>/dev/null || true)"
if [ -n "$GIT_VERSION" ]; then
APP_SHORT_VERSION="${GIT_VERSION#v}"
APP_BUILD_VERSION="$(git -C "$ROOT" rev-list --count HEAD)"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $APP_SHORT_VERSION" "$APP/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $APP_BUILD_VERSION" "$APP/Contents/Info.plist"
echo "==> 本地版本号: $APP_SHORT_VERSION ($APP_BUILD_VERSION)"
fi
fi
# 扩展版本号与宿主 app 保持一致。
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $APP_SHORT_VERSION" "$EXT/Contents/Info.plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $APP_BUILD_VERSION" "$EXT/Contents/Info.plist"

Expand Down
Loading