From 88529bdb157fa9d80f1462616355c569fc79bbf0 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 25 Mar 2016 00:53:45 +0800 Subject: [PATCH] fix format. Signed-off-by: Bo-Yi Wu --- main.go | 4 ++-- notification.go | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/main.go b/main.go index 844e73e..d49d757 100644 --- a/main.go +++ b/main.go @@ -1,11 +1,11 @@ package main import ( - "net/http" - "github.com/gin-gonic/gin" api "github.com/appleboy/gin-status-api" "github.com/fvbock/endless" + "github.com/gin-gonic/gin" "log" + "net/http" ) func AbortWithError(c *gin.Context, code int, message string) { diff --git a/notification.go b/notification.go index d2af22b..4ce7744 100644 --- a/notification.go +++ b/notification.go @@ -1,9 +1,9 @@ package main -import( +import ( apns "github.com/sideshow/apns2" - "github.com/sideshow/apns2/payload" "github.com/sideshow/apns2/certificate" + "github.com/sideshow/apns2/payload" "log" ) @@ -17,14 +17,14 @@ type RequestPushNotification struct { Tokens []string `json:"tokens" binding:"required"` Platform int `json:"platform" binding:"required"` Message string `json:"message" binding:"required"` - Priority string `json:"priority,omitempty"` + Priority string `json:"priority,omitempty"` // Android CollapseKey string `json:"collapse_key,omitempty"` DelayWhileIdle bool `json:"delay_while_idle,omitempty"` TimeToLive int `json:"time_to_live,omitempty"` // iOS - ApnsID string `json:"apns_id,omitempty"` - Topic string `json:"topic,omitempty"` + ApnsID string `json:"apns_id,omitempty"` + Topic string `json:"topic,omitempty"` Badge int `json:"badge,omitempty"` Sound string `json:"sound,omitempty"` Expiry int `json:"expiry,omitempty"` @@ -36,7 +36,7 @@ type RequestPushNotification struct { func pushNotification(notification RequestPushNotification) bool { var ( - success bool + success bool ) cert, err := certificate.FromPemFile("./key.pem", "") @@ -44,7 +44,7 @@ func pushNotification(notification RequestPushNotification) bool { log.Println("Cert Error:", err) } - apnsClient := apns.NewClient(cert).Development() + apnsClient := apns.NewClient(cert).Development() switch notification.Platform { case PlatFormIos: @@ -99,12 +99,12 @@ func pushNotificationIos(req RequestPushNotification, client *apns.Client) bool res, err := client.Push(notification) if err != nil { - log.Println("There was an error", err) - return false + log.Println("There was an error", err) + return false } if res.Sent() { - log.Println("APNs ID:", res.ApnsID) + log.Println("APNs ID:", res.ApnsID) } }