Skip to content

Commit b27be87

Browse files
wip: restrict external urls
1 parent 467725f commit b27be87

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ios/Runner/AppDelegate.swift

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ import UserNotifications
2828
)
2929
}
3030

31+
// Allow only `zulip://login` external urls.
32+
override func application(_ application: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
33+
if url.scheme == "zulip" && url.host == "login" {
34+
return super.application(application, open: url, options: options)
35+
}
36+
return false
37+
}
38+
3139
// Handle notification tap while the app is running.
3240
override func userNotificationCenter(
3341
_ center: UNUserNotificationCenter,

lib/widgets/app.dart

+3-1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class ZulipApp extends StatefulWidget {
141141
class _ZulipAppState extends State<ZulipApp> with WidgetsBindingObserver {
142142
@override
143143
Future<bool> didPushRouteInformation(routeInformation) async {
144+
print("didPushRouteInformation: ${routeInformation.uri}");
144145
switch (routeInformation.uri) {
145146
case Uri(scheme: 'zulip', host: 'login') && var url:
146147
await LoginPage.handleWebAuthUrl(url);
@@ -206,7 +207,8 @@ class _ZulipAppState extends State<ZulipApp> with WidgetsBindingObserver {
206207
// like [Navigator.push], never mere names as with [Navigator.pushNamed].
207208
onGenerateRoute: (_) => null,
208209

209-
onGenerateInitialRoutes: (_) {
210+
onGenerateInitialRoutes: (String initialRoute) {
211+
print("onGenerateInitialRoutes: $initialRoute");
210212
return [
211213
if (initialAccountId == null)
212214
MaterialWidgetRoute(page: const ChooseAccountPage())

0 commit comments

Comments
 (0)