Skip to content

Commit

Permalink
[PlayCase] Adds 1 time popup
Browse files Browse the repository at this point in the history
  • Loading branch information
LitRitt committed Sep 14, 2024
1 parent 818a04b commit 134a9d2
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 15 deletions.
16 changes: 16 additions & 0 deletions Ignited.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@
AC51F1842BAE3A9E003A41D5 /* MGBAOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC51F1832BAE3A9E003A41D5 /* MGBAOptions.swift */; };
AC52A7F22B67739200261267 /* OptionColorPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC52A7F12B67739200261267 /* OptionColorPickerView.swift */; };
AC52A7F42B6773BB00261267 /* OptionSliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC52A7F32B6773BB00261267 /* OptionSliderView.swift */; };
AC53D1CF2C95DD07006AAB98 /* PlayCaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC53D1CE2C95DD07006AAB98 /* PlayCaseView.swift */; };
AC53D1D12C95DD71006AAB98 /* PlayCaseLogoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC53D1D02C95DD71006AAB98 /* PlayCaseLogoView.swift */; };
AC56DDF02A35F38D007C8372 /* N64Features.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC56DDEF2A35F38D007C8372 /* N64Features.swift */; };
AC5A40762B2106470049B755 /* MappingGameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC5A40752B2106470049B755 /* MappingGameViewController.swift */; };
AC5B25232A4F4E4B00591511 /* ExternalDisplaySceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC5B25222A4F4E4B00591511 /* ExternalDisplaySceneDelegate.swift */; };
Expand Down Expand Up @@ -445,6 +447,8 @@
AC51F1832BAE3A9E003A41D5 /* MGBAOptions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MGBAOptions.swift; sourceTree = "<group>"; };
AC52A7F12B67739200261267 /* OptionColorPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionColorPickerView.swift; sourceTree = "<group>"; };
AC52A7F32B6773BB00261267 /* OptionSliderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionSliderView.swift; sourceTree = "<group>"; };
AC53D1CE2C95DD07006AAB98 /* PlayCaseView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayCaseView.swift; sourceTree = "<group>"; };
AC53D1D02C95DD71006AAB98 /* PlayCaseLogoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayCaseLogoView.swift; sourceTree = "<group>"; };
AC56DDEF2A35F38D007C8372 /* N64Features.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = N64Features.swift; sourceTree = "<group>"; };
AC5A40752B2106470049B755 /* MappingGameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MappingGameViewController.swift; sourceTree = "<group>"; };
AC5B25222A4F4E4B00591511 /* ExternalDisplaySceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalDisplaySceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -936,6 +940,15 @@
path = "Button Sounds";
sourceTree = "<group>";
};
AC53D1CD2C95DCF3006AAB98 /* PlayCase */ = {
isa = PBXGroup;
children = (
AC53D1CE2C95DD07006AAB98 /* PlayCaseView.swift */,
AC53D1D02C95DD71006AAB98 /* PlayCaseLogoView.swift */,
);
path = PlayCase;
sourceTree = "<group>";
};
AC56DDEE2A35F327007C8372 /* N64 */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1673,6 +1686,7 @@
BF525EE61FF5F355004AA849 /* Deep Linking */,
AC7262D82C49B30D0009B577 /* Patreon */,
AC7FCC992BC113090072BF7C /* Purchases */,
AC53D1CD2C95DCF3006AAB98 /* PlayCase */,
AC1C223C2BFA4191008B40EF /* Widgets */,
ACAB77192B468C50001AB619 /* Protocols */,
BF5942571E09BB5D0051894B /* Components */,
Expand Down Expand Up @@ -2196,6 +2210,7 @@
BF04E6FF1DB8625C000F35D3 /* ControllerSkinsViewController.swift in Sources */,
BF5942891E09BC8B0051894B /* _GameCollection.swift in Sources */,
AC23D2D62AFDCD2A0056CC3F /* SaveStatesOptions.swift in Sources */,
AC53D1D12C95DD71006AAB98 /* PlayCaseLogoView.swift in Sources */,
BF34FA111CF1899D006624C7 /* CheatTextView.swift in Sources */,
D5AAF27729884F8600F21ACF /* CheatDevice.swift in Sources */,
ACCD93F42B97A9CA00BB4F6A /* AirPlayDeviceOptions.swift in Sources */,
Expand Down Expand Up @@ -2253,6 +2268,7 @@
AC7262F22C49BAB30009B577 /* PremiumPatronsView.swift in Sources */,
ACF7E31F29F75BA0000FE071 /* PHPhotoLibrary+Authorization.swift in Sources */,
AC14384D2A4F67430099977F /* DSFeatures.swift in Sources */,
AC53D1CF2C95DD07006AAB98 /* PlayCaseView.swift in Sources */,
BFFC464C1D5998D600AF2CC6 /* CheatTableViewCell.swift in Sources */,
AC64BBEB2C09999A00467ACC /* OnboardingView.swift in Sources */,
BF5942941E09BD1A0051894B /* NSManagedObject+Conveniences.swift in Sources */,
Expand Down
24 changes: 9 additions & 15 deletions Ignited/Features/Controllers/PlayCaseOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,14 @@ struct PlayCaseOptions
{
@Option(name: "Logo",
description: "PlayCase is a phone case designed to enhance your mobile emulation experience by giving you physical buttons on top of your screen.",
detailView: { _ in
HStack {
Image("PlayCaseLogo")
.resizable()
.aspectRatio(contentMode: .fit)
Spacer()
GifImageView("playcase")
.frame(width: 70, height: 100, alignment: .center)
}
.frame(height: 100)
.padding()
.displayInline()
})
detailView: { _ in PlayCaseLogoView().displayInline() })
var logo: Bool = false

