-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from nhiroyasu/develop
v1.6.0
- Loading branch information
Showing
44 changed files
with
1,782 additions
and
346 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
slideover-for-macos.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
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,32 @@ | ||
import Foundation | ||
import Swinject | ||
import Injectable | ||
|
||
class AppContainer { | ||
|
||
static func build() -> Container { | ||
let container = Container() | ||
|
||
container.register(ScreenManager.self) { _ in ScreenManagerImpl() } | ||
container.register(ApplicationService.self) { _ in ApplicationServiceImpl() } | ||
container.register(WindowManager.self) { _ in WindowManagerImpl() } | ||
container.register(UIQueue.self) { _ in DispatchQueue.main } | ||
container.register(GlobalShortcutService.self) { _ in GlobalShortcutServiceImpl() } | ||
container.register(NotificationManager.self) { _ in NotificationManagerImpl() } | ||
container.register(AlertService.self) { _ in AlertServiceImpl() } | ||
container.register(URLValidationService.self) { _ in URLValidationServiceImpl() } | ||
container.register(URLEncodeService.self) { _ in URLEncodeServiceImpl() } | ||
container.register(WebViewService.self) { _ in WebViewServiceImpl() } | ||
container.register(UserSettingService.self) { _ in UserSettingServiceImpl(userDefaults: UserDefaults.standard) }.inObjectScope(.container) | ||
container.register(SlideOverComputation.self) { injector in SlideOverComputationImpl(injector: injector) } | ||
container.register(SlideOverService.self) { injector in | ||
SlideOverServiceImpl(injector: injector) | ||
} | ||
|
||
return container | ||
} | ||
} | ||
|
||
extension Injector { | ||
static let shared = Injector(container: AppContainer.build()) | ||
} |
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,10 @@ | ||
import AppKit | ||
|
||
public protocol Coordinator { | ||
func create() -> NSWindowController | ||
} | ||
|
||
public protocol NavigationCoordinator: Coordinator { | ||
func start() | ||
func dismiss() | ||
} |
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,32 @@ | ||
import AppKit | ||
import Swinject | ||
import Injectable | ||
|
||
class SettingContainerBuilder { | ||
static func build(parent: Container?) -> Container { | ||
let container = Container(parent: parent) | ||
return container | ||
} | ||
} | ||
|
||
class SettingCoordinator: Coordinator { | ||
private var windowController: SettingWindowController? | ||
private let injector: Injectable | ||
|
||
init(injector: Injectable) { | ||
self.injector = injector | ||
} | ||
|
||
func create() -> NSWindowController { | ||
if let windowController = windowController { | ||
return windowController | ||
} else { | ||
let storyboard = NSStoryboard(name: "Main", bundle: nil) | ||
windowController = storyboard.instantiateController(identifier: "settingWindowController") { coder in | ||
SettingWindowController(coder: coder) | ||
} | ||
return windowController! | ||
} | ||
} | ||
} | ||
|
57 changes: 57 additions & 0 deletions
57
slideover-for-macos/Coordinator/SlideOverCoordinator.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,57 @@ | ||
import AppKit | ||
import Swinject | ||
import Injectable | ||
|
||
class SlideOverContainerBuilder { | ||
static func build(parent: Container?, state: SlideOverState) -> Container { | ||
let container = Container(parent: parent) | ||
|
||
container.register(SlideOverAction.self) { resolver in | ||
SlideOverActionImpl(injector: resolver, state: state) | ||
}.inObjectScope(.container) | ||
container.register(SlideOverUseCase.self) { resolver in | ||
SlideOverInteractor(injector: resolver) | ||
}.inObjectScope(.container) | ||
container.register(SlideOverPresenter.self) { resolver in | ||
SlideOverPresenterImpl(injector: resolver, state: state) | ||
}.inObjectScope(.container) | ||
container.register(SlideOverNotificationObserver.self) { resolver in | ||
SlideOverNotificationObserver(injector: resolver) | ||
}.inObjectScope(.container) | ||
|
||
return container | ||
} | ||
} | ||
|
||
class SlideOverCoordinator: Coordinator { | ||
private var windowController: SlideOverWindowController? | ||
private lazy var settingCoordinator: SettingCoordinator = .init(injector: injector) | ||
private let injector: Injectable | ||
private let state: SlideOverState | ||
private let notificationObserver: SlideOverNotificationObserver | ||
|
||
init(injector: Injectable, state: SlideOverState) { | ||
self.injector = injector | ||
self.state = state | ||
self.notificationObserver = injector.build() | ||
} | ||
|
||
func create() -> NSWindowController { | ||
if let windowController = windowController { | ||
return windowController | ||
} else { | ||
let storyboard = NSStoryboard(name: "Main", bundle: nil) | ||
windowController = storyboard.instantiateController(identifier: "slideOverWindowController") { coder in | ||
SlideOverWindowController(coder: coder, injector: self.injector, state: self.state) | ||
} | ||
return windowController! | ||
} | ||
} | ||
} | ||
|
||
extension SlideOverCoordinator: SlideOverTransition { | ||
func openSettingWindow() { | ||
let windowController = settingCoordinator.create() | ||
windowController.showWindow(self) | ||
} | ||
} |
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,20 @@ | ||
import AppKit | ||
|
||
public protocol Transitionable { | ||
func present( | ||
_ viewController: NSViewController, | ||
animator: NSViewControllerPresentationAnimator | ||
) | ||
func dismiss(_ viewController: NSViewController) | ||
func present( | ||
_ viewController: NSViewController, | ||
asPopoverRelativeTo positioningRect: NSRect, | ||
of positioningView: NSView, | ||
preferredEdge: NSRectEdge, | ||
behavior: NSPopover.Behavior | ||
) | ||
func presentAsModalWindow(_ viewController: NSViewController) | ||
func presentAsSheet(_ viewController: NSViewController) | ||
} | ||
|
||
extension NSViewController: Transitionable {} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...ideOverWindow/SlideOverWindowAction.swift → ...ideOverWindow/SlideOverWindowAction.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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import Foundation | ||
import Injectable | ||
|
||
/// @mockable | ||
protocol SlideOverWindowAction { | ||
|
Oops, something went wrong.