Skip to content

5.2.0 changes #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 8, 2024
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
12 changes: 4 additions & 8 deletions DatWeatherDoe.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
20F17D3A26597A02003A164E /* WeatherData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20F17D3926597A02003A164E /* WeatherData.swift */; };
E3105BA62818805A00FB4C55 /* SunriseAndSunsetTextBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3105BA52818805A00FB4C55 /* SunriseAndSunsetTextBuilder.swift */; };
E3BE2C91292C505A00C4F468 /* DropdownIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BE2C90292C505A00C4F468 /* DropdownIcon.swift */; };
E3BE2C93292C50ED00C4F468 /* DropdownIconMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BE2C92292C50ED00C4F468 /* DropdownIconMapper.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -163,7 +162,6 @@
61D04A2F1C7B7BCF00CBE6AE /* DatWeatherDoeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DatWeatherDoeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
E3105BA52818805A00FB4C55 /* SunriseAndSunsetTextBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SunriseAndSunsetTextBuilder.swift; sourceTree = "<group>"; };
E3BE2C90292C505A00C4F468 /* DropdownIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownIcon.swift; sourceTree = "<group>"; };
E3BE2C92292C50ED00C4F468 /* DropdownIconMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DropdownIconMapper.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -256,7 +254,6 @@
children = (
2000D4072AD86DAA0052EDA6 /* WindSpeedFormatter.swift */,
E3BE2C90292C505A00C4F468 /* DropdownIcon.swift */,
E3BE2C92292C50ED00C4F468 /* DropdownIconMapper.swift */,
2039B3FA2C28D1B0006A6B6D /* CustomButton.swift */,
2039B3FC2C28D1C0006A6B6D /* MenuOptionsView.swift */,
2039B3FE2C28D1D3006A6B6D /* NonInteractiveMenuOptionView.swift */,
Expand Down Expand Up @@ -699,7 +696,6 @@
206E15252A7C4C5C0096D33C /* ConfigOptions.swift in Sources */,
2039B3E72C2896BD006A6B6D /* WindData.swift in Sources */,
2005C059278CB5FC0067BBD1 /* WeatherURLBuilder.swift in Sources */,
E3BE2C93292C50ED00C4F468 /* DropdownIconMapper.swift in Sources */,
20D857122A831802005727BB /* ConfigureWeatherOptionsView.swift in Sources */,
20D8571D2A831F40005727BB /* WeatherRepositoryFactory.swift in Sources */,
20B468192793989B00FC6050 /* HumidityTextBuilder.swift in Sources */,
Expand Down Expand Up @@ -868,7 +864,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 47;
CURRENT_PROJECT_VERSION = 48;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DatWeatherDoe/Resources/DevelopmentAssets\" \"DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift\"";
DEVELOPMENT_TEAM = Q8X4D3A8MT;
Expand All @@ -880,7 +876,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 5.1.0;
MARKETING_VERSION = 5.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.inderdhir.DatWeatherDoe.debug;
PRODUCT_NAME = DatWeatherDoe;
PROVISIONING_PROFILE = "";
Expand All @@ -898,7 +894,7 @@
CODE_SIGN_IDENTITY = "Mac Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 47;
CURRENT_PROJECT_VERSION = 48;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"DatWeatherDoe/Resources/DevelopmentAssets\" \"DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift\"";
DEVELOPMENT_TEAM = Q8X4D3A8MT;
Expand All @@ -910,7 +906,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 5.1.0;
MARKETING_VERSION = 5.2.0;
PRODUCT_BUNDLE_IDENTIFIER = com.inderdhir.DatWeatherDoe;
PRODUCT_NAME = DatWeatherDoe;
PROVISIONING_PROFILE = "";
Expand Down
6 changes: 5 additions & 1 deletion DatWeatherDoe/API/NetworkClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Copyright © 2022 Inder Dhir. All rights reserved.
//

import Foundation

Check notice on line 9 in DatWeatherDoe/API/NetworkClient.swift

View check run for this annotation

Xcode Cloud / DatWeatherDoe | Tests | Test - macOS

DatWeatherDoe/API/NetworkClient.swift#L9

Add '@preconcurrency' to suppress 'Sendable'-related warnings from module 'Foundation'

