jpush 4.0.4 → 4.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/docs/Guides.md +8 -2
- data/lib/jpush/push/notification.rb +9 -13
- data/lib/jpush/push/push_payload.rb +1 -1
- data/lib/jpush/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d83dfc03c68eb6ee9aa5f6186fa6a852d6d732f
|
4
|
+
data.tar.gz: 0099414451636b14b1863761575777a2f73d5212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb2db9530810cea2a30f0a7374674fe7fc0a4530a1db80cbfecc3b1d7ff3d317d400b0857a0529f5e1823650e655b69183b5da52e682ce93d94ede62a5e2d48a
|
7
|
+
data.tar.gz: da5cd810d4246bd8b833c0a081dd934bcaf6495479b1f3d199dfc7c5ef37a0a245ffd65b6fddf57cc24ff89a5112dcb4061fc82d4ac4da54bad5c95c9e34f14c
|
data/docs/Guides.md
CHANGED
@@ -118,7 +118,13 @@ notification.set_android(
|
|
118
118
|
| --- | :---: | --- |
|
119
119
|
| alert | 是 | 表示通知内容,会覆盖上级统一指定的 alert 信息;内容可以为空字符串,表示不展示到通知栏 |
|
120
120
|
| title | 否 | 表示通知标题,会替换通知里原来展示 App 名称的地方 |
|
121
|
-
| builder_id | 否 | 表示通知栏样式ID,Android SDK 可设置通知栏样式,这里根据样式 ID 来指定该使用哪套样式 |
|
121
|
+
| builder_id | 否 | 表示通知栏样式 ID,Android SDK 可设置通知栏样式,这里根据样式 ID 来指定该使用哪套样式 |
|
122
|
+
| priority | 否 | 表示通知栏展示优先级,默认为 0,范围为 -2~2 ,其他值将会被忽略而采用默认值 |
|
123
|
+
| category | 否 | 表示通知栏条目过滤或排序,完全依赖 rom 厂商对 category 的处理策略 |
|
124
|
+
| style | 否 | 表示通知栏样式类型,默认为 0,还有1,2,3 可选,用来指定选择哪种通知栏样式,其他值无效。有三种可选分别为 bigText = 1,Inbox = 2,bigPicture = 3 |
|
125
|
+
| big_text | 否 | 表示大文本通知栏样式,当 style = 1 时可用,内容会被通知栏以大文本的形式展示出来,支持 api 16 以上的 rom |
|
126
|
+
| inbox | 否 | 表示文本条目通知栏样式,接受一个数组,当 style = 2 时可用,数组的每个 key 对应的 value 会被当作文本条目逐条展示,支持 api 16 以上的 rom |
|
127
|
+
| big_pic_path | 否 | 表示大图片通知栏样式,当 style = 3 时可用,可以是网络图片 url,或本地图片的 path,目前支持 .jpg 和 .png 后缀的图片。图片内容会被通知栏以大图片的形式展示出来。如果是 http/https 的 url,会自动下载;如果要指定开发者准备的本地图片就填 sdcard 的相对路径,支持 api 16 以上的 rom |
|
122
128
|
| extras | 否 | 表示扩展字段,接受一个 Hash 对象,以供业务使用 |
|
123
129
|
|
124
130
|
###### ios
|
@@ -141,7 +147,7 @@ notification.set_ios(
|
|
141
147
|
| --- | :---: | --- |
|
142
148
|
| alert | 是 | 表示通知内容,会覆盖上级统一指定的 alert 信息;内容可以为空字符串,表示不展示到通知栏 |
|
143
149
|
| sound | 否 | 表示通知提示声音 |
|
144
|
-
| badge | 否 | 表示应用角标,把角标数字改为指定的数字;为 0
|
150
|
+
| badge | 否 | 表示应用角标,把角标数字改为指定的数字;为 0 表示清除,若不填默认是默认是 +1 |
|
145
151
|
| contentavailable | 否 | 表示推送唤醒,仅接受 true 表示为 Background Remote Notification,若不填默认是 nil 表示普通的 Remote Notification |
|
146
152
|
| mutablecontent | 否 | 表示通知扩展,仅接受 true 表示支持 iOS10 的 UNNotificationServiceExtension,若不填默认是 nil 表示普通的 Remote Notification |
|
147
153
|
| category | 否 | IOS8才支持。设置 APNs payload 中的 'category' 字段值 |
|
@@ -19,25 +19,29 @@ module JPush
|
|
19
19
|
self
|
20
20
|
end
|
21
21
|
|
22
|
-
def set_android(alert: , title: nil, builder_id: nil,
|
22
|
+
def set_android(alert: , title: nil, builder_id: nil,
|
23
|
+
priority: nil, category: nil, style: nil, big_text: nil, inbox: nil, big_pic_path: nil, extras: nil)
|
23
24
|
extras = Notification.build_extras(extras)
|
24
|
-
check_argument(alert: alert, title: title, builder_id: builder_id)
|
25
25
|
@android = {
|
26
26
|
alert: alert,
|
27
27
|
title: title,
|
28
28
|
builder_id: builder_id,
|
29
|
+
priority: priority,
|
30
|
+
category: category,
|
31
|
+
style: style,
|
32
|
+
big_text: big_text,
|
33
|
+
inbox: inbox,
|
34
|
+
big_pic_path: big_pic_path,
|
29
35
|
extras: extras
|
30
36
|
}.compact
|
31
37
|
self
|
32
38
|
end
|
33
39
|
|
34
|
-
def set_ios(alert: , sound: nil, badge:
|
40
|
+
def set_ios(alert: , sound: nil, badge: '+1', available: nil, category:nil, extras: nil, contentavailable: nil, mutablecontent: nil)
|
35
41
|
contentavailable = available if contentavailable.nil?
|
36
42
|
extras = Notification.build_extras(extras)
|
37
|
-
badge = 0 == badge.to_i ? '0' : badge unless badge.nil?
|
38
43
|
contentavailable = nil unless contentavailable.is_a? TrueClass
|
39
44
|
mutablecontent = nil unless mutablecontent.is_a? TrueClass
|
40
|
-
check_argument(alert: alert, sound: sound, badge: badge, category: category)
|
41
45
|
@ios = {
|
42
46
|
alert: alert,
|
43
47
|
sound: sound,
|
@@ -61,14 +65,6 @@ module JPush
|
|
61
65
|
@notification
|
62
66
|
end
|
63
67
|
|
64
|
-
private
|
65
|
-
|
66
|
-
def check_argument(args)
|
67
|
-
hash = args.select{|key, value| !value.nil?}
|
68
|
-
hash.delete(:alert) if '' == hash[:alert]
|
69
|
-
Notification.ensure_argument_not_blank(hash)
|
70
|
-
end
|
71
|
-
|
72
68
|
end
|
73
69
|
end
|
74
70
|
end
|
data/lib/jpush/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JPush Offical
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|