Commit 80d493c1 by Victor Wang

重构模板的初始化方法

parent 9f66c58e
......@@ -3,6 +3,8 @@ module IGeTui
attr_accessor :transmission_type, :transmission_content
def initialize
@transmission_type = 0
@transmission_content = ''
@push_info = nil
end
......
module IGeTui
class LinkTemplate < BaseTemplate
attr_accessor :title, :text, :logo, :logo_url, :url
attr_accessor :is_ring, :is_vibrate, :is_clearable
STRING_ATTRIBUTES = %i(title text logo logo_url url).freeze
BOOLEAN_ATTRIBUTES = %i(is_ring is_vibrate is_clearable).freeze
attr_accessor *STRING_ATTRIBUTES, *BOOLEAN_ATTRIBUTES
def initialize
@title = ''
@text = ''
@logo = ''
@logo_url = ''
@transmission_type = 0
@transmission_content = ''
@is_ring = true
@is_vibrate = true
@is_clearable = true
super
STRING_ATTRIBUTES.each { |attr| instance_variable_set("@#{attr}", '') }
BOOLEAN_ATTRIBUTES.each { |attr| instance_variable_set("@#{attr}", true) }
end
def get_action_chain
......
module IGeTui
class NotificationTemplate < BaseTemplate
attr_accessor :title, :text, :logo, :logo_url
attr_accessor :is_ring, :is_vibrate, :is_clearable
STRING_ATTRIBUTES = %i(title text logo logo_url).freeze
BOOLEAN_ATTRIBUTES = %i(is_ring is_vibrate is_clearable).freeze
attr_accessor *STRING_ATTRIBUTES, *BOOLEAN_ATTRIBUTES
def initialize
@title = ''
@text = ''
@logo = ''
@logo_url = ''
@transmission_type = 0
@transmission_content = ''
@is_ring = true
@is_vibrate = true
@is_clearable = true
super
STRING_ATTRIBUTES.each { |attr| instance_variable_set("@#{attr}", '') }
BOOLEAN_ATTRIBUTES.each { |attr| instance_variable_set("@#{attr}", true) }
end
def get_action_chain
......
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 :android_mask, :symbia_mask, :ios_mask
attr_accessor :is_auto_install, :is_active
STRING_ATTRIBUTES = %i(
title text logo logo_url
pop_title pop_text pop_image
pop_button_1 pop_button_2
load_icon load_title load_url
android_mask symbia_mask ios_mask
).freeze
BOOLEAN_ATTRIBUTES_OF_TRUE = %i(is_ring is_vibrate is_clearable).freeze
BOOLEAN_ATTRIBUTES_OF_FALSE = %i(is_auto_install is_active).freeze
attr_accessor *STRING_ATTRIBUTES, *BOOLEAN_ATTRIBUTES_OF_TRUE, *BOOLEAN_ATTRIBUTES_OF_FALSE
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
@android_mask = ''
@symbia_mask = ''
@ios_mask = ''
@is_auto_install = false
@is_active = false
super
STRING_ATTRIBUTES.each { |attr| instance_variable_set("@#{attr}", '') }
BOOLEAN_ATTRIBUTES_OF_TRUE.each { |attr| instance_variable_set("@#{attr}", true) }
BOOLEAN_ATTRIBUTES_OF_FALSE.each { |attr| instance_variable_set("@#{attr}", false) }
end
def get_action_chain
......
module IGeTui
class TransmissionTemplate < BaseTemplate
def initialize
@transmission_type = 0
@transmission_content = ''
super
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