In Spring 18, UserInfo.getUiThemeDisplayed()
would return Theme3
when it was called by a lightning component in classic. In summer 18, it has now started returning Theme4d
. This is a problem, as we need to detect if the user is in classic mode or lightning (we redirect pages differently depending on this).
There are no notes in the documentation for this change, so I believe this is a bug on salesforces part.
Has any one else noticed this? Has salesforce provided an alternative method of determining if the user is in classic or lightning? Alternatives are available. See comments below.
P.S - This definitely worked in Spring 18 and has only stopped working in Summer 18
Edit
I have a lightning component that needs to redirect the user when the user clicks the button. If the user is in lightning experience, then we use the redirect event to redirect the user. If classic, we use window.location.href.
To detect if the user is in classic or lightning experience, we make a call to an apex controller UserInfo.getUiThemeDisplayed()
.
This used to return Theme3
in Spring 18 when on classic and now returns Theme4d
.
Edit
Some one has raised a case with Salesforce. https://success.salesforce.com/issues_view?id=a1p3A000000ETV0QAO