Information Panel iOS Only 4.9.3+
Surge iOS 4.9.3 added an experimental feature that lets users customize one or more information panels.
To access this feature, users will need to have an active subscription that expires after September 22, 2021. If the subscription expires and there is a Panel profile section still configured, the panel will not be displayed but it will not affect the normal use of other features. Example:
[Panel]
PanelA = title="Panel Title",content="Panel Content\nSecondLine",style=info
The supported style parameters are good, info, alert, and error.
PanelA is the name of the information panel. This parameter 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.
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 will automatically cache the returned results of the last script and always display the results of the last script before executing a 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.