@Option(name: "Visit PlayCase",
description: "Consider buying a PlayCase to support its creator, who strives to continue improving the product and provides excellent customer support!.",
detailView: { _ in
Button("Visit PlayCase") {
UIApplication.shared.openWebpage(site: "https://playcase.gg")
UIApplication.shared.openWebpage(site: PlayCaseOptions.affiliateURL)
}
.font(.system(size: 17, weight: .bold, design: .default))
.foregroundColor(.accentColor)
Expand All @@ -45,7 +33,7 @@ struct PlayCaseOptions
description: "Tap here to download compatible skins from the PlayCase website.",
detailView: { _ in
Button("Download Skins") {
UIApplication.shared.openWebpage(site: "https://playcase.gg/skins/")
UIApplication.shared.openWebpage(site: PlayCaseOptions.affiliateSkinsURL)
}
.font(.system(size: 17, weight: .bold, design: .default))
.foregroundColor(.accentColor)
Expand All @@ -63,3 +51,9 @@ extension PlayCaseOptions {
return EdgeInsets(top: 0, leading: 0, bottom: safeAreaBottomInset, trailing: 0)
}
}

extension PlayCaseOptions {
static let affiliateURL: String = "https://playcase.gg/ref/LitRitt/"
static let affiliateSkinsURL: String = "https://playcase.gg/skins/ref/LitRitt/"
static let videoURL: String = "https://www.youtube.com/watch?v=2dDebK5G9FY&ab_channel=Buppin"
}
5 changes: 5 additions & 0 deletions Ignited/Launch/LaunchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ extension LaunchViewController
let onboardingView = OnboardingView.makeViewController()
UIApplication.shared.topViewController()?.present(onboardingView, animated: true)
}
else if !Settings.playCaseHasBeenSeen
{
let onboardingView = PlayCaseView.makeViewController()
UIApplication.shared.topViewController()?.present(onboardingView, animated: true)
}
}

