Add whars new user message
This commit is contained in:
parent
8c2316a51a
commit
c5922368de
@ -170,7 +170,7 @@ class HAClientApp extends StatelessWidget {
|
|||||||
"/": (context) => MainPage(title: 'HA Client'),
|
"/": (context) => MainPage(title: 'HA Client'),
|
||||||
"/connection-settings": (context) => ConnectionSettingsPage(title: "Settings"),
|
"/connection-settings": (context) => ConnectionSettingsPage(title: "Settings"),
|
||||||
"/putchase": (context) => PurchasePage(title: "Support app development"),
|
"/putchase": (context) => PurchasePage(title: "Support app development"),
|
||||||
"/play-media": (context) => PlayMediaPage(mediaUrl: "${(ModalRoute.of(context).settings.arguments as Map)['url']}",),
|
"/play-media": (context) => PlayMediaPage(mediaUrl: "${ModalRoute.of(context).settings.arguments != null ? (ModalRoute.of(context).settings.arguments as Map)['url'] : ''}",),
|
||||||
"/log-view": (context) => LogViewPage(title: "Log"),
|
"/log-view": (context) => LogViewPage(title: "Log"),
|
||||||
"/login": (context) => WebviewScaffold(
|
"/login": (context) => WebviewScaffold(
|
||||||
url: "${ConnectionManager().oauthUrl}",
|
url: "${ConnectionManager().oauthUrl}",
|
||||||
|
@ -12,13 +12,18 @@ class StartupUserMessagesManager {
|
|||||||
StartupUserMessagesManager._internal() {}
|
StartupUserMessagesManager._internal() {}
|
||||||
|
|
||||||
bool _supportAppDevelopmentMessageShown;
|
bool _supportAppDevelopmentMessageShown;
|
||||||
|
bool _whatsNewMessageShown;
|
||||||
static final _supportAppDevelopmentMessageKey = "user-message-shown-support-development_3";
|
static final _supportAppDevelopmentMessageKey = "user-message-shown-support-development_3";
|
||||||
|
static final _whatsNewMessageKey = "user-message-shown-whats-new-660";
|
||||||
|
|
||||||
void checkMessagesToShow() async {
|
void checkMessagesToShow() async {
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.reload();
|
await prefs.reload();
|
||||||
_supportAppDevelopmentMessageShown = prefs.getBool(_supportAppDevelopmentMessageKey) ?? false;
|
_supportAppDevelopmentMessageShown = prefs.getBool(_supportAppDevelopmentMessageKey) ?? false;
|
||||||
if (!_supportAppDevelopmentMessageShown) {
|
_whatsNewMessageShown = prefs.getBool(_whatsNewMessageKey) ?? false;
|
||||||
|
if (!_whatsNewMessageShown) {
|
||||||
|
_showWhatsNewMessage();
|
||||||
|
} else if (!_supportAppDevelopmentMessageShown) {
|
||||||
_showSupportAppDevelopmentMessage();
|
_showSupportAppDevelopmentMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -43,4 +48,24 @@ class StartupUserMessagesManager {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showWhatsNewMessage() {
|
||||||
|
eventBus.fire(ShowPopupDialogEvent(
|
||||||
|
title: "What's new",
|
||||||
|
body: "You can now share any media url to HA Client via Android share menu. It will try to play that media on one of your media player. There is also 'tv' button available in app header if you want to send some url manually",
|
||||||
|
positiveText: "Full release notes",
|
||||||
|
negativeText: "Ok",
|
||||||
|
onPositive: () {
|
||||||
|
SharedPreferences.getInstance().then((prefs) {
|
||||||
|
prefs.setBool(_whatsNewMessageKey, true);
|
||||||
|
Launcher.launchURL("https://github.com/estevez-dev/ha_client/releases");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onNegative: () {
|
||||||
|
SharedPreferences.getInstance().then((prefs) {
|
||||||
|
prefs.setBool(_whatsNewMessageKey, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user