Module: SolidusSocial::FacebookOmniauthStrategyExt

Defined in:
lib/solidus_social/facebook_omniauth_strategy_ext.rb

Overview

Patch the Facebook strategy discriminating between mobile and desktop.

Constant Summary collapse

MOBILE_USER_AGENTS =
'palm|blackberry|nokia|phone|midp|mobi|symbian|chtml|ericsson|minimo|' \
'audiovox|motorola|samsung|telit|upg1|windows ce|ucweb|astel|plucker|' \
'x320|x240|j2me|sgh|portable|sprint|docomo|kddi|softbank|android|mmp|' \
'pdxgw|netfront|xiino|vodafone|portalmmm|sagem|mot-|sie-|ipod|up\\.b|' \
'webos|amoi|novarra|cdm|alcatel|pocket|ipad|iphone|mobileexplorer|' \
'mobile'

Instance Method Summary collapse

Instance Method Details

#mobile_request?Boolean

Returns:

  • (Boolean)


18
19
20
21
# File 'lib/solidus_social/facebook_omniauth_strategy_ext.rb', line 18

def mobile_request?
  ua = Rack::Request.new(@env).user_agent.to_s
  ua.downcase =~ Regexp.new(MOBILE_USER_AGENTS)
end

#request_phaseObject



11
12
13
14
15
16
# File 'lib/solidus_social/facebook_omniauth_strategy_ext.rb', line 11

def request_phase
  options[:scope] ||= 'email'
  options[:info_fields] ||= 'email'
  options[:display] = mobile_request? ? 'touch' : 'page'
  super
end