Add a logout option

This commit is contained in:
Jackson Harper
2023-05-31 19:08:09 +08:00
parent 2f879386a3
commit f53ce94049
6 changed files with 26 additions and 4 deletions

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>

View File

@ -1388,7 +1388,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 82;
CURRENT_PROJECT_VERSION = 90;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = QJF2XZ86HB;
@ -1400,7 +1400,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.24.0;
MARKETING_VERSION = 1.27.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app;
@ -1423,7 +1423,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 82;
CURRENT_PROJECT_VERSION = 90;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = QJF2XZ86HB;
@ -1435,7 +1435,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.24.0;
MARKETING_VERSION = 1.27.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = app.omnivore.app;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@ -142,6 +142,11 @@ import Views
}
})
}
CommandGroup(after: .appTermination) {
Button("Logout", action: {
NSNotification.logout()
})
}
CommandMenu("Reader Display") {
spacingButtons

View File

@ -9,6 +9,8 @@ import Views
struct HomeFeedView: View {
@EnvironmentObject var dataService: DataService
@EnvironmentObject var audioController: AudioController
@EnvironmentObject var authenticator: Authenticator
@State private var itemToRemove: LinkedItem?
@State private var confirmationShown = false
@State private var presentProfileSheet = false
@ -151,6 +153,9 @@ import Views
.onReceive(NSNotification.displayProfilePublisher) { _ in
presentProfileSheet = true
}
.onReceive(NSNotification.logoutPublisher) { _ in
authenticator.logout(dataService: dataService)
}
.task {
if viewModel.items.isEmpty {
loadItems(isRefresh: true)

View File

@ -10,6 +10,7 @@ public extension NSNotification {
static let ReaderSettingsChanged = Notification.Name("ReaderSettingsChanged")
static let SpeakingReaderItem = Notification.Name("SpeakingReaderItem")
static let DisplayProfile = Notification.Name("DisplayProfile")
static let Logout = Notification.Name("Logout")
static var pushFeedItemPublisher: NotificationCenter.Publisher {
NotificationCenter.default.publisher(for: PushJSONArticle)
@ -39,6 +40,10 @@ public extension NSNotification {
NotificationCenter.default.publisher(for: DisplayProfile)
}
static var logoutPublisher: NotificationCenter.Publisher {
NotificationCenter.default.publisher(for: Logout)
}
internal var operationMessage: String? {
if let message = userInfo?["message"] as? String {
return message
@ -74,6 +79,10 @@ public extension NSNotification {
NotificationCenter.default.post(name: NSNotification.ReaderSettingsChanged, object: nil)
}
static func logout() {
NotificationCenter.default.post(name: NSNotification.Logout, object: nil)
}
static func displayProfile() {
NotificationCenter.default.post(name: NSNotification.DisplayProfile, object: nil)
}

View File

@ -165,6 +165,7 @@ public enum LocalText {
public static let genericFontFamily = localText(key: "genericFontFamily")
public static let genericHighContrastText = localText(key: "genericHighContrastText")
public static let enableJustifyText = localText(key: "enableJustifyText")
public static let enableHighlightOnReleaseText = localText(key: "enableHighlightOnReleaseText")
public static let genericFont = localText(key: "genericFont")
public static let genericHighlight = localText(key: "genericHighlight")
public static let labelsGeneric = localText(key: "labelsGeneric")