Skip to content

Commit

Permalink
release: 0.8.69
Browse files Browse the repository at this point in the history
  • Loading branch information
appfairz committed Jul 8, 2022
1 parent 7f91f1a commit a255a5f
Show file tree
Hide file tree
Showing 14 changed files with 660 additions and 396 deletions.
4 changes: 2 additions & 2 deletions AppFairApp.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ PRODUCT_NAME = App Fair
PRODUCT_BUNDLE_IDENTIFIER = app.App-Fair

// The semantic version for the app matching the git tag for the release
MARKETING_VERSION = 0.8.67
MARKETING_VERSION = 0.8.69

// The monotonically increasing number specifying the internal app version
CURRENT_PROJECT_VERSION = 796
CURRENT_PROJECT_VERSION = 799

// The category of the app should be one of: public.app-category.business, developer-tools, education, entertainment, finance, games, graphics-design, healthcare-fitness, lifestyle, medical, music, news, photography, productivity, reference, social-networking, sports, travel, utilities, video, weather
APP_CATEGORY = public.app-category.utilities
Expand Down
60 changes: 9 additions & 51 deletions Sources/App/AppFairCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import Combine

/// The source of the apps
public enum AppSource: String, CaseIterable {
/// The Homebrew Casks catalog from [formulae.brew.sh](https://formulae.brew.sh)
case homebrew

/// The Fairapps catalog from [appfair.net](https://appfair.net)
case fairapps
}

Expand Down Expand Up @@ -47,9 +50,10 @@ public extension AppSource {
}
}

struct AppInfo : Identifiable, Equatable {
/// A structure representing an ``FairApp.AppCatalogItem`` with optional ``CaskItem`` metadata.
struct AppInfo : Identifiable {
/// The catalog item metadata
var catalogMetadata: AppCatalogItem
var app: AppCatalogItem

/// The associated homebrew cask
var cask: CaskItem?
Expand All @@ -61,7 +65,7 @@ struct AppInfo : Identifiable, Equatable {

/// The bundle ID of the selected app (e.g., "app.App-Name")
var id: AppCatalogItem.ID {
catalogMetadata.id
app.id
}

/// Returns the homepage for the info URL
Expand All @@ -75,59 +79,13 @@ struct AppInfo : Identifiable, Equatable {

return nil
} else {
return catalogMetadata.homepage
return app.homepage
}
}

/// The categories as should be displayed in the UI; this will collapes sub-groups (i.e., game categories) into their parent groups.
var displayCategories: [AppCategory] {
catalogMetadata.appCategories
.map { cat in
switch cat {
case .business: return .business
case .developertools: return .developertools
case .education: return .education
case .entertainment: return .entertainment
case .finance: return .finance
case .graphicsdesign: return .graphicsdesign
case .healthcarefitness: return .healthcarefitness
case .lifestyle: return .lifestyle
case .medical: return .medical
case .music: return .music
case .news: return .news
case .photography: return .photography
case .productivity: return .productivity
case .reference: return .reference
case .socialnetworking: return .socialnetworking
case .sports: return .sports
case .travel: return .travel
case .utilities: return .utilities
case .video: return .video
case .weather: return .weather

case .games: return .games

case .actiongames: return .games
case .adventuregames: return .games
case .arcadegames: return .games
case .boardgames: return .games
case .cardgames: return .games
case .casinogames: return .games
case .dicegames: return .games
case .educationalgames: return .games
case .familygames: return .games
case .kidsgames: return .games
case .musicgames: return .games
case .puzzlegames: return .games
case .racinggames: return .games
case .roleplayinggames: return .games
case .simulationgames: return .games
case .sportsgames: return .games
case .strategygames: return .games
case .triviagames: return .games
case .wordgames: return .games
}
}
app.appCategories.filter({ $0.parentCategory == nil })
}
}

Expand Down
51 changes: 51 additions & 0 deletions Sources/App/AppSources.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,57 @@ public extension AppCategory {
}
}

/// Returns the parent category of this category, or nil
/// if it is a root category.
///
/// E.g., the parent category of ``boardgames`` is ``games``.
var parentCategory: AppCategory? {
switch self {
case .business: return nil
case .developertools: return nil
case .education: return nil
case .entertainment: return nil
case .finance: return nil
case .graphicsdesign: return nil
case .healthcarefitness: return nil
case .lifestyle: return nil
case .medical: return nil
case .music: return nil
case .news: return nil
case .photography: return nil
case .productivity: return nil
case .reference: return nil
case .socialnetworking: return nil
case .sports: return nil
case .travel: return nil
case .utilities: return nil
case .video: return nil
case .weather: return nil

case .games: return nil

case .actiongames: return .games
case .adventuregames: return .games
case .arcadegames: return .games
case .boardgames: return .games
case .cardgames: return .games
case .casinogames: return .games
case .dicegames: return .games
case .educationalgames: return .games
case .familygames: return .games
case .kidsgames: return .games
case .musicgames: return .games
case .puzzlegames: return .games
case .racinggames: return .games
case .roleplayinggames: return .games
case .simulationgames: return .games
case .sportsgames: return .games
case .strategygames: return .games
case .triviagames: return .games
case .wordgames: return .games
}
}

