Skip to content

Commit

Permalink
Enforce Parra prefix on public facing types
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmaccallum committed Aug 7, 2024
1 parent b861b77 commit 7dbc45d
Show file tree
Hide file tree
Showing 207 changed files with 1,362 additions and 1,358 deletions.
2 changes: 1 addition & 1 deletion dev/ParraDev/Settings Tab/Cells/ChangelogCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct ChangelogCell: View {
errorMessage = String(describing: error)
changelogInfo = nil

Logger.error(error)
ParraLogger.error(error)
}

isLoading = false
Expand Down
2 changes: 1 addition & 1 deletion dev/ParraDev/Settings Tab/Cells/FeedbackCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ struct FeedbackCell: View {
errorMessage = String(describing: error)
formData = nil

Logger.error(error)
ParraLogger.error(error)
}

isLoading = false
Expand Down
2 changes: 1 addition & 1 deletion dev/ParraDev/Settings Tab/Cells/LatestReleaseCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct LatestReleaseCell: View {

@State private var isLoading = false
@State private var errorMessage: String?
@State private var appVersionInfo: NewInstalledVersionInfo? // #3
@State private var appVersionInfo: ParraNewInstalledVersionInfo? // #3

var showLatestRelease: Bool {
return parra.releases.updateAvailable()
Expand Down
2 changes: 1 addition & 1 deletion dev/ParraDev/Settings Tab/Cells/RoadmapCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct RoadmapCell: View {
errorMessage = String(describing: error)
roadmapInfo = nil

Logger.error(error)
ParraLogger.error(error)
}

isLoading = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ struct EditProfileView: View {
)
} catch {
success = false
Logger.error("Error saving personal info", error)

ParraLogger.error("Error saving personal info", error)
}

withAnimation {
isLoading = false
isShowingSuccess = success
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import Foundation

public enum SheetDismissType: Equatable {
public enum ParraSheetDismissType: Equatable {
case cancelled
case completed
case failed(String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Sheet<SheetContent>: ViewModifier where SheetContent: View {
@ViewBuilder content: @escaping () -> SheetContent,
detents: Set<PresentationDetent> = [.large],
visibility: Visibility = .visible,
onDismiss: ((SheetDismissType) -> Void)? = nil
onDismiss: ((ParraSheetDismissType) -> Void)? = nil
) {
_isPresented = isPresented
self.content = content
Expand Down Expand Up @@ -52,5 +52,5 @@ struct Sheet<SheetContent>: ViewModifier where SheetContent: View {

private let detents: Set<PresentationDetent>
private let visibility: Visibility
private let onDismiss: ((SheetDismissType) -> Void)?
private let onDismiss: ((ParraSheetDismissType) -> Void)?
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct SheetWithLoader<TransformParams, Data, SheetContent>: ViewModifier
loader: ViewDataLoader<TransformParams, Data, SheetContent>,
detents: Set<PresentationDetent> = [.large],
visibility: Visibility = .visible,
onDismiss: ((SheetDismissType) -> Void)?
onDismiss: ((ParraSheetDismissType) -> Void)?
) {
self._loadType = loadType
self.loader = loader
Expand Down Expand Up @@ -99,10 +99,10 @@ struct SheetWithLoader<TransformParams, Data, SheetContent>: ViewModifier
private let loader: ViewDataLoader<TransformParams, Data, SheetContent>
private let detents: Set<PresentationDetent>
private let visibility: Visibility
private let onDismiss: ((SheetDismissType) -> Void)?
private let onDismiss: ((ParraSheetDismissType) -> Void)?

@MainActor
private func dismiss(_ type: SheetDismissType) {
private func dismiss(_ type: ParraSheetDismissType) {
loadType = .none
state = .ready

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extension View {
func presentSheet(
isPresented: Binding<Bool>,
@ViewBuilder content: @escaping () -> some View,
onDismiss: ((SheetDismissType) -> Void)? = nil
onDismiss: ((ParraSheetDismissType) -> Void)? = nil
) -> some View {
modifier(
Sheet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extension View {
.LoadType?
>,
with loader: ViewDataLoader<TransformParams, Data, SheetContent>,
onDismiss: ((SheetDismissType) -> Void)? = nil
onDismiss: ((ParraSheetDismissType) -> Void)? = nil
) -> some View {
modifier(
SheetWithLoader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public struct ParraChangelogInfo: Equatable {

extension ViewDataLoader {
static func changelogLoader(
config: ChangelogWidgetConfig
config: ParraChangelogWidgetConfig
)
-> ViewDataLoader<
ChangelogParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private let logger = Logger()

extension ViewDataLoader {
static func feedbackFormLoader(
config: FeedbackFormWidgetConfig,
config: ParraFeedbackFormWidgetConfig,
submissionType: FeedbackFormSubmissionType
) -> ViewDataLoader<String, ParraFeedbackForm, FeedbackFormWidget> {
return ViewDataLoader<String, ParraFeedbackForm, FeedbackFormWidget>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private let logger = Logger()

extension ViewDataLoader {
static func releaseLoader(
config: ChangelogWidgetConfig
config: ParraChangelogWidgetConfig
)
-> ViewDataLoader<
Never,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ struct RoadmapParams: Equatable {
}

public struct ParraRoadmapInfo: Equatable {
public let roadmapConfig: AppRoadmapConfiguration
public let selectedTab: RoadmapConfigurationTab
public let ticketResponse: UserTicketCollectionResponse
public let roadmapConfig: ParraAppRoadmapConfiguration
public let selectedTab: ParraRoadmapConfigurationTab
public let ticketResponse: ParraUserTicketCollectionResponse
}

extension ViewDataLoader {
static func roadmapLoader(
config: RoadmapWidgetConfig
config: ParraRoadmapWidgetConfig
) -> ViewDataLoader<RoadmapParams, ParraRoadmapInfo, RoadmapWidget> {
return ViewDataLoader<
RoadmapParams,
Expand Down
4 changes: 2 additions & 2 deletions ios/Sources/Parra/Containers/Loaders/ViewDataLoader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import SwiftUI

@MainActor
public struct ViewDataLoader<TransformParams, Data, ViewContent>
struct ViewDataLoader<TransformParams, Data, ViewContent>
where ViewContent: View, Data: Equatable, TransformParams: Equatable
{
// MARK: - Lifecycle
Expand Down Expand Up @@ -56,7 +56,7 @@ public struct ViewDataLoader<TransformParams, Data, ViewContent>
}
}

typealias Dismisser = @MainActor (SheetDismissType) -> Void
typealias Dismisser = @MainActor (ParraSheetDismissType) -> Void

@ViewBuilder let render: @MainActor (Parra, Data, Dismisser?) -> ViewContent
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct BadgeComponent: View {
// MARK: - Lifecycle

init(
content: BadgeContent,
content: ParraBadgeContent,
attributes: ParraAttributes.Badge
) {
self.content = content
Expand All @@ -21,7 +21,7 @@ struct BadgeComponent: View {

// MARK: - Internal

let content: BadgeContent
let content: ParraBadgeContent
let attributes: ParraAttributes.Badge

var body: some View {
Expand Down Expand Up @@ -51,7 +51,7 @@ struct BadgeComponent: View {
: attributes

componentFactory.buildLabel(
content: LabelContent(
content: ParraLabelContent(
text: content.text,
icon: content.icon
),
Expand Down
18 changes: 8 additions & 10 deletions ios/Sources/Parra/Containers/Views/CachedAsyncImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import SwiftUI
/// }
///
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct CachedAsyncImage<Content>: View where Content: View {
struct CachedAsyncImage<Content>: View where Content: View {
// MARK: - Lifecycle

/// Loads and displays an image from the specified URL.
Expand All @@ -114,7 +114,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
/// different value when loading images designed for higher resolution
/// displays. For example, set a value of `2` for an image that you
/// would name with the `@2x` suffix if stored in a file on disk.
public init(url: URL?, urlCache: URLCache = .shared, scale: CGFloat = 1)
init(url: URL?, urlCache: URLCache = .shared, scale: CGFloat = 1)
where Content == Image
{
let urlRequest = url == nil ? nil : URLRequest(url: url!)
Expand Down Expand Up @@ -143,7 +143,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
/// different value when loading images designed for higher resolution
/// displays. For example, set a value of `2` for an image that you
/// would name with the `@2x` suffix if stored in a file on disk.
public init(
init(
urlRequest: URLRequest?,
urlCache: URLCache = .shared,
scale: CGFloat = 1
Expand Down Expand Up @@ -193,7 +193,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
/// modify it as needed before returning it.
/// - placeholder: A closure that returns the view to show until the
/// load operation completes successfully.
public init<I, P>(
init<I, P>(
url: URL?,
urlCache: URLCache = .shared,
scale: CGFloat = 1,
Expand Down Expand Up @@ -241,7 +241,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
/// modify it as needed before returning it.
/// - placeholder: A closure that returns the view to show until the
/// load operation completes successfully.
public init<I, P>(
init<I, P>(
urlRequest: URLRequest?,
urlCache: URLCache = .shared,
scale: CGFloat = 1,
Expand Down Expand Up @@ -297,7 +297,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
/// - transaction: The transaction to use when the phase changes.
/// - content: A closure that takes the load phase as an input, and
/// returns the view to display for the specified phase.
public init(
init(
url: URL?,
urlCache: URLCache = .shared,
scale: CGFloat = 1,
Expand Down Expand Up @@ -349,7 +349,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
/// - transaction: The transaction to use when the phase changes.
/// - content: A closure that takes the load phase as an input, and
/// returns the view to display for the specified phase.
public init(
init(
urlRequest: URLRequest?,
urlCache: URLCache = .shared,
scale: CGFloat = 1,
Expand Down Expand Up @@ -377,9 +377,7 @@ public struct CachedAsyncImage<Content>: View where Content: View {
}
}

// MARK: - Public

public var body: some View {
var body: some View {
content(phase)
.task(id: urlRequest) {
do {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@

import Foundation

extension FeedbackFormField: ParraFixture {
static func validStates() -> [FeedbackFormField] {
extension ParraFeedbackFormField: ParraFixture {
static func validStates() -> [ParraFeedbackFormField] {
return [
FeedbackFormField(
ParraFeedbackFormField(
name: "type",
title: "Type of Feedback",
helperText: "Select one, please!",
type: .select,
required: true,
data: .feedbackFormSelectFieldData(
FeedbackFormSelectFieldData(
ParraFeedbackFormSelectFieldData(
placeholder: "Please select an option",
options: [
FeedbackFormSelectFieldOption(
ParraFeedbackFormSelectFieldOption(
title: "General feedback",
value: "general-feedback",
isOther: nil
),
FeedbackFormSelectFieldOption(
ParraFeedbackFormSelectFieldOption(
title: "Bug report",
value: "bug-report",
isOther: nil
),
FeedbackFormSelectFieldOption(
ParraFeedbackFormSelectFieldOption(
title: "Feature request",
value: "feature-request",
isOther: nil
),
FeedbackFormSelectFieldOption(
ParraFeedbackFormSelectFieldOption(
title: "Idea",
value: "idea",
isOther: nil
),
FeedbackFormSelectFieldOption(
ParraFeedbackFormSelectFieldOption(
title: "Other",
value: "other",
isOther: nil
Expand All @@ -50,26 +50,26 @@ extension FeedbackFormField: ParraFixture {
)
)
),
FeedbackFormField(
ParraFeedbackFormField(
name: "response-input",
title: "Your Feedback",
helperText: nil,
type: .input,
required: true,
data: .feedbackFormInputFieldData(
FeedbackFormInputFieldData(
ParraFeedbackFormInputFieldData(
placeholder: "placeholder"
)
)
),
FeedbackFormField(
ParraFeedbackFormField(
name: "response-text",
title: "Your Feedback",
helperText: nil,
type: .text,
required: true,
data: .feedbackFormTextFieldData(
FeedbackFormTextFieldData(
ParraFeedbackFormTextFieldData(
placeholder: "placeholder",
lines: 5,
minCharacters: 20,
Expand All @@ -81,7 +81,7 @@ extension FeedbackFormField: ParraFixture {
]
}

static func invalidStates() -> [FeedbackFormField] {
static func invalidStates() -> [ParraFeedbackFormField] {
return []
}
}
Loading

0 comments on commit 7dbc45d

Please sign in to comment.