Skip to content

Commit

Permalink
Merge pull request #133 from Rubenfer/feature/itunes-region
Browse files Browse the repository at this point in the history
Let developer set App Store region for UpdateAvailableInsight
  • Loading branch information
AvdLee committed Oct 18, 2022
2 parents 4e92cbb + 0632a78 commit 3a93b44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Sources/DiagnosticsReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public enum DiagnosticsReporter {
/// - filters: The filters to use for the generated diagnostics. Should conform to the `DiagnosticsReportFilter` protocol.
/// - smartInsightsProvider: Provide any smart insights for the given `DiagnosticsChapter`.
public static func create(
filename: String = "Diagnostics-Report.html",
using reporters: [DiagnosticsReporting] = DefaultReporter.allReporters,
filters: [DiagnosticsReportFilter.Type]? = nil,
smartInsightsProvider: SmartInsightsProviding? = nil
Expand Down Expand Up @@ -87,7 +88,7 @@ public enum DiagnosticsReporter {

let html = generateHTML(using: reportChapters)
let data = html.data(using: .utf8)!
return DiagnosticsReport(filename: "Diagnostics-Report.html", data: data)
return DiagnosticsReport(filename: filename, data: data)
}
}

Expand Down
5 changes: 3 additions & 2 deletions Sources/SmartInsights/UpdateAvailableInsight.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ struct UpdateAvailableInsight: SmartInsightProviding {
init?(
bundleIdentifier: String? = Bundle.main.bundleIdentifier,
currentVersion: String = Bundle.appVersion,
appMetadataPublisher: AnyPublisher<AppMetadataResults, Error>? = nil
appMetadataPublisher: AnyPublisher<AppMetadataResults, Error>? = nil,
itunesRegion: String = Locale.current.regionCode ?? "us"
) {
guard let bundleIdentifier = bundleIdentifier else { return nil }
let url = URL(string: "https://itunes.apple.com/br/lookup?bundleId=\(bundleIdentifier)")!
let url = URL(string: "https://itunes.apple.com/\(itunesRegion)/lookup?bundleId=\(bundleIdentifier)")!

let group = DispatchGroup()
group.enter()
Expand Down

0 comments on commit 3a93b44

Please sign in to comment.