Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Commit

Permalink
Add UI sounds similar to Front Row
Browse files Browse the repository at this point in the history
Add Settings toggle for UI sounds
Simplify Dark Mode code (the workaround didn't work anyway)
Update build to 40, version to 1.3
Update bundled XML files
Update README.md
  • Loading branch information
conath committed May 25, 2021
1 parent 3eec0f0 commit 84e00ac
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 63 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ This app does not collect any personally identifiable information. See [Privacy]
See [License](LICENSE) for details about the source code license.

Two XML files from iTunes Movie Trailers are included with the project for reference and educational purposes. The [License](LICENSE) does not cover these XML files.
Four AIFF files from [Front Row](https://en.wikipedia.org/wiki/Front_Row_(software)) are included with the project. These files are also not covered by the [License](LICENSE).

The Apple Logo, AirPlay, iOS, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries.
The Apple Logo, AirPlay, iOS, iTunes, and Front Row are trademarks of Apple Inc., registered in the U.S. and other countries.
FRIENDSGIVING is © 2020 SABAN FILMS.
40 changes: 32 additions & 8 deletions TheatricalMovieTrailers.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
834FFDC4254085ED007E63C2 /* AVPlayerViewController+enterFullScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 834FFDC3254085ED007E63C2 /* AVPlayerViewController+enterFullScreen.swift */; };
8379E84F25A0904400A1CDF2 /* CoverFlowRotatingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 834ADB3C25398496002D9F1E /* CoverFlowRotatingView.swift */; };
8379E86025A09EC100A1CDF2 /* LargePosterReflectionWithTitle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8379E85D25A09CFB00A1CDF2 /* LargePosterReflectionWithTitle.swift */; };
837BFE0E265C4E3400E2B86A /* Limit.aif in Resources */ = {isa = PBXBuildFile; fileRef = 837BFE0D265C4E1C00E2B86A /* Limit.aif */; };
837BFE0F265C4E3600E2B86A /* Selection.aif in Resources */ = {isa = PBXBuildFile; fileRef = 837BFE0C265C4E1C00E2B86A /* Selection.aif */; };
837BFE12265C4EE900E2B86A /* Exit.aif in Resources */ = {isa = PBXBuildFile; fileRef = 837BFE10265C4EE500E2B86A /* Exit.aif */; };
837BFE13265C4EE900E2B86A /* SelectionChange.aif in Resources */ = {isa = PBXBuildFile; fileRef = 837BFE11265C4EE500E2B86A /* SelectionChange.aif */; };
837DB1402548CE200071CB2E /* ShareSheet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 837DB13F2548CE200071CB2E /* ShareSheet.swift */; };
837DB1432548D5E30071CB2E /* AppStoreReviewsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 837DB1422548D5E30071CB2E /* AppStoreReviewsManager.swift */; };
8380C59C24A665B000CA1EB4 /* TrailerMetaView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8380C59B24A665B000CA1EB4 /* TrailerMetaView.swift */; };
Expand Down Expand Up @@ -127,6 +131,10 @@
834FF5BC2572A43F00A4AF39 /* TrailersWidgetExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = TrailersWidgetExtension.entitlements; sourceTree = "<group>"; };
834FFDC3254085ED007E63C2 /* AVPlayerViewController+enterFullScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AVPlayerViewController+enterFullScreen.swift"; sourceTree = "<group>"; };
8379E85D25A09CFB00A1CDF2 /* LargePosterReflectionWithTitle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LargePosterReflectionWithTitle.swift; sourceTree = "<group>"; };
837BFE0C265C4E1C00E2B86A /* Selection.aif */ = {isa = PBXFileReference; lastKnownFileType = file; path = Selection.aif; sourceTree = "<group>"; };
837BFE0D265C4E1C00E2B86A /* Limit.aif */ = {isa = PBXFileReference; lastKnownFileType = file; path = Limit.aif; sourceTree = "<group>"; };
837BFE10265C4EE500E2B86A /* Exit.aif */ = {isa = PBXFileReference; lastKnownFileType = file; path = Exit.aif; sourceTree = "<group>"; };
837BFE11265C4EE500E2B86A /* SelectionChange.aif */ = {isa = PBXFileReference; lastKnownFileType = file; path = SelectionChange.aif; sourceTree = "<group>"; };
837DB13F2548CE200071CB2E /* ShareSheet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareSheet.swift; sourceTree = "<group>"; };
837DB1422548D5E30071CB2E /* AppStoreReviewsManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppStoreReviewsManager.swift; sourceTree = "<group>"; };
8380C59B24A665B000CA1EB4 /* TrailerMetaView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrailerMetaView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -240,9 +248,21 @@
path = TrailersWidget;
sourceTree = "<group>";
};
837BFE0B265C4E1500E2B86A /* Audio Files */ = {
isa = PBXGroup;
children = (
837BFE10265C4EE500E2B86A /* Exit.aif */,
837BFE11265C4EE500E2B86A /* SelectionChange.aif */,
837BFE0C265C4E1C00E2B86A /* Selection.aif */,
837BFE0D265C4E1C00E2B86A /* Limit.aif */,
);
path = "Audio Files";
sourceTree = "<group>";
};
8380C59F24A670D800CA1EB4 /* Supporting Files */ = {
isa = PBXGroup;
children = (
837BFE0B265C4E1500E2B86A /* Audio Files */,
83AC6270255018CE00197B0B /* API Extensions */,
831F1B5D2549792A008D24D4 /* currentTrailers.bundle */,
8316E0EE24A64AD400467F14 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -396,6 +416,10 @@
8316E0ED24A64AD400467F14 /* Preview Assets.xcassets in Resources */,
8316E0EA24A64AD400467F14 /* Assets.xcassets in Resources */,
831F1B5E2549792A008D24D4 /* currentTrailers.bundle in Resources */,
837BFE0E265C4E3400E2B86A /* Limit.aif in Resources */,
837BFE13265C4EE900E2B86A /* SelectionChange.aif in Resources */,
837BFE0F265C4E3600E2B86A /* Selection.aif in Resources */,
837BFE12265C4EE900E2B86A /* Exit.aif in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -622,7 +646,7 @@
CODE_SIGN_ENTITLEMENTS = TheatricalMovieTrailers/TheatricalMovieTrailers.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_ASSET_PATHS = "\"TheatricalMovieTrailers/Preview Content\"";
DEVELOPMENT_TEAM = U96PJYMZWW;
ENABLE_PREVIEWS = YES;
Expand All @@ -632,7 +656,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -650,7 +674,7 @@
CODE_SIGN_ENTITLEMENTS = TheatricalMovieTrailers/TheatricalMovieTrailers.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_ASSET_PATHS = "\"TheatricalMovieTrailers/Preview Content\"";
DEVELOPMENT_TEAM = U96PJYMZWW;
ENABLE_PREVIEWS = YES;
Expand All @@ -660,7 +684,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.2;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -677,7 +701,7 @@
CODE_SIGN_ENTITLEMENTS = TrailersWidgetExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_TEAM = U96PJYMZWW;
INFOPLIST_FILE = TrailersWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand All @@ -686,7 +710,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt.TrailersWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -703,7 +727,7 @@
CODE_SIGN_ENTITLEMENTS = TrailersWidgetExtension.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 36;
CURRENT_PROJECT_VERSION = 40;
DEVELOPMENT_TEAM = U96PJYMZWW;
INFOPLIST_FILE = TrailersWidget/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
Expand All @@ -712,7 +736,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.2;
MARKETING_VERSION = 1.3;
PRODUCT_BUNDLE_IDENTIFIER = cafe.chrisp.tmt.TrailersWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down
21 changes: 19 additions & 2 deletions TheatricalMovieTrailers/Model/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ fileprivate extension String {
static let loadHighDefinition = "loadHighDefinition"
static let firstLaunchedDate = "firstLaunchedDate"
static let lastReviewRequestAppVersion = "lastReviewRequestAppVersion"
static let playUISounds = "playUISounds"
}

class Settings: ObservableObject {
Expand Down Expand Up @@ -53,14 +54,22 @@ class Settings: ObservableObject {
defaults.synchronize()
}
}
/// Added in Build 40
/// Whether to play FrontRow-inspired UI sounds
@Published var playUISounds = true {
didSet {
let defaults = Self.userDefaults
defaults.setValue(playUISounds, forKey: .playUISounds)
defaults.synchronize()
}
}

private init() {
let defaults = Self.userDefaults
/// Check for version upgrade
let lastBuild = defaults.string(forKey: .lastBuildNumber)
if lastBuild == nil {
let oldDefaults = UserDefaults()
/// If last build is 31, that used non-specific UserDefaults suite. Must migrate!
let oldBuild = oldDefaults.string(forKey: .lastBuildNumber)
if let old = oldBuild, let oldNumber = Int(old) {
if oldNumber < 30 {
Expand All @@ -70,6 +79,7 @@ class Settings: ObservableObject {
firstLaunchedDate = oldDefaults.value(forKey: .firstLaunchedDate) as! Date
}
}
/// If last build is older than 30, that used non-specific UserDefaults suite. Must migrate!
if oldDefaults.string(forKey: .lastBuildNumber) == "31" {
/// Migrate settings to new defaults suite
let isAutoDark = oldDefaults.integer(forKey: .autoDark) == ValueAutomaticDark
Expand All @@ -91,8 +101,13 @@ class Settings: ObservableObject {
defaults.setValue(Date(), forKey: .firstLaunchedDate)
}
} else if let prevBuild = lastBuild, prevBuild != UIApplication.build {
let prevBuild = Int(prevBuild)!
/// Version upgrade happened
/// There are no changes yet in the new settings.
/// Upgrade from older to 40
if prevBuild < 40 {
/// Added playUISounds key; default value should be true but it's false for a boolean
defaults.setValue(true, forKey: .playUISounds)
}
defaults.setValue(UIApplication.build, forKey: .lastBuildNumber)
}
/// Load settings
Expand All @@ -103,5 +118,7 @@ class Settings: ObservableObject {
/// App Store Reviews Manager metadata
firstLaunchedDate = defaults.value(forKey: .firstLaunchedDate) as! Date
lastReviewRequestAppVersion = defaults.string(forKey: .lastReviewRequestAppVersion)
/// UI Sounds
playUISounds = defaults.bool(forKey: .playUISounds)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,8 @@ struct CustomDarkAppearance: ViewModifier {
@ObservedObject var settings = Settings.instance

func body(content: Content) -> some View {
if settings.prefersDarkAppearance {
return AnyView(
content
.preferredColorScheme(.dark)
)
} else {
return AnyView(
content
.preferredColorScheme(
// using .none does cause the ContentView to update properly
// if prefersDarkAppearance was switched from true to false
UITraitCollection().userInterfaceStyle == .dark ? .dark : .light
)
)
}
AnyView(
content.preferredColorScheme(settings.prefersDarkAppearance ? .some(.dark) : .none)
)
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions TheatricalMovieTrailers/Views/CoverFlowMovieMetaView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct CoverFlowMovieMetaView: View {
RoundedRectangle(cornerRadius: 25.0, style: .continuous)
)
})
.disabled(!dataStore.streamingAvailable)
.foregroundColor(dataStore.streamingAvailable ? Color(.systemBlue) : Color(.systemGray))
.hoverEffect(.lift)
.padding(.init(top: 0, leading: 16, bottom: 16, trailing: 16))

Expand Down Expand Up @@ -108,7 +108,7 @@ struct CoverFlowMovieMetaView: View {
RoundedRectangle(cornerRadius: 25.0, style: .continuous)
)
})
.disabled(!dataStore.streamingAvailable)
.foregroundColor(dataStore.streamingAvailable ? Color(.systemBlue) : Color(.systemGray))
.hoverEffect(.lift)
.padding()
/// Share button
Expand Down
Loading

0 comments on commit 84e00ac

Please sign in to comment.