Skip to content

Commit

Permalink
Merge pull request #41 from worthbak/wb/mac-studio-bug
Browse files Browse the repository at this point in the history
bug fixes
  • Loading branch information
worthbak authored Jul 17, 2022
2 parents 4ab6084 + 24162e1 commit 3354f8c
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 43 deletions.
8 changes: 4 additions & 4 deletions InventoryWatch.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"InventoryWatch/Preview Content\"";
DEVELOPMENT_TEAM = 64A6JSYH8N;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -324,7 +324,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 0.0.6;
MARKETING_VERSION = 0.0.7;
PRODUCT_BUNDLE_IDENTIFIER = com.worthbak.InventoryWatch;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -341,7 +341,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"InventoryWatch/Preview Content\"";
DEVELOPMENT_TEAM = 64A6JSYH8N;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -354,7 +354,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 0.0.6;
MARKETING_VERSION = 0.0.7;
PRODUCT_BUNDLE_IDENTIFIER = com.worthbak.InventoryWatch;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
44 changes: 29 additions & 15 deletions InventoryWatch/Countries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,67 @@ struct Country: Hashable {
let name: String
let storePathComponent: String
let skuCode: String
let altSkuCode: String? // for ipad in some countries

private static let GermanyAltCode = "FD"
private static let CanadaAltCode = "VC"

/// Some countries have alternate country code schemes for specific products, which are accounted for here.
func skuCode(for product: ProductType) -> String? {
switch product {
case .MacStudio, .StudioDisplay:
return name == "Canada" ? Country.CanadaAltCode : nil
case .iPadWifi, .iPadCellular:
switch name {
case "Germany":
return Country.GermanyAltCode
case "Canada":
return Country.CanadaAltCode
default:
return nil
}
default:
return nil
}
}
}

let USData = Country(
name: "United States",
storePathComponent: "",
skuCode: "LL",
altSkuCode: nil
skuCode: "LL"
)

let Countries: [String: Country] = [
"US": USData,
"CA": Country(
name: "Canada",
storePathComponent: "/ca",
skuCode: "LL",
altSkuCode: "VC"
skuCode: "LL"
),
"AU": Country(
name: "Australia",
storePathComponent: "/au",
skuCode: "X",
altSkuCode: nil
skuCode: "X"
),
"DE": Country(
name: "Germany",
storePathComponent: "/de",
skuCode: "D",
altSkuCode: "FD"
skuCode: "D"
),
"UK": Country(
name: "United Kingdom",
storePathComponent: "/uk",
skuCode: "B",
altSkuCode: nil
skuCode: "B"
),
"KR": Country(
name: "South Korea",
storePathComponent: "/kr",
skuCode: "KH",
altSkuCode: nil
skuCode: "KH"
),
"HK": Country(
name: "Hong Kong",
storePathComponent: "/hk",
skuCode: "ZP",
altSkuCode: nil
skuCode: "ZP"
)
];

Expand Down
49 changes: 27 additions & 22 deletions InventoryWatch/SKUData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct SKUData {
}

