diff --git a/README.md b/README.md index 58060e8..b824dac 100644 --- a/README.md +++ b/README.md @@ -1,46 +1,47 @@ -# **Windows SDK for Facebook** +# Windows SDK for Facebook -The Windows SDK for Facebook is geared towards app developers creating modern windows applications on both desktop and phone. Easily integrate Facebook Auth, Like and other Facebook Graph functionality using this SDK. Nuget package for Windows 10 available at: https://www.nuget.org/packages/winsdkfb +The Windows SDK for Facebook is geared towards app developers creating modern windows applications on both desktop and phone. +Easily integrate Facebook Auth, Like and other Facebook Graph functionality using this SDK. Nuget package for Windows 10 +available at: https://www.nuget.org/packages/winsdkfb +## Features -## **Features** - -###Auth +### Auth - Login - Logout - Login Button - Profile Picture control -###Dialogs +### Dialogs - Feed dialog - Request dialog - Send dialog -###Graph - - Custom Stories +### Graph + + - Custom Stories - Post to user’s feed - Upload Photo - Like a Page/Object -###AppInstalls +### AppInstalls - Mobile App Installs (can be disabled by defining \_\_NOFBAPPEVENTS__) +## Supported Platforms -## **Supported Platforms** - -Windows 8.1+ -Windows Phone 8.1+ -Windows 10 +- [x] Windows 8.1+ +- [x] Windows Phone 8.1+ +- [x] Windows 10 -## **Documentation** +## Documentation - http://microsoft.github.io/winsdkfb -## **License** +## License See the LICENSE file for licensing information. -## **Contributing** +## Contributing All pull requests should be made to the `develop` branch. diff --git a/samples/LoginCpp/LoginCpp/LoginCpp.Shared/MainPage.Shared.xaml.cpp b/samples/LoginCpp/LoginCpp/LoginCpp.Shared/MainPage.Shared.xaml.cpp index 58be18d..60ad4d3 100644 --- a/samples/LoginCpp/LoginCpp/LoginCpp.Shared/MainPage.Shared.xaml.cpp +++ b/samples/LoginCpp/LoginCpp/LoginCpp.Shared/MainPage.Shared.xaml.cpp @@ -48,7 +48,6 @@ const wchar_t* requested_permissions[] = L"public_profile", L"user_friends", L"user_likes", - L"user_groups", L"user_location" }; diff --git a/winsdkfb/build/build-sdk.cmd b/winsdkfb/build/build-sdk.cmd index e4565c6..71b48b0 100644 --- a/winsdkfb/build/build-sdk.cmd +++ b/winsdkfb/build/build-sdk.cmd @@ -1,113 +1,2 @@ -rem --------------------------------------------------------------------------- -rem Script to build the Microsoft SDK for Facebook Integration. This script -rem will build the Windows 8.1 and Windows Phone 8.1 versions of the SDK, then -rem the Windows 10 Universal version, then package everything up with NuGet. -rem -rem On completion, the SDK packages should be located in the directory -rem winsdkfb\bin under the root of the repository. A synopsis of the build will -rem exist in the file sdk-build.log in the same directory as the build script. -rem -rem This script assumes it is located in the Git repository and location in -rem which it originated. If it is moved, it will cease to function! -rem --------------------------------------------------------------------------- - -set starting_dir=%cd% -set script_dir=%~dp0 -set logfile=%script_dir%\sdk-build.log -cd /d %script_dir%\.. - -@echo Starting build... >%logfile% - -rem --------------------------------------------------------------------------- -rem build for Windows 8.1 and Phone 8.1 -rem --------------------------------------------------------------------------- -call :build_one_flavor winsdkfb.sln Win32 Debug -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb.sln Win32 Release -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb.sln x64 Debug -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb.sln x64 Release -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb.sln ARM Debug -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb.sln ARM Release -if errorlevel 1 goto errorExit - -rem --------------------------------------------------------------------------- -rem build for Windows 10 Universal -rem --------------------------------------------------------------------------- - -call :build_one_flavor winsdkfb_uwp/winsdkfb_uwp.sln Win32 Debug -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb_uwp/winsdkfb_uwp.sln Win32 Release -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb_uwp/winsdkfb_uwp.sln x64 Debug -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb_uwp/winsdkfb_uwp.sln x64 Release -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb_uwp/winsdkfb_uwp.sln ARM Debug -if errorlevel 1 goto errorExit - -call :build_one_flavor winsdkfb_uwp/winsdkfb_uwp.sln ARM Release -if errorlevel 1 goto errorExit - -rem --------------------------------------------------------------------------- -rem build NuGet packages -rem --------------------------------------------------------------------------- -:build_nuget -cd %script_dir%\nuget - -rem Get version number, so we can test for packages after build attempt -for /f "delims=" %%i in ('type VERSION') do set version=%%i - -@echo Checking for nuget.exe... >>%logfile% -if not exist nuget.exe call download-nuget.cmd -if not exist nuget.exe ( - @echo Error: failed to download nuget.exe, can't package the SDK - goto :eof -) - -@echo Packaging SDK... >>%logfile% - -call build-nupkg.cmd -if not exist ..\..\bin\winsdkfb.%version%.nupkg ( - @echo Error: failed to build SDK NuGet package - goto :eof -) - -cd /d %starting_dir% -@echo Build successful >>%logfile% -@echo "All done!" -goto :eof - -rem --------------------------------------------------------------------------- -rem Subroutine to build for one solution, platform, and configuration -rem --------------------------------------------------------------------------- -:build_one_flavor -@echo Starting build for solution %1, platform %2, configuration %3 >>%logfile% -msbuild %1 /p:Platform=%2;Configuration=%3 -if errorlevel 1 ( - @echo Error building solution %1, platform %2, configuration %3 >>%logfile% - exit /b -) -@echo Completed build for solution %1, platform %2, configurattion %3 >>%logfile% -exit /b - -rem --------------------------------------------------------------------------- -rem In case of build failure, err out here -rem --------------------------------------------------------------------------- -:errorExit -@echo "Error: one or more targets failed to build." -cd /d %starting_dir% -goto :eof +powershell %~dp0\build-sdk.ps1 \ No newline at end of file diff --git a/winsdkfb/build/build-sdk.ps1 b/winsdkfb/build/build-sdk.ps1 new file mode 100644 index 0000000..95bfd87 --- /dev/null +++ b/winsdkfb/build/build-sdk.ps1 @@ -0,0 +1,147 @@ + +# If you move this script, change this environment variable to point to the root +# of the winsdkfb directory. Stuff will break if you don't! +Set-Item -force -path "env:WinsdkfbRoot" -value "$PSScriptRoot\..\.." + +#.SYNOPSIS +# Grabs all environment variable set after vcvarsall.bat is called and pulls +# them into the Powershell environment. +function Set-MsbuildDevEnvironment() +{ + $path = "$env:VS140COMNTOOLS\..\.." + pushd $path + cmd /c "vcvarsall.bat&set" | foreach { + if ($_ -match "=") + { + $s = $_.Split("="); + Set-Item -force -path "env:\$($s[0])" -value "$($s[1])" + } + } + popd + Write-Host "Dev environment variables set" -ForegroundColor Green +} + +#.SYNOPSIS +# Downloads the latest version of nuget.exe. +# +#.PARAMETER $DownloadTargetDir +# The directory to place nuget.exe in. +function Get-Nuget() +{ + [CmdletBinding()] + Param ( + [parameter(Mandatory=$true)] + [string]$DownloadTargetDir + ) + + $NugetDownloadUrl = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' + $Downloader = New-Object System.Net.WebClient + $Downloader.DownloadFile($NugetDownloadUrl, "$DownloadTargetDir\nuget.exe") +} + +#.SYNOPSIS +# Ensures that the build tools required can be found on the system. +function Test-BuildToolsPresent() +{ + Set-MsbuildDevEnvironment + if ((Get-Command "msbuild.exe" -ErrorAction SilentlyContinue) -eq $null) + { + Throw "msbuild.exe is not present in path" + } + if ((Get-Command "nuget.exe" -ErrorAction SilentlyContinue) -eq $null) + { + $NugetTargetDir = "$env:WinsdkfbRoot\winsdkfb\build\nuget" + if (-not (Test-Path "$NugetTargetDir\nuget.exe")) + { + Write-Host "downloading latest nuget.exe..." + Get-Nuget -DownloadTargetDir $NugetTargetDir + } + $env:Path += ";$NugetTargetDir;" + } + if ((Get-Command "TextTransform.exe" -ErrorAction SilentlyContinue) -eq $null) + { + $TextTemplateDir = "${env:CommonProgramFiles(x86)}\Microsoft Shared\TextTemplating\14.0" + if (Test-Path "$TextTemplateDir\TextTransform.exe") + { + $env:Path += ";$TextTemplateDir;" + } + else + { + Throw "TextTransform.exe cannot be found." + } + } +} + +#.SYNOPSIS +# Builds a winsdkfb solution. +# +#.PARAMETER $SolutionName +# The path to the solution to build. +# +#.PARAMETER $Platform +# The platform to target. May be Win32, x64, ARM. +# +#.PARAMETER $Configuration +# The configuration to target. May be Debug, Release. +function Invoke-OpenConsoleBuild() +{ + [CmdletBinding()] + Param ( + [parameter(Mandatory=$true)] + [string]$SolutionName, + + [parameter(Mandatory=$true)] + [string]$Platform, + + [parameter(Mandatory=$true)] + [string]$Configuration + ) + + Write-Host "building $SolutionName,$Platform,$Configuration" + nuget.exe restore $SolutionName + if (-not $?) + { + Throw "nuget restore failed" + } + msbuild.exe $SolutionName /p:Platform=$Platform /p:Configuration=$Configuration + if (-not $?) + { + Throw "building $SolutionName,$Platform,$Configuration failed" + } +} + +#.SYNOPSIS +# Creates a winsdkfb nuget package. +function Invoke-NugetPackage() +{ + # set version number + $Version = (Get-Content $env:winsdkfbRoot\winsdkfb\build\nuget\VERSION).ToString() + $env:version = $Version + # build-nupkg.cmd requires that the current working directory is the + # directory that it sits in because it uses relative paths. + pushd $env:winsdkfbRoot\winsdkfb\build\nuget + & $env:WinsdkfbRoot\winsdkfb\build\nuget\build-nupkg.cmd + if (-not (Test-Path "$env:WinsdkfbRoot\winsdkfb\bin\winsdkfb.${Version}.nupkg")) + { + popd + Throw "Failed to build SDK NuGet package" + } + popd +} + +# main +Test-BuildToolsPresent +$SolutionFiles = @("$env:WinsdkfbRoot\winsdkfb\winsdkfb.sln", "$env:winsdkfbRoot\winsdkfb\winsdkfb_uwp\winsdkfb_uwp.sln") +$Platforms = @("Win32", "x64", "ARM") +$Configurations = @("Debug", "Release") +foreach ($Solution in $SolutionFiles) +{ + foreach ($Platform in $Platforms) + { + foreach ($Configuration in $Configurations) + { + Invoke-OpenConsoleBuild -SolutionName $Solution -Platform $Platform -Configuration $Configuration + } + } +} +Invoke-NugetPackage diff --git a/winsdkfb/build/nuget/VERSION b/winsdkfb/build/nuget/VERSION index 54d1a4f..a803cc2 100644 --- a/winsdkfb/build/nuget/VERSION +++ b/winsdkfb/build/nuget/VERSION @@ -1 +1 @@ -0.13.0 +0.14.0 diff --git a/winsdkfb/build/nuget/download-nuget.cmd b/winsdkfb/build/nuget/download-nuget.cmd index 9e8d1af..89effb8 100644 --- a/winsdkfb/build/nuget/download-nuget.cmd +++ b/winsdkfb/build/nuget/download-nuget.cmd @@ -1 +1 @@ -powershell -command "(New-Object System.Net.WebClient).DownloadFile('http://nuget.org/nuget.exe', '%~pd0nuget.exe')" +powershell -command "(New-Object System.Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%~pd0nuget.exe')" diff --git a/winsdkfb/build/nuget/nuget.exe b/winsdkfb/build/nuget/nuget.exe index 9f8781d..305300a 100644 Binary files a/winsdkfb/build/nuget/nuget.exe and b/winsdkfb/build/nuget/nuget.exe differ diff --git a/winsdkfb/winsdkfb/winsdkfb.Shared/FBConstants.h b/winsdkfb/winsdkfb/winsdkfb.Shared/FBConstants.h index 29e3c71..63d1105 100644 --- a/winsdkfb/winsdkfb/winsdkfb.Shared/FBConstants.h +++ b/winsdkfb/winsdkfb/winsdkfb.Shared/FBConstants.h @@ -22,4 +22,4 @@ // Define the base version of the SDK. // Keep in sync with winsdkfb\build\nuget\VERSION -#define WINSDKFB_VERSION L"0.13.0" +#define WINSDKFB_VERSION L"0.14.0" diff --git a/winsdkfb/winsdkfb/winsdkfb.Shared/FacebookSession.cpp b/winsdkfb/winsdkfb/winsdkfb.Shared/FacebookSession.cpp index 4b24031..8fbedcf 100644 --- a/winsdkfb/winsdkfb/winsdkfb.Shared/FacebookSession.cpp +++ b/winsdkfb/winsdkfb/winsdkfb.Shared/FacebookSession.cpp @@ -210,7 +210,7 @@ task FBSession::GetUserInfo( { PropertySet^ parameters = ref new PropertySet(); parameters->Insert(L"fields", - L"gender,link,first_name,last_name,locale,timezone,email,updated_time,verified,name,id"); + L"gender,link,first_name,last_name,locale,timezone,email,updated_time,verified,name,id,picture"); FBSingleValue^ value = ref new FBSingleValue( "/me", parameters, @@ -231,7 +231,11 @@ IAsyncOperation^ FBSession::MyTryGetItemAsync( { return create_task([=]() -> task { +#if defined(_WIN32_WINNT_WIN10) + return create_task(folder->TryGetItemAsync(itemName)); +#else return create_task(folder->GetItemAsync(itemName)); +#endif }) .then([=](task folderTask) -> IStorageItem^ {