Skip to content

Commit 69faf2d

Browse files
authored
Merge pull request #4689 from dpalou/MOBILE-4982
MOBILE-4892 webapp: Allow passing deep link as parameter
2 parents 738bd25 + 757e71a commit 69faf2d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/core/initializers/initialize-urlscheme.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
import { CorePlatform } from '@services/platform';
1516
import { CoreCustomURLSchemes } from '@services/urlschemes';
1617
import { NgZone } from '@singletons';
1718
import { CoreEvents } from '@singletons/events';
19+
import { CoreUrl } from '@singletons/url';
1820

1921
/**
2022
* Asynchronous function to handle custom URLs when the app is launched.
@@ -46,4 +48,17 @@ export default async function(): Promise<void> {
4648
});
4749
});
4850
};
51+
52+
// Allow launching the app with a deep link in web app.
53+
const searchParams = new URLSearchParams(window.location.search);
54+
55+
await CorePlatform.ready();
56+
57+
if (!CorePlatform.isMobile()) {
58+
const url = searchParams.get('webAppDeepLink');
59+
if (url) {
60+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
61+
(<any> window).handleOpenURL(CoreUrl.decodeURIComponent(url));
62+
}
63+
}
4964
}

src/core/services/urlschemes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ export class CoreCustomURLSchemesProvider {
298298
siteUrl: url,
299299
username: username,
300300
token: params.token,
301-
privateToken: params.privateToken,
301+
privateToken: params.privateToken || params.privatetoken,
302302
redirect: params.redirect,
303303
isAuthenticationURL: !!params.token,
304304
};

0 commit comments

Comments
 (0)