Skip to content

Commit

Permalink
Merge pull request #2974 from numbersprotocol/feature-v230808-configu…
Browse files Browse the repository at this point in the history
…re-capture-app-to-receive-deep-links

Feature v230808 configure capture app to receive deep links
  • Loading branch information
sultanmyrza authored Aug 7, 2023
2 parents f043e33 + 5776ff4 commit 1371dbe
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
9 changes: 9 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@

<data android:scheme="@string/custom_url_scheme" />
</intent-filter>

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="https" android:host="capture-cam-deep-links.web.app" />
</intent-filter>
</activity>

<provider
Expand Down
22 changes: 13 additions & 9 deletions ios/App/App/App.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:capture-cam-deep-links.web.app</string>
</array>
<key>com.apple.developer.networking.HotspotConfiguration</key>
<true/>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>app-proxy-provider</string>
</array>
<key>com.apple.external-accessory.wireless-configuration</key>
<true/>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<true/>
<key>com.apple.developer.networking.networkextension</key>
<array>
<string>app-proxy-provider</string>
</array>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>com.apple.external-accessory.wireless-configuration</key>
<true/>
</dict>
</plist>
16 changes: 15 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Component } from '@angular/core';
import { Component, NgZone } from '@angular/core';
import { MatIconRegistry } from '@angular/material/icon';
import { DomSanitizer } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { App, URLOpenListenerEvent } from '@capacitor/app';
import { SplashScreen } from '@capacitor/splash-screen';
import { Platform } from '@ionic/angular';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
Expand Down Expand Up @@ -38,6 +40,8 @@ export class AppComponent {
private readonly cameraService: CameraService,
private readonly errorService: ErrorService,
private readonly inAppStoreService: InAppStoreService,
private readonly zone: NgZone,
private readonly router: Router,
appsFlyerService: AppsFlyerService,
notificationService: NotificationService,
pushNotificationService: PushNotificationService,
Expand All @@ -58,6 +62,7 @@ export class AppComponent {
.subscribe();
this.inAppStoreService.initialize();
this.initializeApp();
this.initializeDeepLinking();
this.restoreAppState();
this.initializeCollector();
this.registerIcon();
Expand All @@ -81,6 +86,15 @@ export class AppComponent {
await SplashScreen.hide();
}

async initializeDeepLinking() {
App.addListener('appUrlOpen', (event: URLOpenListenerEvent) => {
this.zone.run(() => {
const slug = event.url.split('.app').pop();
if (slug) this.router.navigateByUrl(slug);
});
});
}

private restoreAppState() {
this.cameraService.restoreKilledCaptureEvent$
.pipe(
Expand Down

0 comments on commit 1371dbe

Please sign in to comment.