Merge pull request #108 from omnivore-app/chore/resolve-apple-warnings

Resolve lint/xcode warnings
This commit is contained in:
Satindar Dhillon
2022-02-22 09:39:03 -08:00
committed by GitHub
12 changed files with 61 additions and 78 deletions

View File

@ -32,29 +32,8 @@ extension ShareExtensionViewModel {
switch action {
case let .savePage(requestID):
self?.savePage(extensionContext: extensionContext, requestId: requestID)
case let .dismissButtonTapped(reminderTime, hideUntilReminded):
case .dismissButtonTapped:
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
//
// guard let reminderTime = reminderTime, let self = self else {
// extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
// return
// }
//
// let services = Services()
//
// services.dataService.createReminderPublisher(
// hideUntilReminded: hideUntilReminded,
// reminderTime: reminderTime,
// reminderItemId: .clientRequest(id: self.requestID)
// )
// .sink { _ in
// extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
// } receiveValue: { _ in
// extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
// }
// .store(in: &self.subscriptions)
//
// extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
case .copyLinkButtonTapped:
print("copy link button tapped")
case .readNowButtonTapped:
@ -65,7 +44,6 @@ extension ShareExtensionViewModel {
}
#endif
extensionContext?.completeRequest(returningItems: [], completionHandler: nil)
// TODO: implement macos
case .archiveButtonTapped:
print("archive button tapped")
}

View File

@ -177,7 +177,6 @@ extension HomeFeedViewModel {
}
}
// TODO: replace these deprecated calls with a progress bar or custom spinner
private func startNetworkActivityIndicator() {
#if os(iOS)
UIApplication.shared.isNetworkActivityIndicatorVisible = true

View File

@ -71,6 +71,7 @@ public enum PageScraper {
}
}
// swiftlint:disable:next function_body_length
private static func scrapeURLOnly(
extensionContext: NSExtensionContext?,
completion: @escaping (Result<PageScrapePayload, PageScrapeError>) -> Void

View File

@ -107,7 +107,6 @@ public extension DataService {
case let .success(payload):
switch payload.data {
case let .success(result: result):
// TODO: check local db to see what has a local documentpath
promise(.success(result))
case .error:
promise(.failure(.unknown))

View File

@ -7,10 +7,10 @@ import Foundation
#endif
public enum FeatureFlag {
public static let exampleFlag = false // unused
public static let showAccountDeletion = false
public static let enableSnoozeFromShareExtension = false
public static let enableReadNowFromShareExtension = false
public static let enableRemindersFromShareExtension = false
public static let enablePushNotifications = false
public static let enableShareButton = false
}

View File

@ -35,7 +35,7 @@ import WebKit
webView.configuration.userContentController = contentController
webView.scrollView.delegate = context.coordinator
webView.scrollView.contentInset.top = LinkItemDetailView.navBarHeight
webView.scrollView.verticalScrollIndicatorInsets = UIEdgeInsets(top: LinkItemDetailView.navBarHeight, left: 0, bottom: 0, right: 0)
webView.scrollView.verticalScrollIndicatorInsets.top = LinkItemDetailView.navBarHeight
for action in WebViewAction.allCases {
webView.configuration.userContentController.add(context.coordinator, name: action.rawValue)
@ -125,7 +125,7 @@ import WebKit
themeId: NSApp.effectiveAppearance.name == NSAppearance.Name.darkAqua ? "Gray" : "LightGray",
margin: 0,
fontSize: fontSize(),
fontFamily: "inter", // TODO: allow user to change this and save to user defaults
fontFamily: "inter",
rawAuthCookie: rawAuthCookie
)
)

View File

@ -157,11 +157,13 @@
}
@objc class var customSecondarySystemGroupedBackground: UIColor {
UIColor(named: "_appPrimaryBackground", in: .module, compatibleWith: .current) ?? .secondarySystemGroupedBackground
UIColor(named: "_appPrimaryBackground", in: .module, compatibleWith: .current)
?? .secondarySystemGroupedBackground
}
@objc class var customSystemTertiaryGroupedBackground: UIColor {
UIColor(named: "_appPrimaryBackground", in: .module, compatibleWith: .current) ?? .customSystemTertiaryGroupedBackground
UIColor(named: "_appPrimaryBackground", in: .module, compatibleWith: .current)
?? .customSystemTertiaryGroupedBackground
}
@objc class var customSeparator: UIColor {

View File

@ -70,16 +70,17 @@ import SwiftUI
let content: () -> Content
func makeUIViewController(
context _: UIViewControllerRepresentableContext<FormSheet<Content>>) -> FormSheetWrapper<Content>
{
context _: UIViewControllerRepresentableContext<FormSheet<Content>>
) -> FormSheetWrapper<Content> {
let controller = FormSheetWrapper(content: content, modalSize: modalSize)
controller.onDismiss = { self.show = false }
return controller
}
func updateUIViewController(_ uiViewController: FormSheetWrapper<Content>,
context _: UIViewControllerRepresentableContext<FormSheet<Content>>)
{
func updateUIViewController(
_ uiViewController: FormSheetWrapper<Content>,
context _: UIViewControllerRepresentableContext<FormSheet<Content>>
) {
if show {
uiViewController.show()
} else {
@ -89,10 +90,11 @@ import SwiftUI
}
public extension View {
func formSheet<Content: View>(isPresented: Binding<Bool>,
modalSize: CGSize = CGSize(width: 320, height: 320),
@ViewBuilder content: @escaping () -> Content) -> some View
{
func formSheet<Content: View>(
isPresented: Binding<Bool>,
modalSize: CGSize = CGSize(width: 320, height: 320),
@ViewBuilder content: @escaping () -> Content
) -> some View {
background(FormSheet(show: isPresented,
modalSize: modalSize,
content: content))

View File

@ -38,7 +38,7 @@ public final class HomeFeedViewModel: ObservableObject {
// Check if user has scrolled to the last five items in the list
if itemIndex == thresholdIndex {
print("load more items triggered") // TODO: fix loading mechanism
print("load more items triggered")
// performActionSubject.send(.loadItems)
}
}

View File

@ -13,12 +13,13 @@ struct Snackbar: View {
@Environment(\.colorScheme) private var colorScheme: ColorScheme
init<Presenting>(isShowing: Binding<Bool>,
presenting: Presenting,
text: Text,
actionText: Text? = nil,
action: (() -> Void)? = nil) where Presenting: View
{
init<Presenting>(
isShowing: Binding<Bool>,
presenting: Presenting,
text: Text,
actionText: Text? = nil,
action: (() -> Void)? = nil
) where Presenting: View {
self._isShowing = isShowing
self.presenting = AnyView(presenting)
self.text = text
@ -73,11 +74,12 @@ struct Snackbar: View {
}
public extension View {
func snackBar(isShowing: Binding<Bool>,
text: Text,
actionText: Text? = nil,
action: (() -> Void)? = nil) -> some View
{
func snackBar(
isShowing: Binding<Bool>,
text: Text,
actionText: Text? = nil,
action: (() -> Void)? = nil
) -> some View {
Snackbar(isShowing: isShowing,
presenting: self,
text: text,

View File

@ -53,25 +53,26 @@ private struct SnoozeIconButtonView: View {
let action: (_ snooze: Snooze) -> Void
var body: some View {
Button(action: {
action(snooze)
}) {
VStack(alignment: .center, spacing: 8) {
snooze.icon
.font(.appTitle)
.foregroundColor(.appYellow48)
Text(snooze.title)
.font(.appBody)
.foregroundColor(.appGrayText)
Text(snooze.untilStr)
.font(.appCaption)
.foregroundColor(.appGrayText)
Button(
action: { action(snooze) },
label: {
VStack(alignment: .center, spacing: 8) {
snooze.icon
.font(.appTitle)
.foregroundColor(.appYellow48)
Text(snooze.title)
.font(.appBody)
.foregroundColor(.appGrayText)
Text(snooze.untilStr)
.font(.appCaption)
.foregroundColor(.appGrayText)
}
.frame(
maxWidth: .infinity,
maxHeight: .infinity
)
}
.frame(
maxWidth: .infinity,
maxHeight: .infinity
)
}
)
.frame(height: 100)
}
}

View File

@ -1,6 +1,7 @@
import Binders
import Combine
import SwiftUI
import Utils
#if os(iOS)
import PDFKit
@ -103,15 +104,13 @@ import SwiftUI
let highlights = annotations?.compactMap { $0 as? HighlightAnnotation }
let shortId = highlights.flatMap { coordinator.shortHighlightIds($0).first }
if let shortId = shortId {
/*
let share = MenuItem(title: "Share", block: {
if let shareURL = viewModel.highlightShareURL(shortId: shortId) {
shareLink = ShareLink(id: UUID(), url: shareURL)
}
})
result.append(share)
*/
if let shortId = shortId, FeatureFlag.enableShareButton {
let share = MenuItem(title: "Share", block: {
if let shareURL = viewModel.highlightShareURL(shortId: shortId) {
shareLink = ShareLink(id: UUID(), url: shareURL)
}
})
result.append(share)
}
return result