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

Removed not used type #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions sdk/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@ import (
"strings"
)

// ExponentPushToken is a valid Expo push token
type ExponentPushToken string

// ErrMalformedToken is returned if a token does not start with 'ExponentPushToken'
var ErrMalformedToken = errors.New("Token should start with ExponentPushToken")

//NewExponentPushToken returns a token and may return an error if the input token is invalid
func NewExponentPushToken(token string) (ExponentPushToken, error) {
func NewExponentPushToken(token string) (string, error) {
if !strings.HasPrefix(token, "ExponentPushToken") {
return "", ErrMalformedToken
}
return ExponentPushToken(token), nil
return token, nil
}

const (
Expand Down Expand Up @@ -52,16 +49,16 @@ const (
// ChannelID: ID of the Notification Channel through which to display this
// notification on Android devices.
type PushMessage struct {
To []ExponentPushToken `json:"to"`
Body string `json:"body"`
Data map[string]string `json:"data,omitempty"`
Sound string `json:"sound,omitempty"`
Title string `json:"title,omitempty"`
TTLSeconds int `json:"ttl,omitempty"`
Expiration int64 `json:"expiration,omitempty"`
Priority string `json:"priority,omitempty"`
Badge int `json:"badge,omitempty"`
ChannelID string `json:"channelId,omitempty"`
To []string `json:"to"`
Body string `json:"body"`
Data map[string]string `json:"data,omitempty"`
Sound string `json:"sound,omitempty"`
Title string `json:"title,omitempty"`
TTLSeconds int `json:"ttl,omitempty"`
Expiration int64 `json:"expiration,omitempty"`
Priority string `json:"priority,omitempty"`
Badge int `json:"badge,omitempty"`
ChannelID string `json:"channelId,omitempty"`
}

// Response is the HTTP response returned from an Expo publish HTTP request
Expand Down Expand Up @@ -90,7 +87,7 @@ const ErrorMessageRateExceeded = "MessageRateExceeded"
// 'message': '"adsf" is not a registered push notification recipient'}
type PushResponse struct {
PushMessage PushMessage
ID string `json:"id"`
ID string `json:"id"`
Status string `json:"status"`
Message string `json:"message"`
Details map[string]string `json:"details"`
Expand Down