In electron, how to set callback at dialog.showMessageBox for 6.0.0 version? - callback

I upgrade the electron version of developing program, from 5.0.0. to 6.0.0. But I found that the arguments of dialog.showMessageBox for 6.0.0 was changed. Previously I put callback info as one of argument, but I upgrade to 6.0.0, I do not know how to set callback info.
Can you tell me how to set up it?

dialog.showMessageBox has been renamed to dialog.showMessageBoxSync. dialog.showMessageBox now returns a Promise.
Any existing call to dialog.showMessageBox will now return a Promise instead of a value.
In plus users will need to change to dialog.showMessageBoxSync to return to the prior behavior, or modify their code to accept a Promise instead.
Please use showMessageBox(options).then(response) instead set callback at showMessageBox

Related

How to get a version of UI5 framework within the controller?

I want to retrieve an UI5 version (e.g. 1.97.0-SNAPSHOT) inside of controller. The simplest way is to get a value of sap.ui.version, but it's a global variable, which I want to avoid.
I thought, sap.ui.VersionInfo would be a right choice, but looking at its API, I can't find any method, related to the retrieval of the UI5 version.
I also checked the controller's internals (not too deep) and sap.ui.Device, but no version number.
How can I retrieve the UI5 framework version without using a global variable?
If you're using OpenUI5, require sap/ui/core/Core and get an instance of sap/base/util/Version via Core.getConfiguration().getVersion().
In case of SAPUI5, however, the patch version is not always same as the version of SAPUI5 core (sap.ui.core) since SAPUI5-exclusive libraries may contain patches in addition to OpenUI5 libraries. See this graphic SAPUI5 library patch versions (e.g. v1.96). To get the correct SAPUI5 version reliably, require the module sap/ui/VersionInfo. Its method load() will return a promise that resolves with an object - same as https://<host>/resources/sap-ui-version.json - containing all information about the current framework including its version.
// VersionInfo required from "sap/ui/VersionInfo"
// VersionUtil required from "sap/base/util/Version"
// Within an async function:
const { version } = await VersionInfo.load();
const versionUtil = new VersionUtil(version);
As you can see, it's also possible to combine the retrieved version string with the module sap/base/util/Version which provides methods such as getMajor(), getMinor(), getPatch(), compareTo(...), inRange(...), etc.
See section "SAPUI5 Version vs. OpenUI5 Version (Core Version)" from the documentation topic Versioning and Maintenance of SAPUI5.
⚠️ Known issue
When using the module sap/ui/VersionInfo in a standalone UI5 app (e.g. built with ui5 build self-contained -a), the top version value from the generated resources/sap-ui-version.json is the app version instead of the version of the framework. There is currently no reliable way for standalone SAPUI5 apps to determine the correct patch version.
See the issue SAP/ui5-tooling#353.

Scala Play - How to Modify Cookie setting value before response goes out?

I have a project on a 2.7.3 version of Scala Play framework. I need to address being able to set a cookie's Samesite value to 'None'. Currently in 2.7.3 you can only set to 'Lax' or 'Strict' via an enumeration. The ability to set the value to 'None' has been backported for 2.7.x but not yet released.
I need to address this now and can't wait for a future release. I am having a hard time figuring out how to accomplish setting a Cookie's Samesite value to 'None' within the given framework.
In order to modify the response result in a filter, I see I could call result.withCookie() which takes one or more play.api.mvc.cookie. I've tried to extend and modify play.api.mvc.cookie but the Samesite class is sealed abstract inside the Cookie class.
I thought I might be able to use an Essential Filter or an Action to modify the cookie right before the response goes out but don't see a way to get at an existing CSRF cookie or the Play_Session cookie and modify it.
Any ideas?
I think the workaround for this is probably to either use a proxy as #rowan_m mentions. Fortunately Lightbend got back to me and will be releasing their 2.8 version very soon - which I verified in the RC solved the issue using config settings: https://github.com/playframework/playframework/pull/9613#issuecomment-555305142

What should I use for i18n in Flutter: S.of(context) or S.current?

I'm using the i18n plugin for Flutter (I believe it's this one) that comes with Android Studio.
And in every example I see it says to use S.of(context).my_string to get the Strings but it always returns null.
If I use S.current.my_string, it seems to work.
So is S.current the right way to do it and every doc/tutorial out there is wrong, are they the same or what?
What I'm basically asking here, is what is the difference between them.
Seems like S.of(context) is initially available way to access localised string.
But sometimes you need to use it without Build Context (in ViewModel, for example). So S.current was added for these cases.
More info here

