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
package com.test.android.helpers; | |
import android.os.Build; | |
import android.webkit.WebResourceResponse; | |
import com.google.gson.Gson; | |
import com.google.gson.reflect.TypeToken; | |
import com.test.android.Application; | |
import org.apache.commons.collections.CollectionUtils; |
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
{ | |
... | |
"scripts": { | |
"start:web:prod": "npm run build:prod:web && http-server dist/apps/web -d -c-1 -a 0.0.0.0 --proxy http://127.0.0.1:4200? --port 4200", | |
"start:web:prod:local": "npm run build:prod:web:local && http-server dist/apps/web -d -c-1 -a 0.0.0.0 --proxy http://127.0.0.1:4200? --port 4200", | |
"build:prod:web": "ng build web --prod", | |
"postbuild:prod:web": "npm run build:pwa:web", | |
"build:prod:web:local": "ng build web --prod", | |
"postbuild:prod:web:local": "npm run build:pwa:web:local", | |
"build:pwa:web": "rimraf ./dist/apps/web/service-worker.js && webpack --config ./service-worker/webpack.prod.config.js --progress --colors && node ./workbox-build-inject.js", |
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
// FILE PATH: /resources/js/app.js | |
require('./bootstrap'); | |
// Import Service Worker Registry | |
require('./extensions/sw-registry'); | |
import Vue from 'vue'; | |
... |
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
// Add any other logic here as needed. | |
import { CacheableResponsePlugin } from 'workbox-cacheable-response/CacheableResponsePlugin'; | |
import { CacheFirst } from 'workbox-strategies/CacheFirst'; | |
import { createHandlerForURL } from 'workbox-precaching/createHandlerForURL'; | |
import { ExpirationPlugin } from 'workbox-expiration/ExpirationPlugin'; | |
import { NavigationRoute } from 'workbox-routing/NavigationRoute'; | |
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute'; | |
import { registerRoute } from 'workbox-routing/registerRoute'; |
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
async function addToCache(urls) { | |
const pageCache = await window.caches.open('page-cache'); | |
await pageCache.addAll(urls); | |
} | |
// Check that service workers are registered | |
if ('serviceWorker' in navigator) { | |
// Use the window load event to keep the page load performant | |
window.addEventListener('load', () => { | |
addToCache(['/hello-world/', '/main-page/']); |
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
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.6.3/workbox-sw.js"); | |
workbox.clientsClaim(); | |
workbox.skipWaiting(); | |
// html | |
workbox.routing.registerRoute( | |
new RegExp('.\/.*.html'), | |
workbox.strategies.networkFirst({ | |
cacheName: 'page-html-cache' |
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
/* globals importScripts, workbox */ | |
// https://developers.google.com/web/fundamentals/primers/service-workers/ | |
// https://developers.google.com/web/fundamentals/primers/service-workers/high-performance-loading | |
// https://developers.google.com/web/tools/workbox/modules/workbox-sw#using_workbox_sw_via_cdn | |
importScripts('https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js'); | |
if (workbox) { | |
console.log(`Yay! Workbox is loaded 🎉`); | |
} else { |
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
copied from https://devcenter.heroku.com/articles/ssl-certificate-self | |
install go and openssl | |
mac os x: brew install go openssl | |
Generate private key and certificate signing request | |
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 | |
openssl rsa -passin pass:x -in server.pass.key -out server.key |
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
import * as React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { JWPlayerProps, JWPlayerInstance } from './types'; | |
import useJWPlayer from './hooks/useJWPlayer'; | |
import useScript from './hooks/useScript'; | |
const ReactJWPlayer = React.forwardRef((props: JWPlayerProps, ref?: JWPlayerInstance) => { | |
const { isScriptLoaded, isError } = useScript(props.playerId); | |
const { playerInstance, playerElement } = useJWPlayer(props, isScriptLoaded); |
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
import React, { useEffect } from 'react'; | |
import ReactJWPlayer from 'react-jw-player'; | |
import { playerScript } from 'config'; | |
// import { Analytics } from "functions/utils/Analytics"; | |
import { buildArtimediaParams } from 'functions/helpers/artimedia'; | |
import { dispatchGalaxyEvent } from './PlayerAnalytics'; | |
import useEvtListener from 'functions/hooks/useEvtListener'; | |
/**************************************** | |
Author: aamirkhan180@gmail.com | |
github @iamaamir |