Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
555d9e5
Add initial iOS core registration
stevensJourney Sep 4, 2025
b09aa1b
update capacitor
stevensJourney Sep 4, 2025
607d494
update code
stevensJourney Sep 5, 2025
b6afc44
load core extension with Android. woop woop
stevensJourney Sep 20, 2025
55dcd05
Support single read and single write connection. Implement table upda…
stevensJourney Sep 20, 2025
0fdc512
Package README. Update example app. Implement PowerSyncDatabase for C…
stevensJourney Sep 22, 2025
d59cd41
dynamically find capacitor/android for build
stevensJourney Sep 22, 2025
20b083d
added changeset
stevensJourney Sep 22, 2025
685c99b
Merge remote-tracking branch 'origin/main' into capacitor-sdk
stevensJourney Sep 22, 2025
b894538
fix build
stevensJourney Sep 22, 2025
0acfd2d
document execute limitation
stevensJourney Sep 22, 2025
872ce0b
add open factory example
stevensJourney Sep 22, 2025
1841e91
fix build command
stevensJourney Sep 22, 2025
91260c8
allow package to be published
stevensJourney Sep 22, 2025
570b978
use release builds for tests
stevensJourney Sep 22, 2025
37e317b
provide core extension error code logging
stevensJourney Sep 22, 2025
f354b1a
Add tests for package exports
stevensJourney Sep 22, 2025
45cc79f
Merge remote-tracking branch 'origin/main' into capacitor-sdk
stevensJourney Sep 22, 2025
b161d93
add WAL support
stevensJourney Sep 22, 2025
cddefdb
update npm files
stevensJourney Sep 25, 2025
4b52a14
cater for version zero
stevensJourney Sep 25, 2025
48e0f89
Add debugMode
stevensJourney Sep 29, 2025
6756660
fix executeRaw and execute limitations
stevensJourney Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions demos/example-capacitor/android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
sourceCompatibility JavaVersion.VERSION_21
targetCompatibility JavaVersion.VERSION_21
}
}

apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-community-sqlite')
implementation project(':capacitor-splash-screen')
implementation project(':powersync-capacitor')

}

Expand Down
6 changes: 6 additions & 0 deletions demos/example-capacitor/android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,11 @@
include ':capacitor-android'
project(':capacitor-android').projectDir = new File('../../../node_modules/@capacitor/android/capacitor')

include ':capacitor-community-sqlite'
project(':capacitor-community-sqlite').projectDir = new File('../../../node_modules/@capacitor-community/sqlite/android')

include ':capacitor-splash-screen'
project(':capacitor-splash-screen').projectDir = new File('../../../node_modules/@capacitor/splash-screen/android')

include ':powersync-capacitor'
project(':powersync-capacitor').projectDir = new File('../../../packages/capacitor/android')
14 changes: 8 additions & 6 deletions demos/example-capacitor/ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -334,7 +334,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand All @@ -349,12 +349,13 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ZGT7463CVJ;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.powersync.example;
PRODUCT_BUNDLE_IDENTIFIER = com.powersync.capacitor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
Expand All @@ -369,11 +370,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = ZGT7463CVJ;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.powersync.example;
PRODUCT_BUNDLE_IDENTIFIER = com.powersync.capacitor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
SWIFT_VERSION = 5.0;
Expand Down
92 changes: 46 additions & 46 deletions demos/example-capacitor/ios/App/App/Info.plist
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>powersync-capacitor</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
</dict>
</plist>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>powersync-capacitor</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true />
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true />
</dict>
</plist>
4 changes: 3 additions & 1 deletion demos/example-capacitor/ios/App/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require_relative '../../../../node_modules/@capacitor/ios/scripts/pods_helpers'

platform :ios, '13.0'
platform :ios, '14.0'
use_frameworks!

# workaround to avoid Xcode caching of Pods that requires
Expand All @@ -11,7 +11,9 @@ install! 'cocoapods', :disable_input_output_paths => true
def capacitor_pods
pod 'Capacitor', :path => '../../../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../../../node_modules/@capacitor/ios'
pod 'CapacitorCommunitySqlite', :path => '../../../../node_modules/@capacitor-community/sqlite'
pod 'CapacitorSplashScreen', :path => '../../../../node_modules/@capacitor/splash-screen'
pod 'PowersyncCapacitor', :path => '../../../../packages/capacitor'
end

target 'App' do
Expand Down
48 changes: 40 additions & 8 deletions demos/example-capacitor/ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,60 @@
PODS:
- Capacitor (6.0.0):
- Capacitor (7.4.3):
- CapacitorCordova
- CapacitorCordova (6.0.0)
- CapacitorSplashScreen (6.0.0):
- CapacitorCommunitySqlite (7.0.1):
- Capacitor
- SQLCipher
- ZIPFoundation
- CapacitorCordova (7.4.3)
- CapacitorSplashScreen (7.0.2):
- Capacitor
- powersync-sqlite-core (0.4.5)
- PowersyncCapacitor (0.0.1):
- Capacitor
- powersync-sqlite-core (~> 0.4.4)
- SQLCipher (~> 4.0)
- SQLCipher (4.10.0):
- SQLCipher/standard (= 4.10.0)
- SQLCipher/common (4.10.0)
- SQLCipher/standard (4.10.0):
- SQLCipher/common
- ZIPFoundation (0.9.19)

