diff --git a/packages/fxa-content-server/app/scripts/lib/router.js b/packages/fxa-content-server/app/scripts/lib/router.js index 5742e138176..f16314fcde1 100644 --- a/packages/fxa-content-server/app/scripts/lib/router.js +++ b/packages/fxa-content-server/app/scripts/lib/router.js @@ -340,6 +340,7 @@ const Router = Backbone.Router.extend({ this.navigateAway('/beta/settings?' + qs); }, 'app_only_link(/)': createViewHandler('app_only_link'), + 'app_link/*(/)': createViewHandler('app-link-all'), }, initialize(options = {}) { diff --git a/packages/fxa-content-server/app/scripts/templates/app_link_all.mustache b/packages/fxa-content-server/app/scripts/templates/app_link_all.mustache new file mode 100644 index 00000000000..90082d7a3c3 --- /dev/null +++ b/packages/fxa-content-server/app/scripts/templates/app_link_all.mustache @@ -0,0 +1,14 @@ +
+
+

{{#t}}Redirecting...{{/t}}

+
+ +
+
+
+ +

+ {{#t}}Opening app if installed, otherwise you will be redirected to the store.{{/t}} +

+
+
diff --git a/packages/fxa-content-server/app/scripts/views/app_link_all.js b/packages/fxa-content-server/app/scripts/views/app_link_all.js new file mode 100644 index 00000000000..40a887a102e --- /dev/null +++ b/packages/fxa-content-server/app/scripts/views/app_link_all.js @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +import BaseView from './base'; +import Template from 'templates/app_link_all.mustache'; + +var View = BaseView.extend({ + className: 'app-link-all', + template: Template, + initialize(options) { + options = options || {}; + + this.appleItunesApp = options.appleItunesApp; + }, + + afterRender() { + //TO DO - Change time to configurable + const country = this.lang || 'us' + + const url = new URL(this.appleItunesApp); + const params = new URLSearchParams(url.search); + const appId = params.get('app-id'); + + return setTimeout(() => { + this.navigateAway( + `https://apps.apple.com/${country}/app/enote-intelligent-sheet-music/id${appId}` + ); + }, 3000); + }, +}); + +export default View; diff --git a/packages/fxa-content-server/server/lib/routes/get-frontend.js b/packages/fxa-content-server/server/lib/routes/get-frontend.js index 024b025b250..6a685c4834e 100644 --- a/packages/fxa-content-server/server/lib/routes/get-frontend.js +++ b/packages/fxa-content-server/server/lib/routes/get-frontend.js @@ -106,6 +106,7 @@ module.exports = function (config) { 'verify_secondary_email', 'would_you_like_to_sync', 'app_only_link', + 'app_link/*', ].filter((path) => { return !redirectPaths.includes(path); }).join('|'); // prepare for use in a RegExp