Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,30 @@ jobs:
if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/')
uses: oversizedev/GithubWorkflows/.github/workflows/test.yml@main
secrets: inherit

build-swiftpm:
name: Build SwiftPM
needs: tests

build-app-store-services:
name: Build OversizeAppStoreServices
needs:
- tests
uses: oversizedev/GithubWorkflows/.github/workflows/build-swiftpm-all-platforms.yml@main
with:
package: OversizeAppStoreServices
secrets: inherit

build-metric-services:
name: Build OversizeMetricServices
needs:
- tests
uses: oversizedev/GithubWorkflows/.github/workflows/build-swiftpm-all-platforms.yml@main
with:
package: OversizeMetricServices
secrets: inherit

bump:
name: Bump version
needs: build-swiftpm
needs:
- build-app-store-services
- build-metric-services
if: github.ref == 'refs/heads/main'
uses: oversizedev/GithubWorkflows/.github/workflows/bump.yml@main
secrets: inherit
Expand Down
17 changes: 16 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,25 @@ let package = Package(
name: "OversizeAppStoreServices",
targets: ["OversizeAppStoreServices"]
),
.library(
name: "OversizeMetricServices",
targets: ["OversizeMetricServices"]
),
],
dependencies: dependencies,
targets: [
.target(
name: "OversizeAppStoreServices",
dependencies: [
.product(name: "AppStoreConnect", package: "asc-swift"),
.product(name: "Factory", package: "Factory"),
.product(name: "OversizeCore", package: "OversizeCore"),
.product(name: "OversizeModels", package: "OversizeModels"),
.product(name: "OversizeServices", package: "OversizeServices"),
]
),
.target(
name: "OversizeMetricServices",
dependencies: [
.product(name: "AppStoreConnect", package: "asc-swift"),
.product(name: "Factory", package: "Factory"),
Expand All @@ -51,11 +65,12 @@ let package = Package(
.product(name: "OversizeServices", package: "OversizeServices"),
.product(name: "Gzip", package: "GzipSwift"),
.product(name: "CodableCSV", package: "CodableCSV"),
"OversizeAppStoreServices",
]
),
.testTarget(
name: "OversizeAppStoreServicesTests",
dependencies: ["OversizeAppStoreServices"]
dependencies: ["OversizeAppStoreServices", "OversizeMetricServices"]
),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import OversizeCore

public struct AgeRatingDeclaration: Sendable {
Expand Down
5 changes: 4 additions & 1 deletion Sources/OversizeAppStoreServices/Models/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import Foundation

public struct App: Identifiable, Sendable {
Expand Down Expand Up @@ -83,6 +82,8 @@ public struct App: Identifiable, Sendable {
appStoreVersions.append(includedAppStoreVersion)
case let .build(includedBuild):
builds.append(includedBuild)
case let .prereleaseVersion(prereleaseVersion):
prereleaseVersions.append(prereleaseVersion)
default:
continue
}
Expand Down Expand Up @@ -135,6 +136,8 @@ public struct App: Identifiable, Sendable {
appStoreVersions.append(includedAppStoreVersion)
case let .build(includedBuild):
builds.append(includedBuild)
case let .prereleaseVersion(prereleaseVersion):
prereleaseVersions.append(prereleaseVersion)
default:
continue
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/OversizeAppStoreServices/Models/AppCategory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

import AppStoreAPI
import AppStoreConnect

import Foundation
import OversizeCore
import SwiftUI
Expand Down Expand Up @@ -33,10 +33,10 @@ public struct AppCategory: Identifiable, Sendable {
}

self.included = .init(subCategories: subcategoryIds?.compactMap { subcategoryId in
if let subcategory = included.first { $0.id == subcategoryId } {
return .init(schema: subcategory)
if let subcategory = included.first(where: { $0.id == subcategoryId }) {
.init(schema: subcategory)
} else {
return nil
nil
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeAppStoreServices/Models/AppInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

import AppStoreAPI
import AppStoreConnect

import OversizeCore

public struct AppInfo: Sendable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import Foundation

public struct AppInfoLocalization: Sendable, Hashable, Identifiable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import Foundation
import OversizeCore

Expand Down
5 changes: 2 additions & 3 deletions Sources/OversizeAppStoreServices/Models/AppStoreVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import Foundation
import OversizeCore

Expand Down Expand Up @@ -74,10 +73,10 @@ public struct AppStoreVersion: Sendable, Identifiable {
build: includedBuild.flatMap { .init(schema: $0) },
ageRatingDeclaration: includedAgeRatingDeclaration.flatMap { .init(schema: $0) },
appStoreVersionLocalizations: includedAppStoreVersionLocalizations.flatMap { localizations in
localizations.flatMap(AppStoreVersionLocalization.init)
localizations.compactMap(AppStoreVersionLocalization.init)
},
appStoreReviewDetail: includedAppStoreReviewDetail.flatMap { reviewDetails in
reviewDetails.flatMap(AppStoreReviewDetail.init)
reviewDetails.compactMap(AppStoreReviewDetail.init)
}
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

import AppStoreAPI
import AppStoreConnect

import Foundation
import OversizeCore

Expand Down
2 changes: 0 additions & 2 deletions Sources/OversizeAppStoreServices/Models/Build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import Foundation

public struct Build: Sendable, Identifiable {
Expand Down Expand Up @@ -50,7 +49,6 @@ public struct Build: Sendable, Identifiable {
} else {
buildAudienceType = .none
}
let templateUrl = schema.attributes?.iconAssetToken?.templateURL
relationships = .init(
buildBundlesIds: schema.relationships?.buildBundles?.data?.compactMap { $0.id }
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// swift-format-ignore-file

import AppStoreAPI
import AppStoreConnect

import Foundation

public struct BuildBundleFileSize: Sendable, Identifiable {
Expand Down
9 changes: 5 additions & 4 deletions Sources/OversizeAppStoreServices/Models/Certificate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
//

import AppStoreAPI
import AppStoreConnect

import Foundation

public struct Certificate: Sendable {
public let id: String
public let name: String
public let platform: BundleID.Platform
public let platform: BundleIDPlatform
public let type: CertificateType
public let content: String
public var expirationDate: Date
Expand All @@ -19,12 +19,13 @@ public struct Certificate: Sendable {
guard let name = schema.attributes?.name,
let type = CertificateType(rawValue: schema.attributes?.certificateType?.rawValue ?? ""),
let content = schema.attributes?.certificateContent,
let platform = schema.attributes?.platform,
let platformRawValue = schema.attributes?.platform?.rawValue,
let platform: BundleIDPlatform = .init(rawValue: platformRawValue),
let expirationDate = schema.attributes?.expirationDate
else { return nil }
id = schema.id
self.name = name
self.platform = BundleID.Platform(schema: platform)
self.platform = platform
self.type = type
self.content = content
self.expirationDate = expirationDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

import AppStoreAPI
import AppStoreConnect

import Foundation

public struct CustomerReview: Sendable, Identifiable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//

import AppStoreAPI
import AppStoreConnect
import Foundation

public struct CustomerReviewResponseV1: Sendable, Identifiable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OversizeAppStoreServices/Models/ImageAsset.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// ImageAsset.swift, created on 17.01.2025
//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchaseAvailability.swift, created on 24.01.2025
//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchaseContent.swift, created on 17.01.2025
//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchaseImage.swift, created on 17.01.2025
//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchaseLocalization.swift, created on 12.01.2025
//

import AppStoreAPI
import AppStoreConnect

import Foundation
import SwiftUI

Expand Down
37 changes: 23 additions & 14 deletions Sources/OversizeAppStoreServices/Models/InAppPurchasePrice.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchasePrice.swift, created on 29.01.2025
//

Expand Down Expand Up @@ -27,20 +27,29 @@ public struct InAppPurchasePrice: Sendable, Identifiable {
territoryId: schema.relationships?.territory?.data?.id
)

self.included = .init(
inAppPurchasePricePoint: included?.compactMap { (item: InAppPurchasePricesResponse.IncludedItem) -> InAppPurchasePricePoint? in
if case let .inAppPurchasePricePoint(value) = item {
return .init(schema: value)
}
return nil
}.first,
territory: included?.compactMap { (item: InAppPurchasePricesResponse.IncludedItem) -> Territory? in
if case let .territory(value) = item {
return .init(schema: value)
if let includedItems = included {
var inAppPurchasePricePoint: InAppPurchasePricePoint?
var territory: Territory?

for includedItem in includedItems {
switch includedItem {
case let .inAppPurchasePricePoint(value):
if schema.relationships?.inAppPurchasePricePoint?.data?.id == value.id {
inAppPurchasePricePoint = .init(schema: value)
}
case let .territory(value):
if schema.relationships?.territory?.data?.id == value.id {
territory = .init(schema: value)
}
}
return nil
}.first
)
}
self.included = .init(
inAppPurchasePricePoint: inAppPurchasePricePoint,
territory: territory
)
} else {
self.included = nil
}
}

public struct Relationships: Sendable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchasePricePoint.swift, created on 17.01.2025
//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchasePriceSchedule.swift, created on 17.01.2025
//

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright © 2025 Aleksandr Romanov
// Copyright © 2025 Alexander Romanov
// InAppPurchaseV2.swift, created on 02.01.2025
//

Expand Down
Loading