-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
216 additions
and
12 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import RxFlow | ||
|
||
public enum EasterEggStep: Step { | ||
case easterEggIsRequired | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import UIKit | ||
import SwiftUI | ||
import Presentation | ||
import Swinject | ||
import RxFlow | ||
import Core | ||
|
||
|
||
public final class EasterEggFlow: Flow { | ||
public let container: Container | ||
private let rootViewController: RxFlowViewController | ||
public var root: Presentable { | ||
return rootViewController | ||
} | ||
|
||
public init(container: Container) { | ||
self.container = container | ||
self.rootViewController = container.resolve(EasterEggViewController.self)! | ||
} | ||
|
||
public func navigate(to step: Step) -> FlowContributors { | ||
guard let step = step as? EasterEggStep else { return .none } | ||
|
||
switch step { | ||
case .easterEggIsRequired: | ||
return navigateToEasterEgg() | ||
} | ||
} | ||
} | ||
|
||
private extension EasterEggFlow { | ||
func navigateToEasterEgg() -> FlowContributors { | ||
return .one(flowContributor: .contribute(withNext: rootViewController)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cassets/Jobis logo.imageset/Contents.json → ...s/Easter Egg/Close.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+105 KB
...signSystem/Resources/Images/Images.xcassets/Easter Egg/Close.imageset/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,8 @@ | |
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"properties" : { | ||
"provides-namespace" : true | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...s/Team return logo.imageset/Contents.json → ...ts/Easter Egg/Open.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+113 KB
...DesignSystem/Resources/Images/Images.xcassets/Easter Egg/Open.imageset/open.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-39.7 KB
...n/Resources/Images/OnboardingImages.xcassets/Jobis logo.imageset/Jobis logo.png
Binary file not shown.
Binary file removed
BIN
-13.5 KB
...Images/OnboardingImages.xcassets/Team return logo.imageset/Team return logo.png
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
Projects/Presentation/Sources/EasterEgg/EasterEggView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import SwiftUI | ||
import DesignSystem | ||
|
||
struct EasterEggView: View { | ||
@State private var count = 0 | ||
@State private var angle = 0 | ||
@State private var index = 0 | ||
private var colors: [Color] = [ | ||
.yellow, | ||
.red, | ||
.blue, | ||
.green, | ||
.purple, | ||
.orange, | ||
.mint, | ||
.white | ||
] | ||
var body: some View { | ||
VStack { | ||
Button("", action: addAction) | ||
.buttonStyle(CatButtonStyle()) | ||
.rotationEffect(.degrees(Double(angle))) | ||
|
||
Text("\(count)") | ||
.padding(.top, 50) | ||
} | ||
.frame(maxWidth: .infinity, maxHeight: .infinity) | ||
.padding() | ||
.background(colors[index]) | ||
} | ||
|
||
private func addAction() { | ||
count += 1 | ||
angle = (angle + 45) % 360 | ||
index = Int.random(in: 0..<colors.count) | ||
HapticManager.instance.impact(style: .heavy) | ||
} | ||
} | ||
|
||
private struct CatButtonStyle: ButtonStyle { | ||
func makeBody(configuration: Configuration) -> some View { | ||
configuration.isPressed ? DesignSystemAsset.Images.EasterEgg.open.swiftUIImage: | ||
DesignSystemAsset.Images.EasterEgg.close.swiftUIImage | ||
} | ||
} | ||
|
||
final private class HapticManager { | ||
static let instance = HapticManager() | ||
|
||
func notification(type: UINotificationFeedbackGenerator.FeedbackType) { | ||
|
||
let generator = UINotificationFeedbackGenerator() | ||
generator.notificationOccurred(type) | ||
} | ||
|
||
func impact(style: UIImpactFeedbackGenerator.FeedbackStyle) { | ||
let generator = UIImpactFeedbackGenerator(style: style) | ||
generator.impactOccurred() | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
Projects/Presentation/Sources/EasterEgg/EasterEggViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import UIKit | ||
import SwiftUI | ||
import RxFlow | ||
import RxCocoa | ||
import RxSwift | ||
import DesignSystem | ||
|
||
public final class EasterEggViewController: RxFlowViewController { | ||
public init() { | ||
super.init(nibName: nil, bundle: nil) | ||
contentViewController = UIHostingController(rootView: EasterEggView()) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
public override func viewDidLoad() { | ||
super.viewDidLoad() | ||
} | ||
|
||
public override func viewWillAppear(_ animated: Bool) { | ||
self.hideTabbar() | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Projects/Presentation/Sources/EasterEgg/RxFlowViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import UIKit | ||
import RxFlow | ||
import RxCocoa | ||
|
||
public class RxFlowViewController: UIViewController, RxFlow.Stepper { | ||
public let steps = PublishRelay<Step>() | ||
var contentViewController = UIViewController() | ||
|
||
private var didSetupConstraints = false | ||
|
||
open override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
addChild(contentViewController) | ||
view.addSubview(contentViewController.view) | ||
setupConstraints() | ||
|
||
} | ||
|
||
fileprivate func setupConstraints() { | ||
contentViewController.view.translatesAutoresizingMaskIntoConstraints = false | ||
contentViewController.view.topAnchor.constraint(equalTo: view.topAnchor).isActive = true | ||
contentViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true | ||
contentViewController.view.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true | ||
contentViewController.view.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters