Skip to content

Commit

Permalink
feat: PWA support, now this app is installable
Browse files Browse the repository at this point in the history
  • Loading branch information
axmad386 committed Nov 6, 2021
1 parent e72d92e commit c44584a
Show file tree
Hide file tree
Showing 37 changed files with 270 additions and 33 deletions.
41 changes: 13 additions & 28 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
<a name="unreleased"></a>

## [Unreleased]

### New Features
### Bug Fixes
- disable go to last read when nothing is saved

- markdown import from CHANGELOG.md
- add modal about us
- add modal info and change layout
- **tajweed:** ikhfa syafawi rule finder
### New Features
- add modal info and change layout ([#61](https://github.com/kodepintar/colorful-quran/issues/61))
- add share button to social media ([#56](https://github.com/kodepintar/colorful-quran/issues/56))
- **tajweed:** ikhfa syafawi rule finder ([#60](https://github.com/kodepintar/colorful-quran/issues/60))

<a name="v0.3.0"></a>

<a name="v0.3.0"></a>
## [v0.3.0] - 2021-10-29

### Bug Fixes

- madd jaiz and madd wajib start index ([#55](https://github.com/kodepintar/colorful-quran/issues/55))

### New Features

- hide / show terjemahan ([#54](https://github.com/kodepintar/colorful-quran/issues/54))

<a name="v0.2.0"></a>

<a name="v0.2.0"></a>
## [v0.2.0] - 2021-10-23

### Bug Fixes

- tolltip toggle description
- input range for dynamic font size
- madd-lazim-mutsaqal-harfi invalid rule
Expand All @@ -37,7 +31,6 @@
- tooltip direction

### New Features

- Tasbih ([#48](https://github.com/kodepintar/colorful-quran/issues/48))
- dark mode and dynamic font size ([#47](https://github.com/kodepintar/colorful-quran/issues/47))
- madd lazim harfi mukhofaf and mutsaqal rule finder
Expand All @@ -48,30 +41,25 @@
- Arabic number char ([#40](https://github.com/kodepintar/colorful-quran/issues/40))
- change layout ([#39](https://github.com/kodepintar/colorful-quran/issues/39))

<a name="v0.1.0"></a>

<a name="v0.1.0"></a>
## [v0.1.0] - 2021-10-21

### New Features

- add madd-arid-lissukun to kemenag tajweed generator script
- tajweed tooltip ([#38](https://github.com/kodepintar/colorful-quran/issues/38))
- add share button to social media ([#37](https://github.com/kodepintar/colorful-quran/issues/37))
- madd arid lissukun rule finder

<a name="v0.0.3"></a>

<a name="v0.0.3"></a>
## [v0.0.3] - 2021-10-19

### Bug Fixes

- NoonOrTanwinBasedRule when base huruf has shaddah
- NoonOrTanwinBasedRule split rule scope
- falsy ghunnah
- tajweed generator break when load aya that not yet have tajweed

### New Features

- idgham mimi rule finder
- madd-wajib rule finder
- add last reading ([#35](https://github.com/kodepintar/colorful-quran/issues/35))
Expand All @@ -84,12 +72,10 @@
- tajweed surah 2 aya 21-30 kemenag ([#26](https://github.com/kodepintar/colorful-quran/issues/26))
- tajweed surah 2 aya 31-40 kemenag ([#22](https://github.com/kodepintar/colorful-quran/issues/22))

<a name="v0.0.2"></a>

<a name="v0.0.2"></a>
## [v0.0.2] - 2021-10-08

### New Features

- load current tajweed on tajweed generator
- add title tajweed class and fix some tajweed rule
- tajweed surah 2 aya 11-20 kemenag ([#17](https://github.com/kodepintar/colorful-quran/issues/17))
Expand All @@ -100,12 +86,10 @@
- tajweed surah 2 aya 1-5 kemenag version ([#12](https://github.com/kodepintar/colorful-quran/issues/12))
- add tajweed surah 2 aya 10 kemenag version ([#11](https://github.com/kodepintar/colorful-quran/issues/11))

<a name="v0.0.1"></a>

<a name="v0.0.1"></a>
## v0.0.1 - 2021-10-07

### New Features

- tajweed surah 1 kemenag version ([#3](https://github.com/kodepintar/colorful-quran/issues/3))
- style page surah ([#2](https://github.com/kodepintar/colorful-quran/issues/2))
- kemenag LPMQ font
Expand All @@ -114,7 +98,8 @@
- new page for dynamic surah
- new db Quran kemenag

[unreleased]: https://github.com/kodepintar/colorful-quran/compare/v0.3.0...HEAD

[Unreleased]: https://github.com/kodepintar/colorful-quran/compare/v0.3.0...HEAD
[v0.3.0]: https://github.com/kodepintar/colorful-quran/compare/v0.2.0...v0.3.0
[v0.2.0]: https://github.com/kodepintar/colorful-quran/compare/v0.1.0...v0.2.0
[v0.1.0]: https://github.com/kodepintar/colorful-quran/compare/v0.0.3...v0.1.0
Expand Down
1 change: 0 additions & 1 deletion pnpm-lock.yaml

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

139 changes: 138 additions & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,145 @@
<html lang="en" class="notranslate" translate="no">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<link rel="icon" href="/logo/apple-icon-180.png" />
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="apple-touch-icon" href="/logo/apple-icon-180.png" />

<meta name="apple-mobile-web-app-capable" content="yes" />

<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2048-2732.jpg"
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2732-2048.jpg"
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1668-2388.jpg"
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2388-1668.jpg"
media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1536-2048.jpg"
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2048-1536.jpg"
media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1668-2224.jpg"
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2224-1668.jpg"
media="(device-width: 834px) and (device-height: 1112px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1620-2160.jpg"
media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2160-1620.jpg"
media="(device-width: 810px) and (device-height: 1080px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1284-2778.jpg"
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2778-1284.jpg"
media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1170-2532.jpg"
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2532-1170.jpg"
media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1125-2436.jpg"
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2436-1125.jpg"
media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1242-2688.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2688-1242.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-828-1792.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1792-828.jpg"
media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1242-2208.jpg"
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-2208-1242.jpg"
media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-750-1334.jpg"
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1334-750.jpg"
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-640-1136.jpg"
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: portrait)"
/>
<link
rel="apple-touch-startup-image"
href="/logo/apple-splash-1136-640.jpg"
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape)"
/>

%svelte.head%
</head>

Expand Down
4 changes: 3 additions & 1 deletion src/routes/[source]/surah/[surah_id].svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@
</div>
</div>
{/if}
<TajweedView {surah} {surahDetail} on:saveLastReading={saveLastReading} />
<div class="pb-10">
<TajweedView {surah} {surahDetail} on:saveLastReading={saveLastReading} />
</div>
92 changes: 92 additions & 0 deletions src/service-worker.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { timestamp, files, build } from '$service-worker';

const _files = files.filter((o) => !o.includes('.DS_Store'));
const ASSETS = `cache${timestamp}`;

// `build` is an array of all the files generated by the bundler,
// `files` is an array of everything in the `static` directory
const to_cache = (build as string[]).concat(_files as string[]);
const staticAssets = new Set(to_cache);

self.addEventListener('install', (event: ExtendableEvent) => {
event.waitUntil(
caches
.open(ASSETS)
.then((cache) =>
cache
.addAll(to_cache)
.then()
.catch((e) => console.warn(e))
)
.then(() => {
(self as never as ServiceWorkerGlobalScope).skipWaiting();
})
);
});

self.addEventListener('activate', (event: ExtendableEvent) => {
event.waitUntil(
caches.keys().then(async (keys) => {
// delete old caches
for (const key of keys) {
if (key !== ASSETS) await caches.delete(key);
}

(self as never as ServiceWorkerGlobalScope).clients.claim();
})
);
});

/**
* Fetch the asset from the network and store it in the cache.
* Fall back to the cache if the user is offline.
*/
async function fetchAndCache(request: Request) {
const cache = await caches.open(`offline${timestamp}`);

try {
const response = await fetch(request);
cache.put(request, response.clone());
return response;
} catch (err) {
const response = await cache.match(request);
if (response) return response;

throw err;
}
}

self.addEventListener('fetch', (event: FetchEvent) => {
if (event.request.method !== 'GET' || event.request.headers.has('range')) return;

const url = new URL(event.request.url);

// don't try to handle e.g. data: URIs
const isHttp = url.protocol.startsWith('http');
const isDevServerRequest =
url.hostname === self.location.hostname && url.port !== self.location.port;
const isStaticAsset = url.host === self.location.host && staticAssets.has(url.pathname);
const skipBecauseUncached = event.request.cache === 'only-if-cached' && !isStaticAsset;

if (isHttp && !isDevServerRequest && !skipBecauseUncached) {
event.respondWith(
(async () => {
// always serve static files and bundler-generated assets from cache.
// if your application has other URLs with data that will never change,
// set this variable to true for them and they will only be fetched once.
const cachedAsset = isStaticAsset && (await caches.match(event.request));

// for pages, you might want to serve a shell `service-worker-index.html` file,
// which Sapper has generated for you. It's not right for every
// app, but if it's right for yours then uncomment this section
/*
if (!cachedAsset && url.origin === self.origin && routes.find(route => route.pattern.test(url.pathname))) {
return caches.match('/service-worker-index.html');
}
*/

return cachedAsset || fetchAndCache(event.request);
})()
);
}
});
2 changes: 1 addition & 1 deletion src/store/Setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { browser } from '$app/env';
interface ISetting {
last_read_surah?: string;
last_read_aya?: string;
theme?: 'light'|'dark';
theme?: 'light' | 'dark';
ukuranAyat?: number;
ukuranTerjemahan?: number;
showTranslate?: boolean;
Expand Down
Binary file added static/logo/apple-icon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1125-2436.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1136-640.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1170-2532.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1242-2208.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1242-2688.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1284-2778.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1334-750.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1536-2048.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1620-2160.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1668-2224.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1668-2388.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-1792-828.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2048-1536.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2048-2732.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2160-1620.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2208-1242.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2224-1668.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2388-1668.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2436-1125.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2532-1170.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2688-1242.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2732-2048.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-2778-1284.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-640-1136.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/logo/apple-splash-750-1334.jpg
Binary file added static/logo/apple-splash-828-1792.jpg
Binary file added static/logo/manifest-icon-192.maskable.png
Binary file added static/logo/manifest-icon-512.maskable.png
Loading

0 comments on commit c44584a

Please sign in to comment.