My SingletonHelper class reads as:
And the messageReceived() in my SafariExtensionHandler class reads as:
Ideally, the url would have opened up whenever the user opens Safari after right-clicking and quitting Safari. However, for some reason, it also opens up when I connect and disconnect my charging cable.
Why is connecting and disconnecting the cable resetting the firstRunFlag?
Code Block class SingletonHelper : NSObject{ private override init(){} static let shared = SingletonHelper() var firstRunFlag = true }
And the messageReceived() in my SafariExtensionHandler class reads as:
Code Block if SingletonHelper.shared.firstRunFlag == true{ NSWorkspace.shared.open(url) SingletonHelper.shared.firstRunFlag = false }
Ideally, the url would have opened up whenever the user opens Safari after right-clicking and quitting Safari. However, for some reason, it also opens up when I connect and disconnect my charging cable.
Why is connecting and disconnecting the cable resetting the firstRunFlag?