* Makes Consumer Apps dictate aasa results * progress with ConsumerApp query * Adds Team ID migration + Stimulus consumer_app_controller.js * Adds cypress tests * Adds Backfill data_update_script + more specs & tweaks * Remove file added by mistake * Comment typo * Small tweaks + improved specs * Update lib/data_update_scripts/20210622145212_backfill_forem_consumer_app_team_id.rb Co-authored-by: Jamie Gaskins <jamie@forem.com> * Update spec/lib/data_update_scripts/backfill_forem_consumer_app_team_id_spec.rb Co-authored-by: rhymes <github@rhymes.dev> * Make use of create! and log errors to ForemStatsClient * Fix specs * Add mock_rpush call as suggested in review * Add Review suggestions * Fix tests * Remove redundant assert in spec Co-authored-by: Jamie Gaskins <jamie@forem.com> Co-authored-by: rhymes <github@rhymes.dev>
32 lines
1.1 KiB
Ruby
32 lines
1.1 KiB
Ruby
class DeepLinksController < ApplicationController
|
|
def mobile; end
|
|
|
|
# Apple Application Site Association - based on Apple docs guidelines
|
|
# https://developer.apple.com/library/archive/documentation/General/Conceptual/AppSearch/UniversalLinks.html
|
|
def aasa
|
|
# This query plucks :team_id & :app_bundle so we get an array or arrays
|
|
# Example: [['TEAM1', 'app.bundle.one'], ['TEAM2', 'app.bundle.two']]
|
|
consumer_apps = ConsumerApps::FindOrCreateAllQuery.call
|
|
.where(platform: Device::IOS)
|
|
.where.not(team_id: nil)
|
|
.order(:created_at)
|
|
.pluck(:team_id, :app_bundle)
|
|
|
|
# Now restructure the array of arrays into valid AASA App ID's
|
|
# Example: ['TEAM1.app.bundle.one', 'TEAM2.app.bundle.two']
|
|
supported_apps = consumer_apps.map { |result| result.join(".") }
|
|
|
|
render json: {
|
|
applinks: {
|
|
apps: [],
|
|
details: supported_apps.map { |app_id| { appID: app_id, paths: ["/*"] } }
|
|
},
|
|
activitycontinuation: {
|
|
apps: supported_apps
|
|
},
|
|
webcredentials: {
|
|
apps: supported_apps
|
|
}
|
|
}
|
|
end
|
|
end
|