Skip to content

Commit

Permalink
Display warning when user do not use recommended Firefox browser
Browse files Browse the repository at this point in the history
- Fix name of theme to Super.Human.Portal related (reference #55)
  • Loading branch information
piotrzarzycki21 committed May 8, 2024
1 parent 501e26c commit fc7b8b3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,6 @@ package constants
public static const COMMAND_AUTH_TEST:String = NAME + SEPARATOR + "CommandAuthTest";
public static const COMMAND_GET_LTPA_TOKEN:String = NAME + SEPARATOR + "CommandGetLTPAToken";
public static const COMMAND_LAUNCH_NOMAD_LINK:String = NAME + SEPARATOR + "CommandLaunchNomadLink";
public static const COMMAND_SHOW_BROWSER_WARNING:String = NAME + SEPARATOR + "CommandShowBrowserWarning";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package controller
{
import org.apache.royale.jewel.Snackbar;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.command.SimpleCommand;

public class CommandShowBrowserWarning extends SimpleCommand
{
override public function execute(note:INotification):void
{
var showBrowserWarning:Boolean = Boolean(window["Cookies"].get("SuperHumanPortalBrowserWarning"));
if (!showBrowserWarning)
{
window["Cookies"].set("SuperHumanPortalBrowserWarning", true);

var uaParser:Object = new window["UAParser"]();
var browser:Object = uaParser.getBrowser();

if (browser.name != "Firefox")
{
var browserSnackbar:Snackbar = Snackbar.show("It appears you're currently using a browser other than Firefox. For the optimum experience and full compatibility with all the features of our app, we highly recommend utilizing Firefox.",
0, "Close");
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package controller.startup.pepareController
import org.puremvc.as3.multicore.patterns.command.SimpleCommand;
import controller.startup.prepareView.CommandSwitchTheme;
import controller.CommandLaunchNomadLink;
import controller.CommandShowBrowserWarning;

public class CommandPrepareController extends SimpleCommand
{
Expand All @@ -48,6 +49,7 @@ package controller.startup.pepareController
facade.registerCommand(ApplicationConstants.COMMAND_AUTH_TEST, CommandAuthenticationTest);
facade.registerCommand(ApplicationConstants.COMMAND_GET_LTPA_TOKEN, CommandGetLTPAToken);
facade.registerCommand(ApplicationConstants.COMMAND_LAUNCH_NOMAD_LINK, CommandLaunchNomadLink);
facade.registerCommand(ApplicationConstants.COMMAND_SHOW_BROWSER_WARNING, CommandShowBrowserWarning);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ package controller.startup.start
if (proxyParams.target == "Register") return;

sendNotification(ApplicationConstants.NOTE_OPEN_VIEW_HELLO);
sendNotification(ApplicationConstants.COMMAND_SHOW_BROWSER_WARNING);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ package model.proxy

public function getTheme():Object
{
var currentTheme:String = window["Cookies"].get("MyAccountTheme");
var currentThemeId:String = window["Cookies"].get("MyAccountThemeId");
var currentTheme:String = window["Cookies"].get("SuperHumanPortalTheme");
var currentThemeId:String = window["Cookies"].get("SuperHumanPortalThemeId");

for (var t:String in Theme)
{
Expand All @@ -36,8 +36,8 @@ package model.proxy
{
if (Theme[t] == theme)
{
window["Cookies"].set("MyAccountTheme", theme);
window["Cookies"].set("MyAccountThemeId", themeId);
window["Cookies"].set("SuperHumanPortalTheme", theme);
window["Cookies"].set("SuperHumanPortalThemeId", themeId);

this.setData({theme: theme, themeId: themeId});
break;
Expand Down

0 comments on commit fc7b8b3

Please sign in to comment.