v2.0.6 — Auth section shows sign-in status, re-authenticate and sign out buttons
This commit is contained in:
@@ -591,25 +591,48 @@ struct SettingsView: View {
|
|||||||
.font(.system(size: 16, weight: .semibold))
|
.font(.system(size: 16, weight: .semibold))
|
||||||
|
|
||||||
// Auth section
|
// Auth section
|
||||||
VStack(alignment: .leading, spacing: 6) {
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
Label("Authentication", systemImage: "person.crop.circle")
|
Label("Authentication", systemImage: "person.crop.circle")
|
||||||
.font(.system(size: 12, weight: .medium))
|
.font(.system(size: 12, weight: .medium))
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
|
|
||||||
Text("ClaudeChecker signs into claude.ai inside a built-in browser window and reads your quota data directly from the API. Your session is stored locally and persists across restarts.")
|
HStack(spacing: 6) {
|
||||||
|
Circle()
|
||||||
|
.fill(vm.isSignedIn ? Color.green : Color.orange)
|
||||||
|
.frame(width: 7, height: 7)
|
||||||
|
Text(vm.isSignedIn ? "Signed in to claude.ai" : "Not signed in")
|
||||||
|
.font(.system(size: 12, weight: .medium))
|
||||||
|
.foregroundColor(vm.isSignedIn ? .primary : .orange)
|
||||||
|
}
|
||||||
|
|
||||||
|
Text("Your session is stored locally and persists across restarts.")
|
||||||
.font(.system(size: 11.5))
|
.font(.system(size: 11.5))
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
.fixedSize(horizontal: false, vertical: true)
|
.fixedSize(horizontal: false, vertical: true)
|
||||||
|
|
||||||
Button(action: {
|
HStack(spacing: 8) {
|
||||||
showSettings = false
|
Button(action: {
|
||||||
vm.triggerLogin = true
|
showSettings = false
|
||||||
}) {
|
vm.triggerLogin = true
|
||||||
Label("Sign in again", systemImage: "arrow.right.circle")
|
}) {
|
||||||
.font(.system(size: 12))
|
Label(vm.isSignedIn ? "Re-authenticate" : "Sign in", systemImage: "arrow.right.circle")
|
||||||
|
.font(.system(size: 12))
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
.controlSize(.small)
|
||||||
|
|
||||||
|
if vm.isSignedIn {
|
||||||
|
Button(action: {
|
||||||
|
Task { await vm.signOut() }
|
||||||
|
}) {
|
||||||
|
Label("Sign out", systemImage: "rectangle.portrait.and.arrow.right")
|
||||||
|
.font(.system(size: 12))
|
||||||
|
}
|
||||||
|
.buttonStyle(.bordered)
|
||||||
|
.controlSize(.small)
|
||||||
|
.tint(.red)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
|
||||||
.controlSize(.small)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Divider()
|
Divider()
|
||||||
|
|||||||
@@ -15,9 +15,9 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.0.5</string>
|
<string>2.0.6</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>12</string>
|
<string>13</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>13.0</string>
|
<string>13.0</string>
|
||||||
<key>LSUIElement</key>
|
<key>LSUIElement</key>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class UsageViewModel: ObservableObject {
|
|||||||
@Published var overageSpendLimit: OverageSpendLimit?
|
@Published var overageSpendLimit: OverageSpendLimit?
|
||||||
@Published var planLabel: String = "Claude"
|
@Published var planLabel: String = "Claude"
|
||||||
@Published var isNotAuthenticated: Bool = false
|
@Published var isNotAuthenticated: Bool = false
|
||||||
|
@Published var isSignedIn: Bool = false
|
||||||
@Published var triggerLogin: Bool = false
|
@Published var triggerLogin: Bool = false
|
||||||
@Published var showInMenuBar: Bool = true {
|
@Published var showInMenuBar: Bool = true {
|
||||||
didSet { UserDefaults.standard.set(showInMenuBar, forKey: "show_in_menubar") }
|
didSet { UserDefaults.standard.set(showInMenuBar, forKey: "show_in_menubar") }
|
||||||
@@ -36,6 +37,21 @@ class UsageViewModel: ObservableObject {
|
|||||||
loadPlaceholderData()
|
loadPlaceholderData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func signOut() async {
|
||||||
|
let store = WKWebsiteDataStore.default()
|
||||||
|
let types = WKWebsiteDataStore.allWebsiteDataTypes()
|
||||||
|
let records = await store.dataRecords(ofTypes: types)
|
||||||
|
let claudeRecords = records.filter { $0.displayName.contains("claude.ai") }
|
||||||
|
await store.removeData(ofTypes: types, for: claudeRecords)
|
||||||
|
isSignedIn = false
|
||||||
|
isNotAuthenticated = true
|
||||||
|
lastUpdated = nil
|
||||||
|
limits = []
|
||||||
|
extraUsage = nil
|
||||||
|
prepaidCredits = nil
|
||||||
|
overageSpendLimit = nil
|
||||||
|
}
|
||||||
|
|
||||||
func refresh() async {
|
func refresh() async {
|
||||||
isLoading = true
|
isLoading = true
|
||||||
errorMessage = nil
|
errorMessage = nil
|
||||||
@@ -54,6 +70,7 @@ class UsageViewModel: ObservableObject {
|
|||||||
overageSpendLimit = overage
|
overageSpendLimit = overage
|
||||||
planLabel = "Pro"
|
planLabel = "Pro"
|
||||||
lastUpdated = Date()
|
lastUpdated = Date()
|
||||||
|
isSignedIn = true
|
||||||
|
|
||||||
for i in limits.indices {
|
for i in limits.indices {
|
||||||
let key = limits[i].window.rawValue
|
let key = limits[i].window.rawValue
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
[](https://www.apple.com/macos/)
|
[](https://www.apple.com/macos/)
|
||||||
[](https://swift.org)
|
[](https://swift.org)
|
||||||
[](https://github.com/superdooper86/claudechecker/releases)
|
[](https://github.com/superdooper86/claudechecker/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.0.5",
|
"version": "2.0.6",
|
||||||
"url": "https://github.com/superdooper86/claudechecker/releases/download/v2.0.5/ClaudeChecker.zip",
|
"url": "https://github.com/superdooper86/claudechecker/releases/download/v2.0.6/ClaudeChecker.zip",
|
||||||
"notes": "Fixed window size and update banner dismiss."
|
"notes": "Authentication section shows sign-in status with re-authenticate and sign out options."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user