docbrown/app/controllers/deep_links_controller.rb
Fernando Valverde affc704c9b
Runtime Banner for Mobile Deep Linking (#13190)
* First version using custom schemes for iOS

* Starting to take shape with /r/mobile redirect page

* Wording and aasa

* Adds e2e tests

* Trigger CI

* Tweaks to AASA

* Uses external pivot domain to trigger Universal Links

* Add missing external domain deep link

* Fix test by enabling runtime_banner only in E2E tests

* Fix URL encoding mismatch in Cypress test

* banner sttyling

* Cleanup unrelated changes

* Add AASA tests + remove lingering Gemfile.lock changes

* Fix cypress test

* Remove unnecessary window global assignment

* Trigger Travis

* Replace querySelectorAll with querySelector

* Apply suggestions from code review

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Refactor inline comments, extract URL.deep_link logic and other review feedback

* Small tweaks

* Remove untrusted user-provided redirect (CodeQL suggestion)

* Fix failing tests

* Whoops - another test fix

* Use Forem's UDL server

* Extract timeoutDelay and add comment clarifying

* Add target='_blank' to deep link

* Add TODO comment for replacing hardcoded identifiers

* Apply suggestions from code review

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Add a11y attributes

Co-authored-by: Paweł Ludwiczak <ludwiczakpawel@gmail.com>
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-23 15:45:34 -06:00

23 lines
692 B
Ruby

class DeepLinksController < ApplicationController
def mobile; end
# Apple Application Site Association
def aasa
# TODO: [@fdoxyz] Replace these hardcoded identifiers with configurations
# creators can use to customize their Forems - `/admin/consumer_apps`
supported_apps = ["R9SWHSQNV8.com.forem.app"]
supported_apps << "R9SWHSQNV8.to.dev.ios" if SiteConfig.dev_to?
render json: {
applinks: {
apps: supported_apps,
details: supported_apps.map { |app_id| { appID: app_id, paths: ["/*"] } }
},
activitycontinuation: {
apps: supported_apps
},
webcredentials: {
apps: supported_apps
}
}
end
end