Commit 15453c55 by Victor Wang

增加通知栏弹框 下载模版

parent d82a6716
...@@ -2,3 +2,4 @@ require 'igetui/template/base_template' ...@@ -2,3 +2,4 @@ require 'igetui/template/base_template'
require 'igetui/template/transmission_template' require 'igetui/template/transmission_template'
require 'igetui/template/link_template' require 'igetui/template/link_template'
require 'igetui/template/notification_template' require 'igetui/template/notification_template'
require 'igetui/template/noty_pop_load_template'
...@@ -12,7 +12,7 @@ module IGeTui ...@@ -12,7 +12,7 @@ module IGeTui
@transmission_content = '' @transmission_content = ''
@is_ring = true @is_ring = true
@is_vibrate = true @is_vibrate = true
@is_clearable = false @is_clearable = true
super super
end end
......
...@@ -12,7 +12,7 @@ module IGeTui ...@@ -12,7 +12,7 @@ module IGeTui
@transmission_content = '' @transmission_content = ''
@is_ring = true @is_ring = true
@is_vibrate = true @is_vibrate = true
@is_clearable = false @is_clearable = true
super super
end end
......
module IGeTui
class NotyPopLoadTemplate < BaseTemplate
attr_accessor :title, :text, :logo, :logo_url
attr_accessor :is_ring, :is_vibrate, :is_clearable
attr_accessor :pop_title, :pop_text, :pop_image
attr_accessor :pop_button_1, :pop_button_2
attr_accessor :load_icon, :load_title, :load_url
attr_accessor :is_auto_install, :is_active
def initialize
@title = ''
@text = ''
@logo = ''
@logo_url = ''
@pop_title = ''
@pop_text = ''
@pop_image = ''
@pop_button_1 = ''
@pop_button_2 = ''
@load_icon = ''
@load_title = ''
@load_url = ''
@transmission_type = 0
@transmission_content = ''
@is_ring = true
@is_vibrate = true
@is_clearable = true
@is_auto_install = false
@is_active = false
super
end
def get_action_chain
# set actionchain
action_chain_1 = GtReq::ActionChain.new
action_chain_1.actionId = 1
action_chain_1.type = GtReq::ActionChain::Type::Goto
action_chain_1.next = 10000
# notification
action_chain_2 = GtReq::ActionChain.new
action_chain_2.actionId = 10000
action_chain_2.type = GtReq::ActionChain::Type::Notification
action_chain_2.title = title
action_chain_2.text = text
action_chain_2.logo = logo
action_chain_2.logoURL = logo_url
action_chain_2.ring = is_ring
action_chain_2.clearable = is_clearable
action_chain_2.buzz = is_vibrate
action_chain_2.next = 10010
# goto
action_chain_3 = GtReq::ActionChain.new
action_chain_3.actionId = 10010
action_chain_3.type = GtReq::ActionChain::Type::Goto
action_chain_3.next = 10020
action_chain_4 = GtReq::ActionChain.new
button_1 = GtReq::Button.new
button_1.text = pop_button_1
button_1.next = 10040
button_2 = GtReq::Button.new
button_2.text = pop_button_2
button_2.next = 100
action_chain_4.actionId = 10020
action_chain_4.type = GtReq::ActionChain::Type::Popup
action_chain_4.title = pop_title
action_chain_4.text = pop_text
action_chain_4.img = pop_image
action_chain_4.buttons = [button_1, button_2]
action_chain_4.next = 6
app_start_up = GtReq::AppStartUp.new(android: '', symbia: '', ios: '')
action_chain_5 = GtReq::ActionChain.new
action_chain_5.actionId = 10040
action_chain_5.type = GtReq::ActionChain::Type::Appdownload
action_chain_5.name = load_title
action_chain_5.url = load_url
action_chain_5.logo = load_icon
action_chain_5.autoInstall = is_auto_install
action_chain_5.autostart = is_active
action_chain_5.appstartupid = app_start_up
action_chain_5.next = 6
# end
action_chain_6 = GtReq::ActionChain.new
action_chain_6.actionId = 100
action_chain_6.type = GtReq::ActionChain::Type::Eoa
[action_chain_1, action_chain_2, action_chain_3, action_chain_4, action_chain_5, action_chain_6]
end
def get_push_type
"NotyPopLoadMsg"
end
end
end
module IGeTui module IGeTui
VERSION = "0.0.2" VERSION = "1.0.0"
end end
...@@ -21,6 +21,13 @@ class PusherTest < MiniTest::Unit::TestCase ...@@ -21,6 +21,13 @@ class PusherTest < MiniTest::Unit::TestCase
assert_equal ret["result"], "Online" assert_equal ret["result"], "Online"
end end
def test_to_single_noty_pop_load
single_message = IGeTui::SingleMessage.new
single_message.data = noty_pop_load_template
ret = @pusher.push_message_to_single(single_message, @client_1)
assert_equal ret["result"], "ok"
end
def test_to_single_notification def test_to_single_notification
single_message = IGeTui::SingleMessage.new single_message = IGeTui::SingleMessage.new
single_message.data = notification_template single_message.data = notification_template
...@@ -98,4 +105,19 @@ class PusherTest < MiniTest::Unit::TestCase ...@@ -98,4 +105,19 @@ class PusherTest < MiniTest::Unit::TestCase
template template
end end
# attr_accessor :load_icon, :load_title, :load_url
def noty_pop_load_template
template = IGeTui::NotyPopLoadTemplate.new
set_template_base_info(template)
template.pop_title = "弹框标题"
template.pop_text = "弹框内容"
template.pop_image = ""
template.pop_button_1 = "下载"
template.pop_button_2 = "取消"
template.load_icon = "file://icon.png"
template.load_title = "下载内容"
template.load_url = "http://gdown.baidu.com/data/wisegame/c95836e06c224f51/weixinxinqing_5.apk"
template
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment