-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
51 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
$plugin = elgg_get_plugin_from_id('pwa'); | ||
?> | ||
|
||
import 'jquery'; | ||
|
||
// Initialize deferredPrompt for use later to show browser install prompt. | ||
let deferredPrompt; | ||
|
||
window.addEventListener('beforeinstallprompt', (e) => { | ||
// Stash the event so it can be triggered later. | ||
deferredPrompt = e; | ||
|
||
<?php if ($plugin->installable !== 'default') { ?> | ||
// Prevent the mini-infobar from appearing on mobile | ||
e.preventDefault(); | ||
|
||
<?php if ($plugin->installable === 'custom') { ?> | ||
// Update UI notify the user they can install the PWA | ||
showPWAInstallPromotion(); | ||
<?php } ?> | ||
<?php } ?> | ||
}); | ||
|
||
window.addEventListener('appinstalled', () => { | ||
// Handle app installed event | ||
appInstalledEventHandler(); | ||
|
||
// Clear the deferredPrompt so it can be garbage collected | ||
deferredPrompt = null; | ||
}); | ||
|
||
<?php | ||
|
||
// the following view contains the code for showPWAInstallPromotion() | ||
echo elgg_view('pwa/install_events.js'); | ||
|