DEPENDENCIES:
- "Capacitor (from `../../../../node_modules/@capacitor/ios`)"
- "CapacitorCommunitySqlite (from `../../../../node_modules/@capacitor-community/sqlite`)"
- "CapacitorCordova (from `../../../../node_modules/@capacitor/ios`)"
- "CapacitorSplashScreen (from `../../../../node_modules/@capacitor/splash-screen`)"
- PowersyncCapacitor (from `../../../../packages/capacitor`)

SPEC REPOS:
trunk:
- powersync-sqlite-core
- SQLCipher
- ZIPFoundation

EXTERNAL SOURCES:
Capacitor:
:path: "../../../../node_modules/@capacitor/ios"
CapacitorCommunitySqlite:
:path: "../../../../node_modules/@capacitor-community/sqlite"
CapacitorCordova:
:path: "../../../../node_modules/@capacitor/ios"
CapacitorSplashScreen:
:path: "../../../../node_modules/@capacitor/splash-screen"
PowersyncCapacitor:
:path: "../../../../packages/capacitor"

SPEC CHECKSUMS:
Capacitor: 559d073c4ca6c27f8e7002c807eea94c3ba435a9
CapacitorCordova: 8c4bfdf69368512e85b1d8b724dd7546abeb30af
CapacitorSplashScreen: 5431ab8d19c1c6e95777d53bfaa7a36a6c3d94c7
Capacitor: b4741ca7affb32c1b70debd03df92cbf522d8a80
CapacitorCommunitySqlite: 3f60098baa077322ce32a678614a5fa0029ab519
CapacitorCordova: 435121e81a2df4d0034f0fb11fcefab5104cfdb5
CapacitorSplashScreen: 8d6c8cb0542a8e81585c593815db8785ed8ce454
powersync-sqlite-core: 6f32860379009d2a37cadc9e9427a431bdbd83c8
PowersyncCapacitor: 91411eaf8f7a773df9da4b76b19f576275b5a40a
SQLCipher: eb79c64049cb002b4e9fcb30edb7979bf4706dfc
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c

PODFILE CHECKSUM: 30a5df536d5e7830e635f84e1fe35fa438802eaa
PODFILE CHECKSUM: 1c728e00549cebade63eaffb81de205fd020c4ea

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
8 changes: 5 additions & 3 deletions demos/example-capacitor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,21 @@
"preview": "vite preview"
},
"dependencies": {
"@capacitor/android": "^6.0.0",
"@capacitor-community/sqlite": "^7.0.1",
"@capacitor/android": "^7.4.3",
"@capacitor/core": "latest",
"@capacitor/ios": "^6.0.0",
"@capacitor/ios": "^7.4.3",
"@capacitor/splash-screen": "latest",
"@journeyapps/wa-sqlite": "^1.3.1",
"@powersync/capacitor": "workspace:*",
"@powersync/react": "workspace:*",
"@powersync/web": "workspace:*",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.0"
},
"devDependencies": {
"@capacitor/cli": "^6.0.0",
"@capacitor/cli": "^7.4.3",
"@swc/core": "~1.6.0",
"@types/node": "^20.12.12",
"@types/react": "^18.3.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { PowerSyncContext } from '@powersync/react';
import { PowerSyncDatabase, createBaseLogger, LogLevel } from '@powersync/web';
import { Capacitor } from '@capacitor/core';
import { CircularProgress } from '@mui/material';
import { CapacitorSQLiteAdapter } from '@powersync/capacitor';
import { PowerSyncContext } from '@powersync/react';
import { createBaseLogger, LogLevel, PowerSyncDatabase } from '@powersync/web';
import React, { Suspense } from 'react';
import { AppSchema } from '../../library/powersync/AppSchema.js';
import { BackendConnector } from '../../library/powersync/BackendConnector.js';
import { Capacitor } from '@capacitor/core';

const logger = createBaseLogger();
logger.useDefaults();
Expand All @@ -16,7 +17,10 @@ const isIOs = platform === 'ios';
const useWebWorker = !isIOs;

const powerSync = new PowerSyncDatabase({
database: { dbFilename: 'powersync2.db' },
// We should probably rather have a separate Capacitor PowerSync client
database: new CapacitorSQLiteAdapter({
dbFilename: 'test.sqlite'
}),
schema: AppSchema,
flags: {
enableMultiTabs: false,
Expand Down
70 changes: 70 additions & 0 deletions packages/capacitor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# node files
dist
node_modules

# iOS files
Pods
Podfile.lock
Package.resolved
Build
xcuserdata
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc


# macOS files
.DS_Store



# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore

# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin
gen
out

# Gradle files
.gradle
build

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation

# Android Studio captures folder
captures

# IntelliJ
*.iml
.idea

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
Loading