This commit is contained in:
Serhiy Mytrovtsiy
2021-07-18 15:01:10 +02:00
parent 570a7a63c3
commit c5c4e4df3d
5 changed files with 17 additions and 6 deletions

View File

@@ -21,6 +21,8 @@ struct event: Codable {
var device: String
var os: String
var language: String
var omit: Bool
}
public class Server {
@@ -41,7 +43,7 @@ public class Server {
}
}
public func sendEvent(modules: [String]) {
public func sendEvent(modules: [String], omit: Bool = false) {
let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
let build = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
let systemVersion = ProcessInfo().operatingSystemVersion
@@ -52,7 +54,8 @@ public class Server {
build: build ?? "unknown",
modules: modules, device: SystemKit.shared.modelName() ?? "unknown",
os: systemVersion.getFullVersion(),
language: Locale.current.languageCode ?? "unknown"
language: Locale.current.languageCode ?? "unknown",
omit: omit
)
var request = URLRequest(url: self.url)

View File

@@ -2000,7 +2000,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 2.6.0;
MARKETING_VERSION = 2.6.1;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2033,7 +2033,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 2.6.0;
MARKETING_VERSION = 2.6.1;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -60,6 +60,10 @@
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "--omit"
isEnabled = "YES">
</CommandLineArgument>
<CommandLineArgument
argument = "--reset"
isEnabled = "NO">

View File

@@ -54,7 +54,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
self.defaultValues()
self.updateCron()
info("Stats started in \((startingPoint.timeIntervalSinceNow * -1).rounded(toPlaces: 4)) seconds")
Server.shared.sendEvent(modules: modules.filter({ $0.enabled != false && $0.available != false }).map({ $0.config.name }))
Server.shared.sendEvent(
modules: modules.filter({ $0.enabled != false && $0.available != false }).map({ $0.config.name }),
omit: CommandLine.arguments.contains("--omit")
)
}
func applicationWillTerminate(_ aNotification: Notification) {

View File

@@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>289</string>
<string>290</string>
<key>Description</key>
<string>Simple macOS system monitor in your menu bar</string>
<key>LSApplicationCategoryType</key>