|
@ -102,35 +102,9 @@ import { RouteLocationNormalizedLoaded, Router } from "vue-router"; |
|
|
import { APP_SERVER } from "@/constants/app"; |
|
|
import { APP_SERVER } from "@/constants/app"; |
|
|
import { logger } from "@/utils/logger"; |
|
|
import { logger } from "@/utils/logger"; |
|
|
import { errorStringForLog } from "@/libs/endorserServer"; |
|
|
import { errorStringForLog } from "@/libs/endorserServer"; |
|
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin"; |
|
|
import { PlatformServiceFactory } from "@/services/PlatformServiceFactory"; |
|
|
|
|
|
|
|
|
/** |
|
|
@Component({}) |
|
|
* DeepLinkRedirectView Component |
|
|
|
|
|
* |
|
|
|
|
|
* Handles deep link redirection from web to the Time Safari mobile app. |
|
|
|
|
|
* Provides platform-specific redirection logic and fallback options. |
|
|
|
|
|
* |
|
|
|
|
|
* Features: |
|
|
|
|
|
* - Deep link redirection to mobile app |
|
|
|
|
|
* - Platform detection (iOS/Android/Desktop) |
|
|
|
|
|
* - Web fallback for desktop users |
|
|
|
|
|
* - Manual link options for failed redirects |
|
|
|
|
|
* - Development debugging information |
|
|
|
|
|
* |
|
|
|
|
|
* Deep Link Format: |
|
|
|
|
|
* - Mobile: timesafari://[path]?[query] |
|
|
|
|
|
* - Web: https://timesafari.app/[path]?[query] |
|
|
|
|
|
* |
|
|
|
|
|
* Route Parameters: |
|
|
|
|
|
* - path: Catch-all parameter for the destination path |
|
|
|
|
|
* - query: Query parameters to pass to the app |
|
|
|
|
|
* |
|
|
|
|
|
* @author Matthew Raymer |
|
|
|
|
|
* @since 2025-07-21 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Component({ |
|
|
|
|
|
mixins: [PlatformServiceMixin], |
|
|
|
|
|
}) |
|
|
|
|
|
export default class DeepLinkRedirectView extends Vue { |
|
|
export default class DeepLinkRedirectView extends Vue { |
|
|
$router!: Router; |
|
|
$router!: Router; |
|
|
$route!: RouteLocationNormalizedLoaded; |
|
|
$route!: RouteLocationNormalizedLoaded; |
|
@ -140,11 +114,8 @@ export default class DeepLinkRedirectView extends Vue { |
|
|
webUrl: string | null = null; // web link, eg "https://timesafari.app/..." |
|
|
webUrl: string | null = null; // web link, eg "https://timesafari.app/..." |
|
|
isDevelopment: boolean = false; |
|
|
isDevelopment: boolean = false; |
|
|
userAgent: string = ""; |
|
|
userAgent: string = ""; |
|
|
|
|
|
private platformService = PlatformServiceFactory.getInstance(); |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Component lifecycle hook - initializes deep link redirection |
|
|
|
|
|
* Parses route parameters and sets up redirect URLs |
|
|
|
|
|
*/ |
|
|
|
|
|
mounted() { |
|
|
mounted() { |
|
|
// Get the path from the route parameter (catch-all parameter) |
|
|
// Get the path from the route parameter (catch-all parameter) |
|
|
const pathParam = this.$route.params.path; |
|
|
const pathParam = this.$route.params.path; |
|
@ -183,10 +154,6 @@ export default class DeepLinkRedirectView extends Vue { |
|
|
this.openDeepLink(); |
|
|
this.openDeepLink(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Attempts to open the deep link URL |
|
|
|
|
|
* Uses multiple fallback methods for maximum compatibility |
|
|
|
|
|
*/ |
|
|
|
|
|
private openDeepLink() { |
|
|
private openDeepLink() { |
|
|
if (!this.deepLinkUrl || !this.webUrl) { |
|
|
if (!this.deepLinkUrl || !this.webUrl) { |
|
|
this.pageError = |
|
|
this.pageError = |
|
@ -225,11 +192,6 @@ export default class DeepLinkRedirectView extends Vue { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Handles deep link button click |
|
|
|
|
|
* Prevents default behavior and manually triggers deep link |
|
|
|
|
|
* @param event - Click event |
|
|
|
|
|
*/ |
|
|
|
|
|
private handleDeepLinkClick(event: Event) { |
|
|
private handleDeepLinkClick(event: Event) { |
|
|
if (!this.deepLinkUrl) return; |
|
|
if (!this.deepLinkUrl) return; |
|
|
|
|
|
|
|
@ -239,16 +201,11 @@ export default class DeepLinkRedirectView extends Vue { |
|
|
this.openDeepLink(); |
|
|
this.openDeepLink(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Handles web fallback button click |
|
|
|
|
|
* Uses platform-specific behavior for opening web links |
|
|
|
|
|
* @param event - Click event |
|
|
|
|
|
*/ |
|
|
|
|
|
private handleWebFallbackClick(event: Event) { |
|
|
private handleWebFallbackClick(event: Event) { |
|
|
if (!this.webUrl) return; |
|
|
if (!this.webUrl) return; |
|
|
|
|
|
|
|
|
// Get platform capabilities using mixin |
|
|
// Get platform capabilities |
|
|
const capabilities = this.platformCapabilities; |
|
|
const capabilities = this.platformService.getCapabilities(); |
|
|
|
|
|
|
|
|
// For mobile, try to open in a new tab/window |
|
|
// For mobile, try to open in a new tab/window |
|
|
if (capabilities.isMobile) { |
|
|
if (capabilities.isMobile) { |
|
@ -258,30 +215,13 @@ export default class DeepLinkRedirectView extends Vue { |
|
|
// For desktop, let the default behavior happen (opens in same tab) |
|
|
// For desktop, let the default behavior happen (opens in same tab) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// ===== COMPUTED PROPERTIES ===== |
|
|
// Computed properties for template |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Platform capabilities accessor |
|
|
|
|
|
* Provides cached access to platform capabilities |
|
|
|
|
|
*/ |
|
|
|
|
|
get platformCapabilities() { |
|
|
|
|
|
return this.platformService.getCapabilities(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Determines if the current platform is mobile |
|
|
|
|
|
* Uses PlatformServiceMixin for platform detection |
|
|
|
|
|
*/ |
|
|
|
|
|
get isMobile(): boolean { |
|
|
get isMobile(): boolean { |
|
|
return this.platformCapabilities.isMobile; |
|
|
return this.platformService.getCapabilities().isMobile; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Determines if the current platform is iOS |
|
|
|
|
|
* Uses PlatformServiceMixin for platform detection |
|
|
|
|
|
*/ |
|
|
|
|
|
get isIOS(): boolean { |
|
|
get isIOS(): boolean { |
|
|
return this.platformCapabilities.isIOS; |
|
|
return this.platformService.getCapabilities().isIOS; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|