-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Windows AsyncStorage (#327)
* Add Windows AsyncStorage
- Loading branch information
Showing
46 changed files
with
2,494 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
*AppPackages* | ||
*BundleArtifacts* | ||
|
||
#OS junk files | ||
[Tt]humbs.db | ||
*.DS_Store | ||
|
||
#Visual Studio files | ||
*.[Oo]bj | ||
*.user | ||
*.aps | ||
*.pch | ||
*.vspscc | ||
*.vssscc | ||
*_i.c | ||
*_p.c | ||
*.ncb | ||
*.suo | ||
*.tlb | ||
*.tlh | ||
*.bak | ||
*.[Cc]ache | ||
*.ilk | ||
*.log | ||
*.lib | ||
*.sbr | ||
*.sdf | ||
*.opensdf | ||
*.opendb | ||
*.unsuccessfulbuild | ||
ipch/ | ||
[Oo]bj/ | ||
[Bb]in | ||
[Dd]ebug*/ | ||
[Rr]elease*/ | ||
Ankh.NoLoad | ||
|
||
# Visual C++ cache files | ||
ipch/ | ||
*.aps | ||
*.ncb | ||
*.opendb | ||
*.opensdf | ||
*.sdf | ||
*.cachefile | ||
*.VC.db | ||
*.VC.VC.opendb | ||
|
||
#MonoDevelop | ||
*.pidb | ||
*.userprefs | ||
|
||
#Tooling | ||
_ReSharper*/ | ||
*.resharper | ||
[Tt]est[Rr]esult* | ||
*.sass-cache | ||
|
||
#Project files | ||
[Bb]uild/ | ||
|
||
#Subversion files | ||
.svn | ||
|
||
# Office Temp Files | ||
~$* | ||
|
||
# vim Temp Files | ||
*~ | ||
|
||
#NuGet | ||
packages/ | ||
*.nupkg | ||
|
||
#ncrunch | ||
*ncrunch* | ||
*crunch*.local.xml | ||
|
||
# visual studio database projects | ||
*.dbmdl | ||
|
||
#Test files | ||
*.testsettings | ||
|
||
#Other files | ||
*.DotSettings | ||
.vs/ | ||
*project.lock.json | ||
|
||
#Files generated by the VS build | ||
**/Generated Files/** | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include "pch.h" | ||
#include "App.h" | ||
#include "ReactPackageProvider.h" | ||
|
||
using namespace winrt::AsyncStorageExample; | ||
using namespace winrt::AsyncStorageExample::implementation; | ||
|
||
/// <summary> | ||
/// Initializes the singleton application object. This is the first line of | ||
/// authored code executed, and as such is the logical equivalent of main() or | ||
/// WinMain(). | ||
/// </summary> | ||
App::App() noexcept | ||
{ | ||
MainComponentName(L"AsyncStorageExample"); | ||
|
||
#if BUNDLE | ||
JavaScriptBundleFile(L"index.windows"); | ||
InstanceSettings().UseWebDebugger(false); | ||
InstanceSettings().UseFastRefresh(false); | ||
#else | ||
JavaScriptMainModuleName(L"example/index"); | ||
InstanceSettings().UseWebDebugger(true); | ||
InstanceSettings().UseFastRefresh(true); | ||
#endif | ||
|
||
#if _DEBUG | ||
InstanceSettings().EnableDeveloperMenu(true); | ||
#else | ||
InstanceSettings().EnableDeveloperMenu(false); | ||
#endif | ||
|
||
PackageProviders().Append(make<ReactPackageProvider>()); // Includes all modules in this project | ||
PackageProviders().Append(winrt::ReactNativeAsyncStorage::ReactPackageProvider()); | ||
|
||
REACT_REGISTER_NATIVE_MODULE_PACKAGES(); //code-gen macro from autolink | ||
|
||
InitializeComponent(); | ||
|
||
// This works around a cpp/winrt bug with composable/aggregable types tracked | ||
// by 22116519 | ||
AddRef(); | ||
m_inner.as<::IUnknown>()->Release(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
|
||
#include "App.xaml.g.h" | ||
|
||
namespace winrt::AsyncStorageExample::implementation | ||
{ | ||
struct App : AppT<App> | ||
{ | ||
App() noexcept; | ||
}; | ||
} // namespace winrt::AsyncStorageExample::implementation | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace AsyncStorageExample | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<react:ReactApplication | ||
x:Class="AsyncStorageExample.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:AsyncStorageExample" | ||
xmlns:react="using:Microsoft.ReactNative"> | ||
<Application.Resources> | ||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> | ||
</Application.Resources> | ||
</react:ReactApplication> |
Binary file added
BIN
+1.4 KB
example/windows/AsyncStorageExample/Assets/LockScreenLogo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.52 KB
example/windows/AsyncStorageExample/Assets/SplashScreen.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.87 KB
example/windows/AsyncStorageExample/Assets/Square150x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.61 KB
example/windows/AsyncStorageExample/Assets/Square44x44Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.23 KB
...s/AsyncStorageExample/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.13 KB
example/windows/AsyncStorageExample/Assets/Wide310x150Logo.scale-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
179 changes: 179 additions & 0 deletions
179
example/windows/AsyncStorageExample/AsyncStorageExample.vcxproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" /> | ||
<PropertyGroup Label="Globals"> | ||
<CppWinRTOptimized>true</CppWinRTOptimized> | ||
<CppWinRTRootNamespaceAutoMerge>true</CppWinRTRootNamespaceAutoMerge> | ||
<MinimalCoreWin>true</MinimalCoreWin> | ||
<ProjectGuid>{2337bc5e-985c-4b3b-acd7-c9e2fb5d3209}</ProjectGuid> | ||
<ProjectName>AsyncStorageExample</ProjectName> | ||
<RootNamespace>AsyncStorageExample</RootNamespace> | ||
<DefaultLanguage>en-US</DefaultLanguage> | ||
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion> | ||
<AppContainerApplication>true</AppContainerApplication> | ||
<ApplicationType>Windows Store</ApplicationType> | ||
<ApplicationTypeRevision>10.0</ApplicationTypeRevision> | ||
<WindowsTargetPlatformVersion Condition=" '$(WindowsTargetPlatformVersion)' == '' ">10.0.18362.0</WindowsTargetPlatformVersion> | ||
<WindowsTargetPlatformMinVersion>10.0.15063.0</WindowsTargetPlatformMinVersion> | ||
<PackageCertificateKeyFile>AsyncStorageExample_TemporaryKey.pfx</PackageCertificateKeyFile> | ||
<PackageCertificateThumbprint>6D20FDF32BD30D0DD6A435E6134297ED6037C34E</PackageCertificateThumbprint> | ||
<PackageCertificatePassword>password</PackageCertificatePassword> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|ARM"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>ARM</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|ARM64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>ARM64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|ARM"> | ||
<Configuration>Release</Configuration> | ||
<Platform>ARM</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|ARM64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>ARM64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration"> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<LinkIncremental>true</LinkIncremental> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration"> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<LinkIncremental>false</LinkIncremental> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
<Import Project="..\..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems" Label="Shared" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets"> | ||
<Import Project="PropertySheet.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<PrecompiledHeader>Use</PrecompiledHeader> | ||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile> | ||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile> | ||
<WarningLevel>Level4</WarningLevel> | ||
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions> | ||
<DisableSpecificWarnings>4453;28204</DisableSpecificWarnings> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> | ||
<ClCompile> | ||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> | ||
<ClCompile> | ||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClInclude Include="ReactPackageProvider.h" /> | ||
<ClInclude Include="pch.h" /> | ||
<ClInclude Include="App.h"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ApplicationDefinition Include="App.xaml"> | ||
<SubType>Designer</SubType> | ||
</ApplicationDefinition> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<AppxManifest Include="Package.appxmanifest"> | ||
<SubType>Designer</SubType> | ||
</AppxManifest> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Image Include="Assets\LockScreenLogo.scale-200.png" /> | ||
<Image Include="Assets\SplashScreen.scale-200.png" /> | ||
<Image Include="Assets\Square150x150Logo.scale-200.png" /> | ||
<Image Include="Assets\Square44x44Logo.scale-200.png" /> | ||
<Image Include="Assets\Square44x44Logo.targetsize-24_altform-unplated.png" /> | ||
<Image Include="Assets\StoreLogo.png" /> | ||
<Image Include="Assets\Wide310x150Logo.scale-200.png" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="ReactPackageProvider.cpp" /> | ||
<ClCompile Include="pch.cpp"> | ||
<PrecompiledHeader>Create</PrecompiledHeader> | ||
</ClCompile> | ||
<ClCompile Include="App.cpp"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
</ClCompile> | ||
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Midl Include="App.idl"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
</Midl> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
<None Include="PropertySheet.props" /> | ||
<Text Include="readme.txt"> | ||
<DeploymentContent>false</DeploymentContent> | ||
</Text> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\node_modules\react-native-windows\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj"> | ||
<Project>{f7d32bd0-2749-483e-9a0d-1635ef7e3136}</Project> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\..\windows\ReactNativeAsyncStorage\ReactNativeAsyncStorage.vcxproj"> | ||
<Project>{4855d892-e16c-404d-8286-0089e0f7f9c4}</Project> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<PropertyGroup> | ||
<BundleCommand> | ||
npx --no-install react-native bundle --platform windows --entry-file index.js --bundle-output $(MSBuildThisFileDirectory)/Bundle/index.windows.bundle --assets-dest $(MSBuildThisFileDirectory)/Bundle | ||
</BundleCommand> | ||
</PropertyGroup> | ||
<Import Project="..\..\..\node_modules\react-native-windows\PropertySheets\Bundle.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" /> | ||
<Import Project="..\packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets" Condition="Exists('..\packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets')" /> | ||
</ImportGroup> | ||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
<PropertyGroup> | ||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
</PropertyGroup> | ||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.props'))" /> | ||
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.190730.2\build\native\Microsoft.Windows.CppWinRT.targets'))" /> | ||
<Error Condition="!Exists('..\packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.UI.Xaml.2.3.191129002\build\native\Microsoft.UI.Xaml.targets'))" /> | ||
</Target> | ||
</Project> |
Oops, something went wrong.