Skip to content

Commit

Permalink
add basic localization, chunk picture across subkeys, house keeping
Browse files Browse the repository at this point in the history
  • Loading branch information
LGro committed Feb 20, 2025
1 parent 48ab17c commit 07d92ba
Show file tree
Hide file tree
Showing 40 changed files with 1,054 additions and 1,197 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
ndkVersion "26.3.11579264"
ndkVersion "27.0.12077973"
compileSdkVersion flutter.compileSdkVersion

compileOptions {
Expand Down
8 changes: 0 additions & 8 deletions build.bat

This file was deleted.

9 changes: 0 additions & 9 deletions build.sh

This file was deleted.

16 changes: 0 additions & 16 deletions dev-setup/_script_common

This file was deleted.

37 changes: 0 additions & 37 deletions dev-setup/install_protoc_linux.sh

This file was deleted.

41 changes: 0 additions & 41 deletions dev-setup/setup_linux.sh

This file was deleted.

46 changes: 0 additions & 46 deletions dev-setup/setup_macos.sh

This file was deleted.

26 changes: 0 additions & 26 deletions dev-setup/setup_windows.bat

This file was deleted.

25 changes: 0 additions & 25 deletions dev-setup/wasm_update.sh

This file was deleted.

8 changes: 8 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
801101F42B93304700425284 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
803CB26B2C5A0EE5001E3F56 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
8088CDB82D67801400E22B07 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
8088CDB92D67801400E22B07 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -177,6 +179,7 @@
knownRegions = (
en,
Base,
de,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
Expand Down Expand Up @@ -310,6 +313,7 @@
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
8088CDB82D67801400E22B07 /* de */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand All @@ -318,6 +322,7 @@
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
8088CDB92D67801400E22B07 /* de */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
Expand All @@ -329,6 +334,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -406,6 +412,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down Expand Up @@ -461,6 +468,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand Down
1 change: 1 addition & 0 deletions ios/Runner/de.lproj/LaunchScreen.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions ios/Runner/de.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
23 changes: 13 additions & 10 deletions lib/data/models/coag_contact.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2024 The Coagulate Authors. All rights reserved.
// SPDX-License-Identifier: MPL-2.0

import 'dart:convert';
import 'dart:typed_data';

import 'package:equatable/equatable.dart';
Expand Down Expand Up @@ -116,7 +117,7 @@ class ContactDHTSettings extends Equatable {
@JsonSerializable()
class ContactDetails extends Equatable {
const ContactDetails({
this.avatar,
this.picture,
this.publicKey,
this.names = const {},
this.phones = const [],
Expand All @@ -130,7 +131,7 @@ class ContactDetails extends Equatable {

// TODO: Can it backfire if we drop all names but the display name?
ContactDetails.fromSystemContact(Contact c)
: avatar = c.photo?.toList(),
: picture = c.photo?.toList(),
names = {'0': c.displayName},
publicKey = null,
phones = c.phones,
Expand All @@ -143,7 +144,7 @@ class ContactDetails extends Equatable {

Contact toSystemContact(String displayName) => Contact(
displayName: displayName,
photo: (avatar == null) ? null : Uint8List.fromList(avatar!),
photo: (picture == null) ? null : Uint8List.fromList(picture!),
phones: phones,
emails: emails,
addresses: addresses,
Expand All @@ -156,7 +157,7 @@ class ContactDetails extends Equatable {
_$ContactDetailsFromJson(json);

/// Binary integer representation of an image
final List<int>? avatar;
final List<int>? picture;

/// Public key for encrypting data
final String? publicKey;
Expand Down Expand Up @@ -188,7 +189,7 @@ class ContactDetails extends Equatable {
Map<String, dynamic> toJson() => _$ContactDetailsToJson(this);

ContactDetails copyWith(
{List<int>? avatar,
{List<int>? picture,
String? publicKey,
Map<String, String>? names,
List<Phone>? phones,
Expand All @@ -199,7 +200,7 @@ class ContactDetails extends Equatable {
List<SocialMedia>? socialMedias,
List<Event>? events}) =>
ContactDetails(
avatar: avatar ?? this.avatar,
picture: picture ?? this.picture,
publicKey: publicKey ?? this.publicKey,
names: names ?? this.names,
phones: phones ?? this.phones,
Expand All @@ -213,7 +214,7 @@ class ContactDetails extends Equatable {

@override
List<Object?> get props => [
avatar,
picture,
publicKey,
names,
phones,
Expand Down Expand Up @@ -310,9 +311,8 @@ class CoagContact extends Equatable {
/// Cryptographic keys and DHT record info for sharing with this contact
final DhtSettings dhtSettings;

// TODO: Make this a proper type with toJson?
/// Personalized selection of profile info that is shared with this contact
final String? sharedProfile;
final CoagContactDHTSchema? sharedProfile;

// TODO: Move these two to contact details to also have the same for the system contact
final DateTime? mostRecentUpdate;
Expand Down Expand Up @@ -356,7 +356,7 @@ class CoagContact extends Equatable {
Map<int, ContactAddressLocation>? addressLocations,
List<ContactTemporaryLocation>? temporaryLocations,
DhtSettings? dhtSettings,
String? sharedProfile,
CoagContactDHTSchema? sharedProfile,
DateTime? mostRecentUpdate,
DateTime? mostRecentChange,
}) =>
Expand Down Expand Up @@ -481,6 +481,9 @@ class CoagContactDHTSchemaV2 extends Equatable {

Map<String, dynamic> toJson() => _$CoagContactDHTSchemaV2ToJson(this);

String toJsonStringWithoutPicture() =>
jsonEncode(copyWith(details: details.copyWith(picture: [])).toJson());

CoagContactDHTSchemaV2 copyWith({
ContactDetails? details,
String? shareBackDHTKey,
Expand Down
Loading

0 comments on commit 07d92ba

Please sign in to comment.