display notification every time users open the app or login

This commit is contained in:
MaysWind
2024-08-05 01:25:26 +08:00
parent c137156c97
commit 05a93667eb
9 changed files with 113 additions and 17 deletions
+26
View File
@@ -16,3 +16,29 @@ var (
func SetCurrentConfig(config *Config) {
Container.Current = config
}
// GetAfterLoginNotificationContent returns the notification content displayed each time users log in
func (c *ConfigContainer) GetAfterLoginNotificationContent(language string) string {
if !c.Current.AfterLoginNotification.Enabled {
return ""
}
if multiLanguageContent, exists := c.Current.AfterLoginNotification.MultiLanguageContent[language]; exists {
return multiLanguageContent
}
return c.Current.AfterLoginNotification.DefaultContent
}
// GetAfterOpenNotificationContent returns the notification content displayed each time users open the app
func (c *ConfigContainer) GetAfterOpenNotificationContent(language string) string {
if !c.Current.AfterOpenNotification.Enabled {
return ""
}
if multiLanguageContent, exists := c.Current.AfterOpenNotification.MultiLanguageContent[language]; exists {
return multiLanguageContent
}
return c.Current.AfterOpenNotification.DefaultContent
}