mirror of
https://github.com/nicoverbruggen/phpmon.git
synced 2025-08-07 03:50:08 +02:00
🏗 WIP: Present OnboardingWC if launch count >= 1
This commit is contained in:
@ -264,6 +264,7 @@
|
|||||||
C4F780CD25D80B75000DBC97 /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476FF9722B0DD830098105B /* Alert.swift */; };
|
C4F780CD25D80B75000DBC97 /* Alert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C476FF9722B0DD830098105B /* Alert.swift */; };
|
||||||
C4F780CE25D80B75000DBC97 /* LocalNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = C474B00524C0E98C00066A22 /* LocalNotification.swift */; };
|
C4F780CE25D80B75000DBC97 /* LocalNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = C474B00524C0E98C00066A22 /* LocalNotification.swift */; };
|
||||||
C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */; };
|
C4F8C0A422D4F12C002EFE61 /* DateExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */; };
|
||||||
|
C4FACE83288F1F9700FC478F /* OnboardingWC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FACE82288F1F9700FC478F /* OnboardingWC.swift */; };
|
||||||
C4FBFC532616485F00CDB8E1 /* PhpVersionDetectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FBFC512616485F00CDB8E1 /* PhpVersionDetectionTest.swift */; };
|
C4FBFC532616485F00CDB8E1 /* PhpVersionDetectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FBFC512616485F00CDB8E1 /* PhpVersionDetectionTest.swift */; };
|
||||||
C4FC21B128391F8E00D368BB /* MainMenu+Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F361602836BFD9003598CC /* MainMenu+Actions.swift */; };
|
C4FC21B128391F8E00D368BB /* MainMenu+Actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4F361602836BFD9003598CC /* MainMenu+Actions.swift */; };
|
||||||
C4FE011128084FC200D1DE6D /* SelectionVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FE011028084FC200D1DE6D /* SelectionVC.swift */; };
|
C4FE011128084FC200D1DE6D /* SelectionVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4FE011028084FC200D1DE6D /* SelectionVC.swift */; };
|
||||||
@ -440,6 +441,7 @@
|
|||||||
C4F780AD25D80B37000DBC97 /* PhpExtensionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpExtensionTest.swift; sourceTree = "<group>"; };
|
C4F780AD25D80B37000DBC97 /* PhpExtensionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhpExtensionTest.swift; sourceTree = "<group>"; };
|
||||||
C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtension.swift; sourceTree = "<group>"; };
|
C4F8C0A322D4F12C002EFE61 /* DateExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateExtension.swift; sourceTree = "<group>"; };
|
||||||
C4F8C0A522D4FA41002EFE61 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
C4F8C0A522D4FA41002EFE61 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
|
||||||
|
C4FACE82288F1F9700FC478F /* OnboardingWC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingWC.swift; sourceTree = "<group>"; };
|
||||||
C4FBFC512616485F00CDB8E1 /* PhpVersionDetectionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhpVersionDetectionTest.swift; sourceTree = "<group>"; };
|
C4FBFC512616485F00CDB8E1 /* PhpVersionDetectionTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhpVersionDetectionTest.swift; sourceTree = "<group>"; };
|
||||||
C4FE011028084FC200D1DE6D /* SelectionVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionVC.swift; sourceTree = "<group>"; };
|
C4FE011028084FC200D1DE6D /* SelectionVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionVC.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
@ -1011,6 +1013,7 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
C4E9D2BF2878B336008FFDAD /* OnboardingView.swift */,
|
C4E9D2BF2878B336008FFDAD /* OnboardingView.swift */,
|
||||||
|
C4FACE82288F1F9700FC478F /* OnboardingWC.swift */,
|
||||||
);
|
);
|
||||||
path = Onboarding;
|
path = Onboarding;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1308,6 +1311,7 @@
|
|||||||
C4D5CFCA27E0F9CD00035329 /* NginxConfigurationFile.swift in Sources */,
|
C4D5CFCA27E0F9CD00035329 /* NginxConfigurationFile.swift in Sources */,
|
||||||
C4CE3BBA27B31F670086CA49 /* ComposerWindow.swift in Sources */,
|
C4CE3BBA27B31F670086CA49 /* ComposerWindow.swift in Sources */,
|
||||||
C4D9ADC8277611A0007277F4 /* InternalSwitcher.swift in Sources */,
|
C4D9ADC8277611A0007277F4 /* InternalSwitcher.swift in Sources */,
|
||||||
|
C4FACE83288F1F9700FC478F /* OnboardingWC.swift in Sources */,
|
||||||
C4080FFA27BD956700BF2C6B /* BetterAlertVC.swift in Sources */,
|
C4080FFA27BD956700BF2C6B /* BetterAlertVC.swift in Sources */,
|
||||||
C4B5635E276AB09000F12CCB /* VersionExtractor.swift in Sources */,
|
C4B5635E276AB09000F12CCB /* VersionExtractor.swift in Sources */,
|
||||||
54D9E0B627E4F51E003B9AD9 /* HotKey.swift in Sources */,
|
54D9E0B627E4F51E003B9AD9 /* HotKey.swift in Sources */,
|
||||||
|
@ -56,6 +56,9 @@ class App {
|
|||||||
/** The window controller of the currently active site list window. */
|
/** The window controller of the currently active site list window. */
|
||||||
var domainListWindowController: DomainListWC?
|
var domainListWindowController: DomainListWC?
|
||||||
|
|
||||||
|
/** The window controller of the onboarding window. */
|
||||||
|
var onboardingWindowController: OnboardingWC?
|
||||||
|
|
||||||
/** List of detected (installed) applications that PHP Monitor can work with. */
|
/** List of detected (installed) applications that PHP Monitor can work with. */
|
||||||
var detectedApplications: [Application] = []
|
var detectedApplications: [Application] = []
|
||||||
|
|
||||||
|
@ -397,6 +397,28 @@
|
|||||||
<point key="canvasLocation" x="283" y="-252"/>
|
<point key="canvasLocation" x="283" y="-252"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Window Controller-->
|
<!--Window Controller-->
|
||||||
|
<scene sceneID="V0z-jV-4FM">
|
||||||
|
<objects>
|
||||||
|
<windowController storyboardIdentifier="onboardingWindow" id="7r0-ZV-qX6" customClass="OnboardingWC" customModule="PHP_Monitor" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
<window key="window" title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="29a-6B-cdR">
|
||||||
|
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||||
|
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||||
|
<rect key="contentRect" x="425" y="462" width="480" height="270"/>
|
||||||
|
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
|
||||||
|
<view key="contentView" id="Zxc-EX-vzB">
|
||||||
|
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
|
||||||
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
|
</view>
|
||||||
|
<connections>
|
||||||
|
<outlet property="delegate" destination="7r0-ZV-qX6" id="4ET-xO-W3Y"/>
|
||||||
|
</connections>
|
||||||
|
</window>
|
||||||
|
</windowController>
|
||||||
|
<customObject id="Gd5-Ea-Y2l" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
|
</objects>
|
||||||
|
<point key="canvasLocation" x="303" y="329"/>
|
||||||
|
</scene>
|
||||||
|
<!--Window Controller-->
|
||||||
<scene sceneID="4XS-kY-YIS">
|
<scene sceneID="4XS-kY-YIS">
|
||||||
<objects>
|
<objects>
|
||||||
<windowController storyboardIdentifier="domainListWindow" id="8Ec-9q-82s" customClass="DomainListWC" customModule="PHP_Monitor" customModuleProvider="target" sceneMemberID="viewController">
|
<windowController storyboardIdentifier="domainListWindow" id="8Ec-9q-82s" customClass="DomainListWC" customModule="PHP_Monitor" customModuleProvider="target" sceneMemberID="viewController">
|
||||||
|
@ -88,6 +88,14 @@ extension MainMenu {
|
|||||||
Stats.incrementSuccessfulLaunchCount()
|
Stats.incrementSuccessfulLaunchCount()
|
||||||
Stats.evaluateSponsorMessageShouldBeDisplayed()
|
Stats.evaluateSponsorMessageShouldBeDisplayed()
|
||||||
|
|
||||||
|
// Present first launch screen if needed
|
||||||
|
if Stats.successfulLaunchCount >= 1 { // TODO: Make this == 1 for release
|
||||||
|
Log.info("Should present the first launch screen!")
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
OnboardingWC.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for updates
|
// Check for updates
|
||||||
DispatchQueue.global(qos: .utility).async {
|
DispatchQueue.global(qos: .utility).async {
|
||||||
AppUpdateChecker.checkIfNewerVersionIsAvailable()
|
AppUpdateChecker.checkIfNewerVersionIsAvailable()
|
||||||
|
@ -51,7 +51,7 @@ struct OnboardingView: View {
|
|||||||
.foregroundColor(.gray)
|
.foregroundColor(.gray)
|
||||||
.padding(.top, 5)
|
.padding(.top, 5)
|
||||||
Button("Close Tour") {
|
Button("Close Tour") {
|
||||||
|
App.shared.onboardingWindowController?.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
|
47
phpmon/Domain/SwiftUI/Onboarding/OnboardingWC.swift
Normal file
47
phpmon/Domain/SwiftUI/Onboarding/OnboardingWC.swift
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// OnboardingWC.swift
|
||||||
|
// PHP Monitor
|
||||||
|
//
|
||||||
|
// Created by Nico Verbruggen on 25/06/2022.
|
||||||
|
// Copyright © 2022 Nico Verbruggen. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Cocoa
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
class OnboardingWC: PMWindowController {
|
||||||
|
|
||||||
|
// MARK: - Window Identifier
|
||||||
|
|
||||||
|
override var windowName: String {
|
||||||
|
return "Onboarding"
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func create(delegate: NSWindowDelegate?) {
|
||||||
|
let storyboard = NSStoryboard(name: "Main", bundle: nil)
|
||||||
|
|
||||||
|
let windowController = storyboard.instantiateController(
|
||||||
|
withIdentifier: "onboardingWindow"
|
||||||
|
) as! OnboardingWC
|
||||||
|
|
||||||
|
windowController.window!.title = "onboarding.title".localized
|
||||||
|
windowController.window!.delegate = delegate
|
||||||
|
windowController.window!.styleMask = [.titled, .closable, .miniaturizable]
|
||||||
|
windowController.window!.delegate = windowController
|
||||||
|
windowController.window!.contentView = NSHostingView(rootView: OnboardingView())
|
||||||
|
windowController.window!.setContentSize(NSSize(width: 600, height: 600))
|
||||||
|
|
||||||
|
App.shared.onboardingWindowController = windowController
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func show(delegate: NSWindowDelegate? = nil) {
|
||||||
|
if App.shared.onboardingWindowController == nil {
|
||||||
|
Self.create(delegate: delegate)
|
||||||
|
}
|
||||||
|
|
||||||
|
App.shared.onboardingWindowController?.showWindow(self)
|
||||||
|
App.shared.onboardingWindowController?.window?.setCenterPosition(offsetY: 70)
|
||||||
|
|
||||||
|
NSApp.activate(ignoringOtherApps: true)
|
||||||
|
}
|
||||||
|
}
|
@ -500,6 +500,7 @@ You can do this by running `composer global update` in your terminal. After that
|
|||||||
|
|
||||||
// ONBOARDING
|
// ONBOARDING
|
||||||
|
|
||||||
|
"onboarding.title" = "";
|
||||||
"onboarding.welcome" = "Welcome to PHP Monitor!";
|
"onboarding.welcome" = "Welcome to PHP Monitor!";
|
||||||
"onboarding.explore" = "Explore some of the features below, or close the tour and get started.";
|
"onboarding.explore" = "Explore some of the features below, or close the tour and get started.";
|
||||||
"onboarding.tour.menu_bar.title" = "Get Started";
|
"onboarding.tour.menu_bar.title" = "Get Started";
|
||||||
|
Reference in New Issue
Block a user