+
+ def application_data
+ data = {
+ :locale => I18n.locale,
+ :preferred_editor => preferred_editor
+ }
+
+ if current_user
+ data[:user] = current_user.id.to_json
+
+ unless current_user.home_lon.nil? || current_user.home_lat.nil?
+ data[:user_home] = { :lat => current_user.home_lat, :lon => current_user.home_lon }
+ end
+ end
+
+ data[:location] = session[:location] if session[:location]
+
+ if @oauth
+ data[:token] = @oauth.token
+ data[:token_secret] = @oauth.secret
+ data[:consumer_key] = @oauth.client_application.key
+ data[:consumer_secret] = @oauth.client_application.secret
+ end
+
+ data
+ end