Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Added fix for Facebook redirecting the webview to e.g. javascript app… #255

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion winsdkfb/winsdkfb/winsdkfb.Shared/FacebookDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
MinWidth="0" MinHeight="0" Width="30" Height="30"
Style="{StaticResource CircleWithCrossButtonKey}" Click="CloseDialogButton_OnClick" FontFamily="Segoe UI Symbol"
Margin="0,0,0,5" Foreground="White" />
<WebView x:Name="dialogWebBrowser" Grid.Row="1" />
<WebView x:Name="dialogWebBrowser" Grid.Row="1" NavigationStarting="dialogWebBrowser_CancelClosedRedirects" />
</Grid>
</Grid>
</UserControl>
11 changes: 11 additions & 0 deletions winsdkfb/winsdkfb/winsdkfb.Shared/FacebookDialog.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,17 @@ void FacebookDialog::dialogWebView_NavCompleted(
}
}

void winsdkfb::FacebookDialog::dialogWebBrowser_CancelClosedRedirects(
Windows::UI::Xaml::Controls::WebView^ sender,
Windows::UI::Xaml::Controls::WebViewNavigationStartingEventArgs^ args
)
{
if (!_popup || !_popup->IsOpen) { // ignore if Facebook tries to redirect webview after we have been closed
args->Cancel = true;
}
}


void FacebookDialog::CloseDialogButton_OnClick(
Object^ sender,
RoutedEventArgs^ e
Expand Down
7 changes: 6 additions & 1 deletion winsdkfb/winsdkfb/winsdkfb.Shared/FacebookDialog.xaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@ namespace winsdkfb
Windows::UI::Xaml::Controls::WebViewNavigationCompletedEventArgs^ e
);

void dialogWebBrowser_CancelClosedRedirects(
Windows::UI::Xaml::Controls::WebView^ sender,
Windows::UI::Xaml::Controls::WebViewNavigationStartingEventArgs^ args
);

void CloseDialogButton_OnClick(
Platform::Object^ sender,
Windows::UI::Xaml::RoutedEventArgs^ e
Expand Down Expand Up @@ -161,5 +166,5 @@ namespace winsdkfb
Windows::UI::Xaml::Controls::Grid^ _grid;
Windows::UI::Xaml::Controls::Primitives::Popup^ _popup;
concurrency::task_completion_event<winsdkfb::FBResult^> _dialogResponse;
};
};
}