Has anyone used SlickGrid with the updated drag functions jquery.event.drag-2.2.js?

I read from the threedubmedia site "The previous version of this plugin allowed this method to be overloaded with arguments to additionally bind handlers for "dragstart" and "dragend" in a single call, but this is no longer supported." but since I haven't actually read every line of the code I was wondering if this has already been accounted for?
Yes I upgraded to v2.2 (Updated: 2012-05-21) and it works fine for me.
I actually had an issue with 'dragend' event getting missed sometimes with v2.0.
I was doing some operations at the end of 'dragend' event (like when user stops resizing column width), but sometimes the operation won't trigger because this event was missed. Actually one had to resize rather quickly and release mouse soon to get the problem in v2.0.
After upgrading to v2.2 those issues are gone.

How to check if not available methods are used if deployment target < base sdk?

I would like to know how you check that your code do not call not available methods when the deployment target is inferior to base SDK ?
It is possible to run the application on a device with the SDK equal to deployment target, but I search a way more 'automatic'. Any idea ?
Regards,
Quentin
The easiest way to do this is to use the __IPHONE_OS_VERSION_MAX_ALLOWED preprocessor define.
You do this by adding
__IPHONE_OS_VERSION_MAX_ALLOWED=__IPHONE_4_2
or something similar to your "Preprocessor Macros" option in Build Settings of your target. You can look up versions available in <Availability.h>.
Unfortunately if you add this define it will cause mismatch errors with your precompiled header. So, to fix that you need to turn off the "Precompile Prefix Header" option in your build settings as well.
Once you do this you'll get a bunch of errors for classes that don't exist on your targeted SDK (for instance NSOrderedSet doesn't exist in iOS 4.2). If you're trying to go back pre-iOS 4 you'll probably get so many errors that the compiler bails--I don't know of a workaround for this. In any case, ignore the errors about missing classes in the UIKit headers, and go to the bottom of the error list; there you should find an error for each time you use a method or class that isn't included in the SDK pointed to by __IPHONE_OS_VERSION_MAX_ALLOWED. Make sure each of these methods is enclosed in an
if( [targetObject respondsToSelector:#selector(thePossiblyMissingSelector:)]
and you should be safe. Classes that may be missing should be tested as well
if ([NSOrderedSet class] != nil)
These settings aren't something you want to accidentally forget to flip back however. To make this an automatic option for testing, do the following:
Create a new build configuration called something like "Old SDK Testing".
Define __IPHONE_OS_VERSION_MAX_ALLOWED and the precompiled head option only for this configuration (hit the disclosure arrow beside each line in Build Settings to access per configuration settings).
Duplicate your current Scheme and set its name to something like "Old SDK Check".
Set the Build Configuration of the Run item in this new scheme to the build configuration you created in step 1.
Select the new Scheme and build.
Notes:
I make no guarantee that this will catch any/all of your issues.
Anything outside of UIKit will not be caught by this check.
This is not a substitute for testing your code on the versions of iOS you
plan to support.
use NSClassFromString();
Class cls = NSClassFromString(#"YourClass");
if (cls == nil)
is this you are looking for?
best way to do that which i found: compile code with old SDK :) link which can help
I think this question is releated with next
I belive that someday Apple allow to compile project for old SDK by simple defining #define __IPHONE_OS_VERSION_MAX_ALLOWED __IPHONE_3_0
upd: I found solution here
4.3 5.0 and 5.1 SDK just fail to compile after trying to redefine this macro
Are you looking for something like
- (BOOL)respondsToSelector:(SEL)aSelector
If you have an instance of a class, you can use the following to see if it understands the method you want to call:
if ([mipmapBrowserView respondsToSelector:#selector(setBackgroundColor:)]) {
// set the background layer since IKImageView supports it
}
Here, mipmapBrowserView is an instance of IKImageView, which was first introduced in Mac OS X 10.5. The setBackgroundColor: method of IKImageView was only added in 10.6, however, so I need to check before I call it. This allows me to build against the 10.6 SDK, and take advantage of the new features, yet still support OS X 10.5 as well. While this example involves OS X rather than iOS, the same method (pun intended?) works in iOS as well.
Note that things are slightly different when you are subclassing a class, and you want to know whether the superclass responds to a certain selector:
"You cannot test whether an object inherits a method from its superclass by sending respondsToSelector: to the object using the super keyword. This method will still be testing the object as a whole, not just the superclass’s implementation. Therefore, sending respondsToSelector: to super is equivalent to sending it to self. Instead, you must invoke the NSObject class method instancesRespondToSelector: directly on the object’s superclass...."