Skip to content

Commit dbdb64f

Browse files
feat: delta sync (#18428)
* feat: delta sync * fix: ignore iCloud assets * feat: dev logs * add full sync button * remove photo_manager dep for sync * misc logs and fix * add time taken to DLog * fix: build release iOS * ios sync go brrr * rename local sync service * update isar fork * rename to platform assets / albums * fix ci check --------- Co-authored-by: shenlong-tanwen <[email protected]> Co-authored-by: Alex <[email protected]>
1 parent 2b1b20a commit dbdb64f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5634
-488
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ mobile/lib/**/*.g.dart linguist-generated=true
99
mobile/lib/**/*.drift.dart -diff -merge
1010
mobile/lib/**/*.drift.dart linguist-generated=true
1111

12+
mobile/drift_schemas/main/drift_schema_*.json -diff -merge
13+
mobile/drift_schemas/main/drift_schema_*.json linguist-generated=true
14+
1215
open-api/typescript-sdk/fetch-client.ts -diff -merge
1316
open-api/typescript-sdk/fetch-client.ts linguist-generated=true
1417

.github/workflows/build-mobile.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ jobs:
9393
run: make translation
9494
working-directory: ./mobile
9595

96+
- name: Generate platform APIs
97+
run: make pigeon
98+
working-directory: ./mobile
99+
96100
- name: Build Android App Bundle
97101
working-directory: ./mobile
98102
env:

.github/workflows/static_analysis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ jobs:
5959
working-directory: ./mobile
6060

6161
- name: Generate translation file
62-
run: make translation; dart format lib/generated/codegen_loader.g.dart
62+
run: make translation
6363
working-directory: ./mobile
6464

6565
- name: Run Build Runner
6666
run: make build
6767
working-directory: ./mobile
6868

69+
- name: Generate platform API
70+
run: make pigeon
71+
working-directory: ./mobile
72+
6973
- name: Find file changes
7074
uses: tj-actions/verify-changed-files@a1c6acee9df209257a246f2cc6ae8cb6581c1edf # v20.0.4
7175
id: verify-changed-files

mobile/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ custom_lint:
5555
restrict: package:photo_manager
5656
allowed:
5757
# required / wanted
58+
- 'lib/infrastructure/repositories/album_media.repository.dart'
5859
- 'lib/repositories/{album,asset,file}_media.repository.dart'
5960
# acceptable exceptions for the time being
6061
- lib/entities/asset.entity.dart # to provide local AssetEntity for now

mobile/android/app/build.gradle

Lines changed: 70 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,106 @@
11
plugins {
2-
id "com.android.application"
3-
id "kotlin-android"
4-
id "dev.flutter.flutter-gradle-plugin"
5-
id 'com.google.devtools.ksp'
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
id 'com.google.devtools.ksp'
66
}
77

88
def localProperties = new Properties()
99
def localPropertiesFile = rootProject.file('local.properties')
1010
if (localPropertiesFile.exists()) {
11-
localPropertiesFile.withInputStream { localProperties.load(it) }
11+
localPropertiesFile.withInputStream { localProperties.load(it) }
1212
}
1313

1414
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1515
if (flutterVersionCode == null) {
16-
flutterVersionCode = '1'
16+
flutterVersionCode = '1'
1717
}
1818

1919
def flutterVersionName = localProperties.getProperty('flutter.versionName')
2020
if (flutterVersionName == null) {
21-
flutterVersionName = '1.0'
21+
flutterVersionName = '1.0'
2222
}
2323

2424
def keystoreProperties = new Properties()
2525
def keystorePropertiesFile = rootProject.file('key.properties')
2626
if (keystorePropertiesFile.exists()) {
27-
keystorePropertiesFile.withInputStream { keystoreProperties.load(it) }
27+
keystorePropertiesFile.withInputStream { keystoreProperties.load(it) }
2828
}
2929

3030
android {
31-
compileSdkVersion 35
32-
33-
compileOptions {
34-
sourceCompatibility JavaVersion.VERSION_17
35-
targetCompatibility JavaVersion.VERSION_17
36-
coreLibraryDesugaringEnabled true
37-
}
38-
39-
kotlinOptions {
40-
jvmTarget = '17'
41-
}
42-
43-
sourceSets {
44-
main.java.srcDirs += 'src/main/kotlin'
31+
compileSdkVersion 35
32+
33+
compileOptions {
34+
sourceCompatibility JavaVersion.VERSION_17
35+
targetCompatibility JavaVersion.VERSION_17
36+
coreLibraryDesugaringEnabled true
37+
}
38+
39+
kotlinOptions {
40+
jvmTarget = '17'
41+
}
42+
43+
sourceSets {
44+
main.java.srcDirs += 'src/main/kotlin'
45+
}
46+
47+
defaultConfig {
48+
applicationId "app.alextran.immich"
49+
minSdkVersion 26
50+
targetSdkVersion 35
51+
versionCode flutterVersionCode.toInteger()
52+
versionName flutterVersionName
53+
}
54+
55+
signingConfigs {
56+
release {
57+
def keyAliasVal = System.getenv("ALIAS")
58+
def keyPasswordVal = System.getenv("ANDROID_KEY_PASSWORD")
59+
def storePasswordVal = System.getenv("ANDROID_STORE_PASSWORD")
60+
61+
keyAlias keyAliasVal ? keyAliasVal : keystoreProperties['keyAlias']
62+
keyPassword keyPasswordVal ? keyPasswordVal : keystoreProperties['keyPassword']
63+
storeFile file("../key.jks") ? file("../key.jks") : file(keystoreProperties['storeFile'])
64+
storePassword storePasswordVal ? storePasswordVal : keystoreProperties['storePassword']
4565
}
66+
}
4667

47-
defaultConfig {
48-
applicationId "app.alextran.immich"
49-
minSdkVersion 26
50-
targetSdkVersion 35
51-
versionCode flutterVersionCode.toInteger()
52-
versionName flutterVersionName
68+
buildTypes {
69+
debug {
70+
applicationIdSuffix '.debug'
71+
versionNameSuffix '-DEBUG'
5372
}
5473

55-
signingConfigs {
56-
release {
57-
def keyAliasVal = System.getenv("ALIAS")
58-
def keyPasswordVal = System.getenv("ANDROID_KEY_PASSWORD")
59-
def storePasswordVal = System.getenv("ANDROID_STORE_PASSWORD")
60-
61-
keyAlias keyAliasVal ? keyAliasVal : keystoreProperties['keyAlias']
62-
keyPassword keyPasswordVal ? keyPasswordVal : keystoreProperties['keyPassword']
63-
storeFile file("../key.jks") ? file("../key.jks") : file(keystoreProperties['storeFile'])
64-
storePassword storePasswordVal ? storePasswordVal : keystoreProperties['storePassword']
65-
}
66-
}
67-
68-
buildTypes {
69-
debug {
70-
applicationIdSuffix '.debug'
71-
versionNameSuffix '-DEBUG'
72-
}
73-
74-
release {
75-
signingConfig signingConfigs.release
76-
}
74+
release {
75+
signingConfig signingConfigs.release
7776
}
78-
namespace 'app.alextran.immich'
77+
}
78+
namespace 'app.alextran.immich'
7979
}
8080

8181
flutter {
82-
source '../..'
82+
source '../..'
8383
}
8484

8585
dependencies {
86-
def kotlin_version = '2.0.20'
87-
def kotlin_coroutines_version = '1.9.0'
88-
def work_version = '2.9.1'
89-
def concurrent_version = '1.2.0'
90-
def guava_version = '33.3.1-android'
91-
def glide_version = '4.16.0'
92-
93-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
94-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
95-
implementation "androidx.work:work-runtime-ktx:$work_version"
96-
implementation "androidx.concurrent:concurrent-futures:$concurrent_version"
97-
implementation "com.google.guava:guava:$guava_version"
98-
implementation "com.github.bumptech.glide:glide:$glide_version"
99-
ksp "com.github.bumptech.glide:ksp:$glide_version"
100-
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'
86+
def kotlin_version = '2.0.20'
87+
def kotlin_coroutines_version = '1.9.0'
88+
def work_version = '2.9.1'
89+
def concurrent_version = '1.2.0'
90+
def guava_version = '33.3.1-android'
91+
def glide_version = '4.16.0'
92+
def serialization_version = '1.8.1'
93+
94+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
95+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
96+
implementation "androidx.work:work-runtime-ktx:$work_version"
97+
implementation "androidx.concurrent:concurrent-futures:$concurrent_version"
98+
implementation "com.google.guava:guava:$guava_version"
99+
implementation "com.github.bumptech.glide:glide:$glide_version"
100+
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$serialization_version"
101+
102+
ksp "com.github.bumptech.glide:ksp:$glide_version"
103+
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'
101104
}
102105

103106
// This is uncommented in F-Droid build script

mobile/android/app/src/main/kotlin/app/alextran/immich/MainActivity.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package app.alextran.immich
22

3+
import android.os.Build
4+
import android.os.ext.SdkExtensions
35
import androidx.annotation.NonNull
6+
import app.alextran.immich.sync.NativeSyncApi
7+
import app.alextran.immich.sync.NativeSyncApiImpl26
8+
import app.alextran.immich.sync.NativeSyncApiImpl30
49
import io.flutter.embedding.android.FlutterFragmentActivity
510
import io.flutter.embedding.engine.FlutterEngine
611

@@ -10,5 +15,13 @@ class MainActivity : FlutterFragmentActivity() {
1015
flutterEngine.plugins.add(BackgroundServicePlugin())
1116
flutterEngine.plugins.add(HttpSSLOptionsPlugin())
1217
// No need to set up method channel here as it's now handled in the plugin
18+
19+
val nativeSyncApiImpl =
20+
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R || SdkExtensions.getExtensionVersion(Build.VERSION_CODES.R) < 1) {
21+
NativeSyncApiImpl26(this)
22+
} else {
23+
NativeSyncApiImpl30(this)
24+
}
25+
NativeSyncApi.setUp(flutterEngine.dartExecutor.binaryMessenger, nativeSyncApiImpl)
1326
}
1427
}

0 commit comments

Comments
 (0)