func iPadDataForCountry(_ country: Country, isWifi: Bool) -> SKUData {
let skuCode = country.altSkuCode ?? country.skuCode
let skuCode = country.skuCode(for: isWifi ? .iPadWifi : .iPadCellular) ?? country.skuCode

let wifiData = [
"MK7R3": "iPad Mini 64GB Purple Wifi",
Expand Down Expand Up @@ -64,36 +64,40 @@ func iPadDataForCountry(_ country: Country, isWifi: Bool) -> SKUData {
}

func StudioDisplayForCountry(_ country: Country) -> SKUData {
let skuCode = country.skuCode(for: .StudioDisplay) ?? country.skuCode

let orderedSkus = [
"MK0U3\(country.skuCode)/A",
"MK0Q3\(country.skuCode)/A",
"MMYQ3\(country.skuCode)/A",
"MMYW3\(country.skuCode)/A",
"MMYV3\(country.skuCode)/A",
"MMYX3\(country.skuCode)/A"
"MK0U3\(skuCode)/A",
"MK0Q3\(skuCode)/A",
"MMYQ3\(skuCode)/A",
"MMYW3\(skuCode)/A",
"MMYV3\(skuCode)/A",
"MMYX3\(skuCode)/A"
]

let skusToName = [
"MK0U3\(country.skuCode)/A": "Studio Display - Standard glass - Tilt-adjustable stand",
"MK0Q3\(country.skuCode)/A": "Studio Display - Standard glass - Tilt- and height-adjustable stand",
"MMYQ3\(country.skuCode)/A": "Studio Display - Standard glass - VESA mount adapter",
"MMYW3\(country.skuCode)/A": "Studio Display - Nano-texture glass - Tilt-adjustable stand",
"MMYV3\(country.skuCode)/A": "Studio Display - Nano-texture glass - Tilt- and height-adjustable stand",
"MMYX3\(country.skuCode)/A": "Studio Display - Nano-texture glass - VESA mount adapter"
"MK0U3\(skuCode)/A": "Studio Display - Standard glass - Tilt-adjustable stand",
"MK0Q3\(skuCode)/A": "Studio Display - Standard glass - Tilt- and height-adjustable stand",
"MMYQ3\(skuCode)/A": "Studio Display - Standard glass - VESA mount adapter",
"MMYW3\(skuCode)/A": "Studio Display - Nano-texture glass - Tilt-adjustable stand",
"MMYV3\(skuCode)/A": "Studio Display - Nano-texture glass - Tilt- and height-adjustable stand",
"MMYX3\(skuCode)/A": "Studio Display - Nano-texture glass - VESA mount adapter"
]

return SKUData(orderedSKUs: orderedSkus, lookup: skusToName)
}

func MacStudioDataForCountry(_ country: Country) -> SKUData {
let skuCode = country.skuCode(for: .MacStudio) ?? country.skuCode

let orderedSkus = [
"MJMW3\(country.skuCode)/A",
"MJMV3\(country.skuCode)/A"
"MJMW3\(skuCode)/A",
"MJMV3\(skuCode)/A"
]

let skusToName = [
"MJMV3\(country.skuCode)/A": "M1 Max (10c CPU, 24c GPU), 32GB RAM, 512GB SSD",
"MJMW3\(country.skuCode)/A": "M1 Ultra (20c CPU, 48c GPU), 64GB RAM, 1TB SSD"
"MJMV3\(skuCode)/A": "M1 Max (10c CPU, 24c GPU), 32GB RAM, 512GB SSD",
"MJMW3\(skuCode)/A": "M1 Ultra (20c CPU, 48c GPU), 64GB RAM, 1TB SSD"
]

return SKUData(orderedSKUs: orderedSkus, lookup: skusToName)
Expand Down Expand Up @@ -129,11 +133,12 @@ func MBPDataForCountry(_ country: Country) -> SKUData {
"MKGQ3\(country.skuCode)/A": "14\" M1 Pro (10c CPU, 16c GPU) 16GB/1TB Space Grey",
"MMQX3\(country.skuCode)/A": "14\" M1 Max (10c CPU, 32c GPU) 64GB/2TB Silver, Ultimate",
"MKH53\(country.skuCode)/A": "14\" M1 Max (10c CPU, 32c GPU) 64GB/2TB Space Grey, Ultimate",

"MK1F3\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/512GB Silver",
"MK193\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/512GB Space Grey",
"MK1E3\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/1TB Silver",
"MK183\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/1TB Space Grey",

"MK1E3\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/512GB Silver",
"MK183\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/512GB Space Grey",
"MK1F3\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/1TB Silver",
"MK193\(country.skuCode)/A": "16\" M1 Pro (10c CPU, 16c GPU) 16GB/1TB Space Grey",

"MK1H3\(country.skuCode)/A": "16\" M1 Max (10c CPU, 32c GPU) 32GB/1TB Silver",
"MK1A3\(country.skuCode)/A": "16\" M1 Max (10c CPU, 32c GPU) 32GB/1TB Space Grey",
"MMQW3\(country.skuCode)/A": "16\" M1 Max (10c CPU, 32c GPU) 64GB/4TB Silver, Ultimate",
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## [Download InventoryWatch (0.0.6) Now ⤵️](./InventoryWatch-0.0.6.zip)
## [Download InventoryWatch (0.0.7) Now ⤵️](./InventoryWatch-0.0.7.zip)

![InventoryWatch-Screenshot](./ic-mkt.jpg)

Expand Down Expand Up @@ -55,4 +55,4 @@ macOS Big Sur 11.5 or newer. InventoryWatch is built with SwiftUI.

## Ready to go?

[Download InventoryWatch (0.0.6) Now ⤵️](./InventoryWatch-0.0.6.zip)
[Download InventoryWatch (0.0.7) Now ⤵️](./InventoryWatch-0.0.7.zip)

0 comments on commit 3354f8c

Please sign in to comment.