-
Notifications
You must be signed in to change notification settings - Fork 2
feat: MAUI support #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 37 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
cfbfe07
Added setup for MAUI app, before PS is working on it.
Chriztiaan c9bf567
Merge branch 'main' into maui
Chriztiaan 447cc76
Merge branch 'main' into maui
Chriztiaan 2c678a1
Added initial Maui package that has extension loading code and factory.
Chriztiaan d6d60a3
Fixed factory not working. Initial stab for loading extensions via MA…
Chriztiaan ace6dbf
Setup code for MAUI.
Chriztiaan a0750d4
Removed unsupported MAUI platforms from Demo.
Chriztiaan f5bf19e
Ensuring runtimes/platforms are applied to their specific builds. Set…
Chriztiaan 28d6b9b
Priming changelogs.
Chriztiaan 7877784
Clearing mac catalyst support from demo.
Chriztiaan 2c78052
Converted Demo to Lists+Todos design.
Chriztiaan eb658d3
Changing datamodel to look similar to PowerSync App schema.
Chriztiaan 067d126
Swapped in PowerSync db over base sqlite database.
Chriztiaan 9b0830e
Can show data syncs between demos.
Chriztiaan f091b52
wip
Chriztiaan 3c223b4
Moved both pages to use a watch query.
Chriztiaan ad8d205
General cleanup.
Chriztiaan 480e35b
Added sql console. Cleanup.
Chriztiaan ff93bd7
Working on releasing of dev packages.
Chriztiaan 0494423
Fixing selection issue on Android for list.
Chriztiaan 73cc017
Filter todos by list
benitav dff49b8
Add Readme
benitav a29eb7e
Add psql note
benitav 98b53e2
Hook up self-host-demo client with MAUI demo
benitav df00aea
Update readme with inspection notes
benitav 924e8fe
Fixed connection retry crashing due to serialization issue.
Chriztiaan 0a86c0a
Merge branch 'maui' of https://github.com/powersync-ja/powersync-dotn…
Chriztiaan f69e0ea
New dev release.
Chriztiaan d85d796
Remove known issues
benitav 43ba9c2
Not failing on failed package push.
Chriztiaan ddb26f6
Merge branch 'maui' of https://github.com/powersync-ja/powersync-dotn…
Chriztiaan 763aabb
Updated release workflow to support MAUI.
Chriztiaan 4635569
Release versions in changelog.
Chriztiaan 2fa1a32
Added extension loading for windows target. Added windows platform fi…
Chriztiaan 0813194
Renamed TodoSqlite demo to MAUITodo.
Chriztiaan b1c0e6e
Updated readme entry for Maui demo.
Chriztiaan 635f18d
Updated windows entry.
Chriztiaan e5dedc7
Readme polish
benitav e4f0463
Document frameworks
benitav 0575b9d
Updated MAUI package readme.
Chriztiaan e28c526
Update PowerSync/PowerSync.Maui/README.md
Chriztiaan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,9 @@ | ||
# PowerSync.Maui Changelog | ||
|
||
## 0.0.1-alpha.1 | ||
|
||
- Introduce package. Support for iOS/Android use cases. | ||
|
||
### Platform Runtime Support Added | ||
* MAUI iOS | ||
* MAUI Android |
This file contains hidden or 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,57 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netstandard2.0;net6.0;net8.0;net9.0;net8.0-ios;net8.0-android</TargetFrameworks> | ||
<LangVersion>12</LangVersion> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<PackageId>PowerSync.Maui</PackageId> | ||
<Title>PowerSync.Maui</Title> | ||
<Description>PowerSync.Maui is a package that enables MAUI usage for PowerSync</Description> | ||
<Authors>PowerSync</Authors> | ||
<owners>powersync</owners> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<RepositoryUrl>https://github.com/powersync-ja/powersync-dotnet</RepositoryUrl> | ||
<PackageProjectUrl>https://powersync.com</PackageProjectUrl> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<PackageReleaseNotes>https://github.com/powersync-ja/powersync-dotnet/PowerSync/PowerSync.Maui/CHANGELOG.md</PackageReleaseNotes> | ||
<PackageTags>powersync local-first local-storage state-management offline sql db persistence sqlite sync </PackageTags> | ||
<PackageIcon>icon.png</PackageIcon> | ||
<NoWarn>NU5100</NoWarn> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\PowerSync.Common\PowerSync.Common.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\icon.png" Pack="true" PackagePath=""/> | ||
<None Include="README.md" Pack="true" PackagePath=""/> | ||
<None Update="Platforms\Android\Resources\values\colors.xml"> | ||
<SubType>Designer</SubType> | ||
</None> | ||
</ItemGroup> | ||
|
||
<!-- For monorepo--> | ||
<ItemGroup Condition="$(TargetFramework.Contains('-android'))"> | ||
<Content Include="Platforms\Android\**\*.*"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))"> | ||
<Content Include="Platforms\iOS\NativeLibs\powersync-sqlite-core.xcframework\**\*.*"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<!-- For releasing runtimes --> | ||
<ItemGroup Condition="$(TargetFramework.Contains('-android'))"> | ||
<None Include="Platforms\Android\**\*.*" Pack="true" PackagePath="Platforms\Android" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="$(TargetFramework.Contains('-ios'))"> | ||
<None Include="Platforms\iOS\NativeLibs\powersync-sqlite-core.xcframework\**\*.*" Pack="true" PackagePath="Platforms\iOS" /> | ||
</ItemGroup> | ||
</Project> |
This file contains hidden or 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,5 @@ | ||
# PowerSync SDK .NET MAUI | ||
|
||
## Usage | ||
|
||
TBD Factory Example | ||
This file contains hidden or 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,44 @@ | ||
namespace PowerSync.Maui.SQLite; | ||
|
||
using Microsoft.Data.Sqlite; | ||
using PowerSync.Common.MDSQLite; | ||
|
||
// iOS specific imports | ||
#if IOS | ||
using Foundation; | ||
#endif | ||
|
||
public class MAUISQLiteAdapter : MDSQLiteAdapter | ||
{ | ||
public MAUISQLiteAdapter(MDSQLiteAdapterOptions options) : base(options) | ||
{ | ||
} | ||
|
||
protected override void LoadExtension(SqliteConnection db) | ||
{ | ||
db.EnableExtensions(true); | ||
|
||
#if IOS | ||
LoadExtensionIOS(db); | ||
#elif ANDROID | ||
db.LoadExtension("libpowersync"); | ||
#else | ||
base.LoadExtension(db); | ||
#endif | ||
} | ||
|
||
private void LoadExtensionIOS(SqliteConnection db) | ||
{ | ||
#if IOS | ||
var bundlePath = Foundation.NSBundle.MainBundle.BundlePath; | ||
var filePath = | ||
Path.Combine(bundlePath, "Frameworks", "powersync-sqlite-core.framework", "powersync-sqlite-core"); | ||
|
||
using var loadExtension = db.CreateCommand(); | ||
loadExtension.CommandText = "SELECT load_extension(@path, @entryPoint)"; | ||
loadExtension.Parameters.AddWithValue("@path", filePath); | ||
loadExtension.Parameters.AddWithValue("@entryPoint", "sqlite3_powersync_init"); | ||
loadExtension.ExecuteNonQuery(); | ||
#endif | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
PowerSync/PowerSync.Maui/SQLite/MAUISQLiteDBOpenFactory.cs
This file contains hidden or 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,26 @@ | ||
using PowerSync.Common.DB; | ||
|
||
namespace PowerSync.Maui.SQLite; | ||
|
||
using PowerSync.Common.Client; | ||
using PowerSync.Common.MDSQLite; | ||
|
||
|
||
public class MAUISQLiteDBOpenFactory : ISQLOpenFactory | ||
{ | ||
private readonly MDSQLiteOpenFactoryOptions options; | ||
|
||
public MAUISQLiteDBOpenFactory(MDSQLiteOpenFactoryOptions options) | ||
{ | ||
this.options = options; | ||
} | ||
|
||
public IDBAdapter OpenDatabase() | ||
{ | ||
return new MAUISQLiteAdapter(new MDSQLiteAdapterOptions | ||
{ | ||
Name = options.DbFilename, | ||
SqliteOptions = options.SqliteOptions | ||
}); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.