protocol NetworkClientType {
func performRequest(url: URL) async throws -> Data
Expand All @@ -14,6 +14,10 @@

final actor NetworkClient: NetworkClientType {
func performRequest(url: URL) async throws -> Data {
try await URLSession.shared.data(from: url).0
do {
return try await URLSession.shared.data(from: url).0

Check notice on line 18 in DatWeatherDoe/API/NetworkClient.swift

View check run for this annotation

Xcode Cloud / DatWeatherDoe | Tests | Test - macOS

DatWeatherDoe/API/NetworkClient.swift#L18

Passing argument of non-sendable type '(any URLSessionTaskDelegate)?' outside of actor-isolated context may introduce data races
} catch {
throw WeatherError.networkError
}
}
}
4 changes: 2 additions & 2 deletions DatWeatherDoe/API/Response/AirQuality.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// AirQualityIndex.swift
// AirQuality.swift
// DatWeatherDoe
//
// Created by Inder Dhir on 7/1/24.
Expand All @@ -16,7 +16,7 @@ enum AirQualityIndex: Int, Decodable {
case unhealthy = 4
case veryUnhealthy = 5
case hazardous = 6

var description: String {
switch self {
case .good:
Expand Down
40 changes: 23 additions & 17 deletions DatWeatherDoe/API/Response/WeatherAPIResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,60 +15,64 @@
let weatherConditionCode: Int
let humidity: Int
let windData: WindData
let uvIndex: Double
let forecastDayData: ForecastDayData
let airQualityIndex: AirQualityIndex

private enum RootKeys: String, CodingKey {
case location, current, forecast
}

private enum LocationKeys: String, CodingKey {
case name
}

private enum CurrentKeys: String, CodingKey {
case isDay = "is_day"
case condition, humidity
case airQuality = "air_quality"
case uvIndex = "uv"
}

private enum WeatherConditionKeys: String, CodingKey {
case code
}

private enum ForecastKeys: String, CodingKey {
case forecastDay = "forecastday"
}

private enum ForecastDayKeys: String, CodingKey {
case day, astro
}

private enum AirQualityKeys: String, CodingKey {
case usEpaIndex = "us-epa-index"
}

init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: RootKeys.self)

let locationContainer = try container.nestedContainer(keyedBy: LocationKeys.self, forKey: .location)
locationName = try locationContainer.decode(String.self, forKey: .name)
temperatureData = try container.decode(TemperatureData.self, forKey: .current)

let currentContainer = try container.nestedContainer(keyedBy: CurrentKeys.self, forKey: .current)
let isDayInt = try currentContainer.decode(Int.self, forKey: .isDay)
isDay = isDayInt > 0

let weatherConditionContainer = try currentContainer.nestedContainer(
keyedBy: WeatherConditionKeys.self,
forKey: .condition
)
weatherConditionCode = try weatherConditionContainer.decode(Int.self, forKey: .code)

windData = try container.decode(WindData.self, forKey: .current)


humidity = try currentContainer.decode(Int.self, forKey: .humidity)


windData = try container.decode(WindData.self, forKey: .current)

uvIndex = try currentContainer.decode(Double.self, forKey: .uvIndex)

let forecast = try container.decode(Forecast.self, forKey: .forecast)
if let dayData = forecast.dayDataArr.first {
forecastDayData = dayData
Expand All @@ -79,18 +83,19 @@
debugDescription: "Missing forecast day data"
)
}

let airQualityContainer = try currentContainer.nestedContainer(keyedBy: AirQualityKeys.self, forKey: .airQuality)

Check warning on line 87 in DatWeatherDoe/API/Response/WeatherAPIResponse.swift

View workflow job for this annotation

GitHub Actions / lint

Line Length Violation: Line should be 110 characters or less; currently it has 121 characters (line_length)
airQualityIndex = try airQualityContainer.decode(AirQualityIndex.self, forKey: .usEpaIndex)
}

init(
locationName: String,
temperatureData: TemperatureData,
isDay: Bool,
weatherConditionCode: Int,
humidity: Int,
windData: WindData,
uvIndex: Double,
forecastDayData: ForecastDayData,
airQualityIndex: AirQualityIndex
) {
Expand All @@ -100,6 +105,7 @@
self.weatherConditionCode = weatherConditionCode
self.humidity = humidity
self.windData = windData
self.uvIndex = uvIndex
self.forecastDayData = forecastDayData
self.airQualityIndex = airQualityIndex
}
Expand Down
4 changes: 2 additions & 2 deletions DatWeatherDoe/Config/ConfigManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protocol ConfigManagerType: AnyObject {

func updateWeatherSource(_ source: WeatherSource, sourceText: String)
func setConfigOptions(_ options: ConfigOptions)

var parsedMeasurementUnit: MeasurementUnit { get }
}

Expand Down Expand Up @@ -80,7 +80,7 @@ final class ConfigManager: ConfigManagerType {
valueSeparator = options.valueSeparator
isWeatherConditionAsTextEnabled = options.isWeatherConditionAsTextEnabled
}

var parsedMeasurementUnit: MeasurementUnit {
MeasurementUnit(rawValue: measurementUnit) ?? .imperial
}
Expand Down
1 change: 1 addition & 0 deletions DatWeatherDoe/Resources/DevelopmentAssets/TestData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let response = WeatherAPIResponse(
weatherConditionCode: 1000,
humidity: 45,
windData: .init(speedMph: 12.3, degrees: 305, direction: "NW"),
uvIndex: 7.0,
forecastDayData: .init(
temp: .init(
maxTempC: 32.8, maxTempF: 91.0, minTempC: 20.6, minTempF: 69.2
Expand Down
23 changes: 14 additions & 9 deletions DatWeatherDoe/Resources/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@
}
}
},
"AQI" : {
"comment" : "Air Quality Index",
"extractionState" : "manual"
},
"Before Temperature" : {
"comment" : "Weather condition before temperature",
"localizations" : {
Expand Down Expand Up @@ -578,11 +582,11 @@
}
},
"Good" : {
"comment" : "Air quality index: Good",
"comment" : "Air Quality Index: Good",
"extractionState" : "manual"
},
"Hazardous" : {
"comment" : "Air quality index: Hazardous",
"comment" : "Air Quality Index: Hazardous",
"extractionState" : "manual"
},
"Heavy rain" : {
Expand Down Expand Up @@ -650,9 +654,6 @@
}
}
},
"Key" : {
"extractionState" : "manual"
},
"Lat/Long" : {
"comment" : "Weather based on Lat/Long",
"localizations" : {
Expand Down Expand Up @@ -822,7 +823,7 @@
}
},
"Moderate" : {
"comment" : "Air quality index: Moderate",
"comment" : "Air Quality Index: Moderate",
"extractionState" : "manual"
},
"NSHumanReadableCopyright" : {
Expand Down Expand Up @@ -1280,11 +1281,11 @@
}
},
"Unhealthy" : {
"comment" : "Air quality index: Unhealthy",
"comment" : "Air Quality Index: Unhealthy",
"extractionState" : "manual"
},
"Unhealthy for sensitive groups" : {
"comment" : "Air quality index: Unhealthy for sensitive groups",
"comment" : "Air Quality Index: Unhealthy for sensitive groups",
"extractionState" : "manual"
},
"Unit" : {
Expand Down Expand Up @@ -1406,8 +1407,12 @@
}
}
},
"UV Index" : {
"comment" : "UV Index",
"extractionState" : "manual"
},
"Very unhealthy" : {
"comment" : "Air quality index: Very unhealthy",
"comment" : "Air Quality Index: Very unhealthy",
"extractionState" : "manual"
},
"Weather Condition Position" : {
Expand Down
4 changes: 2 additions & 2 deletions DatWeatherDoe/UI/Decorator/Condition/WeatherCondition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ enum WeatherCondition {
static func getFallback(isDay: Bool) -> WeatherCondition {
isDay ? .sunny : .clearNight
}

var symbolName: String {
switch self {
case .cloudy:
Expand All @@ -45,7 +45,7 @@ enum WeatherCondition {
"cloud.fog"
}
}

var accessibilityLabel: String {
switch self {
case .cloudy:
Expand Down
9 changes: 7 additions & 2 deletions DatWeatherDoe/UI/Menu Bar/DropdownIcon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum DropdownIcon {
case thermometer
case sun
case wind

case uvIndexAndAirQualityText

var symbolName: String {
switch self {
case .location:
Expand All @@ -23,9 +24,11 @@ enum DropdownIcon {
"sun.horizon.circle"
case .wind:
"wind.circle"
case .uvIndexAndAirQualityText:
"sun.max.circle"
}
}

var accessibilityLabel: String {
switch self {
case .location:
Expand All @@ -36,6 +39,8 @@ enum DropdownIcon {
"Sunrise and Sunset"
case .wind:
"Wind data"
case .uvIndexAndAirQualityText:
"UV Index and Air Quality Index"
}
}
}
41 changes: 0 additions & 41 deletions DatWeatherDoe/UI/Menu Bar/DropdownIconMapper.swift

This file was deleted.

Loading
Loading