Class: RubyNative::AasaController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/ruby_native/aasa_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/ruby_native/aasa_controller.rb', line 3

def show
  RubyNative.load_config if Rails.env.development?

  bundle_id = RubyNative.config&.dig(:ios, :bundle_id)
  team_id = RubyNative.config&.dig(:ios, :team_id)
  return head :not_found unless bundle_id.present? && team_id.present?

  app_id = "#{team_id}.#{bundle_id}"
  response.set_header("Cache-Control", "no-cache")
  render json: {
    applinks: {
      details: [
        { appIDs: [ app_id ], components: [ { "/": "*" } ] }
      ]
    },
    webcredentials: {
      apps: [ app_id ]
    }
  }
end