Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
resolve lint issues
Browse files Browse the repository at this point in the history
with #96

to remove stutter (push.PushType)
  • Loading branch information
nathany committed Oct 11, 2019
1 parent bb5a069 commit b80b5e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ headers := &push.Headers{
ID: "922D9F1F-B82E-B337-EDC9-DB4FC8527676",
Expiration: time.Now().Add(time.Hour),
LowPriority: true,
PushType: push.PushTypeAlert,
Type: push.Alert,
}

id, err := service.Push(deviceToken, headers, b)
Expand Down
19 changes: 13 additions & 6 deletions push/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,21 @@ type Headers struct {
// Topic for certificates with multiple topics.
Topic string

PushType PushType
// Type of push
Type Type
}

type PushType string
// Type of push
type Type string

// Available push types
const (
PushTypeAlert PushType = "alert"
PushTypeBackground PushType = "background"
Alert Type = "alert"
Background Type = "background"
VoIP Type = "voip"
Complication Type = "complication"
FileProvider Type = "fileprovider"
MDM Type = "mdm"
)

// set headers for an HTTP request
Expand Down Expand Up @@ -63,7 +70,7 @@ func (h *Headers) set(reqHeader http.Header) {
reqHeader.Set("apns-topic", h.Topic)
}

if h.PushType != "" {
reqHeader.Set("apns-push-type", string(h.PushType))
if h.Type != "" {
reqHeader.Set("apns-push-type", string(h.Type))
}
}
2 changes: 1 addition & 1 deletion push/header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func TestHeaders(t *testing.T) {
Expiration: time.Unix(12622780800, 0),
LowPriority: true,
Topic: "bundle-id",
PushType: PushTypeAlert,
Type: Alert,
}

reqHeader := http.Header{}
Expand Down

0 comments on commit b80b5e8

Please sign in to comment.