Skip to content

Commit

Permalink
app integration improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
rjkat committed Nov 13, 2021
1 parent b201e5f commit 373c8bc
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
12 changes: 9 additions & 3 deletions client/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
class="hidden-print"
:state="state"
:recentCrosswords="recentCrosswords"
:showInstall="installPrompt || (iOSSafari && !standalone)"
:showInstall="installPrompt || (iOS && !standalone)"
:showDownload="!appPlatform"
:showDonate="!appPlatform"
@install-clicked="installClicked()"
Expand Down Expand Up @@ -886,6 +886,7 @@ export default Vue.extend({
const iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i);
const webkit = !!ua.match(/WebKit/i);
this.iOSSafari = iOS && webkit && !ua.match(/CriOS/i);
this.iOS = iOS;
const value = `; ${document.cookie}`;
const toks = value.split(`; app-platform=`);
Expand Down Expand Up @@ -976,6 +977,8 @@ export default Vue.extend({
showAnagramView: false,
toggleOptions: [{name: 'grid', label: 'grid'}, {name: 'tooltips', label: 'tooltips'}],
iOSSafari: false,
iOS: false,
iOSAppURL: 'https://apps.apple.com/au/app/confuzzle/id1592960680',
appPlatform: null,
iOSPrompt: false,
installPrompt: null,
Expand Down Expand Up @@ -1133,8 +1136,11 @@ export default Vue.extend({
return this.getShareablePuz().toEmoji(true);
},
installClicked() {
if (this.iOSSafari) {
this.iOSPrompt = true;
if (this.iOS) {
const a = document.createElement("a");
a.setAttribute('href', this.iOSAppURL);
a.setAttribute('target', '_blank');
a.click();
} else {
if (!this.installPrompt)
return
Expand Down
5 changes: 2 additions & 3 deletions client/components/CfzShareModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
</div>
</div>
<div class="crossword-link-text">{{link}}</div>

<ui-button v-if="shareAvailable" color="primary" style="margin-top: 1em;" @click="shareLink()">Share</ui-button>
<ui-button v-else color="primary" style="margin-top: 1em;" @click="copyClicked()">Copy</ui-button>
<ui-button color="primary" style="margin-top: 1em;" @click="copyClicked()">Copy</ui-button>
<!-- <ui-button v-if="shareAvailable" color="primary" style="margin-top: 1em;" @click="shareLink()">Share</ui-button> -->
</template>
</div>
</ui-modal>
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"compression": "^1.7.4",
"copy-to-clipboard": "^3.3.1",
"cors": "^2.8.5",
"emojisplosion": "^2.5.0",
"emojisplosion": "^2.6.1",
"enolib": "^0.8.2",
"enotype": "^0.3.0",
"express": "^4.17.1",
Expand Down
12 changes: 12 additions & 0 deletions server/public/.well-known/apple-app-site-association
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"applinks": {
"apps": [],
"details": [
{
"appID": "T34685KDX5.app.confuzzle",
"paths": [ "*" ]
}
]
}
}

4 changes: 4 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ app.use(function (req, res, next) {
res.send('User-agent: *\nAllow: /$\nAllow: /syntax$\nDisallow: /');
return;
}
if (req.path == '/.well-known/apple-app-site-association') {
res.sendFile(path.join(__dirname + '/public/.well-known/apple-app-site-association'));
return;
}
res.sendFile(path.join(__dirname + '/../dist/index.html'));
});

Expand Down

0 comments on commit 373c8bc

Please sign in to comment.