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:
Blake Bender 2015-07-27 13:45:22 -07:00
Родитель 56579f6a23
Коммит 6c20966791
7 изменённых файлов: 22 добавлений и 48 удалений

Просмотреть файл

@ -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>