Information Panel iOS Only 4.9.3+
Surge iOS lets you customize one or more information panels shown in the main view. A panel can display static text from the profile or dynamic content generated by a script.
To access this feature, users need an active subscription that expires after September 22, 2021. If the subscription expires while a [Panel] profile section is still configured, the panel will not be displayed, but this does not affect the normal use of other features.
Example:
[Panel]
PanelA = title="Panel Title",content="Panel Content\nSecondLine",style=info
The supported style values are good, info, alert, and error.
PanelA is the name of the information panel. This name is passed to the script in script mode.
Static Mode
The panel generated by the configuration above is static. It can be used with a managed or enterprise profile to update panel content when the profile updates. See Managed Profile.
Dynamic Mode
The contents of the panel can be updated by a script.
[Panel]
PanelB = title="Panel Title",content="Panel Content\nSecondLine",style=info,script-name=panel
[Script]
panel = script-path=panel.js,type=generic
Generic scripts can update panels. When the user taps the refresh button, the script is evaluated with these parameters:
$input : {
purpose: "panel",
position: "policy-selection",
panelName: "PanelB"
},
$trigger: "button" // or "auto-interval"
The script should return the title, content, and style fields in $done().
Before the script is evaluated for the first time, the panel uses the static content in the definition line. After running, Surge automatically caches the returned result of the last script execution and always displays it until the next refresh.
A sample script:
$httpClient.get("https://api.my-ip.io/ip", function(error, response, data){
$done({
title: "External IP Address",
content: data,
});
});
You may also use the update-interval parameter to make the panel update automatically.
[Panel]
PanelB = title="Panel Title",content="Panel Content\nSecondLine",style=info,script-name=panel,update-interval=60
Auto-updating only occurs when the user switches to the policy selection view. You may specify a small value, such as 1, to make the panel update every time.
More Customization
- When the
stylefield is not passed, the card displays only text and no icon. - When the
stylefield is not passed, theiconfield can customize the icon with any valid SF Symbol name, such asbolt.horizontal.circle.fill. - When using the
iconfield, pass theicon-colorfield to control the icon color. The value is a HEX color code.