mycode/myApp/HaruDanim/IOS/Core/AppRefresh.swift
songyc macbook 0b2bb9c55f fix(main): 새로고침 버튼을 프리미엄 전용으로 — 무료에선 숨김 + 도움말 중복 정리
새로고침의 쓰임새(iCloud 동기화 반영·위젯/워치 갱신)가 전부 프리미엄
기능이라 무료 사용자에겐 누를 이유가 없는 버튼 — 모음 탭 툴바에서
프리미엄일 때만 표시한다(실사용 피드백 2026-07-23).

- 도움말 '새로고침 버튼' 항목이 모음 탭 그룹에 2개 중복돼 있던 것을
  하나로 합치고, 프리미엄에서만 표시된다는 문구 추가
- 신규 문구 en/ja 완역, 구 문구 stale 2건 정리 (missing/stale 0)
- CLAUDE.md §6.1 툴바 규칙 갱신
- 검증: Debug/Store 빌드, 무료(-premium NO) 버튼 숨김·프리미엄 표시
  스크린샷

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-23 02:25:30 +09:00

72 lines
2.9 KiB
Swift
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AppRefresh.swift
// Haru_Danim
//
// ( )
// - iCloud ,
// . token identity @Query
// ( , ).
// - (CloudSyncMonitor) ·· .
// .
// " " , CloudKit
// API . (UIBackgroundModes:
// remote-notification, IOS/Info.plist)
// / ( ).
//
import Foundation
import Observation
import SwiftData
import WidgetKit
@MainActor
@Observable
final class AppRefresh {
static let shared = AppRefresh()
/// RootNavigationView .id
private(set) var token = UUID()
private(set) var isRefreshing = false
func refreshNow() {
guard !isRefreshing else { return }
isRefreshing = true
token = UUID()
Task { @MainActor in
//
LiveActivityManager.sync(context: DataStore.shared.mainContext)
WidgetCenter.shared.reloadAllTimelines()
WatchSyncManager.shared.pushSnapshot()
//
try? await Task.sleep(for: .milliseconds(700))
isRefreshing = false
}
}
}
// MARK: - ( )
import SwiftUI
/// .
/// (iCloud ·/ )
///
struct RefreshButton: View {
private let refresh = AppRefresh.shared
var body: some View {
Button {
refresh.refreshNow()
} label: {
if refresh.isRefreshing {
ProgressView()
} else {
Image(systemName: "arrow.clockwise")
}
}
.disabled(refresh.isRefreshing)
.accessibilityLabel(Text("새로고침"))
.accessibilityHint(Text("다른 기기에서 바뀐 내용을 다시 불러오고 위젯도 갱신해요"))
}
}