func tintedLabel(monochrome: Bool) -> TintedLabel {
TintedLabel(title: text, symbol: symbol, tint: monochrome ? nil : tint, mode: monochrome ? .monochrome : nil)
}
Expand Down
Binary file modified Sources/App/Bundle/appfair-homebrew.zip
Binary file not shown.
18 changes: 11 additions & 7 deletions Sources/App/FairManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ import Combine

@AppStorage("enableInstallWarning") public var enableInstallWarning = true
@AppStorage("enableDeleteWarning") public var enableDeleteWarning = true
@AppStorage("enableFundingSupport") public var enableFundingSupport = wip(assertionsEnabled)

/// The base domain of the provider for the hub
@AppStorage("hubProvider") public var hubProvider = "github.com"
/// The organization name of the hub
@AppStorage("hubOrg") public var hubOrg = appfairName
@AppStorage("hubOrg") public var hubOrg = "appfair"
/// The name of the base repository for the provider
@AppStorage("hubRepo") public var hubRepo = Bundle.appfairDefaultAppName
@AppStorage("hubRepo") public var hubRepo = "App"

/// An optional authorization token for direct API usagefor the organization
@AppStorage("hubToken") public var hubToken = ""
Expand All @@ -44,6 +45,9 @@ import Combine
/// Whether links clicked in the embedded browser should open in a new browser window
@AppStorage("openLinksInNewBrowser") var openLinksInNewBrowser = true

/// Whether the embedded browser should use private browsing mode for untrusted sites
@AppStorage("usePrivateBrowsingMode") var usePrivateBrowsingMode = true

/// The appManager, which should be extracted as a separate `EnvironmentObject`
@Published var fairAppInv: FairAppInventory
/// The caskManager, which should be extracted as a separate `EnvironmentObject`
Expand Down Expand Up @@ -122,7 +126,7 @@ import Combine
if info.isCask == true {
homeBrewInv.icon(for: info, useInstalledIcon: false)
} else {
fairAppInv.iconImage(item: info.catalogMetadata)
fairAppInv.iconImage(item: info.app)
}
}
//.transition(AnyTransition.scale(scale: 0.50).combined(with: .opacity)) // bounce & fade in the icon
Expand All @@ -139,7 +143,7 @@ import Combine
if info.isCask == true {
try await homeBrewInv.launch(item: info)
} else {
await fairAppInv.launch(item: info.catalogMetadata)
await fairAppInv.launch(item: info.app)
}
}
}
Expand All @@ -149,7 +153,7 @@ import Combine
if info.isCask {
try await homeBrewInv.install(item: info, progress: parentProgress, update: update)
} else {
try await fairAppInv.install(item: info.catalogMetadata, progress: parentProgress, update: update)
try await fairAppInv.install(item: info.app, progress: parentProgress, update: update)
}
sessionInstalls.insert(info.id)
}
Expand All @@ -159,15 +163,15 @@ import Combine
if item.isCask {
return homeBrewInv.appInstalled(item: item)
} else {
return fairAppInv.appInstalled(item: item.catalogMetadata)
return fairAppInv.appInstalled(item: item.app)
}
}

func appUpdated(for item: AppInfo) -> Bool {
if item.isCask {
return homeBrewInv.appUpdated(item: item)
} else {
return fairAppInv.appUpdated(item: item.catalogMetadata)
return fairAppInv.appUpdated(item: item.app)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/App/Inventory/AppInventory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protocol AppInventoryCatalog {
/// The `AppInventory` protocol handles installing and managing apps.
protocol AppInventory : AppInventoryCatalog {
/// The inventory item associated with this inventory list
associatedtype InventoryItem : Equatable
associatedtype InventoryItem

/// Returns the version string if the given inventory item is currently installed
@MainActor func appInstalled(item: InventoryItem) -> String?
Expand Down
8 changes: 4 additions & 4 deletions Sources/App/Inventory/FairAppInventory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ extension FairAppInventory {
.filter({ sidebarSelection?.item.isLocalFilter == true || matchesRiskFilter(item: $0) })
.filter({ matchesSearch(item: $0, searchText: searchText) })
.filter({ selectionFilter(sidebarSelection, item: $0) }) // TODO: fix categories for app item
.map({ AppInfo(catalogMetadata: $0) })
.map({ AppInfo(app: $0) })
.sorted(using: sortOrder + categorySortOrder(category: sidebarSelection?.item))
}

Expand All @@ -297,11 +297,11 @@ extension FairAppInventory {
case .top:
return [] // use server-defined ordering [KeyPathComparator(\AppInfo.catalogMetadata.downloadCount, order: .reverse)]
case .recent:
return [KeyPathComparator(\AppInfo.catalogMetadata.versionDate, order: .reverse)]
return [KeyPathComparator(\AppInfo.app.versionDate, order: .reverse)]
case .updated:
return [KeyPathComparator(\AppInfo.catalogMetadata.versionDate, order: .reverse)]
return [KeyPathComparator(\AppInfo.app.versionDate, order: .reverse)]
case .installed:
return [KeyPathComparator(\AppInfo.catalogMetadata.name, order: .forward)]
return [KeyPathComparator(\AppInfo.app.name, order: .forward)]
case .category:
return []
}
Expand Down
Loading

0 comments on commit a255a5f

Please sign in to comment.