mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-09-01 08:54:08 +00:00
remove old protobuf model
This commit is contained in:
parent
e43169c2d2
commit
3a27f3b24b
58 changed files with 2334 additions and 10929 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 76a36c4d3da1fd0da04da3aa5a6c2b3b9c984925
|
||||
Subproject commit f46500ce45dbce12ee4431e5becb759ac7f26098
|
||||
|
|
@ -227,14 +227,12 @@ class _AppMainWidgetState extends State<AppMainWidget> {
|
|||
// This means the user is in the onboarding screen, so start with the Proof of Work.
|
||||
|
||||
final proofResult = await rustApiResult(RustApi.getProofOfWork());
|
||||
final proof = proofResult.value == null
|
||||
? null
|
||||
: decodeProofOfWork(proofResult.value!);
|
||||
final proof = proofResult.value;
|
||||
final disabled = proofResult.error == ErrorCode.RegistrationDisabled;
|
||||
if (proof != null) {
|
||||
Log.info('Starting with proof of work calculation.');
|
||||
_proofOfWork = (
|
||||
calculatePoW(proof.prefix, proof.difficulty.toInt()),
|
||||
calculatePoW(proof.prefix, proof.difficulty),
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
// This file is automatically generated, so please do not edit it.
|
||||
// @generated by `flutter_rust_bridge`@ 2.12.0.
|
||||
|
||||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import '../../../../frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
class PqcPreKey {
|
||||
final PlatformInt64 eccPreKeyId;
|
||||
final Uint8List eccPreKey;
|
||||
final PlatformInt64 kyberPreKeyId;
|
||||
final Uint8List kyberPreKey;
|
||||
final Uint8List kyberPreKeySignature;
|
||||
|
||||
const PqcPreKey({
|
||||
required this.eccPreKeyId,
|
||||
required this.eccPreKey,
|
||||
required this.kyberPreKeyId,
|
||||
required this.kyberPreKey,
|
||||
required this.kyberPreKeySignature,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
eccPreKeyId.hashCode ^
|
||||
eccPreKey.hashCode ^
|
||||
kyberPreKeyId.hashCode ^
|
||||
kyberPreKey.hashCode ^
|
||||
kyberPreKeySignature.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is PqcPreKey &&
|
||||
runtimeType == other.runtimeType &&
|
||||
eccPreKeyId == other.eccPreKeyId &&
|
||||
eccPreKey == other.eccPreKey &&
|
||||
kyberPreKeyId == other.kyberPreKeyId &&
|
||||
kyberPreKey == other.kyberPreKey &&
|
||||
kyberPreKeySignature == other.kyberPreKeySignature;
|
||||
}
|
||||
28
lib/core/api/proto/client_to_server/response.dart
Normal file
28
lib/core/api/proto/client_to_server/response.dart
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// This file is automatically generated, so please do not edit it.
|
||||
// @generated by `flutter_rust_bridge`@ 2.12.0.
|
||||
|
||||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import '../../../frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
class PreKey {
|
||||
final PlatformInt64 id;
|
||||
final Uint8List prekey;
|
||||
|
||||
const PreKey({
|
||||
required this.id,
|
||||
required this.prekey,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode ^ prekey.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is PreKey &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
prekey == other.prekey;
|
||||
}
|
||||
|
|
@ -4,8 +4,213 @@
|
|||
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import
|
||||
|
||||
import '../../../frb_generated.dart';
|
||||
import '../client_to_server/handshake/initial_pqc_keys.dart';
|
||||
import '../client_to_server/response.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
class AdditionalAccount {
|
||||
final PlatformInt64 userId;
|
||||
final String planId;
|
||||
|
||||
const AdditionalAccount({
|
||||
required this.userId,
|
||||
required this.planId,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => userId.hashCode ^ planId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AdditionalAccount &&
|
||||
runtimeType == other.runtimeType &&
|
||||
userId == other.userId &&
|
||||
planId == other.planId;
|
||||
}
|
||||
|
||||
class MemoriesUploadUrls {
|
||||
final String mediaId;
|
||||
final PresignedPost? thumbnailUpload;
|
||||
final PresignedPost? fullUpload;
|
||||
|
||||
const MemoriesUploadUrls({
|
||||
required this.mediaId,
|
||||
this.thumbnailUpload,
|
||||
this.fullUpload,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
mediaId.hashCode ^ thumbnailUpload.hashCode ^ fullUpload.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MemoriesUploadUrls &&
|
||||
runtimeType == other.runtimeType &&
|
||||
mediaId == other.mediaId &&
|
||||
thumbnailUpload == other.thumbnailUpload &&
|
||||
fullUpload == other.fullUpload;
|
||||
}
|
||||
|
||||
class MemoriesUsage {
|
||||
final PlatformInt64 maxBytes;
|
||||
final PlatformInt64 currentBytes;
|
||||
final PlatformInt64 count;
|
||||
|
||||
const MemoriesUsage({
|
||||
required this.maxBytes,
|
||||
required this.currentBytes,
|
||||
required this.count,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
maxBytes.hashCode ^ currentBytes.hashCode ^ count.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is MemoriesUsage &&
|
||||
runtimeType == other.runtimeType &&
|
||||
maxBytes == other.maxBytes &&
|
||||
currentBytes == other.currentBytes &&
|
||||
count == other.count;
|
||||
}
|
||||
|
||||
class PasswordlessNotificationMessage {
|
||||
final PlatformInt64 id;
|
||||
final Uint8List encryptedMessage;
|
||||
|
||||
const PasswordlessNotificationMessage({
|
||||
required this.id,
|
||||
required this.encryptedMessage,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode ^ encryptedMessage.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is PasswordlessNotificationMessage &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
encryptedMessage == other.encryptedMessage;
|
||||
}
|
||||
|
||||
class PlanBallance {
|
||||
final PlatformInt64 usedDailyMediaUploadLimit;
|
||||
final PlatformInt64 usedUploadMediaSizeLimit;
|
||||
final PlatformInt64? paymentPeriodDays;
|
||||
final PlatformInt64? lastPaymentDoneUnixTimestamp;
|
||||
final List<Transaction> transactions;
|
||||
final List<AdditionalAccount> additionalAccounts;
|
||||
final bool? autoRenewal;
|
||||
final PlatformInt64? additionalAccountOwnerId;
|
||||
|
||||
const PlanBallance({
|
||||
required this.usedDailyMediaUploadLimit,
|
||||
required this.usedUploadMediaSizeLimit,
|
||||
this.paymentPeriodDays,
|
||||
this.lastPaymentDoneUnixTimestamp,
|
||||
required this.transactions,
|
||||
required this.additionalAccounts,
|
||||
this.autoRenewal,
|
||||
this.additionalAccountOwnerId,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
usedDailyMediaUploadLimit.hashCode ^
|
||||
usedUploadMediaSizeLimit.hashCode ^
|
||||
paymentPeriodDays.hashCode ^
|
||||
lastPaymentDoneUnixTimestamp.hashCode ^
|
||||
transactions.hashCode ^
|
||||
additionalAccounts.hashCode ^
|
||||
autoRenewal.hashCode ^
|
||||
additionalAccountOwnerId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is PlanBallance &&
|
||||
runtimeType == other.runtimeType &&
|
||||
usedDailyMediaUploadLimit == other.usedDailyMediaUploadLimit &&
|
||||
usedUploadMediaSizeLimit == other.usedUploadMediaSizeLimit &&
|
||||
paymentPeriodDays == other.paymentPeriodDays &&
|
||||
lastPaymentDoneUnixTimestamp == other.lastPaymentDoneUnixTimestamp &&
|
||||
transactions == other.transactions &&
|
||||
additionalAccounts == other.additionalAccounts &&
|
||||
autoRenewal == other.autoRenewal &&
|
||||
additionalAccountOwnerId == other.additionalAccountOwnerId;
|
||||
}
|
||||
|
||||
class PqcBundle {
|
||||
final PlatformInt64 eccSignedPrekeyId;
|
||||
final Uint8List eccSignedPrekey;
|
||||
final Uint8List eccSignedPrekeySignature;
|
||||
final PlatformInt64 kyberSignedPrekeyId;
|
||||
final Uint8List kyberSignedPrekey;
|
||||
final Uint8List kyberSignedPrekeySignature;
|
||||
final PqcPreKey? prekey;
|
||||
|
||||
const PqcBundle({
|
||||
required this.eccSignedPrekeyId,
|
||||
required this.eccSignedPrekey,
|
||||
required this.eccSignedPrekeySignature,
|
||||
required this.kyberSignedPrekeyId,
|
||||
required this.kyberSignedPrekey,
|
||||
required this.kyberSignedPrekeySignature,
|
||||
this.prekey,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
eccSignedPrekeyId.hashCode ^
|
||||
eccSignedPrekey.hashCode ^
|
||||
eccSignedPrekeySignature.hashCode ^
|
||||
kyberSignedPrekeyId.hashCode ^
|
||||
kyberSignedPrekey.hashCode ^
|
||||
kyberSignedPrekeySignature.hashCode ^
|
||||
prekey.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is PqcBundle &&
|
||||
runtimeType == other.runtimeType &&
|
||||
eccSignedPrekeyId == other.eccSignedPrekeyId &&
|
||||
eccSignedPrekey == other.eccSignedPrekey &&
|
||||
eccSignedPrekeySignature == other.eccSignedPrekeySignature &&
|
||||
kyberSignedPrekeyId == other.kyberSignedPrekeyId &&
|
||||
kyberSignedPrekey == other.kyberSignedPrekey &&
|
||||
kyberSignedPrekeySignature == other.kyberSignedPrekeySignature &&
|
||||
prekey == other.prekey;
|
||||
}
|
||||
|
||||
class PresignedPost {
|
||||
final String url;
|
||||
final Map<String, String> fields;
|
||||
|
||||
const PresignedPost({
|
||||
required this.url,
|
||||
required this.fields,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => url.hashCode ^ fields.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is PresignedPost &&
|
||||
runtimeType == other.runtimeType &&
|
||||
url == other.url &&
|
||||
fields == other.fields;
|
||||
}
|
||||
|
||||
class ProofOfWork {
|
||||
final String prefix;
|
||||
final PlatformInt64 difficulty;
|
||||
|
|
@ -26,3 +231,66 @@ class ProofOfWork {
|
|||
prefix == other.prefix &&
|
||||
difficulty == other.difficulty;
|
||||
}
|
||||
|
||||
class Transaction {
|
||||
const Transaction();
|
||||
|
||||
@override
|
||||
int get hashCode => 0;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is Transaction && runtimeType == other.runtimeType;
|
||||
}
|
||||
|
||||
class UserData {
|
||||
final PlatformInt64 userId;
|
||||
final List<PreKey> prekeys;
|
||||
final Uint8List? username;
|
||||
final Uint8List? publicIdentityKey;
|
||||
final Uint8List? signedPrekey;
|
||||
final Uint8List? signedPrekeySignature;
|
||||
final PlatformInt64? signedPrekeyId;
|
||||
final PlatformInt64? registrationId;
|
||||
final PqcBundle? pqcBundle;
|
||||
|
||||
const UserData({
|
||||
required this.userId,
|
||||
required this.prekeys,
|
||||
this.username,
|
||||
this.publicIdentityKey,
|
||||
this.signedPrekey,
|
||||
this.signedPrekeySignature,
|
||||
this.signedPrekeyId,
|
||||
this.registrationId,
|
||||
this.pqcBundle,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
userId.hashCode ^
|
||||
prekeys.hashCode ^
|
||||
username.hashCode ^
|
||||
publicIdentityKey.hashCode ^
|
||||
signedPrekey.hashCode ^
|
||||
signedPrekeySignature.hashCode ^
|
||||
signedPrekeyId.hashCode ^
|
||||
registrationId.hashCode ^
|
||||
pqcBundle.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
userId == other.userId &&
|
||||
prekeys == other.prekeys &&
|
||||
username == other.username &&
|
||||
publicIdentityKey == other.publicIdentityKey &&
|
||||
signedPrekey == other.signedPrekey &&
|
||||
signedPrekeySignature == other.signedPrekeySignature &&
|
||||
signedPrekeyId == other.signedPrekeyId &&
|
||||
registrationId == other.registrationId &&
|
||||
pqcBundle == other.pqcBundle;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ import '../api/server/prekeys.dart';
|
|||
import '../frb_generated.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
|
||||
// These functions are ignored because they are not marked as `pub`: `api_result`, `empty_api_response`, `encoded_api_response`, `from_rust_state`
|
||||
// These functions are ignored because they are not marked as `pub`: `api_result`, `empty_api_response`, `from_rust_state`
|
||||
// These types are ignored because they are neither used by any `pub` functions nor (for structs and enums) marked `#[frb(unignore)]`: `ApiConfig`, `ServerResult`
|
||||
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `assert_fields_are_eq`, `assert_fields_are_eq`, `clone`, `clone`, `clone`, `clone`, `eq`, `eq`, `fmt`, `fmt`, `fmt`, `fmt`
|
||||
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `assert_fields_are_eq`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `eq`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`
|
||||
|
||||
enum ApiConnectionState {
|
||||
stopped,
|
||||
|
|
@ -56,6 +56,208 @@ enum ApiEventKind {
|
|||
loginTokenMigrated,
|
||||
}
|
||||
|
||||
class FrbAdditionalAccount {
|
||||
final PlatformInt64 userId;
|
||||
final String planId;
|
||||
|
||||
const FrbAdditionalAccount({
|
||||
required this.userId,
|
||||
required this.planId,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => userId.hashCode ^ planId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbAdditionalAccount &&
|
||||
runtimeType == other.runtimeType &&
|
||||
userId == other.userId &&
|
||||
planId == other.planId;
|
||||
}
|
||||
|
||||
class FrbMemoriesUploadUrls {
|
||||
final String mediaId;
|
||||
final FrbPresignedPost? thumbnailUpload;
|
||||
final FrbPresignedPost? fullUpload;
|
||||
|
||||
const FrbMemoriesUploadUrls({
|
||||
required this.mediaId,
|
||||
this.thumbnailUpload,
|
||||
this.fullUpload,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
mediaId.hashCode ^ thumbnailUpload.hashCode ^ fullUpload.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbMemoriesUploadUrls &&
|
||||
runtimeType == other.runtimeType &&
|
||||
mediaId == other.mediaId &&
|
||||
thumbnailUpload == other.thumbnailUpload &&
|
||||
fullUpload == other.fullUpload;
|
||||
}
|
||||
|
||||
class FrbMemoriesUsage {
|
||||
final PlatformInt64 currentBytes;
|
||||
final PlatformInt64 count;
|
||||
final PlatformInt64 maxBytes;
|
||||
|
||||
const FrbMemoriesUsage({
|
||||
required this.currentBytes,
|
||||
required this.count,
|
||||
required this.maxBytes,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
currentBytes.hashCode ^ count.hashCode ^ maxBytes.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbMemoriesUsage &&
|
||||
runtimeType == other.runtimeType &&
|
||||
currentBytes == other.currentBytes &&
|
||||
count == other.count &&
|
||||
maxBytes == other.maxBytes;
|
||||
}
|
||||
|
||||
class FrbPasswordlessNotificationMessage {
|
||||
final PlatformInt64 id;
|
||||
final Uint8List encryptedMessage;
|
||||
|
||||
const FrbPasswordlessNotificationMessage({
|
||||
required this.id,
|
||||
required this.encryptedMessage,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => id.hashCode ^ encryptedMessage.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbPasswordlessNotificationMessage &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
encryptedMessage == other.encryptedMessage;
|
||||
}
|
||||
|
||||
class FrbPlanBalance {
|
||||
final PlatformInt64 usedDailyMediaUploadLimit;
|
||||
final PlatformInt64 usedUploadMediaSizeLimit;
|
||||
final PlatformInt64? paymentPeriodDays;
|
||||
final PlatformInt64? lastPaymentDoneUnixTimestamp;
|
||||
final List<FrbAdditionalAccount> additionalAccounts;
|
||||
final bool? autoRenewal;
|
||||
final PlatformInt64? additionalAccountOwnerId;
|
||||
|
||||
const FrbPlanBalance({
|
||||
required this.usedDailyMediaUploadLimit,
|
||||
required this.usedUploadMediaSizeLimit,
|
||||
this.paymentPeriodDays,
|
||||
this.lastPaymentDoneUnixTimestamp,
|
||||
required this.additionalAccounts,
|
||||
this.autoRenewal,
|
||||
this.additionalAccountOwnerId,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
usedDailyMediaUploadLimit.hashCode ^
|
||||
usedUploadMediaSizeLimit.hashCode ^
|
||||
paymentPeriodDays.hashCode ^
|
||||
lastPaymentDoneUnixTimestamp.hashCode ^
|
||||
additionalAccounts.hashCode ^
|
||||
autoRenewal.hashCode ^
|
||||
additionalAccountOwnerId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbPlanBalance &&
|
||||
runtimeType == other.runtimeType &&
|
||||
usedDailyMediaUploadLimit == other.usedDailyMediaUploadLimit &&
|
||||
usedUploadMediaSizeLimit == other.usedUploadMediaSizeLimit &&
|
||||
paymentPeriodDays == other.paymentPeriodDays &&
|
||||
lastPaymentDoneUnixTimestamp == other.lastPaymentDoneUnixTimestamp &&
|
||||
additionalAccounts == other.additionalAccounts &&
|
||||
autoRenewal == other.autoRenewal &&
|
||||
additionalAccountOwnerId == other.additionalAccountOwnerId;
|
||||
}
|
||||
|
||||
class FrbPresignedPost {
|
||||
final String url;
|
||||
final List<(String, String)> fields;
|
||||
|
||||
const FrbPresignedPost({
|
||||
required this.url,
|
||||
required this.fields,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => url.hashCode ^ fields.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbPresignedPost &&
|
||||
runtimeType == other.runtimeType &&
|
||||
url == other.url &&
|
||||
fields == other.fields;
|
||||
}
|
||||
|
||||
class FrbProofOfWork {
|
||||
final String prefix;
|
||||
final PlatformInt64 difficulty;
|
||||
|
||||
const FrbProofOfWork({
|
||||
required this.prefix,
|
||||
required this.difficulty,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode => prefix.hashCode ^ difficulty.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbProofOfWork &&
|
||||
runtimeType == other.runtimeType &&
|
||||
prefix == other.prefix &&
|
||||
difficulty == other.difficulty;
|
||||
}
|
||||
|
||||
class FrbUserData {
|
||||
final PlatformInt64 userId;
|
||||
final Uint8List username;
|
||||
final Uint8List publicIdentityKey;
|
||||
|
||||
const FrbUserData({
|
||||
required this.userId,
|
||||
required this.username,
|
||||
required this.publicIdentityKey,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
userId.hashCode ^ username.hashCode ^ publicIdentityKey.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is FrbUserData &&
|
||||
runtimeType == other.runtimeType &&
|
||||
userId == other.userId &&
|
||||
username == other.username &&
|
||||
publicIdentityKey == other.publicIdentityKey;
|
||||
}
|
||||
|
||||
/// Flutter-facing facade for the Rust-owned API runtime.
|
||||
class RustApi {
|
||||
const RustApi();
|
||||
|
|
@ -79,7 +281,8 @@ class RustApi {
|
|||
static Future<void> checkForDeletedUsernames() =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiCheckForDeletedUsernames();
|
||||
|
||||
static Future<Uint8List> checkForPasswordlessNotification({
|
||||
static Future<List<FrbPasswordlessNotificationMessage>>
|
||||
checkForPasswordlessNotification({
|
||||
required String notificationId,
|
||||
required List<int> downloadAuthToken,
|
||||
required Int64List alreadyReceivedMessageIds,
|
||||
|
|
@ -136,7 +339,7 @@ class RustApi {
|
|||
static Future<void> forceIpaCheck() =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiForceIpaCheck();
|
||||
|
||||
static Future<Uint8List> getMemoriesUrl({
|
||||
static Future<String> getMemoriesUrl({
|
||||
required String mediaId,
|
||||
required bool thumbnail,
|
||||
}) => RustLib.instance.api.crateBridgeApiRustApiGetMemoriesUrl(
|
||||
|
|
@ -144,13 +347,13 @@ class RustApi {
|
|||
thumbnail: thumbnail,
|
||||
);
|
||||
|
||||
static Future<Uint8List> getMemoriesUsage() =>
|
||||
static Future<FrbMemoriesUsage> getMemoriesUsage() =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiGetMemoriesUsage();
|
||||
|
||||
static Future<Uint8List> getPlanBalance() =>
|
||||
static Future<FrbPlanBalance> getPlanBalance() =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiGetPlanBalance();
|
||||
|
||||
static Future<Uint8List> getProofOfWork() =>
|
||||
static Future<FrbProofOfWork> getProofOfWork() =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiGetProofOfWork();
|
||||
|
||||
static Future<Uint8List> getServerKeyForPasswordlessRecovery({
|
||||
|
|
@ -168,10 +371,10 @@ class RustApi {
|
|||
email: email,
|
||||
);
|
||||
|
||||
static Future<Uint8List> getUserById({required PlatformInt64 userId}) =>
|
||||
static Future<FrbUserData> getUserById({required PlatformInt64 userId}) =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiGetUserById(userId: userId);
|
||||
|
||||
static Future<Uint8List> getUserData({required String username}) =>
|
||||
static Future<FrbUserData> getUserData({required String username}) =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiGetUserData(username: username);
|
||||
|
||||
static Future<PlatformInt64> getUserIdFromUsername({
|
||||
|
|
@ -226,7 +429,7 @@ class RustApi {
|
|||
verificationData: verificationData,
|
||||
);
|
||||
|
||||
static Future<Uint8List> loadPlanBalance() =>
|
||||
static Future<FrbPlanBalance> loadPlanBalance() =>
|
||||
RustLib.instance.api.crateBridgeApiRustApiLoadPlanBalance();
|
||||
|
||||
static Future<void> notifyMessagesOpened({
|
||||
|
|
@ -313,7 +516,7 @@ class RustApi {
|
|||
.api
|
||||
.crateBridgeApiRustApiRequestMediaReupload(mediaId: mediaId);
|
||||
|
||||
static Future<Uint8List> requestMemoriesUpload({
|
||||
static Future<FrbMemoriesUploadUrls> requestMemoriesUpload({
|
||||
required PlatformInt64 size,
|
||||
required PlatformInt64 originalDate,
|
||||
required String mediaId,
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ abstract class RustLibApi extends BaseApi {
|
|||
|
||||
Future<void> crateBridgeApiRustApiCheckForDeletedUsernames();
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiCheckForPasswordlessNotification({
|
||||
Future<List<FrbPasswordlessNotificationMessage>>
|
||||
crateBridgeApiRustApiCheckForPasswordlessNotification({
|
||||
required String notificationId,
|
||||
required List<int> downloadAuthToken,
|
||||
required Int64List alreadyReceivedMessageIds,
|
||||
|
|
@ -217,16 +218,16 @@ abstract class RustLibApi extends BaseApi {
|
|||
|
||||
Future<void> crateBridgeApiRustApiForceIpaCheck();
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetMemoriesUrl({
|
||||
Future<String> crateBridgeApiRustApiGetMemoriesUrl({
|
||||
required String mediaId,
|
||||
required bool thumbnail,
|
||||
});
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetMemoriesUsage();
|
||||
Future<FrbMemoriesUsage> crateBridgeApiRustApiGetMemoriesUsage();
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetPlanBalance();
|
||||
Future<FrbPlanBalance> crateBridgeApiRustApiGetPlanBalance();
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetProofOfWork();
|
||||
Future<FrbProofOfWork> crateBridgeApiRustApiGetProofOfWork();
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetServerKeyForPasswordlessRecovery({
|
||||
required PlatformInt64 userId,
|
||||
|
|
@ -236,11 +237,11 @@ abstract class RustLibApi extends BaseApi {
|
|||
String? email,
|
||||
});
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetUserById({
|
||||
Future<FrbUserData> crateBridgeApiRustApiGetUserById({
|
||||
required PlatformInt64 userId,
|
||||
});
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiGetUserData({
|
||||
Future<FrbUserData> crateBridgeApiRustApiGetUserData({
|
||||
required String username,
|
||||
});
|
||||
|
||||
|
|
@ -276,7 +277,7 @@ abstract class RustLibApi extends BaseApi {
|
|||
required String verificationData,
|
||||
});
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiLoadPlanBalance();
|
||||
Future<FrbPlanBalance> crateBridgeApiRustApiLoadPlanBalance();
|
||||
|
||||
Future<void> crateBridgeApiRustApiNotifyMessagesOpened({
|
||||
required PlatformInt64 contactId,
|
||||
|
|
@ -331,7 +332,7 @@ abstract class RustLibApi extends BaseApi {
|
|||
required String mediaId,
|
||||
});
|
||||
|
||||
Future<Uint8List> crateBridgeApiRustApiRequestMemoriesUpload({
|
||||
Future<FrbMemoriesUploadUrls> crateBridgeApiRustApiRequestMemoriesUpload({
|
||||
required PlatformInt64 size,
|
||||
required PlatformInt64 originalDate,
|
||||
required String mediaId,
|
||||
|
|
@ -1303,7 +1304,8 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiCheckForPasswordlessNotification({
|
||||
Future<List<FrbPasswordlessNotificationMessage>>
|
||||
crateBridgeApiRustApiCheckForPasswordlessNotification({
|
||||
required String notificationId,
|
||||
required List<int> downloadAuthToken,
|
||||
required Int64List alreadyReceivedMessageIds,
|
||||
|
|
@ -1326,7 +1328,8 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData:
|
||||
sse_decode_list_frb_passwordless_notification_message,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta:
|
||||
|
|
@ -1758,7 +1761,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiGetMemoriesUrl({
|
||||
Future<String> crateBridgeApiRustApiGetMemoriesUrl({
|
||||
required String mediaId,
|
||||
required bool thumbnail,
|
||||
}) {
|
||||
|
|
@ -1776,7 +1779,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_String,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiGetMemoriesUrlConstMeta,
|
||||
|
|
@ -1793,7 +1796,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiGetMemoriesUsage() {
|
||||
Future<FrbMemoriesUsage> crateBridgeApiRustApiGetMemoriesUsage() {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
|
|
@ -1806,7 +1809,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_memories_usage,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiGetMemoriesUsageConstMeta,
|
||||
|
|
@ -1823,7 +1826,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiGetPlanBalance() {
|
||||
Future<FrbPlanBalance> crateBridgeApiRustApiGetPlanBalance() {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
|
|
@ -1836,7 +1839,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_plan_balance,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiGetPlanBalanceConstMeta,
|
||||
|
|
@ -1853,7 +1856,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiGetProofOfWork() {
|
||||
Future<FrbProofOfWork> crateBridgeApiRustApiGetProofOfWork() {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
|
|
@ -1866,7 +1869,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_proof_of_work,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiGetProofOfWorkConstMeta,
|
||||
|
|
@ -1938,7 +1941,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiGetUserById({
|
||||
Future<FrbUserData> crateBridgeApiRustApiGetUserById({
|
||||
required PlatformInt64 userId,
|
||||
}) {
|
||||
return handler.executeNormal(
|
||||
|
|
@ -1954,7 +1957,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_user_data,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiGetUserByIdConstMeta,
|
||||
|
|
@ -1971,7 +1974,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiGetUserData({
|
||||
Future<FrbUserData> crateBridgeApiRustApiGetUserData({
|
||||
required String username,
|
||||
}) {
|
||||
return handler.executeNormal(
|
||||
|
|
@ -1987,7 +1990,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_user_data,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiGetUserDataConstMeta,
|
||||
|
|
@ -2219,7 +2222,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiLoadPlanBalance() {
|
||||
Future<FrbPlanBalance> crateBridgeApiRustApiLoadPlanBalance() {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
|
|
@ -2232,7 +2235,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_plan_balance,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiLoadPlanBalanceConstMeta,
|
||||
|
|
@ -2667,7 +2670,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
|
||||
@override
|
||||
Future<Uint8List> crateBridgeApiRustApiRequestMemoriesUpload({
|
||||
Future<FrbMemoriesUploadUrls> crateBridgeApiRustApiRequestMemoriesUpload({
|
||||
required PlatformInt64 size,
|
||||
required PlatformInt64 originalDate,
|
||||
required String mediaId,
|
||||
|
|
@ -2687,7 +2690,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_prim_u_8_strict,
|
||||
decodeSuccessData: sse_decode_frb_memories_upload_urls,
|
||||
decodeErrorData: sse_decode_AnyhowException,
|
||||
),
|
||||
constMeta: kCrateBridgeApiRustApiRequestMemoriesUploadConstMeta,
|
||||
|
|
@ -5077,6 +5080,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return dco_decode_frb_pre_key_bundle(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPresignedPost dco_decode_box_autoadd_frb_presigned_post(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return dco_decode_frb_presigned_post(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
PlatformInt64 dco_decode_box_autoadd_i_64(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
|
@ -5129,6 +5138,74 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return FlutterUserDiscovery();
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbAdditionalAccount dco_decode_frb_additional_account(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 2)
|
||||
throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
|
||||
return FrbAdditionalAccount(
|
||||
userId: dco_decode_i_64(arr[0]),
|
||||
planId: dco_decode_String(arr[1]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbMemoriesUploadUrls dco_decode_frb_memories_upload_urls(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 3)
|
||||
throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
|
||||
return FrbMemoriesUploadUrls(
|
||||
mediaId: dco_decode_String(arr[0]),
|
||||
thumbnailUpload: dco_decode_opt_box_autoadd_frb_presigned_post(arr[1]),
|
||||
fullUpload: dco_decode_opt_box_autoadd_frb_presigned_post(arr[2]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbMemoriesUsage dco_decode_frb_memories_usage(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 3)
|
||||
throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
|
||||
return FrbMemoriesUsage(
|
||||
currentBytes: dco_decode_i_64(arr[0]),
|
||||
count: dco_decode_i_64(arr[1]),
|
||||
maxBytes: dco_decode_i_64(arr[2]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPasswordlessNotificationMessage
|
||||
dco_decode_frb_passwordless_notification_message(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 2)
|
||||
throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
|
||||
return FrbPasswordlessNotificationMessage(
|
||||
id: dco_decode_i_64(arr[0]),
|
||||
encryptedMessage: dco_decode_list_prim_u_8_strict(arr[1]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPlanBalance dco_decode_frb_plan_balance(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 7)
|
||||
throw Exception('unexpected arr length: expect 7 but see ${arr.length}');
|
||||
return FrbPlanBalance(
|
||||
usedDailyMediaUploadLimit: dco_decode_i_64(arr[0]),
|
||||
usedUploadMediaSizeLimit: dco_decode_i_64(arr[1]),
|
||||
paymentPeriodDays: dco_decode_opt_box_autoadd_i_64(arr[2]),
|
||||
lastPaymentDoneUnixTimestamp: dco_decode_opt_box_autoadd_i_64(arr[3]),
|
||||
additionalAccounts: dco_decode_list_frb_additional_account(arr[4]),
|
||||
autoRenewal: dco_decode_opt_box_autoadd_bool(arr[5]),
|
||||
additionalAccountOwnerId: dco_decode_opt_box_autoadd_i_64(arr[6]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPqcPreKey dco_decode_frb_pqc_pre_key(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
|
@ -5165,6 +5242,43 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPresignedPost dco_decode_frb_presigned_post(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 2)
|
||||
throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
|
||||
return FrbPresignedPost(
|
||||
url: dco_decode_String(arr[0]),
|
||||
fields: dco_decode_list_record_string_string(arr[1]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbProofOfWork dco_decode_frb_proof_of_work(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 2)
|
||||
throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
|
||||
return FrbProofOfWork(
|
||||
prefix: dco_decode_String(arr[0]),
|
||||
difficulty: dco_decode_i_64(arr[1]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbUserData dco_decode_frb_user_data(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 3)
|
||||
throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
|
||||
return FrbUserData(
|
||||
userId: dco_decode_i_64(arr[0]),
|
||||
username: dco_decode_list_prim_u_8_strict(arr[1]),
|
||||
publicIdentityKey: dco_decode_list_prim_u_8_strict(arr[2]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
|
@ -5233,6 +5347,25 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return (raw as List<dynamic>).map(dco_decode_String).toList();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<FrbAdditionalAccount> dco_decode_list_frb_additional_account(
|
||||
dynamic raw,
|
||||
) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return (raw as List<dynamic>)
|
||||
.map(dco_decode_frb_additional_account)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<FrbPasswordlessNotificationMessage>
|
||||
dco_decode_list_frb_passwordless_notification_message(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return (raw as List<dynamic>)
|
||||
.map(dco_decode_frb_passwordless_notification_message)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<FrbPqcPreKey> dco_decode_list_frb_pqc_pre_key(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
|
@ -5289,6 +5422,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
.toList();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<(String, String)> dco_decode_list_record_string_string(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return (raw as List<dynamic>).map(dco_decode_record_string_string).toList();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<SqlRow> dco_decode_list_sql_row(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
|
@ -5343,6 +5482,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return raw == null ? null : dco_decode_box_autoadd_f_64(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPresignedPost? dco_decode_opt_box_autoadd_frb_presigned_post(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw == null ? null : dco_decode_box_autoadd_frb_presigned_post(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
PlatformInt64? dco_decode_opt_box_autoadd_i_64(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
|
|
@ -5862,6 +6007,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return (sse_decode_frb_pre_key_bundle(deserializer));
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPresignedPost sse_decode_box_autoadd_frb_presigned_post(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return (sse_decode_frb_presigned_post(deserializer));
|
||||
}
|
||||
|
||||
@protected
|
||||
PlatformInt64 sse_decode_box_autoadd_i_64(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -5917,6 +6070,89 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return FlutterUserDiscovery();
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbAdditionalAccount sse_decode_frb_additional_account(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_userId = sse_decode_i_64(deserializer);
|
||||
var var_planId = sse_decode_String(deserializer);
|
||||
return FrbAdditionalAccount(userId: var_userId, planId: var_planId);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbMemoriesUploadUrls sse_decode_frb_memories_upload_urls(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_mediaId = sse_decode_String(deserializer);
|
||||
var var_thumbnailUpload = sse_decode_opt_box_autoadd_frb_presigned_post(
|
||||
deserializer,
|
||||
);
|
||||
var var_fullUpload = sse_decode_opt_box_autoadd_frb_presigned_post(
|
||||
deserializer,
|
||||
);
|
||||
return FrbMemoriesUploadUrls(
|
||||
mediaId: var_mediaId,
|
||||
thumbnailUpload: var_thumbnailUpload,
|
||||
fullUpload: var_fullUpload,
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbMemoriesUsage sse_decode_frb_memories_usage(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_currentBytes = sse_decode_i_64(deserializer);
|
||||
var var_count = sse_decode_i_64(deserializer);
|
||||
var var_maxBytes = sse_decode_i_64(deserializer);
|
||||
return FrbMemoriesUsage(
|
||||
currentBytes: var_currentBytes,
|
||||
count: var_count,
|
||||
maxBytes: var_maxBytes,
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPasswordlessNotificationMessage
|
||||
sse_decode_frb_passwordless_notification_message(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_id = sse_decode_i_64(deserializer);
|
||||
var var_encryptedMessage = sse_decode_list_prim_u_8_strict(deserializer);
|
||||
return FrbPasswordlessNotificationMessage(
|
||||
id: var_id,
|
||||
encryptedMessage: var_encryptedMessage,
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPlanBalance sse_decode_frb_plan_balance(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_usedDailyMediaUploadLimit = sse_decode_i_64(deserializer);
|
||||
var var_usedUploadMediaSizeLimit = sse_decode_i_64(deserializer);
|
||||
var var_paymentPeriodDays = sse_decode_opt_box_autoadd_i_64(deserializer);
|
||||
var var_lastPaymentDoneUnixTimestamp = sse_decode_opt_box_autoadd_i_64(
|
||||
deserializer,
|
||||
);
|
||||
var var_additionalAccounts = sse_decode_list_frb_additional_account(
|
||||
deserializer,
|
||||
);
|
||||
var var_autoRenewal = sse_decode_opt_box_autoadd_bool(deserializer);
|
||||
var var_additionalAccountOwnerId = sse_decode_opt_box_autoadd_i_64(
|
||||
deserializer,
|
||||
);
|
||||
return FrbPlanBalance(
|
||||
usedDailyMediaUploadLimit: var_usedDailyMediaUploadLimit,
|
||||
usedUploadMediaSizeLimit: var_usedUploadMediaSizeLimit,
|
||||
paymentPeriodDays: var_paymentPeriodDays,
|
||||
lastPaymentDoneUnixTimestamp: var_lastPaymentDoneUnixTimestamp,
|
||||
additionalAccounts: var_additionalAccounts,
|
||||
autoRenewal: var_autoRenewal,
|
||||
additionalAccountOwnerId: var_additionalAccountOwnerId,
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPqcPreKey sse_decode_frb_pqc_pre_key(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -5969,6 +6205,35 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPresignedPost sse_decode_frb_presigned_post(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_url = sse_decode_String(deserializer);
|
||||
var var_fields = sse_decode_list_record_string_string(deserializer);
|
||||
return FrbPresignedPost(url: var_url, fields: var_fields);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbProofOfWork sse_decode_frb_proof_of_work(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_prefix = sse_decode_String(deserializer);
|
||||
var var_difficulty = sse_decode_i_64(deserializer);
|
||||
return FrbProofOfWork(prefix: var_prefix, difficulty: var_difficulty);
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbUserData sse_decode_frb_user_data(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_userId = sse_decode_i_64(deserializer);
|
||||
var var_username = sse_decode_list_prim_u_8_strict(deserializer);
|
||||
var var_publicIdentityKey = sse_decode_list_prim_u_8_strict(deserializer);
|
||||
return FrbUserData(
|
||||
userId: var_userId,
|
||||
username: var_username,
|
||||
publicIdentityKey: var_publicIdentityKey,
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -6039,6 +6304,35 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return ans_;
|
||||
}
|
||||
|
||||
@protected
|
||||
List<FrbAdditionalAccount> sse_decode_list_frb_additional_account(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
var len_ = sse_decode_i_32(deserializer);
|
||||
var ans_ = <FrbAdditionalAccount>[];
|
||||
for (var idx_ = 0; idx_ < len_; ++idx_) {
|
||||
ans_.add(sse_decode_frb_additional_account(deserializer));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
|
||||
@protected
|
||||
List<FrbPasswordlessNotificationMessage>
|
||||
sse_decode_list_frb_passwordless_notification_message(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
var len_ = sse_decode_i_32(deserializer);
|
||||
var ans_ = <FrbPasswordlessNotificationMessage>[];
|
||||
for (var idx_ = 0; idx_ < len_; ++idx_) {
|
||||
ans_.add(sse_decode_frb_passwordless_notification_message(deserializer));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
|
||||
@protected
|
||||
List<FrbPqcPreKey> sse_decode_list_frb_pqc_pre_key(
|
||||
SseDeserializer deserializer,
|
||||
|
|
@ -6130,6 +6424,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
return ans_;
|
||||
}
|
||||
|
||||
@protected
|
||||
List<(String, String)> sse_decode_list_record_string_string(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
var len_ = sse_decode_i_32(deserializer);
|
||||
var ans_ = <(String, String)>[];
|
||||
for (var idx_ = 0; idx_ < len_; ++idx_) {
|
||||
ans_.add(sse_decode_record_string_string(deserializer));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
|
||||
@protected
|
||||
List<SqlRow> sse_decode_list_sql_row(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -6226,6 +6534,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
FrbPresignedPost? sse_decode_opt_box_autoadd_frb_presigned_post(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
if (sse_decode_bool(deserializer)) {
|
||||
return (sse_decode_box_autoadd_frb_presigned_post(deserializer));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
PlatformInt64? sse_decode_opt_box_autoadd_i_64(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -6947,6 +7268,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
sse_encode_frb_pre_key_bundle(self, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_frb_presigned_post(
|
||||
FrbPresignedPost self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_frb_presigned_post(self, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_i_64(
|
||||
PlatformInt64 self,
|
||||
|
|
@ -7012,6 +7342,69 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_additional_account(
|
||||
FrbAdditionalAccount self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_64(self.userId, serializer);
|
||||
sse_encode_String(self.planId, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_memories_upload_urls(
|
||||
FrbMemoriesUploadUrls self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_String(self.mediaId, serializer);
|
||||
sse_encode_opt_box_autoadd_frb_presigned_post(
|
||||
self.thumbnailUpload,
|
||||
serializer,
|
||||
);
|
||||
sse_encode_opt_box_autoadd_frb_presigned_post(self.fullUpload, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_memories_usage(
|
||||
FrbMemoriesUsage self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_64(self.currentBytes, serializer);
|
||||
sse_encode_i_64(self.count, serializer);
|
||||
sse_encode_i_64(self.maxBytes, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_passwordless_notification_message(
|
||||
FrbPasswordlessNotificationMessage self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_64(self.id, serializer);
|
||||
sse_encode_list_prim_u_8_strict(self.encryptedMessage, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_plan_balance(
|
||||
FrbPlanBalance self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_64(self.usedDailyMediaUploadLimit, serializer);
|
||||
sse_encode_i_64(self.usedUploadMediaSizeLimit, serializer);
|
||||
sse_encode_opt_box_autoadd_i_64(self.paymentPeriodDays, serializer);
|
||||
sse_encode_opt_box_autoadd_i_64(
|
||||
self.lastPaymentDoneUnixTimestamp,
|
||||
serializer,
|
||||
);
|
||||
sse_encode_list_frb_additional_account(self.additionalAccounts, serializer);
|
||||
sse_encode_opt_box_autoadd_bool(self.autoRenewal, serializer);
|
||||
sse_encode_opt_box_autoadd_i_64(self.additionalAccountOwnerId, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_pqc_pre_key(FrbPqcPreKey self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -7041,6 +7434,34 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
sse_encode_list_prim_u_8_strict(self.identityKey, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_presigned_post(
|
||||
FrbPresignedPost self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_String(self.url, serializer);
|
||||
sse_encode_list_record_string_string(self.fields, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_proof_of_work(
|
||||
FrbProofOfWork self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_String(self.prefix, serializer);
|
||||
sse_encode_i_64(self.difficulty, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_user_data(FrbUserData self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_64(self.userId, serializer);
|
||||
sse_encode_list_prim_u_8_strict(self.username, serializer);
|
||||
sse_encode_list_prim_u_8_strict(self.publicIdentityKey, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -7104,6 +7525,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_additional_account(
|
||||
List<FrbAdditionalAccount> self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.length, serializer);
|
||||
for (final item in self) {
|
||||
sse_encode_frb_additional_account(item, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_passwordless_notification_message(
|
||||
List<FrbPasswordlessNotificationMessage> self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.length, serializer);
|
||||
for (final item in self) {
|
||||
sse_encode_frb_passwordless_notification_message(item, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_pqc_pre_key(
|
||||
List<FrbPqcPreKey> self,
|
||||
|
|
@ -7196,6 +7641,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_record_string_string(
|
||||
List<(String, String)> self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.length, serializer);
|
||||
for (final item in self) {
|
||||
sse_encode_record_string_string(item, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_sql_row(List<SqlRow> self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
|
@ -7286,6 +7743,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
|||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_opt_box_autoadd_frb_presigned_post(
|
||||
FrbPresignedPost? self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
sse_encode_bool(self != null, serializer);
|
||||
if (self != null) {
|
||||
sse_encode_box_autoadd_frb_presigned_post(self, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_opt_box_autoadd_i_64(
|
||||
PlatformInt64? self,
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
FrbPreKeyBundle dco_decode_box_autoadd_frb_pre_key_bundle(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost dco_decode_box_autoadd_frb_presigned_post(dynamic raw);
|
||||
|
||||
@protected
|
||||
PlatformInt64 dco_decode_box_autoadd_i_64(dynamic raw);
|
||||
|
||||
|
|
@ -143,12 +146,37 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
FlutterUserDiscovery dco_decode_flutter_user_discovery(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbAdditionalAccount dco_decode_frb_additional_account(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUploadUrls dco_decode_frb_memories_upload_urls(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUsage dco_decode_frb_memories_usage(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPasswordlessNotificationMessage
|
||||
dco_decode_frb_passwordless_notification_message(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPlanBalance dco_decode_frb_plan_balance(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPqcPreKey dco_decode_frb_pqc_pre_key(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPreKeyBundle dco_decode_frb_pre_key_bundle(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost dco_decode_frb_presigned_post(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbProofOfWork dco_decode_frb_proof_of_work(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbUserData dco_decode_frb_user_data(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
|
|
@ -175,6 +203,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
List<String> dco_decode_list_String(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<FrbAdditionalAccount> dco_decode_list_frb_additional_account(
|
||||
dynamic raw,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<FrbPasswordlessNotificationMessage>
|
||||
dco_decode_list_frb_passwordless_notification_message(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<FrbPqcPreKey> dco_decode_list_frb_pqc_pre_key(dynamic raw);
|
||||
|
||||
|
|
@ -203,6 +240,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
dynamic raw,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<(String, String)> dco_decode_list_record_string_string(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<SqlRow> dco_decode_list_sql_row(dynamic raw);
|
||||
|
||||
|
|
@ -231,6 +271,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
double? dco_decode_opt_box_autoadd_f_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost? dco_decode_opt_box_autoadd_frb_presigned_post(dynamic raw);
|
||||
|
||||
@protected
|
||||
PlatformInt64? dco_decode_opt_box_autoadd_i_64(dynamic raw);
|
||||
|
||||
|
|
@ -408,6 +451,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost sse_decode_box_autoadd_frb_presigned_post(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
PlatformInt64 sse_decode_box_autoadd_i_64(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -439,12 +487,43 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbAdditionalAccount sse_decode_frb_additional_account(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUploadUrls sse_decode_frb_memories_upload_urls(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUsage sse_decode_frb_memories_usage(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPasswordlessNotificationMessage
|
||||
sse_decode_frb_passwordless_notification_message(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbPlanBalance sse_decode_frb_plan_balance(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPqcPreKey sse_decode_frb_pqc_pre_key(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPreKeyBundle sse_decode_frb_pre_key_bundle(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost sse_decode_frb_presigned_post(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbProofOfWork sse_decode_frb_proof_of_work(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbUserData sse_decode_frb_user_data(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -475,6 +554,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
List<String> sse_decode_list_String(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
List<FrbAdditionalAccount> sse_decode_list_frb_additional_account(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<FrbPasswordlessNotificationMessage>
|
||||
sse_decode_list_frb_passwordless_notification_message(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<FrbPqcPreKey> sse_decode_list_frb_pqc_pre_key(
|
||||
SseDeserializer deserializer,
|
||||
|
|
@ -509,6 +599,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<(String, String)> sse_decode_list_record_string_string(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<SqlRow> sse_decode_list_sql_row(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -537,6 +632,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
double? sse_decode_opt_box_autoadd_f_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost? sse_decode_opt_box_autoadd_frb_presigned_post(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
PlatformInt64? sse_decode_opt_box_autoadd_i_64(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -782,6 +882,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_frb_presigned_post(
|
||||
FrbPresignedPost self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_i_64(
|
||||
PlatformInt64 self,
|
||||
|
|
@ -824,6 +930,36 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_additional_account(
|
||||
FrbAdditionalAccount self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_memories_upload_urls(
|
||||
FrbMemoriesUploadUrls self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_memories_usage(
|
||||
FrbMemoriesUsage self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_passwordless_notification_message(
|
||||
FrbPasswordlessNotificationMessage self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_plan_balance(
|
||||
FrbPlanBalance self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_pqc_pre_key(FrbPqcPreKey self, SseSerializer serializer);
|
||||
|
||||
|
|
@ -833,6 +969,21 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_presigned_post(
|
||||
FrbPresignedPost self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_proof_of_work(
|
||||
FrbProofOfWork self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_user_data(FrbUserData self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
|
|
@ -866,6 +1017,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
void sse_encode_list_String(List<String> self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_additional_account(
|
||||
List<FrbAdditionalAccount> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_passwordless_notification_message(
|
||||
List<FrbPasswordlessNotificationMessage> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_pqc_pre_key(
|
||||
List<FrbPqcPreKey> self,
|
||||
|
|
@ -911,6 +1074,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_record_string_string(
|
||||
List<(String, String)> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_sql_row(List<SqlRow> self, SseSerializer serializer);
|
||||
|
||||
|
|
@ -944,6 +1113,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
void sse_encode_opt_box_autoadd_f_64(double? self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_opt_box_autoadd_frb_presigned_post(
|
||||
FrbPresignedPost? self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_opt_box_autoadd_i_64(
|
||||
PlatformInt64? self,
|
||||
|
|
|
|||
|
|
@ -120,6 +120,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
FrbPreKeyBundle dco_decode_box_autoadd_frb_pre_key_bundle(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost dco_decode_box_autoadd_frb_presigned_post(dynamic raw);
|
||||
|
||||
@protected
|
||||
PlatformInt64 dco_decode_box_autoadd_i_64(dynamic raw);
|
||||
|
||||
|
|
@ -145,12 +148,37 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
FlutterUserDiscovery dco_decode_flutter_user_discovery(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbAdditionalAccount dco_decode_frb_additional_account(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUploadUrls dco_decode_frb_memories_upload_urls(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUsage dco_decode_frb_memories_usage(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPasswordlessNotificationMessage
|
||||
dco_decode_frb_passwordless_notification_message(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPlanBalance dco_decode_frb_plan_balance(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPqcPreKey dco_decode_frb_pqc_pre_key(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPreKeyBundle dco_decode_frb_pre_key_bundle(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost dco_decode_frb_presigned_post(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbProofOfWork dco_decode_frb_proof_of_work(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbUserData dco_decode_frb_user_data(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
|
|
@ -177,6 +205,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
List<String> dco_decode_list_String(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<FrbAdditionalAccount> dco_decode_list_frb_additional_account(
|
||||
dynamic raw,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<FrbPasswordlessNotificationMessage>
|
||||
dco_decode_list_frb_passwordless_notification_message(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<FrbPqcPreKey> dco_decode_list_frb_pqc_pre_key(dynamic raw);
|
||||
|
||||
|
|
@ -205,6 +242,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
dynamic raw,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<(String, String)> dco_decode_list_record_string_string(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<SqlRow> dco_decode_list_sql_row(dynamic raw);
|
||||
|
||||
|
|
@ -233,6 +273,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
double? dco_decode_opt_box_autoadd_f_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost? dco_decode_opt_box_autoadd_frb_presigned_post(dynamic raw);
|
||||
|
||||
@protected
|
||||
PlatformInt64? dco_decode_opt_box_autoadd_i_64(dynamic raw);
|
||||
|
||||
|
|
@ -410,6 +453,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost sse_decode_box_autoadd_frb_presigned_post(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
PlatformInt64 sse_decode_box_autoadd_i_64(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -441,12 +489,43 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbAdditionalAccount sse_decode_frb_additional_account(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUploadUrls sse_decode_frb_memories_upload_urls(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbMemoriesUsage sse_decode_frb_memories_usage(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPasswordlessNotificationMessage
|
||||
sse_decode_frb_passwordless_notification_message(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
FrbPlanBalance sse_decode_frb_plan_balance(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPqcPreKey sse_decode_frb_pqc_pre_key(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPreKeyBundle sse_decode_frb_pre_key_bundle(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost sse_decode_frb_presigned_post(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbProofOfWork sse_decode_frb_proof_of_work(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbUserData sse_decode_frb_user_data(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -477,6 +556,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
List<String> sse_decode_list_String(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
List<FrbAdditionalAccount> sse_decode_list_frb_additional_account(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<FrbPasswordlessNotificationMessage>
|
||||
sse_decode_list_frb_passwordless_notification_message(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<FrbPqcPreKey> sse_decode_list_frb_pqc_pre_key(
|
||||
SseDeserializer deserializer,
|
||||
|
|
@ -511,6 +601,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<(String, String)> sse_decode_list_record_string_string(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<SqlRow> sse_decode_list_sql_row(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -539,6 +634,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
double? sse_decode_opt_box_autoadd_f_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
FrbPresignedPost? sse_decode_opt_box_autoadd_frb_presigned_post(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
PlatformInt64? sse_decode_opt_box_autoadd_i_64(SseDeserializer deserializer);
|
||||
|
||||
|
|
@ -784,6 +884,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_frb_presigned_post(
|
||||
FrbPresignedPost self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_i_64(
|
||||
PlatformInt64 self,
|
||||
|
|
@ -826,6 +932,36 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_additional_account(
|
||||
FrbAdditionalAccount self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_memories_upload_urls(
|
||||
FrbMemoriesUploadUrls self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_memories_usage(
|
||||
FrbMemoriesUsage self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_passwordless_notification_message(
|
||||
FrbPasswordlessNotificationMessage self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_plan_balance(
|
||||
FrbPlanBalance self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_pqc_pre_key(FrbPqcPreKey self, SseSerializer serializer);
|
||||
|
||||
|
|
@ -835,6 +971,21 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_presigned_post(
|
||||
FrbPresignedPost self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_proof_of_work(
|
||||
FrbProofOfWork self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_frb_user_data(FrbUserData self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
|
|
@ -868,6 +1019,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
void sse_encode_list_String(List<String> self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_additional_account(
|
||||
List<FrbAdditionalAccount> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_passwordless_notification_message(
|
||||
List<FrbPasswordlessNotificationMessage> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_frb_pqc_pre_key(
|
||||
List<FrbPqcPreKey> self,
|
||||
|
|
@ -913,6 +1076,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_record_string_string(
|
||||
List<(String, String)> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_sql_row(List<SqlRow> self, SseSerializer serializer);
|
||||
|
||||
|
|
@ -946,6 +1115,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
|||
@protected
|
||||
void sse_encode_opt_box_autoadd_f_64(double? self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_opt_box_autoadd_frb_presigned_post(
|
||||
FrbPresignedPost? self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_opt_box_autoadd_i_64(
|
||||
PlatformInt64? self,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:twonly/src/services/news.service.dart';
|
|||
import 'package:twonly/src/services/user.service.dart';
|
||||
|
||||
export 'package:twonly/core/bridge/api.dart';
|
||||
export 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart';
|
||||
export 'package:twonly/src/services/api/rust_api_result.dart';
|
||||
|
||||
final GetIt locator = GetIt.instance;
|
||||
|
|
|
|||
58
lib/src/model/error_code.dart
Normal file
58
lib/src/model/error_code.dart
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum ErrorCode {
|
||||
Unknown(0),
|
||||
BadRequest(400),
|
||||
TooManyRequests(429),
|
||||
InternalError(500),
|
||||
|
||||
InvalidInvitationCode(1002),
|
||||
UsernameAlreadyTaken(1003),
|
||||
SignatureNotValid(1004),
|
||||
UsernameNotFound(1005),
|
||||
UsernameNotValid(1006),
|
||||
InvalidPublicKey(1007),
|
||||
SessionAlreadyAuthenticated(1008),
|
||||
SessionNotAuthenticated(1009),
|
||||
OnlyOneSessionAllowed(1010),
|
||||
UploadLimitReached(1011),
|
||||
InvalidUpdateToken(1012),
|
||||
InvalidOffset(1013),
|
||||
InvalidGoogleFcmToken(1014),
|
||||
UploadTokenIsBlocked(1015),
|
||||
UploadChecksumInvalid(1016),
|
||||
InvalidDownloadToken(1017),
|
||||
ApiEndpointNotFound(1018),
|
||||
AuthTokenNotValid(1019),
|
||||
InvalidPreKeys(1020),
|
||||
VoucherInValid(1021),
|
||||
PlanNotAllowed(1022),
|
||||
PlanLimitReached(1023),
|
||||
NotEnoughCredit(1024),
|
||||
PlanDowngrade(1025),
|
||||
PlanUpgradeNotYearly(1026),
|
||||
InvalidSignedPreKey(1027),
|
||||
UserIdNotFound(1028),
|
||||
UserIdAlreadyTaken(1029),
|
||||
AppVersionOutdated(1030),
|
||||
NewDeviceRegistered(1031),
|
||||
InvalidProofOfWork(1032),
|
||||
RegistrationDisabled(1033),
|
||||
IPAPaymentExpired(1034),
|
||||
UserIsNotInFreePlan(1035),
|
||||
ForegroundSessionConnected(1036),
|
||||
NoRecoveryData(1037),
|
||||
InvalidRecoveryData(1038);
|
||||
|
||||
const ErrorCode(this.value);
|
||||
final int value;
|
||||
|
||||
static ErrorCode fromValue(int? value) {
|
||||
return ErrorCode.values.firstWhere(
|
||||
(e) => e.value == value,
|
||||
orElse: () => ErrorCode.Unknown,
|
||||
);
|
||||
}
|
||||
|
||||
static ErrorCode valueOf(int? value) => fromValue(value);
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
//
|
||||
// Generated code. Do not modify.
|
||||
// source: api/http/http_requests.proto
|
||||
//
|
||||
// @dart = 2.12
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
|
||||
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
|
||||
|
||||
export 'http_requests.pb.dart';
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,11 +0,0 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/websocket/client_to_server.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: curly_braces_in_flow_control_structures
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_relative_imports
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +0,0 @@
|
|||
//
|
||||
// Generated code. Do not modify.
|
||||
// source: api/websocket/client_to_server.proto
|
||||
//
|
||||
// @dart = 2.12
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
|
||||
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
|
||||
|
||||
export 'client_to_server.pb.dart';
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/websocket/error.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: curly_braces_in_flow_control_structures
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_relative_imports
|
||||
|
||||
import 'dart:core' as $core;
|
||||
|
||||
export 'package:protobuf/protobuf.dart' show GeneratedMessageGenericExtensions;
|
||||
|
||||
export 'error.pbenum.dart';
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/websocket/error.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: curly_braces_in_flow_control_structures
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_relative_imports
|
||||
|
||||
import 'dart:core' as $core;
|
||||
|
||||
import 'package:protobuf/protobuf.dart' as $pb;
|
||||
|
||||
class ErrorCode extends $pb.ProtobufEnum {
|
||||
static const ErrorCode Unknown =
|
||||
ErrorCode._(0, _omitEnumNames ? '' : 'Unknown');
|
||||
static const ErrorCode BadRequest =
|
||||
ErrorCode._(400, _omitEnumNames ? '' : 'BadRequest');
|
||||
static const ErrorCode TooManyRequests =
|
||||
ErrorCode._(429, _omitEnumNames ? '' : 'TooManyRequests');
|
||||
static const ErrorCode InternalError =
|
||||
ErrorCode._(500, _omitEnumNames ? '' : 'InternalError');
|
||||
static const ErrorCode InvalidInvitationCode =
|
||||
ErrorCode._(1002, _omitEnumNames ? '' : 'InvalidInvitationCode');
|
||||
static const ErrorCode UsernameAlreadyTaken =
|
||||
ErrorCode._(1003, _omitEnumNames ? '' : 'UsernameAlreadyTaken');
|
||||
static const ErrorCode SignatureNotValid =
|
||||
ErrorCode._(1004, _omitEnumNames ? '' : 'SignatureNotValid');
|
||||
static const ErrorCode UsernameNotFound =
|
||||
ErrorCode._(1005, _omitEnumNames ? '' : 'UsernameNotFound');
|
||||
static const ErrorCode UsernameNotValid =
|
||||
ErrorCode._(1006, _omitEnumNames ? '' : 'UsernameNotValid');
|
||||
static const ErrorCode InvalidPublicKey =
|
||||
ErrorCode._(1007, _omitEnumNames ? '' : 'InvalidPublicKey');
|
||||
static const ErrorCode SessionAlreadyAuthenticated =
|
||||
ErrorCode._(1008, _omitEnumNames ? '' : 'SessionAlreadyAuthenticated');
|
||||
static const ErrorCode SessionNotAuthenticated =
|
||||
ErrorCode._(1009, _omitEnumNames ? '' : 'SessionNotAuthenticated');
|
||||
static const ErrorCode OnlyOneSessionAllowed =
|
||||
ErrorCode._(1010, _omitEnumNames ? '' : 'OnlyOneSessionAllowed');
|
||||
static const ErrorCode UploadLimitReached =
|
||||
ErrorCode._(1011, _omitEnumNames ? '' : 'UploadLimitReached');
|
||||
static const ErrorCode InvalidUpdateToken =
|
||||
ErrorCode._(1012, _omitEnumNames ? '' : 'InvalidUpdateToken');
|
||||
static const ErrorCode InvalidOffset =
|
||||
ErrorCode._(1013, _omitEnumNames ? '' : 'InvalidOffset');
|
||||
static const ErrorCode InvalidGoogleFcmToken =
|
||||
ErrorCode._(1014, _omitEnumNames ? '' : 'InvalidGoogleFcmToken');
|
||||
static const ErrorCode UploadTokenIsBlocked =
|
||||
ErrorCode._(1015, _omitEnumNames ? '' : 'UploadTokenIsBlocked');
|
||||
static const ErrorCode UploadChecksumInvalid =
|
||||
ErrorCode._(1016, _omitEnumNames ? '' : 'UploadChecksumInvalid');
|
||||
static const ErrorCode InvalidDownloadToken =
|
||||
ErrorCode._(1017, _omitEnumNames ? '' : 'InvalidDownloadToken');
|
||||
static const ErrorCode ApiEndpointNotFound =
|
||||
ErrorCode._(1018, _omitEnumNames ? '' : 'ApiEndpointNotFound');
|
||||
static const ErrorCode AuthTokenNotValid =
|
||||
ErrorCode._(1019, _omitEnumNames ? '' : 'AuthTokenNotValid');
|
||||
static const ErrorCode InvalidPreKeys =
|
||||
ErrorCode._(1020, _omitEnumNames ? '' : 'InvalidPreKeys');
|
||||
static const ErrorCode VoucherInValid =
|
||||
ErrorCode._(1021, _omitEnumNames ? '' : 'VoucherInValid');
|
||||
static const ErrorCode PlanNotAllowed =
|
||||
ErrorCode._(1022, _omitEnumNames ? '' : 'PlanNotAllowed');
|
||||
static const ErrorCode PlanLimitReached =
|
||||
ErrorCode._(1023, _omitEnumNames ? '' : 'PlanLimitReached');
|
||||
static const ErrorCode NotEnoughCredit =
|
||||
ErrorCode._(1024, _omitEnumNames ? '' : 'NotEnoughCredit');
|
||||
static const ErrorCode PlanDowngrade =
|
||||
ErrorCode._(1025, _omitEnumNames ? '' : 'PlanDowngrade');
|
||||
static const ErrorCode PlanUpgradeNotYearly =
|
||||
ErrorCode._(1026, _omitEnumNames ? '' : 'PlanUpgradeNotYearly');
|
||||
static const ErrorCode InvalidSignedPreKey =
|
||||
ErrorCode._(1027, _omitEnumNames ? '' : 'InvalidSignedPreKey');
|
||||
static const ErrorCode UserIdNotFound =
|
||||
ErrorCode._(1028, _omitEnumNames ? '' : 'UserIdNotFound');
|
||||
static const ErrorCode UserIdAlreadyTaken =
|
||||
ErrorCode._(1029, _omitEnumNames ? '' : 'UserIdAlreadyTaken');
|
||||
static const ErrorCode AppVersionOutdated =
|
||||
ErrorCode._(1030, _omitEnumNames ? '' : 'AppVersionOutdated');
|
||||
static const ErrorCode NewDeviceRegistered =
|
||||
ErrorCode._(1031, _omitEnumNames ? '' : 'NewDeviceRegistered');
|
||||
static const ErrorCode InvalidProofOfWork =
|
||||
ErrorCode._(1032, _omitEnumNames ? '' : 'InvalidProofOfWork');
|
||||
static const ErrorCode RegistrationDisabled =
|
||||
ErrorCode._(1033, _omitEnumNames ? '' : 'RegistrationDisabled');
|
||||
static const ErrorCode IPAPaymentExpired =
|
||||
ErrorCode._(1034, _omitEnumNames ? '' : 'IPAPaymentExpired');
|
||||
static const ErrorCode UserIsNotInFreePlan =
|
||||
ErrorCode._(1035, _omitEnumNames ? '' : 'UserIsNotInFreePlan');
|
||||
static const ErrorCode ForegroundSessionConnected =
|
||||
ErrorCode._(1036, _omitEnumNames ? '' : 'ForegroundSessionConnected');
|
||||
static const ErrorCode NoRecoveryData =
|
||||
ErrorCode._(1037, _omitEnumNames ? '' : 'NoRecoveryData');
|
||||
static const ErrorCode InvalidRecoveryData =
|
||||
ErrorCode._(1038, _omitEnumNames ? '' : 'InvalidRecoveryData');
|
||||
|
||||
static const $core.List<ErrorCode> values = <ErrorCode>[
|
||||
Unknown,
|
||||
BadRequest,
|
||||
TooManyRequests,
|
||||
InternalError,
|
||||
InvalidInvitationCode,
|
||||
UsernameAlreadyTaken,
|
||||
SignatureNotValid,
|
||||
UsernameNotFound,
|
||||
UsernameNotValid,
|
||||
InvalidPublicKey,
|
||||
SessionAlreadyAuthenticated,
|
||||
SessionNotAuthenticated,
|
||||
OnlyOneSessionAllowed,
|
||||
UploadLimitReached,
|
||||
InvalidUpdateToken,
|
||||
InvalidOffset,
|
||||
InvalidGoogleFcmToken,
|
||||
UploadTokenIsBlocked,
|
||||
UploadChecksumInvalid,
|
||||
InvalidDownloadToken,
|
||||
ApiEndpointNotFound,
|
||||
AuthTokenNotValid,
|
||||
InvalidPreKeys,
|
||||
VoucherInValid,
|
||||
PlanNotAllowed,
|
||||
PlanLimitReached,
|
||||
NotEnoughCredit,
|
||||
PlanDowngrade,
|
||||
PlanUpgradeNotYearly,
|
||||
InvalidSignedPreKey,
|
||||
UserIdNotFound,
|
||||
UserIdAlreadyTaken,
|
||||
AppVersionOutdated,
|
||||
NewDeviceRegistered,
|
||||
InvalidProofOfWork,
|
||||
RegistrationDisabled,
|
||||
IPAPaymentExpired,
|
||||
UserIsNotInFreePlan,
|
||||
ForegroundSessionConnected,
|
||||
NoRecoveryData,
|
||||
InvalidRecoveryData,
|
||||
];
|
||||
|
||||
static final $core.Map<$core.int, ErrorCode> _byValue =
|
||||
$pb.ProtobufEnum.initByValue(values);
|
||||
static ErrorCode? valueOf($core.int value) => _byValue[value];
|
||||
|
||||
const ErrorCode._(super.value, super.name);
|
||||
}
|
||||
|
||||
const $core.bool _omitEnumNames =
|
||||
$core.bool.fromEnvironment('protobuf.omit_enum_names');
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/websocket/error.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: curly_braces_in_flow_control_structures
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_relative_imports
|
||||
// ignore_for_file: unused_import
|
||||
|
||||
import 'dart:convert' as $convert;
|
||||
import 'dart:core' as $core;
|
||||
import 'dart:typed_data' as $typed_data;
|
||||
|
||||
@$core.Deprecated('Use errorCodeDescriptor instead')
|
||||
const ErrorCode$json = {
|
||||
'1': 'ErrorCode',
|
||||
'2': [
|
||||
{'1': 'Unknown', '2': 0},
|
||||
{'1': 'BadRequest', '2': 400},
|
||||
{'1': 'TooManyRequests', '2': 429},
|
||||
{'1': 'InternalError', '2': 500},
|
||||
{'1': 'InvalidInvitationCode', '2': 1002},
|
||||
{'1': 'UsernameAlreadyTaken', '2': 1003},
|
||||
{'1': 'SignatureNotValid', '2': 1004},
|
||||
{'1': 'UsernameNotFound', '2': 1005},
|
||||
{'1': 'UsernameNotValid', '2': 1006},
|
||||
{'1': 'InvalidPublicKey', '2': 1007},
|
||||
{'1': 'SessionAlreadyAuthenticated', '2': 1008},
|
||||
{'1': 'SessionNotAuthenticated', '2': 1009},
|
||||
{'1': 'OnlyOneSessionAllowed', '2': 1010},
|
||||
{'1': 'UploadLimitReached', '2': 1011},
|
||||
{'1': 'InvalidUpdateToken', '2': 1012},
|
||||
{'1': 'InvalidOffset', '2': 1013},
|
||||
{'1': 'InvalidGoogleFcmToken', '2': 1014},
|
||||
{'1': 'UploadTokenIsBlocked', '2': 1015},
|
||||
{'1': 'UploadChecksumInvalid', '2': 1016},
|
||||
{'1': 'InvalidDownloadToken', '2': 1017},
|
||||
{'1': 'ApiEndpointNotFound', '2': 1018},
|
||||
{'1': 'AuthTokenNotValid', '2': 1019},
|
||||
{'1': 'InvalidPreKeys', '2': 1020},
|
||||
{'1': 'VoucherInValid', '2': 1021},
|
||||
{'1': 'PlanNotAllowed', '2': 1022},
|
||||
{'1': 'PlanLimitReached', '2': 1023},
|
||||
{'1': 'NotEnoughCredit', '2': 1024},
|
||||
{'1': 'PlanDowngrade', '2': 1025},
|
||||
{'1': 'PlanUpgradeNotYearly', '2': 1026},
|
||||
{'1': 'InvalidSignedPreKey', '2': 1027},
|
||||
{'1': 'UserIdNotFound', '2': 1028},
|
||||
{'1': 'UserIdAlreadyTaken', '2': 1029},
|
||||
{'1': 'AppVersionOutdated', '2': 1030},
|
||||
{'1': 'NewDeviceRegistered', '2': 1031},
|
||||
{'1': 'InvalidProofOfWork', '2': 1032},
|
||||
{'1': 'RegistrationDisabled', '2': 1033},
|
||||
{'1': 'IPAPaymentExpired', '2': 1034},
|
||||
{'1': 'UserIsNotInFreePlan', '2': 1035},
|
||||
{'1': 'ForegroundSessionConnected', '2': 1036},
|
||||
{'1': 'NoRecoveryData', '2': 1037},
|
||||
{'1': 'InvalidRecoveryData', '2': 1038},
|
||||
],
|
||||
};
|
||||
|
||||
/// Descriptor for `ErrorCode`. Decode as a `google.protobuf.EnumDescriptorProto`.
|
||||
final $typed_data.Uint8List errorCodeDescriptor = $convert.base64Decode(
|
||||
'CglFcnJvckNvZGUSCwoHVW5rbm93bhAAEg8KCkJhZFJlcXVlc3QQkAMSFAoPVG9vTWFueVJlcX'
|
||||
'Vlc3RzEK0DEhIKDUludGVybmFsRXJyb3IQ9AMSGgoVSW52YWxpZEludml0YXRpb25Db2RlEOoH'
|
||||
'EhkKFFVzZXJuYW1lQWxyZWFkeVRha2VuEOsHEhYKEVNpZ25hdHVyZU5vdFZhbGlkEOwHEhUKEF'
|
||||
'VzZXJuYW1lTm90Rm91bmQQ7QcSFQoQVXNlcm5hbWVOb3RWYWxpZBDuBxIVChBJbnZhbGlkUHVi'
|
||||
'bGljS2V5EO8HEiAKG1Nlc3Npb25BbHJlYWR5QXV0aGVudGljYXRlZBDwBxIcChdTZXNzaW9uTm'
|
||||
'90QXV0aGVudGljYXRlZBDxBxIaChVPbmx5T25lU2Vzc2lvbkFsbG93ZWQQ8gcSFwoSVXBsb2Fk'
|
||||
'TGltaXRSZWFjaGVkEPMHEhcKEkludmFsaWRVcGRhdGVUb2tlbhD0BxISCg1JbnZhbGlkT2Zmc2'
|
||||
'V0EPUHEhoKFUludmFsaWRHb29nbGVGY21Ub2tlbhD2BxIZChRVcGxvYWRUb2tlbklzQmxvY2tl'
|
||||
'ZBD3BxIaChVVcGxvYWRDaGVja3N1bUludmFsaWQQ+AcSGQoUSW52YWxpZERvd25sb2FkVG9rZW'
|
||||
'4Q+QcSGAoTQXBpRW5kcG9pbnROb3RGb3VuZBD6BxIWChFBdXRoVG9rZW5Ob3RWYWxpZBD7BxIT'
|
||||
'Cg5JbnZhbGlkUHJlS2V5cxD8BxITCg5Wb3VjaGVySW5WYWxpZBD9BxITCg5QbGFuTm90QWxsb3'
|
||||
'dlZBD+BxIVChBQbGFuTGltaXRSZWFjaGVkEP8HEhQKD05vdEVub3VnaENyZWRpdBCACBISCg1Q'
|
||||
'bGFuRG93bmdyYWRlEIEIEhkKFFBsYW5VcGdyYWRlTm90WWVhcmx5EIIIEhgKE0ludmFsaWRTaW'
|
||||
'duZWRQcmVLZXkQgwgSEwoOVXNlcklkTm90Rm91bmQQhAgSFwoSVXNlcklkQWxyZWFkeVRha2Vu'
|
||||
'EIUIEhcKEkFwcFZlcnNpb25PdXRkYXRlZBCGCBIYChNOZXdEZXZpY2VSZWdpc3RlcmVkEIcIEh'
|
||||
'cKEkludmFsaWRQcm9vZk9mV29yaxCICBIZChRSZWdpc3RyYXRpb25EaXNhYmxlZBCJCBIWChFJ'
|
||||
'UEFQYXltZW50RXhwaXJlZBCKCBIYChNVc2VySXNOb3RJbkZyZWVQbGFuEIsIEh8KGkZvcmVncm'
|
||||
'91bmRTZXNzaW9uQ29ubmVjdGVkEIwIEhMKDk5vUmVjb3ZlcnlEYXRhEI0IEhgKE0ludmFsaWRS'
|
||||
'ZWNvdmVyeURhdGEQjgg=');
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
//
|
||||
// Generated code. Do not modify.
|
||||
// source: api/websocket/error.proto
|
||||
//
|
||||
// @dart = 2.12
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
|
||||
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
|
||||
|
||||
export 'error.pb.dart';
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,11 +0,0 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/websocket/server_to_client.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: curly_braces_in_flow_control_structures
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_relative_imports
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +0,0 @@
|
|||
//
|
||||
// Generated code. Do not modify.
|
||||
// source: api/websocket/server_to_client.proto
|
||||
//
|
||||
// @dart = 2.12
|
||||
|
||||
// ignore_for_file: annotate_overrides, camel_case_types, comment_references
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: deprecated_member_use_from_same_package, library_prefixes
|
||||
// ignore_for_file: non_constant_identifier_names, prefer_final_fields
|
||||
// ignore_for_file: unnecessary_import, unnecessary_this, unused_import
|
||||
|
||||
export 'server_to_client.pb.dart';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/http/http_requests.proto.
|
||||
// Generated from http_requests.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/http/http_requests.proto.
|
||||
// Generated from http_requests.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
// This is a generated file - do not edit.
|
||||
//
|
||||
// Generated from api/http/http_requests.proto.
|
||||
// Generated from http_requests.proto.
|
||||
|
||||
// @dart = 3.3
|
||||
|
||||
70
lib/src/model/protobuf/client/http_requests.proto
Normal file
70
lib/src/model/protobuf/client/http_requests.proto
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
syntax = "proto3";
|
||||
package http_requests;
|
||||
|
||||
message TextMessage {
|
||||
int64 user_id = 1;
|
||||
bytes body = 2;
|
||||
optional bytes push_data = 3;
|
||||
}
|
||||
|
||||
message UploadRequest {
|
||||
bytes encrypted_data = 1;
|
||||
repeated bytes download_tokens = 2;
|
||||
repeated TextMessage messages_on_success = 3;
|
||||
}
|
||||
|
||||
message SealedSenderMessageRequest {
|
||||
reserved 4;
|
||||
int64 recipient_user_id = 1;
|
||||
bytes sealed_sender_message = 2;
|
||||
bytes privacy_pass_token = 3;
|
||||
}
|
||||
|
||||
message SealedSenderMessageResponse {
|
||||
string message_id = 1;
|
||||
}
|
||||
|
||||
// plaintext message send to the server
|
||||
message UpdateGroupState {
|
||||
message UpdateTBS {
|
||||
uint64 version_id = 1;
|
||||
bytes encrypted_group_state = 3;
|
||||
bytes public_key = 4;
|
||||
// public group key
|
||||
optional bytes remove_admin = 5;
|
||||
optional bytes add_admin = 6;
|
||||
bytes nonce = 7;
|
||||
}
|
||||
UpdateTBS update = 1;
|
||||
bytes signature = 2;
|
||||
}
|
||||
|
||||
message NewGroupState {
|
||||
string group_id = 1;
|
||||
uint64 version_id = 2;
|
||||
bytes encrypted_group_state = 3;
|
||||
bytes public_key = 4;
|
||||
}
|
||||
|
||||
message AppendGroupState {
|
||||
message AppendTBS {
|
||||
bytes encrypted_group_state_append = 1;
|
||||
bytes public_key = 2;
|
||||
string group_id = 3;
|
||||
bytes nonce = 4;
|
||||
}
|
||||
bytes signature = 1;
|
||||
AppendTBS appendTBS = 2;
|
||||
uint64 versionId = 3;
|
||||
}
|
||||
|
||||
message GroupState {
|
||||
uint64 version_id = 1;
|
||||
bytes encrypted_group_state = 2;
|
||||
repeated AppendGroupState appended_group_states = 3;
|
||||
}
|
||||
|
||||
// this is just a database helper to store multiple appends
|
||||
message AppendGroupStateHelper {
|
||||
repeated AppendGroupState appended_group_states = 1;
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:background_downloader/background_downloader.dart';
|
||||
import 'package:clock/clock.dart';
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
|
|
@ -13,8 +14,8 @@ import 'package:twonly/locator.dart';
|
|||
import 'package:twonly/src/database/tables/mediafiles.table.dart';
|
||||
import 'package:twonly/src/database/tables/messages.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/http/http_requests.pb.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/data.pb.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/http_requests.pb.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart';
|
||||
import 'package:twonly/src/services/api/mediafiles/media_background.api.dart';
|
||||
import 'package:twonly/src/services/api/messages.api.dart';
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
import 'dart:typed_data';
|
||||
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/model/error_code.dart';
|
||||
import 'package:twonly/src/services/api/utils.api.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
|
||||
export 'package:twonly/src/model/error_code.dart';
|
||||
|
||||
Future<Result<T, ErrorCode>> rustApiResult<T>(Future<T> request) async {
|
||||
try {
|
||||
return Result.success(await request);
|
||||
|
|
@ -18,33 +16,3 @@ Future<Result<T, ErrorCode>> rustApiResult<T>(Future<T> request) async {
|
|||
return Result.error(ErrorCode.InternalError);
|
||||
}
|
||||
}
|
||||
|
||||
Future<T?> rustApiProtobuf<T>(
|
||||
Future<Uint8List> request,
|
||||
T Function(List<int>) decode,
|
||||
) async {
|
||||
try {
|
||||
return decode(await request);
|
||||
} catch (error) {
|
||||
Log.error('Rust API call failed', error: error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
server.Response_UserData decodeUserData(List<int> bytes) =>
|
||||
server.Response_UserData.fromBuffer(bytes);
|
||||
|
||||
server.Response_ProofOfWork decodeProofOfWork(List<int> bytes) =>
|
||||
server.Response_ProofOfWork.fromBuffer(bytes);
|
||||
|
||||
server.Response_MemoriesUrl decodeMemoriesUrl(List<int> bytes) =>
|
||||
server.Response_MemoriesUrl.fromBuffer(bytes);
|
||||
|
||||
server.Response_MemoriesUploadUrls decodeMemoriesUploadUrls(List<int> bytes) =>
|
||||
server.Response_MemoriesUploadUrls.fromBuffer(bytes);
|
||||
|
||||
server.Response_MemoriesUsage decodeMemoriesUsage(List<int> bytes) =>
|
||||
server.Response_MemoriesUsage.fromBuffer(bytes);
|
||||
|
||||
server.Response_PlanBallance decodePlanBalance(List<int> bytes) =>
|
||||
server.Response_PlanBallance.fromBuffer(bytes);
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import 'package:twonly/core/bridge/wrapper/key_manager.dart';
|
|||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/tables/mediafiles.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pbserver.dart'
|
||||
hide Message;
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
|
|
@ -35,18 +33,6 @@ DateTime fromTimestamp(Int64 timeStamp) {
|
|||
return date;
|
||||
}
|
||||
|
||||
// ignore: strict_raw_type
|
||||
Result asResult(server.ServerToClient? msg) {
|
||||
if (msg == null) {
|
||||
return Result.error(ErrorCode.InternalError);
|
||||
}
|
||||
if (msg.v0.response.hasOk()) {
|
||||
return Result.success(msg.v0.response.ok);
|
||||
} else {
|
||||
return Result.error(msg.v0.response.error);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> handleMediaError(MediaFile media) async {
|
||||
await twonlyDB.mediaFilesDao.updateMedia(
|
||||
media.mediaId,
|
||||
|
|
@ -72,17 +58,17 @@ Future<void> handleMediaError(MediaFile media) async {
|
|||
}
|
||||
|
||||
Future<bool> importSignalContactAndCreateRequest(
|
||||
server.Response_UserData userdata,
|
||||
FrbUserData userdata,
|
||||
) async {
|
||||
try {
|
||||
await RustApi.establishSignalSession(
|
||||
contactId: userdata.userId.toInt(),
|
||||
contactId: userdata.userId,
|
||||
expectedPublicKey: Uint8List.fromList(userdata.publicIdentityKey),
|
||||
);
|
||||
|
||||
// 2. Then send user request
|
||||
await RustApi.sendEncryptedContent(
|
||||
contactId: userdata.userId.toInt(),
|
||||
contactId: userdata.userId,
|
||||
content: EncryptedContent(
|
||||
contactRequest: EncryptedContent_ContactRequest(
|
||||
type: EncryptedContent_ContactRequest_Type.REQUEST,
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
import 'dart:typed_data' show Uint8List;
|
||||
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'
|
||||
show Int64List;
|
||||
import 'package:twonly/core/bridge/groups.dart' as rust_groups;
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
|
||||
Future<bool> createNewGroup(String groupName, List<Contact> members) =>
|
||||
rust_groups.createNewGroup(
|
||||
groupName: groupName,
|
||||
memberIds: Int64List.fromList(
|
||||
members.map((contact) => contact.userId).toList(),
|
||||
),
|
||||
);
|
||||
|
||||
Future<void> fetchGroupStatesForUnjoinedGroups() =>
|
||||
rust_groups.fetchGroupStatesForUnjoinedGroups();
|
||||
Future<void> fetchMissingGroupPublicKey() =>
|
||||
rust_groups.fetchMissingGroupPublicKeys();
|
||||
Future<bool> fetchGroupState(Group group) =>
|
||||
rust_groups.fetchGroupState(groupId: group.groupId);
|
||||
Future<bool> addNewHiddenContact(int contactId) =>
|
||||
rust_groups.addHiddenContact(contactId: contactId);
|
||||
|
||||
Future<bool> manageAdminState(
|
||||
Group group,
|
||||
Uint8List key,
|
||||
int contactId,
|
||||
bool remove,
|
||||
) => rust_groups.manageAdminState(
|
||||
groupId: group.groupId,
|
||||
groupPublicKey: key,
|
||||
contactId: contactId,
|
||||
remove: remove,
|
||||
);
|
||||
Future<bool> updateGroupName(Group group, String name) =>
|
||||
rust_groups.updateGroupName(groupId: group.groupId, groupName: name);
|
||||
Future<bool> updateChatDeletionTime(Group group, int milliseconds) =>
|
||||
rust_groups.updateChatDeletionTime(
|
||||
groupId: group.groupId,
|
||||
deleteMessagesAfterMilliseconds: milliseconds,
|
||||
);
|
||||
Future<bool> addNewGroupMembers(Group group, List<int> ids) =>
|
||||
rust_groups.addNewGroupMembers(
|
||||
groupId: group.groupId,
|
||||
memberIds: Int64List.fromList(ids),
|
||||
);
|
||||
Future<bool> removeMemberFromGroup(Group group, Uint8List key, int contactId) =>
|
||||
rust_groups.removeMemberFromGroup(
|
||||
groupId: group.groupId,
|
||||
groupPublicKey: key,
|
||||
contactId: contactId,
|
||||
);
|
||||
Future<bool> leaveGroup(Group group) =>
|
||||
rust_groups.leaveGroup(groupId: group.groupId);
|
||||
Future<bool> leaveAsNonAdminFromGroup(Group group) => leaveGroup(group);
|
||||
|
|
@ -12,8 +12,6 @@ import 'package:twonly/core/bridge/wrapper/key_manager.dart';
|
|||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/tables/mediafiles.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/model/protobuf/client/generated/backup.pb.dart';
|
||||
import 'package:twonly/src/services/mediafiles/mediafile.service.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
|
|
@ -171,14 +169,17 @@ class MemoriesCloudService {
|
|||
return true;
|
||||
}
|
||||
|
||||
final urls = await rustApiProtobuf(
|
||||
RustApi.getMemoriesUrl(mediaId: mediaId, thumbnail: isThumbnail),
|
||||
decodeMemoriesUrl,
|
||||
);
|
||||
if (urls == null || !urls.hasFullDownloadUrl()) return false;
|
||||
String? downloadUrl;
|
||||
try {
|
||||
downloadUrl = await RustApi.getMemoriesUrl(
|
||||
mediaId: mediaId,
|
||||
thumbnail: isThumbnail,
|
||||
);
|
||||
} catch (_) {}
|
||||
if (downloadUrl == null || downloadUrl.isEmpty) return false;
|
||||
|
||||
try {
|
||||
final response = await http.get(Uri.parse(urls.fullDownloadUrl));
|
||||
final response = await http.get(Uri.parse(downloadUrl));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return await _decryptFile(response.bodyBytes, targetPath);
|
||||
|
|
@ -208,17 +209,18 @@ class MemoriesCloudService {
|
|||
}
|
||||
|
||||
final sizeBytes = ms.storedPath.lengthSync();
|
||||
final urls = await rustApiProtobuf(
|
||||
RustApi.requestMemoriesUpload(
|
||||
final FrbMemoriesUploadUrls? urls;
|
||||
try {
|
||||
urls = await RustApi.requestMemoriesUpload(
|
||||
size: sizeBytes,
|
||||
originalDate: mediaFile.createdAt.millisecondsSinceEpoch,
|
||||
mediaId: mediaFile.mediaId,
|
||||
),
|
||||
decodeMemoriesUploadUrls,
|
||||
);
|
||||
|
||||
if (urls == null) {
|
||||
Log.error('Could not get upload URLs for memory ${mediaFile.mediaId}');
|
||||
);
|
||||
} catch (error) {
|
||||
Log.error(
|
||||
'Could not get upload URLs for memory ${mediaFile.mediaId}',
|
||||
error: error,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +240,8 @@ class MemoriesCloudService {
|
|||
final tempDir = await getTemporaryDirectory();
|
||||
|
||||
// 1. Upload thumbnail if exists
|
||||
if (ms.thumbnailPath.existsSync() && urls.hasThumbnailUpload()) {
|
||||
final thumbUpload = urls.thumbnailUpload;
|
||||
if (ms.thumbnailPath.existsSync() && thumbUpload != null) {
|
||||
final thumbFile = await _encryptFile(
|
||||
ms.thumbnailPath,
|
||||
mediaKey,
|
||||
|
|
@ -247,7 +250,7 @@ class MemoriesCloudService {
|
|||
'thumb_${mediaFile.mediaId}',
|
||||
);
|
||||
try {
|
||||
await _uploadToS3(urls.thumbnailUpload, thumbFile, (_) {});
|
||||
await _uploadToS3(thumbUpload, thumbFile, (_) {});
|
||||
} finally {
|
||||
if (thumbFile.existsSync()) {
|
||||
thumbFile.deleteSync();
|
||||
|
|
@ -256,7 +259,8 @@ class MemoriesCloudService {
|
|||
}
|
||||
|
||||
// 2. Upload full media if exists
|
||||
if (urls.hasFullUpload()) {
|
||||
final fullUpload = urls.fullUpload;
|
||||
if (fullUpload != null) {
|
||||
final fullFile = await _encryptFile(
|
||||
ms.storedPath,
|
||||
mediaKey,
|
||||
|
|
@ -265,7 +269,7 @@ class MemoriesCloudService {
|
|||
'full_${mediaFile.mediaId}',
|
||||
);
|
||||
try {
|
||||
await _uploadToS3(urls.fullUpload, fullFile, onProgress);
|
||||
await _uploadToS3(fullUpload, fullFile, onProgress);
|
||||
} finally {
|
||||
if (fullFile.existsSync()) {
|
||||
fullFile.deleteSync();
|
||||
|
|
@ -304,7 +308,7 @@ class MemoriesCloudService {
|
|||
}
|
||||
|
||||
Future<void> _uploadToS3(
|
||||
server.Response_PresignedPost presignedPost,
|
||||
FrbPresignedPost presignedPost,
|
||||
File file,
|
||||
void Function(double progress) onProgress,
|
||||
) async {
|
||||
|
|
@ -318,7 +322,9 @@ class MemoriesCloudService {
|
|||
},
|
||||
);
|
||||
|
||||
request.fields.addAll(presignedPost.fields);
|
||||
request.fields.addAll(
|
||||
Map.fromEntries(presignedPost.fields.map((f) => MapEntry(f.$1, f.$2))),
|
||||
);
|
||||
request.files.add(
|
||||
await http.MultipartFile.fromPath(
|
||||
'file',
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ import 'package:twonly/src/database/daos/contacts.dao.dart'
|
|||
show getContactDisplayName;
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/json/onboarding_state.model.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart'
|
||||
as pb;
|
||||
import 'package:twonly/src/model/protobuf/client/generated/passwordless_recovery.pb.dart';
|
||||
|
|
@ -312,6 +310,7 @@ class PasswordlessRecoveryService {
|
|||
}
|
||||
|
||||
unawaited(
|
||||
// ignore: inference_failure_on_untyped_parameter
|
||||
RustApi.performPasswordlessRecoveryHeartbeat().catchError((e) {
|
||||
Log.warn('Failed to perform passwordless recovery heartbeat: $e');
|
||||
}),
|
||||
|
|
@ -377,16 +376,13 @@ class PasswordlessRecoveryService {
|
|||
state.receivedShares.map((share) => share.messageId).toList(),
|
||||
);
|
||||
|
||||
late final server.Response_PasswordlessNotificationMessages response;
|
||||
late final List<FrbPasswordlessNotificationMessage> messages;
|
||||
try {
|
||||
final responseBytes = await RustApi.checkForPasswordlessNotification(
|
||||
messages = await RustApi.checkForPasswordlessNotification(
|
||||
notificationId: state.notificationId!,
|
||||
downloadAuthToken: state.downloadAuthToken!,
|
||||
alreadyReceivedMessageIds: alreadyReceivedIds,
|
||||
);
|
||||
response = server.Response_PasswordlessNotificationMessages.fromBuffer(
|
||||
responseBytes,
|
||||
);
|
||||
} catch (error) {
|
||||
Log.error(
|
||||
'Failed to load passwordless recovery messages',
|
||||
|
|
@ -395,7 +391,7 @@ class PasswordlessRecoveryService {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (response.messages.isEmpty) {
|
||||
if (messages.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -403,8 +399,8 @@ class PasswordlessRecoveryService {
|
|||
final secretKey = SecretKey(state.encryptionKey!);
|
||||
var didUpdate = false;
|
||||
|
||||
for (final msg in response.messages) {
|
||||
final msgId = msg.id.toInt();
|
||||
for (final msg in messages) {
|
||||
final msgId = msg.id;
|
||||
|
||||
try {
|
||||
final envelope = EncryptedEnvelope.fromBuffer(msg.encryptedMessage);
|
||||
|
|
|
|||
|
|
@ -17,11 +17,14 @@ class UserDiscoveryService {
|
|||
.getNewAnnouncementsWithoutData();
|
||||
|
||||
for (final announcedUser in announcedUsers) {
|
||||
final userdata = await rustApiProtobuf(
|
||||
RustApi.getUserById(userId: announcedUser.announcedUserId),
|
||||
decodeUserData,
|
||||
);
|
||||
if (userdata == null) continue;
|
||||
final FrbUserData? userdata;
|
||||
try {
|
||||
userdata = await RustApi.getUserById(
|
||||
userId: announcedUser.announcedUserId,
|
||||
);
|
||||
} catch (_) {
|
||||
continue;
|
||||
}
|
||||
if (!userdata.publicIdentityKey.equals(
|
||||
announcedUser.announcedPublicKey.toList(),
|
||||
)) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import 'package:local_auth/local_auth.dart';
|
|||
import 'package:path/path.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/src/localization/generated/app_localizations.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/error.pb.dart';
|
||||
import 'package:twonly/src/model/error_code.dart';
|
||||
import 'package:twonly/src/providers/settings.provider.dart';
|
||||
import 'package:twonly/src/services/backup.service.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
|
|
@ -150,7 +150,6 @@ String getRandomString(int length) => String.fromCharCodes(
|
|||
);
|
||||
|
||||
String errorCodeToText(BuildContext context, ErrorCode code) {
|
||||
// ignore: exhaustive_cases
|
||||
switch (code) {
|
||||
case ErrorCode.InternalError:
|
||||
return context.lang.errorInternalError;
|
||||
|
|
@ -170,8 +169,10 @@ String errorCodeToText(BuildContext context, ErrorCode code) {
|
|||
return context.lang.errorVoucherInvalid;
|
||||
case ErrorCode.PlanUpgradeNotYearly:
|
||||
return context.lang.errorPlanUpgradeNotYearly;
|
||||
// ignore: no_default_cases
|
||||
default:
|
||||
return code.toString();
|
||||
}
|
||||
return code.toString();
|
||||
}
|
||||
|
||||
String formatDuration(BuildContext context, int seconds) {
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import 'package:drift/drift.dart' show Value;
|
|||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/core/bridge/groups.dart' as rust_groups;
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/tables/groups.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart';
|
||||
import 'package:twonly/src/services/group.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/visual/elements/better_list_title.element.dart';
|
||||
import 'package:twonly/src/visual/views/groups/group.view.dart';
|
||||
|
|
@ -106,7 +106,10 @@ class _SelectChatDeletionTimeListTitleState
|
|||
onlySendIfNoReceiptsAreOpen: false,
|
||||
);
|
||||
} else {
|
||||
if (!await updateChatDeletionTime(group!, selected)) {
|
||||
if (!await rust_groups.updateChatDeletionTime(
|
||||
groupId: group!.groupId,
|
||||
deleteMessagesAfterMilliseconds: selected,
|
||||
)) {
|
||||
if (mounted) {
|
||||
showNetworkIssue(context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,10 @@ class _ChatAskAFriendEntryState extends State<ChatAskAFriendEntry> {
|
|||
_username = contact.displayName ?? contact.username;
|
||||
} else {
|
||||
// Fetch from API
|
||||
final userdata = await rustApiProtobuf(RustApi.getUserById(userId: userId), decodeUserData);
|
||||
FrbUserData? userdata;
|
||||
try {
|
||||
userdata = await RustApi.getUserById(userId: userId);
|
||||
} catch (_) {}
|
||||
if (userdata != null) {
|
||||
_username = utf8.decode(userdata.username);
|
||||
}
|
||||
|
|
@ -122,12 +125,15 @@ class _ChatAskAFriendEntryState extends State<ChatAskAFriendEntry> {
|
|||
});
|
||||
try {
|
||||
final userId = _data!.askAboutUserId.toInt();
|
||||
final userdata = await rustApiProtobuf(RustApi.getUserById(userId: userId), decodeUserData);
|
||||
FrbUserData? userdata;
|
||||
try {
|
||||
userdata = await RustApi.getUserById(userId: userId);
|
||||
} catch (_) {}
|
||||
if (userdata != null) {
|
||||
await twonlyDB.contactsDao.insertOnConflictUpdate(
|
||||
ContactsCompanion(
|
||||
username: Value(utf8.decode(userdata.username)),
|
||||
userId: Value(userdata.userId.toInt()),
|
||||
userId: Value(userdata.userId),
|
||||
requested: const Value(false),
|
||||
blocked: const Value(false),
|
||||
deletedByUser: const Value(false),
|
||||
|
|
|
|||
|
|
@ -117,11 +117,9 @@ class _ContactRowState extends State<_ContactRow> {
|
|||
});
|
||||
|
||||
try {
|
||||
final userdata = await rustApiProtobuf(
|
||||
RustApi.getUserById(userId: widget.contact.userId.toInt()),
|
||||
decodeUserData,
|
||||
final userdata = await RustApi.getUserById(
|
||||
userId: widget.contact.userId.toInt(),
|
||||
);
|
||||
if (userdata == null) return;
|
||||
|
||||
final username = utf8.decode(userdata.username);
|
||||
|
||||
|
|
@ -140,7 +138,7 @@ class _ContactRowState extends State<_ContactRow> {
|
|||
final added = await twonlyDB.contactsDao.insertOnConflictUpdate(
|
||||
ContactsCompanion(
|
||||
username: Value(username),
|
||||
userId: Value(userdata.userId.toInt()),
|
||||
userId: Value(userdata.userId),
|
||||
requested: const Value(false),
|
||||
blocked: const Value(false),
|
||||
deletedByUser: const Value(false),
|
||||
|
|
@ -150,7 +148,7 @@ class _ContactRowState extends State<_ContactRow> {
|
|||
if (added > 0) await importSignalContactAndCreateRequest(userdata);
|
||||
|
||||
await KeyVerificationService.verifySharedContact(
|
||||
contactId: userdata.userId.toInt(),
|
||||
contactId: userdata.userId,
|
||||
sharedPublicIdentityKey: widget.contact.publicIdentityKey,
|
||||
senderId: widget.message.senderId!,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||
import 'package:go_router/go_router.dart';
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/model/protobuf/client/generated/qr.pb.dart';
|
||||
import 'package:twonly/src/services/api/utils.api.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
|
|
@ -39,14 +37,10 @@ class _AddContactViaQrLinkViewState extends State<AddContactViaQrLinkView> {
|
|||
});
|
||||
|
||||
try {
|
||||
final userData = server.Response_UserData(
|
||||
userId: widget.profile.userId,
|
||||
publicIdentityKey: widget.profile.publicIdentityKey,
|
||||
signedPrekey: widget.profile.signedPrekey,
|
||||
signedPrekeySignature: widget.profile.signedPrekeySignature,
|
||||
signedPrekeyId: widget.profile.signedPrekeyId,
|
||||
username: utf8.encode(widget.profile.username),
|
||||
registrationId: widget.profile.registrationId,
|
||||
final userData = FrbUserData(
|
||||
userId: widget.profile.userId.toInt(),
|
||||
publicIdentityKey: Uint8List.fromList(widget.profile.publicIdentityKey),
|
||||
username: Uint8List.fromList(utf8.encode(widget.profile.username)),
|
||||
);
|
||||
|
||||
final added = await twonlyDB.contactsDao.insertOnConflictUpdate(
|
||||
|
|
|
|||
|
|
@ -117,10 +117,12 @@ class _SearchUsernameView extends State<AddNewUserView> {
|
|||
_isLoading = true;
|
||||
});
|
||||
|
||||
final userdata = await rustApiProtobuf(
|
||||
RustApi.getUserData(username: username),
|
||||
decodeUserData,
|
||||
);
|
||||
FrbUserData? userdata;
|
||||
try {
|
||||
userdata = await RustApi.getUserData(username: username);
|
||||
} catch (_) {
|
||||
userdata = null;
|
||||
}
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {
|
||||
|
|
@ -149,7 +151,7 @@ class _SearchUsernameView extends State<AddNewUserView> {
|
|||
final added = await twonlyDB.contactsDao.insertOnConflictUpdate(
|
||||
ContactsCompanion(
|
||||
username: Value(username),
|
||||
userId: Value(userdata.userId.toInt()),
|
||||
userId: Value(userdata.userId),
|
||||
requested: const Value(false),
|
||||
blocked: const Value(false),
|
||||
deletedByUser: const Value(false),
|
||||
|
|
@ -167,7 +169,7 @@ class _SearchUsernameView extends State<AddNewUserView> {
|
|||
);
|
||||
if (markAsVerified) {
|
||||
await twonlyDB.keyVerificationDao.addKeyVerification(
|
||||
userdata.userId.toInt(),
|
||||
userdata.userId,
|
||||
VerificationType.link,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,14 @@ class FriendSuggestionsComp extends StatelessWidget {
|
|||
) async {
|
||||
Log.info('Requesting user via friend suggestions');
|
||||
|
||||
final userdata = await rustApiProtobuf(RustApi.getUserById(userId: user.announcedUserId), decodeUserData);
|
||||
FrbUserData? userdata;
|
||||
try {
|
||||
userdata = await RustApi.getUserById(
|
||||
userId: user.announcedUserId,
|
||||
);
|
||||
} catch (_) {
|
||||
userdata = null;
|
||||
}
|
||||
|
||||
if (userdata == null) {
|
||||
if (context.mounted) {
|
||||
|
|
@ -58,7 +65,7 @@ class FriendSuggestionsComp extends StatelessWidget {
|
|||
final added = await twonlyDB.contactsDao.insertOnConflictUpdate(
|
||||
ContactsCompanion(
|
||||
username: Value(user.username!),
|
||||
userId: Value(userdata.userId.toInt()),
|
||||
userId: Value(userdata.userId),
|
||||
requested: const Value(false),
|
||||
blocked: const Value(false),
|
||||
deletedByUser: const Value(false),
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'
|
||||
show Int64List;
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/core/bridge/groups.dart' as rust_groups;
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||
import 'package:twonly/src/database/tables/groups.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/services/group.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/visual/components/alert.dialog.dart';
|
||||
import 'package:twonly/src/visual/components/avatar_icon.comp.dart';
|
||||
|
|
@ -78,7 +80,10 @@ class _GroupViewState extends State<GroupView> {
|
|||
newGroupName != null &&
|
||||
newGroupName != '' &&
|
||||
newGroupName != _group!.groupName) {
|
||||
if (!await updateGroupName(_group!, newGroupName)) {
|
||||
if (!await rust_groups.updateGroupName(
|
||||
groupId: _group!.groupId,
|
||||
groupName: newGroupName,
|
||||
)) {
|
||||
if (mounted) {
|
||||
showNetworkIssue(context);
|
||||
}
|
||||
|
|
@ -98,7 +103,10 @@ class _GroupViewState extends State<GroupView> {
|
|||
)
|
||||
as List<int>?;
|
||||
if (selectedUserIds == null) return;
|
||||
if (!await addNewGroupMembers(_group!, selectedUserIds)) {
|
||||
if (!await rust_groups.addNewGroupMembers(
|
||||
groupId: _group!.groupId,
|
||||
memberIds: Int64List.fromList(selectedUserIds),
|
||||
)) {
|
||||
if (mounted) {
|
||||
showNetworkIssue(context);
|
||||
}
|
||||
|
|
@ -134,7 +142,7 @@ class _GroupViewState extends State<GroupView> {
|
|||
}
|
||||
}
|
||||
|
||||
final success = await leaveGroup(_group!);
|
||||
final success = await rust_groups.leaveGroup(groupId: _group!.groupId);
|
||||
|
||||
if (!success) {
|
||||
if (mounted) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart'
|
||||
show Int64List;
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:twonly/core/bridge/groups.dart' as rust_groups;
|
||||
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/services/group.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/visual/components/avatar_icon.comp.dart';
|
||||
import 'package:twonly/src/visual/components/contact_labels.comp.dart';
|
||||
|
|
@ -36,9 +38,11 @@ class _GroupCreateSelectGroupNameViewState
|
|||
_isLoading = true;
|
||||
});
|
||||
|
||||
final wasSuccess = await createNewGroup(
|
||||
textFieldGroupName.text,
|
||||
widget.selectedUsers,
|
||||
final wasSuccess = await rust_groups.createNewGroup(
|
||||
groupName: textFieldGroupName.text,
|
||||
memberIds: Int64List.fromList(
|
||||
widget.selectedUsers.map((contact) => contact.userId).toList(),
|
||||
),
|
||||
);
|
||||
if (wasSuccess) {
|
||||
// POP
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@ import 'package:drift/drift.dart' show Value;
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:twonly/core/bridge/groups.dart' as rust_groups;
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/constants/routes.keys.dart';
|
||||
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||
import 'package:twonly/src/database/tables/groups.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart';
|
||||
import 'package:twonly/src/services/group.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/visual/components/alert.dialog.dart';
|
||||
import 'package:twonly/src/visual/components/snackbar.dart';
|
||||
|
|
@ -36,11 +36,11 @@ class GroupMemberContextMenu extends StatelessWidget {
|
|||
customOk: context.lang.makeAdminRightsOkBtn,
|
||||
);
|
||||
if (ok) {
|
||||
if (!await manageAdminState(
|
||||
group,
|
||||
member.groupPublicKey!,
|
||||
contact.userId,
|
||||
false,
|
||||
if (!await rust_groups.manageAdminState(
|
||||
groupId: group.groupId,
|
||||
groupPublicKey: member.groupPublicKey!,
|
||||
contactId: contact.userId,
|
||||
remove: false,
|
||||
)) {
|
||||
if (context.mounted) {
|
||||
showNetworkIssue(context);
|
||||
|
|
@ -57,11 +57,11 @@ class GroupMemberContextMenu extends StatelessWidget {
|
|||
customOk: context.lang.revokeAdminRightsOkBtn,
|
||||
);
|
||||
if (ok) {
|
||||
if (!await manageAdminState(
|
||||
group,
|
||||
member.groupPublicKey!,
|
||||
contact.userId,
|
||||
true,
|
||||
if (!await rust_groups.manageAdminState(
|
||||
groupId: group.groupId,
|
||||
groupPublicKey: member.groupPublicKey!,
|
||||
contactId: contact.userId,
|
||||
remove: true,
|
||||
)) {
|
||||
if (context.mounted) {
|
||||
showNetworkIssue(context);
|
||||
|
|
@ -77,10 +77,10 @@ class GroupMemberContextMenu extends StatelessWidget {
|
|||
'',
|
||||
);
|
||||
if (ok) {
|
||||
if (!await removeMemberFromGroup(
|
||||
group,
|
||||
member.groupPublicKey!,
|
||||
contact.userId,
|
||||
if (!await rust_groups.removeMemberFromGroup(
|
||||
groupId: group.groupId,
|
||||
groupPublicKey: member.groupPublicKey!,
|
||||
contactId: contact.userId,
|
||||
)) {
|
||||
if (context.mounted) {
|
||||
showNetworkIssue(context);
|
||||
|
|
|
|||
|
|
@ -46,7 +46,10 @@ class MemoriesViewState extends State<MemoriesView>
|
|||
}
|
||||
|
||||
Future<void> _checkUsage() async {
|
||||
final usage = await rustApiProtobuf(RustApi.getMemoriesUsage(), decodeMemoriesUsage);
|
||||
FrbMemoriesUsage? usage;
|
||||
try {
|
||||
usage = await RustApi.getMemoriesUsage();
|
||||
} catch (_) {}
|
||||
if (usage != null &&
|
||||
usage.maxBytes > 0 &&
|
||||
usage.currentBytes >= usage.maxBytes) {
|
||||
|
|
|
|||
|
|
@ -78,9 +78,7 @@ class _RegisterViewState extends State<RegisterView> {
|
|||
proof = await proofOfWork!;
|
||||
} else {
|
||||
final proofResult = await rustApiResult(RustApi.getProofOfWork());
|
||||
final pow = proofResult.value == null
|
||||
? null
|
||||
: decodeProofOfWork(proofResult.value!);
|
||||
final pow = proofResult.value;
|
||||
final registrationDisabled =
|
||||
proofResult.error == ErrorCode.RegistrationDisabled;
|
||||
if (pow == null) {
|
||||
|
|
@ -93,7 +91,7 @@ class _RegisterViewState extends State<RegisterView> {
|
|||
}
|
||||
return;
|
||||
}
|
||||
proof = await calculatePoW(pow.prefix, pow.difficulty.toInt());
|
||||
proof = await calculatePoW(pow.prefix, pow.difficulty);
|
||||
}
|
||||
|
||||
Log.info('The result of the POW is $proof');
|
||||
|
|
|
|||
|
|
@ -7,8 +7,6 @@ import 'package:provider/provider.dart';
|
|||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/constants/routes.keys.dart';
|
||||
import 'package:twonly/src/model/json/backup.model.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/providers/purchases.provider.dart';
|
||||
import 'package:twonly/src/services/backup.service.dart';
|
||||
import 'package:twonly/src/services/memories/memories_cloud.service.dart';
|
||||
|
|
@ -33,7 +31,7 @@ class BackupView extends StatefulWidget {
|
|||
class _BackupViewState extends State<BackupView> {
|
||||
bool _isLoading = false;
|
||||
CurrentBackupStatus? _backupStatus;
|
||||
server.Response_MemoriesUsage? _memoriesUsage;
|
||||
FrbMemoriesUsage? _memoriesUsage;
|
||||
StreamSubscription<void>? _backupUpdateSub;
|
||||
|
||||
@override
|
||||
|
|
@ -54,7 +52,10 @@ class _BackupViewState extends State<BackupView> {
|
|||
Future<void> _loadBackupStatus() async {
|
||||
setState(() => _isLoading = true);
|
||||
final status = await BackupService.getData();
|
||||
final memoriesUsage = await rustApiProtobuf(RustApi.getMemoriesUsage(), decodeMemoriesUsage);
|
||||
FrbMemoriesUsage? memoriesUsage;
|
||||
try {
|
||||
memoriesUsage = await RustApi.getMemoriesUsage();
|
||||
} catch (_) {}
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_backupStatus = status;
|
||||
|
|
@ -197,7 +198,7 @@ class _BackupViewState extends State<BackupView> {
|
|||
: (!userService.currentUser.isCloudBackupEnabled
|
||||
? context.lang.backupMemoriesNotEnabled
|
||||
: (_memoriesUsage != null
|
||||
? '${formatBytes(_memoriesUsage!.currentBytes.toInt())} / ${formatBytes(_memoriesUsage!.maxBytes.toInt())}'
|
||||
? '${formatBytes(_memoriesUsage!.currentBytes)} / ${formatBytes(_memoriesUsage!.maxBytes)}'
|
||||
: '-')),
|
||||
),
|
||||
trailing: isFreePlan
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart'
|
||||
as server;
|
||||
import 'package:twonly/src/services/memories/memories_cloud.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/visual/components/snackbar.dart';
|
||||
|
|
@ -19,7 +17,7 @@ class MemoriesBackupDetailView extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _MemoriesBackupDetailViewState extends State<MemoriesBackupDetailView> {
|
||||
server.Response_MemoriesUsage? _memoriesUsage;
|
||||
FrbMemoriesUsage? _memoriesUsage;
|
||||
bool _isLoading = true;
|
||||
|
||||
@override
|
||||
|
|
@ -29,7 +27,10 @@ class _MemoriesBackupDetailViewState extends State<MemoriesBackupDetailView> {
|
|||
}
|
||||
|
||||
Future<void> _loadStats() async {
|
||||
final memoriesUsage = await rustApiProtobuf(RustApi.getMemoriesUsage(), decodeMemoriesUsage);
|
||||
FrbMemoriesUsage? memoriesUsage;
|
||||
try {
|
||||
memoriesUsage = await RustApi.getMemoriesUsage();
|
||||
} catch (_) {}
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_memoriesUsage = memoriesUsage;
|
||||
|
|
@ -58,7 +59,7 @@ class _MemoriesBackupDetailViewState extends State<MemoriesBackupDetailView> {
|
|||
children: [
|
||||
Text(
|
||||
_memoriesUsage != null
|
||||
? '${formatBytes(_memoriesUsage!.currentBytes.toInt())} / ${formatBytes(_memoriesUsage!.maxBytes.toInt())}'
|
||||
? '${formatBytes(_memoriesUsage!.currentBytes)} / ${formatBytes(_memoriesUsage!.maxBytes)}'
|
||||
: '-',
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import 'package:http/http.dart' as http;
|
|||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/constants/routes.keys.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/http/http_requests.pb.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/http_requests.pb.dart';
|
||||
import 'package:twonly/src/services/api/utils.api.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart';
|
||||
import 'package:twonly/src/providers/purchases.provider.dart';
|
||||
import 'package:twonly/src/services/subscription.service.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
|
|
@ -17,14 +16,14 @@ import 'package:twonly/src/visual/views/settings/subscription/select_additional_
|
|||
class AdditionalUsersView extends StatefulWidget {
|
||||
const AdditionalUsersView({required this.ballance, super.key});
|
||||
|
||||
final Response_PlanBallance? ballance;
|
||||
final FrbPlanBalance? ballance;
|
||||
|
||||
@override
|
||||
State<AdditionalUsersView> createState() => _AdditionalUsersViewState();
|
||||
}
|
||||
|
||||
class _AdditionalUsersViewState extends State<AdditionalUsersView> {
|
||||
Response_PlanBallance? ballance;
|
||||
FrbPlanBalance? ballance;
|
||||
|
||||
late int _unusedAdditionalAccounts;
|
||||
int _planLimit = 0;
|
||||
|
|
@ -48,10 +47,11 @@ class _AdditionalUsersViewState extends State<AdditionalUsersView> {
|
|||
|
||||
Future<void> initAsync({required bool force}) async {
|
||||
if (force) {
|
||||
ballance = await rustApiProtobuf(
|
||||
RustApi.loadPlanBalance(),
|
||||
decodePlanBalance,
|
||||
);
|
||||
try {
|
||||
ballance = await RustApi.loadPlanBalance();
|
||||
} catch (_) {
|
||||
ballance = null;
|
||||
}
|
||||
_unusedAdditionalAccounts =
|
||||
_planLimit - (ballance?.additionalAccounts.length ?? _planLimit);
|
||||
}
|
||||
|
|
@ -65,7 +65,7 @@ class _AdditionalUsersViewState extends State<AdditionalUsersView> {
|
|||
limit: _planLimit,
|
||||
alreadySelected:
|
||||
ballance?.additionalAccounts
|
||||
.map((e) => e.userId.toInt())
|
||||
.map((e) => e.userId)
|
||||
.toList() ??
|
||||
[],
|
||||
),
|
||||
|
|
@ -162,7 +162,7 @@ class AdditionalAccount extends StatefulWidget {
|
|||
});
|
||||
|
||||
final void Function() refresh;
|
||||
final Response_AdditionalAccount account;
|
||||
final FrbAdditionalAccount account;
|
||||
@override
|
||||
State<AdditionalAccount> createState() => _AdditionalAccountState();
|
||||
}
|
||||
|
|
@ -179,7 +179,7 @@ class _AdditionalAccountState extends State<AdditionalAccount> {
|
|||
|
||||
Future<void> initAsync() async {
|
||||
final contact = await twonlyDB.contactsDao
|
||||
.getContactByUserId(widget.account.userId.toInt())
|
||||
.getContactByUserId(widget.account.userId)
|
||||
.getSingleOrNull();
|
||||
if (contact != null) {
|
||||
username = getContactDisplayName(contact);
|
||||
|
|
@ -225,7 +225,7 @@ class _AdditionalAccountState extends State<AdditionalAccount> {
|
|||
if (remove) {
|
||||
final res = await rustApiResult(
|
||||
RustApi.removeAdditionalUser(
|
||||
userId: widget.account.userId.toInt(),
|
||||
userId: widget.account.userId,
|
||||
),
|
||||
);
|
||||
if (!context.mounted) return;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|||
import 'package:provider/provider.dart';
|
||||
import 'package:twonly/locator.dart';
|
||||
import 'package:twonly/src/database/daos/contacts.dao.dart';
|
||||
import 'package:twonly/src/model/protobuf/api/websocket/server_to_client.pb.dart';
|
||||
import 'package:twonly/src/model/purchasable_product.model.dart';
|
||||
import 'package:twonly/src/providers/purchases.provider.dart';
|
||||
import 'package:twonly/src/services/subscription.service.dart';
|
||||
|
|
@ -26,7 +25,7 @@ class SubscriptionView extends StatefulWidget {
|
|||
class _SubscriptionViewState extends State<SubscriptionView> {
|
||||
bool loaded = false;
|
||||
bool testerRequested = true;
|
||||
Response_PlanBallance? ballance;
|
||||
FrbPlanBalance? ballance;
|
||||
String? additionalOwnerName;
|
||||
|
||||
@override
|
||||
|
|
@ -36,12 +35,13 @@ class _SubscriptionViewState extends State<SubscriptionView> {
|
|||
}
|
||||
|
||||
Future<void> initAsync() async {
|
||||
ballance = await rustApiProtobuf(
|
||||
RustApi.loadPlanBalance(),
|
||||
decodePlanBalance,
|
||||
);
|
||||
if (ballance != null && ballance!.hasAdditionalAccountOwnerId()) {
|
||||
final ownerId = ballance!.additionalAccountOwnerId.toInt();
|
||||
try {
|
||||
ballance = await RustApi.loadPlanBalance();
|
||||
} catch (_) {
|
||||
ballance = null;
|
||||
}
|
||||
if (ballance != null && ballance!.additionalAccountOwnerId != null) {
|
||||
final ownerId = ballance!.additionalAccountOwnerId!;
|
||||
final contact = await twonlyDB.contactsDao
|
||||
.getContactByUserId(ownerId)
|
||||
.getSingleOrNull();
|
||||
|
|
|
|||
|
|
@ -140,3 +140,10 @@ pub(crate) fn decode_ok_value<T>(
|
|||
ServerResult::ErrorCode(code) => Ok(ServerResult::ErrorCode(code)),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn decode_empty_ok(bytes: Vec<u8>) -> Result<ServerResult<()>> {
|
||||
decode_ok_value(bytes, |value| match value {
|
||||
server_to_client::response::ok::Ok::None(_) => Some(()),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
*/
|
||||
|
||||
use super::Server;
|
||||
use crate::api::proto::client_to_server;
|
||||
use crate::api::proto::server_to_client::response::ok::Ok as ResponseOk;
|
||||
use crate::api::proto::{client_to_server, server_to_client};
|
||||
use crate::api::runtime::helpers::decode_ok_value;
|
||||
use crate::api::server::server_ok;
|
||||
use crate::bridge::api::ServerResult;
|
||||
|
|
@ -24,6 +24,16 @@ impl Server {
|
|||
.await
|
||||
}
|
||||
|
||||
pub async fn get_plan_balance_model(
|
||||
ctx: &Arc<Context>,
|
||||
) -> Result<ServerResult<server_to_client::response::PlanBallance>> {
|
||||
let bytes = Self::get_plan_balance(ctx).await?;
|
||||
decode_ok_value(bytes, |value| match value {
|
||||
server_to_client::response::ok::Ok::Planballance(balance) => Some(balance),
|
||||
_ => None,
|
||||
})
|
||||
}
|
||||
|
||||
pub async fn load_plan_balance(ctx: &Arc<Context>) -> Result<Vec<u8>> {
|
||||
Self::get_plan_balance(ctx).await
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use crate::api::messages::incoming::messages;
|
||||
use crate::api::ApiRuntime;
|
||||
pub use crate::api::PqcPreKeyInput;
|
||||
use crate::api::Server;
|
||||
use crate::api::messages::incoming::messages;
|
||||
use crate::api::proto::server_to_client::response::ok::Ok as ResponseOk;
|
||||
use crate::api::runtime::helpers::decode_ok_value;
|
||||
use crate::context::Context;
|
||||
use crate::error::{Result, TwonlyError};
|
||||
use crate::frb_generated::StreamSink;
|
||||
|
|
@ -16,7 +14,6 @@ use crate::services::contacts::ContactService;
|
|||
use crate::services::messages::MessageService;
|
||||
use crate::user_config::UserConfig;
|
||||
use flutter_rust_bridge::frb;
|
||||
use prost::Message;
|
||||
|
||||
#[frb(ignore)]
|
||||
pub enum ServerResult<T> {
|
||||
|
|
@ -32,17 +29,7 @@ fn api_result<T>(result: ServerResult<T>) -> Result<T> {
|
|||
}
|
||||
|
||||
fn empty_api_response(bytes: Vec<u8>) -> Result<()> {
|
||||
api_result(decode_ok_value(bytes, |value| match value {
|
||||
ResponseOk::None(_) => Some(()),
|
||||
_ => None,
|
||||
})?)
|
||||
}
|
||||
|
||||
fn encoded_api_response<T: Message>(
|
||||
bytes: Vec<u8>,
|
||||
extract: impl FnOnce(ResponseOk) -> Option<T>,
|
||||
) -> Result<Vec<u8>> {
|
||||
api_result(decode_ok_value(bytes, extract)?).map(|value| value.encode_to_vec())
|
||||
crate::api::runtime::helpers::decode_empty_ok(bytes).and_then(api_result)
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
@ -102,6 +89,62 @@ pub enum ApiEventKind {
|
|||
LoginTokenMigrated,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbPasswordlessNotificationMessage {
|
||||
pub id: i64,
|
||||
pub encrypted_message: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbUserData {
|
||||
pub user_id: i64,
|
||||
pub username: Vec<u8>,
|
||||
pub public_identity_key: Vec<u8>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbProofOfWork {
|
||||
pub prefix: String,
|
||||
pub difficulty: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbMemoriesUsage {
|
||||
pub current_bytes: i64,
|
||||
pub count: i64,
|
||||
pub max_bytes: i64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbAdditionalAccount {
|
||||
pub user_id: i64,
|
||||
pub plan_id: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbPlanBalance {
|
||||
pub used_daily_media_upload_limit: i64,
|
||||
pub used_upload_media_size_limit: i64,
|
||||
pub payment_period_days: Option<i64>,
|
||||
pub last_payment_done_unix_timestamp: Option<i64>,
|
||||
pub additional_accounts: Vec<FrbAdditionalAccount>,
|
||||
pub auto_renewal: Option<bool>,
|
||||
pub additional_account_owner_id: Option<i64>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbPresignedPost {
|
||||
pub url: String,
|
||||
pub fields: Vec<(String, String)>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct FrbMemoriesUploadUrls {
|
||||
pub media_id: String,
|
||||
pub thumbnail_upload: Option<FrbPresignedPost>,
|
||||
pub full_upload: Option<FrbPresignedPost>,
|
||||
}
|
||||
|
||||
/// Flutter-facing facade for the Rust-owned API runtime.
|
||||
pub struct RustApi {}
|
||||
|
||||
|
|
@ -188,12 +231,16 @@ impl RustApi {
|
|||
.and_then(api_result)
|
||||
}
|
||||
|
||||
pub async fn get_user_by_id(user_id: i64) -> Result<Vec<u8>> {
|
||||
pub async fn get_user_by_id(user_id: i64) -> Result<FrbUserData> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::get_user_by_id(ctx, user_id)
|
||||
let res = Server::get_user_by_id(ctx, user_id)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
.and_then(api_result)?;
|
||||
Ok(FrbUserData {
|
||||
user_id: res.user_id,
|
||||
username: res.username.unwrap_or_default(),
|
||||
public_identity_key: res.public_identity_key.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
pub async fn check_for_deleted_usernames() -> Result<()> {
|
||||
let ctx = Context::get_static()?;
|
||||
|
|
@ -205,19 +252,24 @@ impl RustApi {
|
|||
.await
|
||||
.and_then(api_result)
|
||||
}
|
||||
pub async fn get_user_data(username: String) -> Result<Vec<u8>> {
|
||||
pub async fn get_user_data(username: String) -> Result<FrbUserData> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::get_user_by_username(ctx, username)
|
||||
let res = Server::get_user_by_username(ctx, username)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
.and_then(api_result)?;
|
||||
Ok(FrbUserData {
|
||||
user_id: res.user_id,
|
||||
username: res.username.unwrap_or_default(),
|
||||
public_identity_key: res.public_identity_key.unwrap_or_default(),
|
||||
})
|
||||
}
|
||||
pub async fn get_proof_of_work() -> Result<Vec<u8>> {
|
||||
pub async fn get_proof_of_work() -> Result<FrbProofOfWork> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::get_proof_of_work(ctx)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
let res = Server::get_proof_of_work(ctx).await.and_then(api_result)?;
|
||||
Ok(FrbProofOfWork {
|
||||
prefix: res.prefix,
|
||||
difficulty: res.difficulty,
|
||||
})
|
||||
}
|
||||
pub async fn download_done(token: Vec<u8>) -> Result<()> {
|
||||
let ctx = Context::get_static()?;
|
||||
|
|
@ -250,30 +302,43 @@ impl RustApi {
|
|||
.await
|
||||
.and_then(api_result)
|
||||
}
|
||||
|
||||
pub async fn request_memories_upload(
|
||||
size: i64,
|
||||
original_date: i64,
|
||||
media_id: String,
|
||||
) -> Result<Vec<u8>> {
|
||||
) -> Result<FrbMemoriesUploadUrls> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::request_memories_upload(ctx, size, original_date, media_id)
|
||||
let res = Server::request_memories_upload(ctx, size, original_date, media_id)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
.and_then(api_result)?;
|
||||
Ok(FrbMemoriesUploadUrls {
|
||||
media_id: res.media_id,
|
||||
thumbnail_upload: res.thumbnail_upload.map(|p| FrbPresignedPost {
|
||||
url: p.url,
|
||||
fields: p.fields.into_iter().collect(),
|
||||
}),
|
||||
full_upload: res.full_upload.map(|p| FrbPresignedPost {
|
||||
url: p.url,
|
||||
fields: p.fields.into_iter().collect(),
|
||||
}),
|
||||
})
|
||||
}
|
||||
pub async fn get_memories_usage() -> Result<Vec<u8>> {
|
||||
pub async fn get_memories_usage() -> Result<FrbMemoriesUsage> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::get_memories_usage(ctx)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
let res = Server::get_memories_usage(ctx).await.and_then(api_result)?;
|
||||
Ok(FrbMemoriesUsage {
|
||||
current_bytes: res.current_bytes,
|
||||
count: res.count,
|
||||
max_bytes: res.max_bytes,
|
||||
})
|
||||
}
|
||||
pub async fn get_memories_url(media_id: String, thumbnail: bool) -> Result<Vec<u8>> {
|
||||
pub async fn get_memories_url(media_id: String, thumbnail: bool) -> Result<String> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::get_memories_url(ctx, media_id, thumbnail)
|
||||
let res = Server::get_memories_url(ctx, media_id, thumbnail)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
.and_then(api_result)?;
|
||||
Ok(res.full_download_url)
|
||||
}
|
||||
pub async fn confirm_memories_upload(media_id: String) -> Result<()> {
|
||||
let ctx = Context::get_static()?;
|
||||
|
|
@ -293,19 +358,30 @@ impl RustApi {
|
|||
.await
|
||||
.and_then(api_result)
|
||||
}
|
||||
pub async fn get_plan_balance() -> Result<Vec<u8>> {
|
||||
pub async fn get_plan_balance() -> Result<FrbPlanBalance> {
|
||||
let ctx = Context::get_static()?;
|
||||
encoded_api_response(Server::get_plan_balance(ctx).await?, |value| match value {
|
||||
ResponseOk::Planballance(balance) => Some(balance),
|
||||
_ => None,
|
||||
let res = Server::get_plan_balance_model(ctx)
|
||||
.await
|
||||
.and_then(api_result)?;
|
||||
Ok(FrbPlanBalance {
|
||||
used_daily_media_upload_limit: res.used_daily_media_upload_limit,
|
||||
used_upload_media_size_limit: res.used_upload_media_size_limit,
|
||||
payment_period_days: res.payment_period_days,
|
||||
last_payment_done_unix_timestamp: res.last_payment_done_unix_timestamp,
|
||||
additional_accounts: res
|
||||
.additional_accounts
|
||||
.into_iter()
|
||||
.map(|a| FrbAdditionalAccount {
|
||||
user_id: a.user_id,
|
||||
plan_id: a.plan_id,
|
||||
})
|
||||
.collect(),
|
||||
auto_renewal: res.auto_renewal,
|
||||
additional_account_owner_id: res.additional_account_owner_id,
|
||||
})
|
||||
}
|
||||
pub async fn load_plan_balance() -> Result<Vec<u8>> {
|
||||
let ctx = Context::get_static()?;
|
||||
encoded_api_response(Server::load_plan_balance(ctx).await?, |value| match value {
|
||||
ResponseOk::Planballance(balance) => Some(balance),
|
||||
_ => None,
|
||||
})
|
||||
pub async fn load_plan_balance() -> Result<FrbPlanBalance> {
|
||||
Self::get_plan_balance().await
|
||||
}
|
||||
pub async fn remove_additional_user(user_id: i64) -> Result<()> {
|
||||
let ctx = Context::get_static()?;
|
||||
|
|
@ -377,22 +453,31 @@ impl RustApi {
|
|||
.await
|
||||
.and_then(api_result)
|
||||
}
|
||||
|
||||
pub async fn check_for_passwordless_notification(
|
||||
notification_id: String,
|
||||
download_auth_token: Vec<u8>,
|
||||
already_received_message_ids: Vec<i64>,
|
||||
) -> Result<Vec<u8>> {
|
||||
) -> Result<Vec<FrbPasswordlessNotificationMessage>> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::check_for_passwordless_notification(
|
||||
let res = Server::check_for_passwordless_notification(
|
||||
ctx,
|
||||
notification_id,
|
||||
download_auth_token,
|
||||
already_received_message_ids,
|
||||
)
|
||||
.await
|
||||
.and_then(api_result)
|
||||
.map(|value| value.encode_to_vec())
|
||||
.and_then(api_result)?;
|
||||
Ok(res
|
||||
.messages
|
||||
.into_iter()
|
||||
.map(|msg| FrbPasswordlessNotificationMessage {
|
||||
id: msg.id,
|
||||
encrypted_message: msg.encrypted_message,
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
pub async fn report_user(user_id: i64, reason: String) -> Result<()> {
|
||||
let ctx = Context::get_static()?;
|
||||
Server::report_user(ctx, user_id, reason)
|
||||
|
|
|
|||
|
|
@ -4553,6 +4553,83 @@ impl SseDecode for crate::bridge::wrapper::user_discovery::FlutterUserDiscovery
|
|||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbAdditionalAccount {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_userId = <i64>::sse_decode(deserializer);
|
||||
let mut var_planId = <String>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbAdditionalAccount {
|
||||
user_id: var_userId,
|
||||
plan_id: var_planId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbMemoriesUploadUrls {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_mediaId = <String>::sse_decode(deserializer);
|
||||
let mut var_thumbnailUpload =
|
||||
<Option<crate::bridge::api::FrbPresignedPost>>::sse_decode(deserializer);
|
||||
let mut var_fullUpload =
|
||||
<Option<crate::bridge::api::FrbPresignedPost>>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbMemoriesUploadUrls {
|
||||
media_id: var_mediaId,
|
||||
thumbnail_upload: var_thumbnailUpload,
|
||||
full_upload: var_fullUpload,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbMemoriesUsage {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_currentBytes = <i64>::sse_decode(deserializer);
|
||||
let mut var_count = <i64>::sse_decode(deserializer);
|
||||
let mut var_maxBytes = <i64>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbMemoriesUsage {
|
||||
current_bytes: var_currentBytes,
|
||||
count: var_count,
|
||||
max_bytes: var_maxBytes,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbPasswordlessNotificationMessage {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_id = <i64>::sse_decode(deserializer);
|
||||
let mut var_encryptedMessage = <Vec<u8>>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbPasswordlessNotificationMessage {
|
||||
id: var_id,
|
||||
encrypted_message: var_encryptedMessage,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbPlanBalance {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_usedDailyMediaUploadLimit = <i64>::sse_decode(deserializer);
|
||||
let mut var_usedUploadMediaSizeLimit = <i64>::sse_decode(deserializer);
|
||||
let mut var_paymentPeriodDays = <Option<i64>>::sse_decode(deserializer);
|
||||
let mut var_lastPaymentDoneUnixTimestamp = <Option<i64>>::sse_decode(deserializer);
|
||||
let mut var_additionalAccounts =
|
||||
<Vec<crate::bridge::api::FrbAdditionalAccount>>::sse_decode(deserializer);
|
||||
let mut var_autoRenewal = <Option<bool>>::sse_decode(deserializer);
|
||||
let mut var_additionalAccountOwnerId = <Option<i64>>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbPlanBalance {
|
||||
used_daily_media_upload_limit: var_usedDailyMediaUploadLimit,
|
||||
used_upload_media_size_limit: var_usedUploadMediaSizeLimit,
|
||||
payment_period_days: var_paymentPeriodDays,
|
||||
last_payment_done_unix_timestamp: var_lastPaymentDoneUnixTimestamp,
|
||||
additional_accounts: var_additionalAccounts,
|
||||
auto_renewal: var_autoRenewal,
|
||||
additional_account_owner_id: var_additionalAccountOwnerId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::signal::engine::FrbPqcPreKey {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
|
|
@ -4601,6 +4678,44 @@ impl SseDecode for crate::signal::engine::FrbPreKeyBundle {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbPresignedPost {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_url = <String>::sse_decode(deserializer);
|
||||
let mut var_fields = <Vec<(String, String)>>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbPresignedPost {
|
||||
url: var_url,
|
||||
fields: var_fields,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbProofOfWork {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_prefix = <String>::sse_decode(deserializer);
|
||||
let mut var_difficulty = <i64>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbProofOfWork {
|
||||
prefix: var_prefix,
|
||||
difficulty: var_difficulty,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for crate::bridge::api::FrbUserData {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut var_userId = <i64>::sse_decode(deserializer);
|
||||
let mut var_username = <Vec<u8>>::sse_decode(deserializer);
|
||||
let mut var_publicIdentityKey = <Vec<u8>>::sse_decode(deserializer);
|
||||
return crate::bridge::api::FrbUserData {
|
||||
user_id: var_userId,
|
||||
username: var_username,
|
||||
public_identity_key: var_publicIdentityKey,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for i32 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
|
|
@ -4687,6 +4802,34 @@ impl SseDecode for Vec<String> {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Vec<crate::bridge::api::FrbAdditionalAccount> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut len_ = <i32>::sse_decode(deserializer);
|
||||
let mut ans_ = Vec::with_capacity(len_ as usize);
|
||||
for idx_ in 0..len_ {
|
||||
ans_.push(<crate::bridge::api::FrbAdditionalAccount>::sse_decode(
|
||||
deserializer,
|
||||
));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Vec<crate::bridge::api::FrbPasswordlessNotificationMessage> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut len_ = <i32>::sse_decode(deserializer);
|
||||
let mut ans_ = Vec::with_capacity(len_ as usize);
|
||||
for idx_ in 0..len_ {
|
||||
ans_.push(
|
||||
<crate::bridge::api::FrbPasswordlessNotificationMessage>::sse_decode(deserializer),
|
||||
);
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Vec<crate::signal::engine::FrbPqcPreKey> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
|
|
@ -4779,6 +4922,18 @@ impl SseDecode for Vec<(String, Vec<String>)> {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Vec<(String, String)> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
let mut len_ = <i32>::sse_decode(deserializer);
|
||||
let mut ans_ = Vec::with_capacity(len_ as usize);
|
||||
for idx_ in 0..len_ {
|
||||
ans_.push(<(String, String)>::sse_decode(deserializer));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Vec<crate::database::app::SqlRow> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
|
|
@ -4873,6 +5028,19 @@ impl SseDecode for Option<f64> {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Option<crate::bridge::api::FrbPresignedPost> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
if (<bool>::sse_decode(deserializer)) {
|
||||
return Some(<crate::bridge::api::FrbPresignedPost>::sse_decode(
|
||||
deserializer,
|
||||
));
|
||||
} else {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseDecode for Option<i64> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
|
||||
|
|
@ -5606,6 +5774,126 @@ impl flutter_rust_bridge::IntoIntoDart<crate::bridge::wrapper::user_discovery::F
|
|||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbAdditionalAccount {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.user_id.into_into_dart().into_dart(),
|
||||
self.plan_id.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbAdditionalAccount
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbAdditionalAccount>
|
||||
for crate::bridge::api::FrbAdditionalAccount
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbAdditionalAccount {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbMemoriesUploadUrls {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.media_id.into_into_dart().into_dart(),
|
||||
self.thumbnail_upload.into_into_dart().into_dart(),
|
||||
self.full_upload.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbMemoriesUploadUrls
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbMemoriesUploadUrls>
|
||||
for crate::bridge::api::FrbMemoriesUploadUrls
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbMemoriesUploadUrls {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbMemoriesUsage {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.current_bytes.into_into_dart().into_dart(),
|
||||
self.count.into_into_dart().into_dart(),
|
||||
self.max_bytes.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbMemoriesUsage
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbMemoriesUsage>
|
||||
for crate::bridge::api::FrbMemoriesUsage
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbMemoriesUsage {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbPasswordlessNotificationMessage {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.id.into_into_dart().into_dart(),
|
||||
self.encrypted_message.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbPasswordlessNotificationMessage
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbPasswordlessNotificationMessage>
|
||||
for crate::bridge::api::FrbPasswordlessNotificationMessage
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbPasswordlessNotificationMessage {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbPlanBalance {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.used_daily_media_upload_limit
|
||||
.into_into_dart()
|
||||
.into_dart(),
|
||||
self.used_upload_media_size_limit
|
||||
.into_into_dart()
|
||||
.into_dart(),
|
||||
self.payment_period_days.into_into_dart().into_dart(),
|
||||
self.last_payment_done_unix_timestamp
|
||||
.into_into_dart()
|
||||
.into_dart(),
|
||||
self.additional_accounts.into_into_dart().into_dart(),
|
||||
self.auto_renewal.into_into_dart().into_dart(),
|
||||
self.additional_account_owner_id
|
||||
.into_into_dart()
|
||||
.into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbPlanBalance
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbPlanBalance>
|
||||
for crate::bridge::api::FrbPlanBalance
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbPlanBalance {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::signal::engine::FrbPqcPreKey {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
|
|
@ -5660,6 +5948,70 @@ impl flutter_rust_bridge::IntoIntoDart<crate::signal::engine::FrbPreKeyBundle>
|
|||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbPresignedPost {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.url.into_into_dart().into_dart(),
|
||||
self.fields.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbPresignedPost
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbPresignedPost>
|
||||
for crate::bridge::api::FrbPresignedPost
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbPresignedPost {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbProofOfWork {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.prefix.into_into_dart().into_dart(),
|
||||
self.difficulty.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbProofOfWork
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbProofOfWork>
|
||||
for crate::bridge::api::FrbProofOfWork
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbProofOfWork {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::api::FrbUserData {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
self.user_id.into_into_dart().into_dart(),
|
||||
self.username.into_into_dart().into_dart(),
|
||||
self.public_identity_key.into_into_dart().into_dart(),
|
||||
]
|
||||
.into_dart()
|
||||
}
|
||||
}
|
||||
impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive
|
||||
for crate::bridge::api::FrbUserData
|
||||
{
|
||||
}
|
||||
impl flutter_rust_bridge::IntoIntoDart<crate::bridge::api::FrbUserData>
|
||||
for crate::bridge::api::FrbUserData
|
||||
{
|
||||
fn into_into_dart(self) -> crate::bridge::api::FrbUserData {
|
||||
self
|
||||
}
|
||||
}
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
impl flutter_rust_bridge::IntoDart for crate::bridge::InitConfig {
|
||||
fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi {
|
||||
[
|
||||
|
|
@ -6304,6 +6656,59 @@ impl SseEncode for crate::bridge::wrapper::user_discovery::FlutterUserDiscovery
|
|||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbAdditionalAccount {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i64>::sse_encode(self.user_id, serializer);
|
||||
<String>::sse_encode(self.plan_id, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbMemoriesUploadUrls {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<String>::sse_encode(self.media_id, serializer);
|
||||
<Option<crate::bridge::api::FrbPresignedPost>>::sse_encode(
|
||||
self.thumbnail_upload,
|
||||
serializer,
|
||||
);
|
||||
<Option<crate::bridge::api::FrbPresignedPost>>::sse_encode(self.full_upload, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbMemoriesUsage {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i64>::sse_encode(self.current_bytes, serializer);
|
||||
<i64>::sse_encode(self.count, serializer);
|
||||
<i64>::sse_encode(self.max_bytes, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbPasswordlessNotificationMessage {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i64>::sse_encode(self.id, serializer);
|
||||
<Vec<u8>>::sse_encode(self.encrypted_message, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbPlanBalance {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i64>::sse_encode(self.used_daily_media_upload_limit, serializer);
|
||||
<i64>::sse_encode(self.used_upload_media_size_limit, serializer);
|
||||
<Option<i64>>::sse_encode(self.payment_period_days, serializer);
|
||||
<Option<i64>>::sse_encode(self.last_payment_done_unix_timestamp, serializer);
|
||||
<Vec<crate::bridge::api::FrbAdditionalAccount>>::sse_encode(
|
||||
self.additional_accounts,
|
||||
serializer,
|
||||
);
|
||||
<Option<bool>>::sse_encode(self.auto_renewal, serializer);
|
||||
<Option<i64>>::sse_encode(self.additional_account_owner_id, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::signal::engine::FrbPqcPreKey {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
|
|
@ -6332,6 +6737,31 @@ impl SseEncode for crate::signal::engine::FrbPreKeyBundle {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbPresignedPost {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<String>::sse_encode(self.url, serializer);
|
||||
<Vec<(String, String)>>::sse_encode(self.fields, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbProofOfWork {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<String>::sse_encode(self.prefix, serializer);
|
||||
<i64>::sse_encode(self.difficulty, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for crate::bridge::api::FrbUserData {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i64>::sse_encode(self.user_id, serializer);
|
||||
<Vec<u8>>::sse_encode(self.username, serializer);
|
||||
<Vec<u8>>::sse_encode(self.public_identity_key, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for i32 {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
|
|
@ -6411,6 +6841,26 @@ impl SseEncode for Vec<String> {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Vec<crate::bridge::api::FrbAdditionalAccount> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i32>::sse_encode(self.len() as _, serializer);
|
||||
for item in self {
|
||||
<crate::bridge::api::FrbAdditionalAccount>::sse_encode(item, serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Vec<crate::bridge::api::FrbPasswordlessNotificationMessage> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i32>::sse_encode(self.len() as _, serializer);
|
||||
for item in self {
|
||||
<crate::bridge::api::FrbPasswordlessNotificationMessage>::sse_encode(item, serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Vec<crate::signal::engine::FrbPqcPreKey> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
|
|
@ -6483,6 +6933,16 @@ impl SseEncode for Vec<(String, Vec<String>)> {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Vec<(String, String)> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<i32>::sse_encode(self.len() as _, serializer);
|
||||
for item in self {
|
||||
<(String, String)>::sse_encode(item, serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Vec<crate::database::app::SqlRow> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
|
|
@ -6563,6 +7023,16 @@ impl SseEncode for Option<f64> {
|
|||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Option<crate::bridge::api::FrbPresignedPost> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
<bool>::sse_encode(self.is_some(), serializer);
|
||||
if let Some(value) = self {
|
||||
<crate::bridge::api::FrbPresignedPost>::sse_encode(value, serializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl SseEncode for Option<i64> {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ import 'dart:io';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:drift/drift.dart' hide isNotNull, isNull;
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:twonly/core/bridge/api.dart';
|
||||
import 'package:twonly/src/database/tables/messages.table.dart';
|
||||
import 'package:twonly/src/database/twonly.db.dart';
|
||||
import 'package:twonly/src/model/protobuf/client/generated/messages.pb.dart'
|
||||
as pb;
|
||||
import 'package:twonly/src/services/api/api.service.dart';
|
||||
import 'package:twonly/src/services/api/rust_api_result.dart';
|
||||
import 'package:twonly/src/services/user.service.dart';
|
||||
import 'package:twonly/src/utils/log.dart';
|
||||
import 'package:twonly/src/utils/pow.dart';
|
||||
|
|
@ -50,19 +50,18 @@ class TestClient {
|
|||
|
||||
await run(() async {
|
||||
Log.info('Requesting POW...');
|
||||
final dynamic pow;
|
||||
final FrbProofOfWork pow;
|
||||
try {
|
||||
final raw = await RustApi.getProofOfWork();
|
||||
pow = decodeProofOfWork(raw);
|
||||
pow = await RustApi.getProofOfWork();
|
||||
} catch (e, st) {
|
||||
print('POW EXCEPTION: $e\n$st');
|
||||
if (kDebugMode) {
|
||||
print('POW EXCEPTION: $e\n$st');
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
Log.info('POW result: $pow');
|
||||
|
||||
final prefix = pow.prefix;
|
||||
final difficulty = pow.difficulty.toInt();
|
||||
final proof = await calculatePoW(prefix, difficulty);
|
||||
final proof = await calculatePoW(pow.prefix, pow.difficulty);
|
||||
|
||||
realUserId = await RustApi.register(
|
||||
username: username,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import 'package:drift/native.dart';
|
|||
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:twonly/core/bridge.dart' as bridge;
|
||||
import 'package:twonly/core/bridge/wrapper/signal.dart';
|
||||
import 'package:twonly/core/frb_generated.dart';
|
||||
import 'package:twonly/globals.dart';
|
||||
import 'package:twonly/locator.dart';
|
||||
|
|
@ -99,15 +98,6 @@ void main() {
|
|||
}
|
||||
});
|
||||
|
||||
Future<void> setupSignalSession(int contactId) async {
|
||||
final bundle = await RustSignal.generateBundle();
|
||||
await RustSignal.processPrekeyBundle(
|
||||
name: contactId.toString(),
|
||||
deviceId: 1,
|
||||
bundle: bundle,
|
||||
);
|
||||
}
|
||||
|
||||
group('PasswordlessRecoveryService - enablePasswordlessRecovery', () {
|
||||
test('works with SecondFactorType.none', () async {
|
||||
await twonlyDB.contactsDao.insertOnConflictUpdate(
|
||||
|
|
|
|||
Loading…
Reference in a new issue