Spaces:
Running
on
Inf2
Running
on
Inf2
add android id in the hf manifest (#1328)
Browse files* add android id in the hf manifest
* Add simple button
* Add extra icon sizes
* fix typo
* updated android modal
* revert unneeded changes to declarations
* debug timer
* show modal everytime
---------
Co-authored-by: Kevin CATHALY <alakme@kevins-mbp.home>
Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
- src/routes/+layout.svelte +41 -0
- static/huggingchat/icon-144x144.png +3 -0
- static/huggingchat/icon-192x192.png +3 -0
- static/huggingchat/icon-36x36.png +3 -0
- static/huggingchat/icon-48x48.png +3 -0
- static/huggingchat/icon-72x72.png +3 -0
- static/huggingchat/icon-96x96.png +3 -0
- static/huggingchat/manifest.json +37 -0
src/routes/+layout.svelte
CHANGED
|
@@ -21,6 +21,9 @@
|
|
| 21 |
import titleUpdate from "$lib/stores/titleUpdate";
|
| 22 |
import DisclaimerModal from "$lib/components/DisclaimerModal.svelte";
|
| 23 |
import ExpandNavigation from "$lib/components/ExpandNavigation.svelte";
|
|
|
|
|
|
|
|
|
|
| 24 |
import { PUBLIC_APP_DISCLAIMER } from "$env/static/public";
|
| 25 |
|
| 26 |
export let data;
|
|
@@ -126,6 +129,12 @@
|
|
| 126 |
$: mobileNavTitle = ["/models", "/assistants", "/privacy"].includes($page.route.id ?? "")
|
| 127 |
? ""
|
| 128 |
: data.conversations.find((conv) => conv.id === $page.params.id)?.title;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
</script>
|
| 130 |
|
| 131 |
<svelte:head>
|
|
@@ -227,3 +236,35 @@
|
|
| 227 |
{/if}
|
| 228 |
<slot />
|
| 229 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
import titleUpdate from "$lib/stores/titleUpdate";
|
| 22 |
import DisclaimerModal from "$lib/components/DisclaimerModal.svelte";
|
| 23 |
import ExpandNavigation from "$lib/components/ExpandNavigation.svelte";
|
| 24 |
+
import Logo from "$lib/components/icons/Logo.svelte";
|
| 25 |
+
import { isHuggingChat } from "$lib/utils/isHuggingChat";
|
| 26 |
+
import CarbonClose from "~icons/carbon/close";
|
| 27 |
import { PUBLIC_APP_DISCLAIMER } from "$env/static/public";
|
| 28 |
|
| 29 |
export let data;
|
|
|
|
| 129 |
$: mobileNavTitle = ["/models", "/assistants", "/privacy"].includes($page.route.id ?? "")
|
| 130 |
? ""
|
| 131 |
: data.conversations.find((conv) => conv.id === $page.params.id)?.title;
|
| 132 |
+
|
| 133 |
+
let showAndroidModal =
|
| 134 |
+
browser && // only show on browser
|
| 135 |
+
isHuggingChat && // only show on huggingchat
|
| 136 |
+
navigator.userAgent.toLowerCase().includes("android") && // if it's android
|
| 137 |
+
!navigator.userAgent.includes("co.huggingface.chat_ui_android"); // but not the android app
|
| 138 |
</script>
|
| 139 |
|
| 140 |
<svelte:head>
|
|
|
|
| 236 |
{/if}
|
| 237 |
<slot />
|
| 238 |
</div>
|
| 239 |
+
|
| 240 |
+
{#if showAndroidModal}
|
| 241 |
+
<a
|
| 242 |
+
href="https://play.google.com/store/apps/details?id=co.huggingface.chat_ui_android"
|
| 243 |
+
class="fixed left-0 right-0 top-0 mx-auto flex h-fit min-h-12 w-screen flex-nowrap items-center justify-evenly gap-4 bg-gray-200 px-4 py-4 text-gray-900 shadow-lg backdrop-blur-md
|
| 244 |
+
hover:bg-gray-100
|
| 245 |
+
sm:top-5 sm:max-w-fit sm:gap-4 sm:rounded-lg
|
| 246 |
+
dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600"
|
| 247 |
+
>
|
| 248 |
+
<button
|
| 249 |
+
class="border-r-2 border-black/20 pr-4 text-2xl"
|
| 250 |
+
on:click|stopPropagation|preventDefault={() => {
|
| 251 |
+
showAndroidModal = false;
|
| 252 |
+
}}
|
| 253 |
+
>
|
| 254 |
+
<CarbonClose />
|
| 255 |
+
</button>
|
| 256 |
+
|
| 257 |
+
<Logo classNames="mx-2.5 scale-150" />
|
| 258 |
+
|
| 259 |
+
<div class="flex flex-col sm:mr-4">
|
| 260 |
+
<span class="text-lg font-semibold">HuggingChat</span>
|
| 261 |
+
<span class="text-sm">View on Google Play</span>
|
| 262 |
+
</div>
|
| 263 |
+
|
| 264 |
+
<span
|
| 265 |
+
class="ml-auto mr-2 text-center text-lg font-medium text-gray-700 underline underline-offset-4 dark:text-gray-300"
|
| 266 |
+
>
|
| 267 |
+
Open
|
| 268 |
+
</span>
|
| 269 |
+
</a>
|
| 270 |
+
{/if}
|
static/huggingchat/icon-144x144.png
ADDED
|
|
Git LFS Details
|
static/huggingchat/icon-192x192.png
ADDED
|
|
Git LFS Details
|
static/huggingchat/icon-36x36.png
ADDED
|
|
Git LFS Details
|
static/huggingchat/icon-48x48.png
ADDED
|
|
Git LFS Details
|
static/huggingchat/icon-72x72.png
ADDED
|
|
Git LFS Details
|
static/huggingchat/icon-96x96.png
ADDED
|
|
Git LFS Details
|
static/huggingchat/manifest.json
CHANGED
|
@@ -5,11 +5,41 @@
|
|
| 5 |
"display": "standalone",
|
| 6 |
"start_url": "/chat",
|
| 7 |
"icons": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
{
|
| 9 |
"src": "/chat/huggingchat/icon-128x128.png",
|
| 10 |
"sizes": "128x128",
|
| 11 |
"type": "image/png"
|
| 12 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
{
|
| 14 |
"src": "/chat/huggingchat/icon-256x256.png",
|
| 15 |
"sizes": "256x256",
|
|
@@ -20,5 +50,12 @@
|
|
| 20 |
"sizes": "512x512",
|
| 21 |
"type": "image/png"
|
| 22 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
]
|
| 24 |
}
|
|
|
|
| 5 |
"display": "standalone",
|
| 6 |
"start_url": "/chat",
|
| 7 |
"icons": [
|
| 8 |
+
{
|
| 9 |
+
"src": "/chat/huggingchat/icon-36x36.png",
|
| 10 |
+
"sizes": "36x36",
|
| 11 |
+
"type": "image/png"
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"src": "/chat/huggingchat/icon-48x48.png",
|
| 15 |
+
"sizes": "48x48",
|
| 16 |
+
"type": "image/png"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"src": "/chat/huggingchat/icon-72x72.png",
|
| 20 |
+
"sizes": "72x72",
|
| 21 |
+
"type": "image/png"
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"src": "/chat/huggingchat/icon-96x96.png",
|
| 25 |
+
"sizes": "96x96",
|
| 26 |
+
"type": "image/png"
|
| 27 |
+
},
|
| 28 |
{
|
| 29 |
"src": "/chat/huggingchat/icon-128x128.png",
|
| 30 |
"sizes": "128x128",
|
| 31 |
"type": "image/png"
|
| 32 |
},
|
| 33 |
+
{
|
| 34 |
+
"src": "/chat/huggingchat/icon-144x144.png",
|
| 35 |
+
"sizes": "144x144",
|
| 36 |
+
"type": "image/png"
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"src": "/chat/huggingchat/icon-192x192.png",
|
| 40 |
+
"sizes": "192x192",
|
| 41 |
+
"type": "image/png"
|
| 42 |
+
},
|
| 43 |
{
|
| 44 |
"src": "/chat/huggingchat/icon-256x256.png",
|
| 45 |
"sizes": "256x256",
|
|
|
|
| 50 |
"sizes": "512x512",
|
| 51 |
"type": "image/png"
|
| 52 |
}
|
| 53 |
+
],
|
| 54 |
+
"prefer_related_applications": true,
|
| 55 |
+
"related_applications": [
|
| 56 |
+
{
|
| 57 |
+
"platform": "play",
|
| 58 |
+
"id": "co.huggingface.chat_ui_android"
|
| 59 |
+
}
|
| 60 |
]
|
| 61 |
}
|