immich/mobile/pigeon/network_api.dart
Mert a05c8c6087
feat(mobile): use shared native client (#25942)
* use shared client in dart

fix android

* websocket integration

platform-side headers

update comment

consistent platform check

tweak websocket handling

support streaming

* redundant logging

* fix proguard

* formatting

* handle onProgress

* support videos on ios

* inline return

* improved ios impl

* cleanup

* sync stopForegroundBackup

* voidify

* future already completed

* stream request on android

* outdated ios ws code

* use `choosePrivateKeyAlias`

* return result

* formatting

* update tests

* redundant check

* handle custom headers

* move completer outside of state

* persist auth

* dispose old socket

* use group id for cookies

* redundant headers

* cache global ref

* handle network switching

* handle basic auth

* apply custom headers immediately

* video player update

* fix

* persist url

* potential logout fix

---------

Co-authored-by: Alex <alex.tran1502@gmail.com>
2026-03-05 11:04:45 -06:00

48 lines
1.1 KiB
Dart

import 'package:pigeon/pigeon.dart';
class ClientCertData {
Uint8List data;
String password;
ClientCertData(this.data, this.password);
}
class ClientCertPrompt {
String title;
String message;
String cancel;
String confirm;
ClientCertPrompt(this.title, this.message, this.cancel, this.confirm);
}
@ConfigurePigeon(
PigeonOptions(
dartOut: 'lib/platform/network_api.g.dart',
swiftOut: 'ios/Runner/Core/Network.g.swift',
swiftOptions: SwiftOptions(includeErrorClass: false),
kotlinOut:
'android/app/src/main/kotlin/app/alextran/immich/core/Network.g.kt',
kotlinOptions: KotlinOptions(package: 'app.alextran.immich.core', includeErrorClass: true),
dartOptions: DartOptions(),
dartPackageName: 'immich_mobile',
),
)
@HostApi()
abstract class NetworkApi {
@async
void addCertificate(ClientCertData clientData);
@async
void selectCertificate(ClientCertPrompt promptText);
@async
void removeCertificate();
bool hasCertificate();
int getClientPointer();
void setRequestHeaders(Map<String, String> headers, List<String> serverUrls);
}