supporting global notification setting

This commit is contained in:
balzack 2022-11-09 20:54:44 -08:00
parent 8f4c15d5da
commit ae0ea4724c
6 changed files with 24 additions and 0 deletions

View File

@ -183,6 +183,14 @@ export function Dashboard(props) {
<Text style={styles.option}>RSA 4096</Text>
</TouchableOpacity>
</View>
<TouchableOpacity style={styles.media} activeOpacity={1}
onPress={() => actions.setPushSupported(!state.pushSupported)}>
<Text style={styles.modalLabel}>Enable Push Notifications: </Text>
<Switch style={styles.switch} value={state.pushSupported}
onValueChange={actions.setPushSupported} trackColor={styles.track}/>
</TouchableOpacity>
<TouchableOpacity style={styles.media} activeOpacity={1}
onPress={() => actions.setEnableImage(!state.enableImage)}>
<Text style={styles.modalLabel}>Enable Image Queue: </Text>

View File

@ -96,6 +96,9 @@ export function useDashboard(config, server, token) {
setStorage: (storage) => {
updateState({ storage: Number(storage.replace(/[^0-9]/g, '')) });
},
setPushSupported: (pushSupported) => {
updateState({ pushSupported });
},
setEnableImage: (enableImage) => {
updateState({ enableImage });
},

View File

@ -3566,6 +3566,8 @@ components:
type: boolean
keyType:
type: string
pushSupported:
type: boolean
AccountStatus:
type: object

View File

@ -21,6 +21,7 @@ func GetNodeConfig(w http.ResponseWriter, r *http.Request) {
config.EnableAudio = getBoolConfigValue(CNFEnableAudio, true)
config.EnableVideo = getBoolConfigValue(CNFEnableVideo, true)
config.KeyType = getStrConfigValue(CNFKeyType, APPRSA4096)
config.PushSupported = getBoolConfigValue(CNFPushSupported, true)
WriteResponse(w, config)
}

View File

@ -66,6 +66,14 @@ func SetNodeConfig(w http.ResponseWriter, r *http.Request) {
return res
}
// upsert push supported
if res := tx.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "config_id"}},
DoUpdates: clause.AssignmentColumns([]string{"bool_value"}),
}).Create(&store.Config{ConfigID: CNFPushSupported, BoolValue: config.PushSupported}).Error; res != nil {
return res
}
// upsert key type
if res := tx.Clauses(clause.OnConflict{
Columns: []clause.Column{{Name: "config_id"}},

View File

@ -347,6 +347,8 @@ type NodeConfig struct {
KeyType string `json:"keyType"`
AccountStorage int64 `json:"accountStorage"`
PushSupported bool `json:"pushSupported"`
}
//Profile public attributes of account