Add path to every view
This commit is contained in:
parent
e4d1a4f823
commit
353c80b6bc
@ -14,7 +14,7 @@ class HomeAssistant {
|
||||
HomeAssistantUI ui;
|
||||
Map _instanceConfig = {};
|
||||
String _userName;
|
||||
String _lovelaceDashbordUrl;
|
||||
String currentDashboardPath;
|
||||
HSVColor savedColor;
|
||||
int savedPlayerPosition;
|
||||
String sendToPlayerId;
|
||||
@ -29,8 +29,6 @@ class HomeAssistant {
|
||||
var _rawUserInfo;
|
||||
var _rawPanels;
|
||||
|
||||
set lovelaceDashboardUrl(String val) => _lovelaceDashbordUrl = val;
|
||||
|
||||
List<Panel> panels = [];
|
||||
|
||||
Duration fetchTimeout = Duration(seconds: 30);
|
||||
@ -194,9 +192,9 @@ class HomeAssistant {
|
||||
} else {
|
||||
Completer completer = Completer();
|
||||
var additionalData;
|
||||
if (AppSettings().haVersion >= 107 && _lovelaceDashbordUrl != HomeAssistant.DEFAULT_DASHBOARD) {
|
||||
if (AppSettings().haVersion >= 107 && currentDashboardPath != HomeAssistant.DEFAULT_DASHBOARD) {
|
||||
additionalData = {
|
||||
'url_path': _lovelaceDashbordUrl
|
||||
'url_path': currentDashboardPath
|
||||
};
|
||||
}
|
||||
ConnectionManager().sendSocketMessage(
|
||||
|
@ -99,7 +99,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
||||
_subscribe().then((_) {
|
||||
ConnectionManager().init(loadSettings: true, forceReconnect: true).then((__){
|
||||
SharedPreferences.getInstance().then((prefs) {
|
||||
HomeAssistant().lovelaceDashboardUrl = prefs.getString('lovelace_dashboard_url') ?? HomeAssistant.DEFAULT_DASHBOARD;
|
||||
HomeAssistant().currentDashboardPath = prefs.getString('lovelace_dashboard_url') ?? HomeAssistant.DEFAULT_DASHBOARD;
|
||||
_fetchData(useCache: true);
|
||||
LocationManager();
|
||||
StartupUserMessagesManager().checkMessagesToShow();
|
||||
@ -603,7 +603,7 @@ class _MainPageState extends State<MainPage> with WidgetsBindingObserver, Ticker
|
||||
context: context,
|
||||
items: serviceMenuItems
|
||||
).then((String val) {
|
||||
HomeAssistant().lovelaceDashboardUrl = HomeAssistant.DEFAULT_DASHBOARD;
|
||||
HomeAssistant().currentDashboardPath = HomeAssistant.DEFAULT_DASHBOARD;
|
||||
if (val == "reload") {
|
||||
|
||||
_quickLoad();
|
||||
|
@ -31,7 +31,8 @@ class Panel {
|
||||
if (componentName.startsWith('haclient')) {
|
||||
Navigator.of(context).pushNamed(urlPath);
|
||||
} else if (componentName == 'lovelace') {
|
||||
HomeAssistant().lovelaceDashboardUrl = this.urlPath;
|
||||
HomeAssistant().currentDashboardPath = this.urlPath;
|
||||
Logger.d('Switching to dashboard: ${this.urlPath}');
|
||||
HomeAssistant().autoUi = false;
|
||||
SharedPreferences.getInstance().then((prefs) {
|
||||
prefs.setString('lovelace_dashboard_url', this.urlPath);
|
||||
|
@ -16,7 +16,7 @@ class HomeAssistantUI {
|
||||
int viewCounter = 0;
|
||||
Logger.d("--Views count: ${rawLovelaceConfig['views'].length}");
|
||||
rawLovelaceConfig["views"].forEach((rawView){
|
||||
Logger.d("----view id: ${rawView['id']}");
|
||||
Logger.d("----view: ${rawView['path'] ?? viewCounter}");
|
||||
HAView view = HAView(
|
||||
count: viewCounter,
|
||||
rawData: rawView
|
||||
|
@ -6,6 +6,7 @@ class HAView {
|
||||
Entity linkedEntity;
|
||||
String name;
|
||||
String id;
|
||||
String path;
|
||||
String iconName;
|
||||
final int count;
|
||||
bool isPanel;
|
||||
@ -15,6 +16,7 @@ class HAView {
|
||||
name = rawData['title'];
|
||||
iconName = rawData['icon'];
|
||||
isPanel = rawData['panel'] ?? false;
|
||||
path = rawData['path'] ?? '$count';
|
||||
|
||||
if (rawData['badges'] != null && !isPanel) {
|
||||
badges = CardData.parse({
|
||||
|
Reference in New Issue
Block a user