Skip to content
/ fxa Public
forked from mozilla/fxa
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/fxa-content-server/app/scripts/lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<div id="main-content" class="card app-only-link">
<header>
<h1 id="fxa-app-only-link-header">{{#t}}Redirecting...{{/t}}</h1>
</header>

<section>
<div class="error"></div>
<div class="success"></div>

<p>
{{#t}}Opening app if installed, otherwise you will be redirected to the store.{{/t}}
</p>
</section>
</div>
33 changes: 33 additions & 0 deletions packages/fxa-content-server/app/scripts/views/app_link_all.js
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down