зеркало из https://github.com/microsoft/winsdkfb.git
Fix up LoginCs to work with WebView login, and setup project to include SDK project rather than refer to NuGet package.
This commit is contained in:
Родитель
56579f6a23
Коммит
6c20966791
|
@ -315,9 +315,21 @@ task<FBResult^> FBSession::CheckForExistingToken(
|
|||
}
|
||||
return decryptTask;
|
||||
})
|
||||
.then([](IBuffer^ clearBuffer) -> FBResult^
|
||||
.then([](task<IBuffer^> clearBufferTask) -> FBResult^
|
||||
{
|
||||
FBResult^ cachedResult = nullptr;
|
||||
IBuffer^ clearBuffer = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
clearBuffer = clearBufferTask.get();
|
||||
}
|
||||
catch (InvalidArgumentException^ ex)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
OutputDebugString(L"Couldn't decrypt cached token. Continuing without cached token data.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (clearBuffer)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<AppContainerApplication>true</AppContainerApplication>
|
||||
<ApplicationType>Windows Store</ApplicationType>
|
||||
<ApplicationTypeRevision>8.2</ApplicationTypeRevision>
|
||||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion>
|
||||
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
|
@ -222,4 +224,4 @@
|
|||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -60,33 +60,6 @@ namespace LoginCs
|
|||
this.Suspending += this.OnSuspending;
|
||||
}
|
||||
|
||||
#if WINDOWS_PHONE_APP
|
||||
protected override void OnActivated(IActivatedEventArgs args)
|
||||
{
|
||||
if (args.Kind == ActivationKind.Protocol)
|
||||
{
|
||||
HandleProtocolActivation(args);
|
||||
}
|
||||
}
|
||||
|
||||
async void HandleProtocolActivation(IActivatedEventArgs args)
|
||||
{
|
||||
ProtocolActivatedEventArgs pArgs =
|
||||
(ProtocolActivatedEventArgs)args;
|
||||
FBSession sess = FBSession.ActiveSession;
|
||||
|
||||
FBResult result = await sess.ContinueAction(pArgs);
|
||||
if (result.Succeeded)
|
||||
{
|
||||
await Window.Current.Dispatcher.RunAsync(
|
||||
Windows.UI.Core.CoreDispatcherPriority.Normal,
|
||||
() =>
|
||||
{
|
||||
RootFrame.Navigate(typeof(UserInfo));
|
||||
});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
const string FBAppIDName = "FBApplicationId";
|
||||
const string FBPhoneAppIDName = "FBWinPhoneAppId";
|
||||
const string FBStoreAppIDName = "FBWinStoreAppId";
|
||||
|
|
|
@ -96,13 +96,13 @@ namespace LoginCs
|
|||
}
|
||||
}
|
||||
|
||||
private void login_OnClicked(object sender, RoutedEventArgs e)
|
||||
private async void login_OnClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FBSession sess = FBSession.ActiveSession;
|
||||
if (sess.LoggedIn)
|
||||
{
|
||||
LoginButton.Content = "Login";
|
||||
sess.Logout();
|
||||
await sess.Logout();
|
||||
//Navigate back to same page, to clear out logged in info.
|
||||
App.RootFrame.Navigate(typeof(MainPage));
|
||||
}
|
||||
|
|
|
@ -116,14 +116,6 @@
|
|||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Facebook">
|
||||
<HintPath>..\..\packages\FBWinSDK.0.9.0\lib\wpa\Facebook.winmd</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\..\packages\Newtonsoft.Json.6.0.8\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\LoginCs.Shared\FBCSObjectImplementation.ttinclude">
|
||||
<Link>FBCSObjectImplementation.ttinclude</Link>
|
||||
|
@ -168,4 +160,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
|
@ -75,7 +75,7 @@ namespace LoginCs
|
|||
|
||||
// Launches a URI to redirect to the FB app, which will log us in
|
||||
// and return the result via our registered protocol.
|
||||
await s.LoginAndContinue();
|
||||
FBResult result = await s.LoginAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -110,13 +110,13 @@ namespace LoginCs
|
|||
}
|
||||
}
|
||||
|
||||
private void login_OnClicked(object sender, RoutedEventArgs e)
|
||||
private async void login_OnClicked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FBSession sess = FBSession.ActiveSession;
|
||||
if (sess.LoggedIn)
|
||||
{
|
||||
LoginButton.Content = "Login";
|
||||
sess.Logout();
|
||||
await sess.Logout();
|
||||
//Navigate back to same page, to clear out logged in info.
|
||||
App.RootFrame.Navigate(typeof(MainPage));
|
||||
}
|
||||
|
|
|
@ -21,11 +21,6 @@
|
|||
</m3:DefaultTile>
|
||||
<m3:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</m3:VisualElements>
|
||||
<Extensions>
|
||||
<Extension Category="windows.protocol">
|
||||
<Protocol Name="fb1406183856361054" />
|
||||
</Extension>
|
||||
</Extensions>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
|
|
Загрузка…
Ссылка в новой задаче