From 499b0b1e778a896e7a51be13dca9b3af38e5e760 Mon Sep 17 00:00:00 2001 From: MojtabaSoumi Date: Sun, 21 Jun 2026 13:05:56 +0330 Subject: [PATCH] 1405/03/31-apk link --- public/.well-known/assetlinks.json | 10 ------ public/apk/.gitkeep | 0 src/app/bootstrap.ts | 15 +++++++- src/utils/config.ts | 9 ++++- src/views/login/components/Login.vue | 36 +++++++++++++++---- .../desktop/components/DesktopLoginForm.vue | 16 +++++++-- yarn.lock | 6 ++-- 7 files changed, 69 insertions(+), 23 deletions(-) delete mode 100644 public/.well-known/assetlinks.json delete mode 100644 public/apk/.gitkeep diff --git a/public/.well-known/assetlinks.json b/public/.well-known/assetlinks.json deleted file mode 100644 index 551b179..0000000 --- a/public/.well-known/assetlinks.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "relation": ["delegate_permission/common.handle_all_urls"], - "target": { - "namespace": "android_app", - "package_name": "ir.samingold.app", - "sha256_cert_fingerprints": ["60:54:C6:C1:22:6C:2E:EA:A1:05:02:B1:17:F5:7D:49:1A:C0:84:FF:4C:ED:FD:42:D9:7F:DF:B2:70:37:8E:03"] - } - } -] diff --git a/public/apk/.gitkeep b/public/apk/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/bootstrap.ts b/src/app/bootstrap.ts index 790ab9e..ce88a69 100644 --- a/src/app/bootstrap.ts +++ b/src/app/bootstrap.ts @@ -83,11 +83,24 @@ function applyTenantThemeVars() { document.documentElement.style.setProperty('--App-background-color', backgroundColor) } } +function detectTWA() { + const fromReferrer = document.referrer.startsWith('android-app://'); + const fromParam = new URLSearchParams(window.location.search).get('source') === 'twa'; + if (fromReferrer || fromParam) { + sessionStorage.setItem('appMode', 'twa'); + // پاک کردن پارامتر از URL + if (fromParam) { + const url = new URL(window.location.href); + url.searchParams.delete('source'); + window.history.replaceState({}, '', url); + } + } +} export async function bootstrapApp() { try { + detectTWA() const config = await withTimeout(loadAppConfig(), 20000, 'Config loading timeout') - setAppConfig(config) applyTenantThemeVars() startPwaManifest(config) diff --git a/src/utils/config.ts b/src/utils/config.ts index bed7c1b..8edd7ff 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -224,7 +224,14 @@ export function applyProjectFont() { document.documentElement.classList.add('font-dana') } } - +export function isTWA() { + if (sessionStorage.getItem('appMode') === 'twa') return true; + if (document.referrer.startsWith('android-app://')) { + sessionStorage.setItem('appMode', 'twa'); + return true; + } + return false; +} export function applyProjectTheme() { applyProjectFont() diff --git a/src/views/login/components/Login.vue b/src/views/login/components/Login.vue index 241c2e2..d33d81b 100644 --- a/src/views/login/components/Login.vue +++ b/src/views/login/components/Login.vue @@ -186,7 +186,7 @@ +
+ + دانلود اپ اندروید + +
+
+ - +
اگر حساب کاربری ندارید @@ -360,7 +377,13 @@ import { useWalletStore } from '@/store/walletStore' import { useSettingsStore } from '@/store/settingsStore' import { setTruth } from '@/app/authBoot' import {useConfigStore} from "@/store/configStore"; -import {getConfigApp, getProjectLoginLogo, getProjectLoginTaglineLines, hasCustomLoginLogoLayout} from "@/utils/config"; +import { + getConfigApp, + getProjectLoginLogo, + getProjectLoginTaglineLines, + hasCustomLoginLogoLayout, + isTWA +} from "@/utils/config"; import BasicActionSheet from "@/components/BasicPacks/BasicActionSheet.vue"; import {getConfig} from "@/api/config"; import shareAppleIcon from '@/assets/img/share-apple.png' @@ -390,6 +413,7 @@ const stepTwoVerify = ref(false) const formRef = ref() const userStore = useUserStore() const walletStore = useWalletStore() +const setting=useSettingsStore() const data = reactive(['ورود با پیامک', 'ورود با کلمه عبور']) const value = ref(data[0]) const refOtpInput = ref | null>(null) diff --git a/src/views/login/desktop/components/DesktopLoginForm.vue b/src/views/login/desktop/components/DesktopLoginForm.vue index 8d71d46..de04fdb 100644 --- a/src/views/login/desktop/components/DesktopLoginForm.vue +++ b/src/views/login/desktop/components/DesktopLoginForm.vue @@ -8,11 +8,14 @@ import { useConfigStore } from '@/store/configStore' import { useLoginPageContext } from '../../composables/useLoginPage' import DesktopPwaGuideModal from './DesktopPwaGuideModal.vue' import router from '@/router' +import {isTWA} from "@/utils/config"; +import {useUserStore} from "@/store/userStore"; +import {useSettingsStore} from "@/store/settingsStore"; const emit = defineEmits<{ register: [val: boolean] }>() - +const setting=useSettingsStore() const config = useConfigStore() const { time, @@ -170,7 +173,7 @@ function goToAboutUs() { + +
diff --git a/yarn.lock b/yarn.lock index dd3d7ff..4e16c86 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1081,10 +1081,10 @@ resolved "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz#255e81fb289b101026131858ab99fba63dcf0071" integrity sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ== -"@esbuild/linux-x64@0.18.20": +"@esbuild/win32-x64@0.18.20": version "0.18.20" - resolved "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz" - integrity sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w== + resolved "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz" + integrity sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ== "@esbuild/netbsd-x64@0.18.20": version "0.18.20"