Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*bool instead of bool #2

Open
gasperinn opened this issue Jul 24, 2024 · 0 comments
Open

*bool instead of bool #2

gasperinn opened this issue Jul 24, 2024 · 0 comments

Comments

@gasperinn
Copy link

I have a problem with setting ForegroundShow to false. Because of the omitempty tag in the definition the variable is not presented in the final json structure sent to the push api:

ForegroundShow bool json:"foreground_show,omitempty"

I suggest changing all bool values to bool pointer type *bool:

ForegroundShow *bool json:"foreground_show,omitempty"

It shoud work as expected:

  • If you don't set the variable then it will not be presented in the final json structure
  • You can set it to true like that:
foregroundShow := true
msg.Message.Android.Notification = &hms.AndroidNotification{
	ForegroundShow: &foregroundShow,
}
  • You can set it to false like that:
foregroundShow := false
msg.Message.Android.Notification = &hms.AndroidNotification{
	ForegroundShow: &foregroundShow,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant