Skip to content

Commit

Permalink
Update changelog, version and build number
Browse files Browse the repository at this point in the history
Clean up code
  • Loading branch information
pawelmilek committed May 27, 2024
1 parent 07213c0 commit 030c1fa
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,3 +213,9 @@ Thank you for using the Swifty Forecast!

[2024-05-18] |
[Full Changelog](https://github.com/pawelmilek/SwiftyForecast/compare/v3.7.1...v3.7.2)

## 3.7.3
- Under the hood performance improvements<br>

[2024-05-18] |
[Full Changelog](https://github.com/pawelmilek/SwiftyForecast/compare/v3.7.2...v3.7.3)
10 changes: 5 additions & 5 deletions SwiftyForecast.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -577,16 +577,16 @@
E21A0B9420EE88F5006AC409 /* Utilities */ = {
isa = PBXGroup;
children = (
E2CAC9F92C044B4F00E573D2 /* ResourceFile.swift */,
E2A32F4725447A05000ACEFE /* DecodedPlist.swift */,
E20DA45A214348AD0047491B /* NetworkReachabilityManager.swift */,
E296A7E62AD6F49D001BFADB /* BuildConfigurationFile.swift */,
E2A32F4725447A05000ACEFE /* DecodedPlist.swift */,
E2D960802120F34800AE0B6E /* GeocodeLocation.swift */,
E20C6B122BE82F8400DDB57A /* JSONSnakeCaseDecoded.swift */,
E24EB89225410010001F5D72 /* MockGenerator.swift */,
E28092E32AFCC9720019FD7C /* UserLocationEntryValidator.swift */,
E2ED36E02C04D20D0001C3EF /* ReleasedDevices.swift */,
E20DA45A214348AD0047491B /* NetworkReachabilityManager.swift */,
E2ED36E22C04EDA10001C3EF /* NetworkResource.swift */,
E2ED36E02C04D20D0001C3EF /* ReleasedDevices.swift */,
E2CAC9F92C044B4F00E573D2 /* ResourceFile.swift */,
E28092E32AFCC9720019FD7C /* UserLocationEntryValidator.swift */,
);
path = Utilities;
sourceTree = "<group>";
Expand Down
29 changes: 17 additions & 12 deletions SwiftyForecast/Screens/About/Models/LicenseReader.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// LicenseReader.swift
// PackageLicense.swift
// Swifty Forecast
//
// Created by Pawel Milek on 12/24/23.
Expand All @@ -8,20 +8,25 @@

import SwiftUI

class LicenseReader: ObservableObject {
@Published private(set) var fileURL: URL?
class PackageLicense: ObservableObject {
@Published private(set) var url: URL?
private let resourceFile: ResourceFile

private let fileName: String

init(fileName: String) {
self.fileName = fileName
convenience init() {
self.init(
resourceFile: ResourceFile(
name: "packages_license",
fileExtension: "html",
bundle: .main
)
)
}

func readFileURL() throws {
guard let url = Bundle.main.url(forResource: fileName, withExtension: "html") else {
throw FileLoaderError.fileNotFound(name: fileName)
}
init(resourceFile: ResourceFile) {
self.resourceFile = resourceFile
}

fileURL = url
func loadURL() throws {
url = try resourceFile.fileURL()
}
}
6 changes: 6 additions & 0 deletions SwiftyForecast/Screens/About/Models/NetworkResourceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,21 @@ import Foundation

enum NetworkResourceType {
case privacyPolicy
case appWebPage
case appStoreReview
case appStorePreview
case weatherService

var stringURL: String {
switch self {
case .privacyPolicy:
"https://sites.google.com/view/pmilek/privacy-policy"
case .appWebPage:
"https://sites.google.com/view/pmilek/swifty-forecast"
case .appStoreReview:
"https://apps.apple.com/app/id1161186194?action=write-review"
case .appStorePreview:
"https://apps.apple.com/us/developer/pawel-milek/id1139599148"
case .weatherService:
"https://openweathermap.org"
}
Expand Down
8 changes: 5 additions & 3 deletions SwiftyForecast/Screens/About/ViewModel/AboutViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ final class AboutViewModel: ObservableObject {
@Published private(set) var appVersion: String
@Published private(set) var appCompatibility: String
@Published private(set) var appURLString: String
@Published private(set) var appStorePreviewURLString: String
@Published private(set) var currentYear: String
@Published private(set) var frameworks: [String]

Expand Down Expand Up @@ -42,7 +43,8 @@ final class AboutViewModel: ObservableObject {
appName = bundle.applicationName
appVersion = "\(bundle.versionNumber) (\(bundle.buildNumber))"
appCompatibility = "iOS \(bundle.minimumOSVersion)"
appURLString = "https://sites.google.com/view/pmilek/swifty-forecast"
appURLString = NetworkResourceType.appWebPage.stringURL
appStorePreviewURLString = NetworkResourceType.appStorePreview.stringURL
currentYear = Date.now.formatted(.dateTime.year())
frameworks = [
"UIKit",
Expand All @@ -61,7 +63,7 @@ final class AboutViewModel: ObservableObject {
let feedbackEmail = SupportEmail(
bundle: bundle,
recipient: buildConfigurationFile.supportEmailAddress(),
subject: "[Feedback] Swifty Forecast"
subject: "[Feedback] \(bundle.applicationName)"
)

feedbackEmail.send(openURL: openURL)
Expand All @@ -71,7 +73,7 @@ final class AboutViewModel: ObservableObject {
let bugEmail = SupportEmail(
bundle: bundle,
recipient: buildConfigurationFile.supportEmailAddress(),
subject: "[Bug] Swifty Forecast"
subject: "[Bug] \(bundle.applicationName)"
)
bugEmail.send(openURL: openURL)
}
Expand Down
2 changes: 1 addition & 1 deletion SwiftyForecast/Screens/About/Views/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct AboutView: View {
title: "Apps Preview",
label: nil,
link: (
destination: "https://apps.apple.com/us/developer/pawel-milek/id1139599148",
destination: viewModel.appStorePreviewURLString,
label: ""
),
action: nil
Expand Down
6 changes: 3 additions & 3 deletions SwiftyForecast/Screens/About/Views/LicenseView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import SwiftUI

struct LicenseView: View {
@StateObject private var reader = LicenseReader(fileName: "packages_license")
@StateObject private var license = PackageLicense()

var body: some View {
HTMLView(fileURL: reader.fileURL)
HTMLView(fileURL: license.url)
.padding(.top, 1)
.navigationBarTitle("Licenses")
.navigationBarTitleDisplayMode(.inline)
.onAppear {
try? reader.readFileURL()
try? license.loadURL()
}
}
}
Expand Down

0 comments on commit 030c1fa

Please sign in to comment.