func updateBuildNumber()
Expand Down
5 changes: 5 additions & 0 deletions Ignited/Onboarding/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ Start customizing your experience by choosing a theme color below. Once you're f
.background(.ultraThinMaterial)
.onDisappear {
Settings.onboardingHasBeenCompleted = true
if !Settings.playCaseHasBeenSeen
{
let onboardingView = PlayCaseView.makeViewController()
UIApplication.shared.topViewController()?.present(onboardingView, animated: true)
}
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions Ignited/PlayCase/PlayCaseLogoView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// PlayCaseLogoView.swift
// Ignited
//
// Created by Chris Rittenhouse on 9/14/24.
// Copyright © 2024 LitRitt. All rights reserved.
//

import SwiftUI

struct PlayCaseLogoView: View {
var body: some View {
HStack {
Image("PlayCaseLogo")
.resizable()
.aspectRatio(contentMode: .fit)
Spacer()
GifImageView("playcase")
.frame(width: 70, height: 100, alignment: .center)
}
.frame(height: 100)
.padding()
}
}
96 changes: 96 additions & 0 deletions Ignited/PlayCase/PlayCaseView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
//
// PlayCaseView.swift
// Ignited
//
// Created by Chris Rittenhouse on 9/14/24.
// Copyright © 2024 LitRitt. All rights reserved.
//

import UIKit
import SwiftUI
import Features

struct PlayCaseView: View {

var body: some View {
ZStack(alignment: .center) {
Rectangle()
.foregroundStyle(.clear)
.frame(maxWidth: .infinity, maxHeight: .infinity)
Image("PlayCaseLogo")
.resizable()
.blur(radius: 30)
.opacity(0.2)
.frame(maxWidth: 500)
VStack(alignment: .center, spacing: 20) {
HStack {
Image(systemName: "chevron.down")
Text("Swipe down to dismiss")
Image(systemName: "chevron.down")
}
.font(.caption)
.foregroundStyle(.secondary)
.padding(.vertical, 12)

PlayCaseLogoView()

Text("Introducing PlayCase")
.font(.title)
.fontWeight(.semibold)
Text("Precision and Protection")
.font(.caption)
.foregroundStyle(.secondary)

Text("""
The PlayCase combines durable phone protection with precise game controls. Just snap on a faceplate to transform your phone case into a retro controller. The number of supported devices and systems is growing all the time, and customer support is top tier. Consider purchasing a PlayCase to support its creator and help the product develop and improve.
Ignited now works seamlessly with PlayCase, allowing you to access all settings and menus without removing the faceplate. This is done via the new PlayCase mode toggle available in Settings -> Controllers and Skins -> PlayCase Mode.
""")
.font(.system(size: 15))

HStack(spacing: 20) {
Button {
UIApplication.shared.openWebpage(site: PlayCaseOptions.affiliateURL)
} label: {
Label("Shop", image: "PlayCase")
.font(.system(size: 24, weight: .semibold))
.foregroundStyle(Color("PlayCasePink"))
.padding(10)
}.background(
Color(uiColor: .systemBackground).opacity(0.2)
.clipShape(RoundedRectangle(cornerRadius: 10)))
Button {
UIApplication.shared.openWebpage(site: PlayCaseOptions.videoURL)
} label: {
Label("Watch", systemImage: "play.circle.fill")
.font(.system(size: 24, weight: .semibold))
.foregroundStyle(Color("PlayCasePink"))
.padding(10)
}.background(
Color(uiColor: .systemBackground).opacity(0.2)
.clipShape(RoundedRectangle(cornerRadius: 10)))
}

Spacer()
}
.padding(.horizontal, 16)
.frame(maxWidth: 500)
}
.background(.ultraThinMaterial)
.onDisappear {
Settings.playCaseHasBeenSeen = true
}
}
}

extension PlayCaseView
{
static func makeViewController() -> UIHostingController<some View>
{
let onboardingView = PlayCaseView()

let hostingController = UIHostingController(rootView: onboardingView)
hostingController.view.backgroundColor = .clear
return hostingController
}
}
11 changes: 11 additions & 0 deletions Ignited/Settings/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ struct Settings
let defaults = [
#keyPath(UserDefaults.buildNumber): 0,
#keyPath(UserDefaults.onboardingHasBeenCompleted): false,
#keyPath(UserDefaults.playCaseHasBeenSeen): false,
#keyPath(UserDefaults.legacyDatabaseHasBeenImported): false,
#keyPath(UserDefaults.legacyDatabaseHasBeenRepaired): false,
#keyPath(UserDefaults.gameShortcutsMode): GameShortcutsMode.recent.rawValue,
Expand Down Expand Up @@ -132,6 +133,15 @@ extension Settings
}
}

/// PlayCase
static var playCaseHasBeenSeen: Bool {
set { UserDefaults.standard.playCaseHasBeenSeen = newValue }
get {
let playCaseHasBeenSeen = UserDefaults.standard.playCaseHasBeenSeen
return playCaseHasBeenSeen
}
}

/// Save States
static var sortSaveStatesByOldestFirst: Bool {
set { UserDefaults.standard.sortSaveStatesByOldestFirst = newValue }
Expand Down Expand Up @@ -455,4 +465,5 @@ private extension UserDefaults
@NSManaged var legacyDatabaseHasBeenImported: Bool
@NSManaged var legacyDatabaseHasBeenRepaired: Bool
@NSManaged var onboardingHasBeenCompleted: Bool
@NSManaged var playCaseHasBeenSeen: Bool
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.549",
"green" : "0.271",
"red" : "0.753"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "124",
"green" : "74",
"red" : "204"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

0 comments on commit 134a9d2

Please sign in to comment.