Allow accessing app-settings even if not logged-in [skip-ci]
This commit is contained in:
@@ -20,20 +20,30 @@ class SCNNavLayout extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SCNNavLayoutState extends State<SCNNavLayout> {
|
class _SCNNavLayoutState extends State<SCNNavLayout> {
|
||||||
int _selectedIndex = 0; // 4 == FAB
|
static const INDEX_MESSAGES = 0;
|
||||||
|
static const INDEX_CHANNELS = 1;
|
||||||
|
static const INDEX_ACCOUNT = 2;
|
||||||
|
static const INDEX_CONFIG = 3;
|
||||||
|
static const INDEX_SEND = 4; // FAB
|
||||||
|
|
||||||
|
int _selectedIndex = INDEX_MESSAGES;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
initState() {
|
initState() {
|
||||||
final userAcc = Provider.of<AppAuth>(context, listen: false);
|
final userAcc = Provider.of<AppAuth>(context, listen: false);
|
||||||
if (!userAcc.isAuth()) _selectedIndex = 2;
|
if (!userAcc.isAuth()) _selectedIndex = INDEX_ACCOUNT;
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onItemTapped(int index) {
|
void _onItemTapped(int index) {
|
||||||
final userAcc = Provider.of<AppAuth>(context, listen: false);
|
final userAcc = Provider.of<AppAuth>(context, listen: false);
|
||||||
if (!userAcc.isAuth()) {
|
|
||||||
|
if (!userAcc.isAuth() && [INDEX_MESSAGES, INDEX_CHANNELS, INDEX_SEND].contains(index)) {
|
||||||
Toaster.info("Not logged in", "Please login or create a new account first");
|
Toaster.info("Not logged in", "Please login or create a new account first");
|
||||||
|
setState(() {
|
||||||
|
_selectedIndex = INDEX_ACCOUNT;
|
||||||
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +60,7 @@ class _SCNNavLayoutState extends State<SCNNavLayout> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedIndex = 4;
|
_selectedIndex = INDEX_SEND;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,17 +69,17 @@ class _SCNNavLayoutState extends State<SCNNavLayout> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: SCNAppBar(
|
appBar: SCNAppBar(
|
||||||
title: null,
|
title: null,
|
||||||
showSearch: _selectedIndex == 0,
|
showSearch: _selectedIndex == INDEX_MESSAGES,
|
||||||
showShare: false,
|
showShare: false,
|
||||||
showThemeSwitch: true,
|
showThemeSwitch: true,
|
||||||
),
|
),
|
||||||
body: IndexedStack(
|
body: IndexedStack(
|
||||||
children: [
|
children: [
|
||||||
ExcludeFocus(excluding: _selectedIndex != 0, child: MessageListPage(isVisiblePage: _selectedIndex == 0)),
|
ExcludeFocus(excluding: _selectedIndex != INDEX_MESSAGES, child: MessageListPage(isVisiblePage: _selectedIndex == INDEX_MESSAGES)),
|
||||||
ExcludeFocus(excluding: _selectedIndex != 1, child: ChannelRootPage(isVisiblePage: _selectedIndex == 1)),
|
ExcludeFocus(excluding: _selectedIndex != INDEX_CHANNELS, child: ChannelRootPage(isVisiblePage: _selectedIndex == INDEX_CHANNELS)),
|
||||||
ExcludeFocus(excluding: _selectedIndex != 2, child: AccountRootPage(isVisiblePage: _selectedIndex == 2)),
|
ExcludeFocus(excluding: _selectedIndex != INDEX_ACCOUNT, child: AccountRootPage(isVisiblePage: _selectedIndex == INDEX_ACCOUNT)),
|
||||||
ExcludeFocus(excluding: _selectedIndex != 3, child: SettingsRootPage(isVisiblePage: _selectedIndex == 3)),
|
ExcludeFocus(excluding: _selectedIndex != INDEX_CONFIG, child: SettingsRootPage(isVisiblePage: _selectedIndex == INDEX_CONFIG)),
|
||||||
ExcludeFocus(excluding: _selectedIndex != 4, child: SendRootPage(isVisiblePage: _selectedIndex == 4)),
|
ExcludeFocus(excluding: _selectedIndex != INDEX_SEND, child: SendRootPage(isVisiblePage: _selectedIndex == INDEX_SEND)),
|
||||||
],
|
],
|
||||||
index: _selectedIndex,
|
index: _selectedIndex,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: simplecloudnotifier
|
|||||||
description: "Receive push messages"
|
description: "Receive push messages"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 2.0.1+493
|
version: 2.0.1+495
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.2.6 <4.0.0'
|
sdk: '>=3.2.6 <4.0.0'
|
||||||
|
|||||||
2
scnserver/.gitignore
vendored
2
scnserver/.gitignore
vendored
@@ -18,6 +18,8 @@ identifier.sqlite
|
|||||||
|
|
||||||
.idea/dataSources.xml
|
.idea/dataSources.xml
|
||||||
|
|
||||||
|
.idea/copilot*
|
||||||
|
|
||||||
.swaggobin
|
.swaggobin
|
||||||
|
|
||||||
scn_send.sh
|
scn_send.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user