module MotionWechat::Config

Public Instance Methods

info_plist_key() click to toggle source
# File lib/motion-wechat/config.rb, line 5
def info_plist_key; "WechatConfig"; end
key() click to toggle source
# File lib/motion-wechat/config.rb, line 6
def key; @key; end
setup(app, key, secret) click to toggle source

Setup wechat information to rubymotion app, i.e. key, secret…

Example: (in Rakefile)

Motion::Project::App.setup do |app|
  ...
  MotionWechat::Config.setup(app, 'app_key', 'app_secret')
end

Arguments:

RubyMotion app: (Motion::Project::App)
Wechat key:     (String)
Wechat secret:  (String)
other options:  (Hash)
# File lib/motion-wechat/config.rb, line 22
def setup(app, key, secret)
  @key = key
  @secret = secret

  app.info_plist[info_plist_key] = { key: @key, secret: @secret }

  bundle_url_types = [
      { 'CFBundleURLName'    => "weixin",
        'CFBundleURLSchemes' => [app.info_plist[info_plist_key][:key]] }
    ]

  app.info_plist['CFBundleURLTypes'] ||= []
  app.info_plist['CFBundleURLTypes'] += bundle_url_types

end