Commit e4fb872f by zmj

fix 初始化参数

parent 0c60a2b2
......@@ -6,61 +6,63 @@ require 'app_push/log'
require 'igetui'
module AppPush
class Push
attr_accessor :igetui_config, :xiaomi_config
def initialize(opts = {})
opts = opts.with_indifferent_access
# {
# base: {
# app_id: '',
# app_key: '',
# master_secret: ''
# template_base: {
# logo: 'ik_logo.png',
# logo_url: 'http://www.ikcrm.com/assets/img/ik_logo.png',
# title: '',
# text: ''
# }
# },
# opts: {
# push_type: 2
# }
# }
@igetui_config = opts['igetui']
# xiaomi default config
# {
# restricted_package_name: 'com.vcooline.aike',
# pass_through: 1,
# title: 'xiaomi push',
# description: 'xiaomi push',
# notify_type: 1
# }
@xiaomi_config = opts['xiaomi']
if @igetui_config.present?
Igetui.config = @igetui_config['opts']
Igetui::Push.config = @igetui_config['base']
class << self
attr_accessor :igetui_config, :xiaomi_config
def init(opts = {})
opts = opts.with_indifferent_access
# {
# base: {
# app_id: '',
# app_key: '',
# master_secret: ''
# template_base: {
# logo: 'ik_logo.png',
# logo_url: 'http://www.ikcrm.com/assets/img/ik_logo.png',
# title: '',
# text: ''
# }
# },
# opts: {
# push_type: 2
# }
# }
@igetui_config = opts['igetui']
# xiaomi default config
# {
# restricted_package_name: 'com.vcooline.aike',
# pass_through: 1,
# title: 'xiaomi push',
# description: 'xiaomi push',
# notify_type: 1
# }
@xiaomi_config = opts['xiaomi']
if @igetui_config.present?
Igetui.config = @igetui_config['opts']
Igetui::Push.config = @igetui_config['base']
end
Xiaomi.config = @xiaomi_config
end
Xiaomi.config = @xiaomi_config
end
# transmission_content 是真正的推送信息
# {
# transmission_content: opts,
# transmission_type: transmission_type
# }
def push(user_device_ids, message)
message = message.with_indifferent_access
# transmission_content 是真正的推送信息
# {
# transmission_content: opts,
# transmission_type: transmission_type
# }
def push(user_device_ids, message)
message = message.with_indifferent_access
# igetui
Igetui.push(user_device_ids, message)
# igetui
Igetui.push(user_device_ids, message)
# xiaomi
Xiaomi.push(user_device_ids, message['transmission_content'])
# xiaomi
Xiaomi.push(user_device_ids, message['transmission_content'])
# huawei
# huawei
# etc
rescue StandardError => err
Log.error(err)
# etc
rescue StandardError => err
Log.error(err)
end
end
end
end
module AppPush
VERSION = "0.1"
VERSION = "0.11"
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