Compare commits
134 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 469259f469 | |||
| 9dcd75fe54 | |||
| adffc4f6f8 | |||
| 7633338359 | |||
| 2f4d239e2b | |||
| c6ff66ba51 | |||
| ca65424653 | |||
| 6e48933a8f | |||
| df50a6d608 | |||
| b3abc39059 | |||
| 61fc7019b2 | |||
| b8d6c0b481 | |||
| 8675f816de | |||
| c9af561868 | |||
| db10790ecd | |||
| 09f389d6de | |||
| 6cf044d7c9 | |||
| d41679f2c0 | |||
| 2bfb2ae58f | |||
| ca56ca2dd1 | |||
| ca35a0635b | |||
| 127f29a17e | |||
| 21eab6dfe9 | |||
| d8ea2ad273 | |||
| a66b4d8923 | |||
| 3c9a289e2d | |||
| 29daa1ee89 | |||
| 769a07449f | |||
| 0993745c33 | |||
| 2218ae91e0 | |||
| 21a8ba9674 | |||
| 153fe5f1e7 | |||
| ec49ac8eb6 | |||
| 0a7b9e7ea2 | |||
| 718bf0d74b | |||
| 82c963c38f | |||
| 999a33e77c | |||
| f9eb55170d | |||
| 2bb104a234 | |||
| b75b29cf08 | |||
| 9a6abed1e4 | |||
| baf5f97e96 | |||
| 3426d9cb37 | |||
| 53f401caf5 | |||
| 4950d0be55 | |||
| 57ac9d6b91 | |||
| 8723adbfcd | |||
| 8c5038c20f | |||
| 6518c22b79 | |||
| 0027e2c93b | |||
| 0b8eaad68a | |||
| 16738f053a | |||
| bed9a4d8d4 | |||
| 1ee3d40f37 | |||
| 1c6e9fc391 | |||
| 31c8e8d46b | |||
| ff6e0d9fbf | |||
| a92ccd6d43 | |||
| 32bdce147a | |||
| 1e6d1ed917 | |||
| 0f9e378923 | |||
| 5aaa11a445 | |||
| e77f266da5 | |||
| dc1be8e07b | |||
| d9daae7f41 | |||
| b30ae06dde | |||
| 488ba08e05 | |||
| 7a1db99daa | |||
| 8450349e19 | |||
| 50a6389b75 | |||
| aa4b65dbb0 | |||
| 96154422c1 | |||
| bc82f56353 | |||
| 1d9c9bb1b6 | |||
| 037a468332 | |||
| df41fa7cba | |||
| a48f595cf7 | |||
| f221321e6c | |||
| bf9842e414 | |||
| 0ee54460ba | |||
| 83a6fc531a | |||
| 8989737c71 | |||
| 56f89af121 | |||
| 97ee01eac1 | |||
| 8c7e430d4d | |||
| 2b36b69251 | |||
| acf8f10f76 | |||
| e5b890a765 | |||
| 3da97acdfd | |||
| 75fc7c48e9 | |||
| 7bdefeab37 | |||
| f71097f2d2 | |||
| 90e2229543 | |||
| e8e9987eb3 | |||
| 68b5383dc4 | |||
| 5ab215489a | |||
| 8f401e2a09 | |||
| 572932e92d | |||
| f924a407b3 | |||
| adcbf118b6 | |||
| 0e185eff4c | |||
| ad5df50eb9 | |||
| 22921e72e9 | |||
| 199881e3b2 | |||
| 12ec74e835 | |||
| 42d0a40f58 | |||
| 68e8b64b47 | |||
| a06f77b5f8 | |||
| b809fc007b | |||
| 334893071b | |||
| 306064e260 | |||
| 85f679c69f | |||
| f23e3d4e22 | |||
| 59d4c8fbd8 | |||
| 5f33c8a56d | |||
| 45ba604820 | |||
| 780df4df46 | |||
| 01ac637142 | |||
| 147de536f7 | |||
| 9f0596de0a | |||
| 750fbaa6cc | |||
| c623343b04 | |||
| b216274b37 | |||
| 843e813593 | |||
| 9eb0608c89 | |||
| 560a993972 | |||
| 8701c72d43 | |||
| 454f8a4628 | |||
| 03cc658e7e | |||
| e12081642d | |||
| 9cbdd8d553 | |||
| 65b1d93c70 | |||
| 085eace0cf | |||
| 552f6e2975 |
@@ -0,0 +1,175 @@
|
||||
# GitHub Copilot Instructions for ArcaneChat Android
|
||||
|
||||
## Project Overview
|
||||
|
||||
ArcaneChat is a Delta Chat Android client built on top of the official Delta Chat client with several improvements. It is a messenger app that uses email infrastructure for secure communication.
|
||||
|
||||
**Technology Stack:**
|
||||
- **Language:** Java (Java 8 compatibility)
|
||||
- **Build System:** Gradle with Android Gradle Plugin 8.11.1
|
||||
- **Min SDK:** 21 (Android 5.0)
|
||||
- **Target SDK:** 35 (Android 15)
|
||||
- **NDK Version:** 27.0.12077973
|
||||
- **Native Components:** Rust (deltachat-core-rust submodule)
|
||||
- **UI Framework:** Android SDK, Material Design Components
|
||||
- **Testing:** JUnit 4, Espresso, Mockito, PowerMock, AssertJ
|
||||
|
||||
## Repository Structure
|
||||
|
||||
- `src/main/` - Main application source code
|
||||
- `src/androidTest/` - Instrumented tests (UI tests, benchmarks)
|
||||
- `src/gplay/` - Google Play flavor-specific code
|
||||
- `src/foss/` - F-Droid/FOSS flavor-specific code
|
||||
- `jni/deltachat-core-rust/` - Native Rust core library (submodule)
|
||||
- `scripts/` - Build and helper scripts
|
||||
- `docs/` - Documentation
|
||||
- `fastlane/` - App store metadata and screenshots
|
||||
|
||||
## Build Instructions
|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. **Initialize submodules:**
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
2. **Build native libraries:**
|
||||
```bash
|
||||
scripts/ndk-make.sh
|
||||
```
|
||||
Note: First run may take significant time as it builds for all architectures (armeabi-v7a, arm64-v8a, x86, x86_64)
|
||||
|
||||
3. **Build APK:**
|
||||
```bash
|
||||
./gradlew assembleDebug
|
||||
```
|
||||
|
||||
### Build Flavors
|
||||
|
||||
- **gplay:** Google Play version with Firebase Cloud Messaging (applicationId: `com.github.arcanechat`)
|
||||
- **foss:** F-Droid version without proprietary services (applicationId: `chat.delta.lite`)
|
||||
|
||||
### Build Outputs
|
||||
|
||||
- Debug APKs: `build/outputs/apk/gplay/debug/` and `build/outputs/apk/fat/debug/`
|
||||
- Release APKs require signing configuration in `~/.gradle/gradle.properties`
|
||||
|
||||
## Testing
|
||||
|
||||
### Running Unit Tests
|
||||
|
||||
```bash
|
||||
./gradlew test
|
||||
```
|
||||
|
||||
### Running Instrumented Tests
|
||||
|
||||
1. **Disable animations** on your device/emulator:
|
||||
- Developer Options → Set "Window animation scale", "Transition animation scale", and "Animator duration scale" to 0x
|
||||
|
||||
2. **Run tests:**
|
||||
```bash
|
||||
./gradlew connectedAndroidTest
|
||||
```
|
||||
|
||||
### Online Tests
|
||||
|
||||
Some tests require real email credentials. Configure in `~/.gradle/gradle.properties`:
|
||||
```properties
|
||||
TEST_ADDR=youraccount@yourdomain.org
|
||||
TEST_MAIL_PW=yourpassword
|
||||
```
|
||||
|
||||
### UI Tests and Benchmarks
|
||||
|
||||
- Located in `src/androidTest/java/com/b44t/messenger/`
|
||||
- Test categories: `uitests/online/`, `uitests/offline/`, `uibenchmarks/`
|
||||
- Run via Android Studio: Run → Edit Configurations → Android Instrumented Test
|
||||
|
||||
## Coding Conventions
|
||||
|
||||
### General Guidelines
|
||||
|
||||
1. **Embrace existing style:** Match the coding style of the file you're editing
|
||||
2. **Minimize changes:** Don't refactor or rename in the same PR as bug fixes/features
|
||||
3. **Readable over paradigmatic:** Favor readability over strict Java patterns
|
||||
4. **Avoid premature optimization:** Keep things simple and on point
|
||||
5. **No excessive abstraction:** Avoid unnecessary factories, one-liner functions, or abstraction layers
|
||||
6. **Comments:** Only add comments if they match existing style or explain complex logic
|
||||
|
||||
### Architecture
|
||||
|
||||
- **UI/Model Separation:** Delta Chat Core (Rust) handles the model layer
|
||||
- **High-level interface:** Core provides data in UI-ready form; avoid additional transformations in UI layer
|
||||
- **Direct approach:** Prefer direct implementation over excessive class hierarchies
|
||||
|
||||
### Key Principles
|
||||
|
||||
- Work hard to avoid options and up-front choices
|
||||
- Avoid speaking about keys/encryption in primary UI
|
||||
- App must work offline and with poor network
|
||||
- Users don't read much text
|
||||
- Consistency matters
|
||||
- Primary UI should only show highly useful features
|
||||
|
||||
## Common Development Tasks
|
||||
|
||||
### Adding New Features
|
||||
|
||||
1. Consider the UX philosophy (minimal options, offline-first, simplicity)
|
||||
2. Check if core library changes are needed before implementing in UI
|
||||
3. Match existing code style in modified files
|
||||
4. Add instrumented tests for UI changes when appropriate
|
||||
5. Update relevant documentation
|
||||
|
||||
### Modifying Core Integration
|
||||
|
||||
- Core library is in `jni/deltachat-core-rust/` submodule
|
||||
- Java bindings are in `src/main/java/com/b44t/messenger/Dc*.java`
|
||||
- JSON-RPC bindings in `chat.delta.rpc.*` package (generated via dcrpcgen)
|
||||
|
||||
### Working with Translations
|
||||
|
||||
- Translations managed via Transifex (not in repository)
|
||||
- English source strings: `res/values/strings.xml`
|
||||
- Don't mix string changes with refactoring
|
||||
|
||||
### Debugging Native Code
|
||||
|
||||
Decode crash symbols:
|
||||
```bash
|
||||
$ANDROID_NDK_ROOT/ndk-stack --sym obj/local/armeabi-v7a --dump crash.txt > decoded.txt
|
||||
```
|
||||
|
||||
## WebXDC Support
|
||||
|
||||
ArcaneChat has extended WebXDC support:
|
||||
- `window.webxdc.arcanechat` - Version detection
|
||||
- `sendToChat()` - Extra properties: `subject`, `html`, `type` (sticker/image/audio/video/file)
|
||||
- External link support in apps
|
||||
- `manifest.toml` - `orientation` field for landscape mode
|
||||
|
||||
## Important Files
|
||||
|
||||
- `build.gradle` - Main build configuration
|
||||
- `CONTRIBUTING.md` - Contribution guidelines
|
||||
- `BUILDING.md` - Detailed build setup
|
||||
- `RELEASE.md` - Release process
|
||||
- `proguard-rules.pro` - ProGuard configuration
|
||||
- `google-services.json` - Firebase configuration (gplay flavor)
|
||||
|
||||
## Package Structure
|
||||
|
||||
- `org.thoughtcrime.securesms.*` - Main UI components (legacy namespace from Signal)
|
||||
- `com.b44t.messenger.*` - Delta Chat core integration
|
||||
- `chat.delta.rpc.*` - JSON-RPC bindings (generated)
|
||||
|
||||
## Notes for AI Assistants
|
||||
|
||||
- This is a fork of Delta Chat Android with ArcaneChat-specific improvements
|
||||
- Maintain compatibility with Delta Chat core library
|
||||
- Test on both gplay and foss flavors when making changes
|
||||
- Native library must be rebuilt after core changes
|
||||
- ProGuard is enabled in both debug and release builds
|
||||
- Multi-dex is enabled due to app size
|
||||
@@ -22,24 +22,12 @@ subproject _deltachat-core-rust_:
|
||||
|
||||
## Generate JSON-RPC bindings
|
||||
|
||||
To generate the JSON-RPC bindings (ex. `chat.delta.rpc.*` package)
|
||||
install the [dcrpcgen tool](https://github.com/chatmail/dcrpcgen)
|
||||
then generate the `schema.json` file:
|
||||
To generate/update the JSON-RPC bindings (ex. `chat.delta.rpc.*` package)
|
||||
install Rust tooling (read sections below) and the [dcrpcgen tool](https://github.com/chatmail/dcrpcgen)
|
||||
then generate the code running the script:
|
||||
|
||||
```
|
||||
# install deltachat-rpc-server program:
|
||||
cargo install --path ./jni/deltachat-core-rust/deltachat-rpc-server
|
||||
# check the version of core matches:
|
||||
deltachat-rpc-server --version
|
||||
# generate the schema:
|
||||
deltachat-rpc-server --openrpc > schema.json
|
||||
```
|
||||
|
||||
then pass the schema file to the `dcrpcgen` tool to generate the
|
||||
code:
|
||||
|
||||
```
|
||||
dcrpcgen java --schema schema.json -o ./src/main/java/
|
||||
./scripts/generate-rpc-bindings.sh
|
||||
```
|
||||
|
||||
## Build Using Nix
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# Delta Chat Android Changelog
|
||||
|
||||
## Unreleased
|
||||
|
||||
* Change color of links in text messages
|
||||
* Allow to withdraw channel invite links and QR codes
|
||||
* Allow to open externally links clicked inside in-chat apps
|
||||
* Do not show "1 member" when the process of joining the group is not finished
|
||||
* Improve handling of video recoding
|
||||
* Send .webm videos as file, they are not supported by all platforms
|
||||
* Tweak advanced section and wording of some advanced options
|
||||
* Fix: avoid crash in push notifications handling
|
||||
* Expose new "Multi-device mode" option instead of "Delete from server" for chatmail profiles
|
||||
* Opened in-chat apps got a 'About Apps' menu item
|
||||
* Avoid gray avatar on profile creation
|
||||
* Update to core 2.28.0
|
||||
|
||||
## v2.25.0
|
||||
2025-11
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
## Generate APKs
|
||||
|
||||
### Update core and translations
|
||||
|
||||
on the command-line, in a PR called "update-core-and-stuff-DATE":
|
||||
|
||||
1. update core:
|
||||
@@ -21,12 +23,19 @@ a) Update `CHANGELOG.md`
|
||||
as `update to core 1.2.3` or `using core 1.2.3`
|
||||
|
||||
|
||||
2. update translations and local help:
|
||||
2. update JSON-RPC bindings:
|
||||
```
|
||||
./scripts/update-rpc-bindings.sh
|
||||
```
|
||||
|
||||
3. update translations and local help:
|
||||
```
|
||||
./scripts/tx-pull-translations.sh
|
||||
./scripts/create-local-help.sh # requires deltachat-pages checked out at ../deltachat-pages
|
||||
```
|
||||
|
||||
### Prepare release
|
||||
|
||||
the following steps are done in a PR called `prep-VERSION` (no leading "v"):
|
||||
|
||||
3. Update `CHANGELOG.md`:
|
||||
|
||||
@@ -23,12 +23,11 @@ ArcaneChat is a Delta Chat client and was created with a focus on usability, goo
|
||||
<li>Multiple color themes/skins</li>
|
||||
<li>It is possible to disable profiles to completely disconnect them saving data/bandwidth</li>
|
||||
<li>You can easily see the connection status of all your profiles in the profile switcher</li>
|
||||
<li>A videochat instance is set by default</li>
|
||||
<li>Extra option to share location for 12 hours</li>
|
||||
<li>Clicking on a message with a POI location, will open the POI on the map</li>
|
||||
<li>Last-seen status of contacts is shown in your contact list, like in WhatsApp, Telegram, etc.</li>
|
||||
<li>Videos are played in loop, useful for short GIF videos</li>
|
||||
<li>Verified icon is shown in the chat list for the "Device Messages" chat</li>
|
||||
<li>Verified icon is shown in the chat list for the "Device Messages" and "Saved Messages" chat to avoid fishing attempts by scammer pretending to be the official chats</li>
|
||||
<li>Voice messages have more aggressive compression in "worse quality" mode to save data plan</li>
|
||||
<li>Automatic download of messages limited to 640KB by default</li>
|
||||
<li>Profile's display name is always shown in the app's title bar instead of the name of the app</li>
|
||||
|
||||
@@ -138,11 +138,11 @@
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1756197489,
|
||||
"narHash": "sha256-S16rPaBH1TnMbDyL5NlGSJcYd7wPlOEWTStdBDL7BHw=",
|
||||
"lastModified": 1763347184,
|
||||
"narHash": "sha256-6QH8hpCYJxifvyHEYg+Da0BotUn03BwLIvYo3JAxuqQ=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "8ec04f46f1edeeed3f870da62191745b93975da7",
|
||||
"rev": "08895cce80433978d5bfd668efa41c5e24578cbd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -231,6 +231,12 @@ JNIEXPORT jboolean Java_com_b44t_messenger_DcAccounts_backgroundFetch(JNIEnv *en
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void Java_com_b44t_messenger_DcAccounts_stopBackgroundFetch(JNIEnv *env, jobject obj)
|
||||
{
|
||||
dc_accounts_stop_background_fetch(get_dc_accounts(env, obj));
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT jint Java_com_b44t_messenger_DcAccounts_migrateAccount(JNIEnv *env, jobject obj, jstring dbfile)
|
||||
{
|
||||
CHAR_REF(dbfile);
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.86.0
|
||||
1.91.1
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
# you need to have dcrpcgen
|
||||
|
||||
# generate schema.json
|
||||
ROOT_DIR=$PWD
|
||||
cd ./jni/deltachat-core-rust/deltachat-rpc-server
|
||||
cargo run -- --openrpc > "$ROOT_DIR/schema.json"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
# generate code
|
||||
dcrpcgen java --schema schema.json -o ./src/main/java/
|
||||
@@ -39,6 +39,7 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
|
||||
|
||||
<!-- force compiling emojipicker on sdk<21; runtime checks are required then -->
|
||||
<uses-sdk tools:overrideLibrary="androidx.emoji2.emojipicker"/>
|
||||
@@ -233,7 +234,7 @@
|
||||
android:theme="@style/TextSecure.LightNoActionBar"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>
|
||||
|
||||
<activity android:name=".RegistrationActivity"
|
||||
<activity android:name=".EditTransportActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateUnchanged"
|
||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
|
||||
|
||||
|
After Width: | Height: | Size: 577 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 137 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 148 B |
|
After Width: | Height: | Size: 232 B |
|
After Width: | Height: | Size: 286 B |
@@ -0,0 +1,32 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = Account.Configured.class, name="Configured"), @Type(value = Account.Unconfigured.class, name="Unconfigured")})
|
||||
public abstract class Account {
|
||||
|
||||
public static class Configured extends Account {
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String addr;
|
||||
public String color;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String displayName;
|
||||
public Integer id;
|
||||
/* Optional tag as "Work", "Family". Meant to help profile owner to differ between profiles with similar names. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String privateTag;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String profileImage;
|
||||
}
|
||||
|
||||
public static class Unconfigured extends Account {
|
||||
public Integer id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
/**
|
||||
* cheaper version of fullchat, omits: - contacts - contact_ids - fresh_message_counter - ephemeral_timer - self_in_group - was_seen_recently - can_send
|
||||
* <p>
|
||||
* used when you only need the basic metadata of a chat like type, name, profile picture
|
||||
*/
|
||||
public class BasicChat {
|
||||
public Boolean archived;
|
||||
public ChatType chatType;
|
||||
public String color;
|
||||
public Integer id;
|
||||
public Boolean isContactRequest;
|
||||
public Boolean isDeviceChat;
|
||||
/**
|
||||
* True if the chat is encrypted. This means that all messages in the chat are encrypted, and all contacts in the chat are "key-contacts", i.e. identified by the PGP key fingerprint.
|
||||
* <p>
|
||||
* False if the chat is unencrypted. This means that all messages in the chat are unencrypted, and all contacts in the chat are "address-contacts", i.e. identified by the email address. The UI should mark this chat e.g. with a mail-letter icon.
|
||||
* <p>
|
||||
* Unencrypted groups are called "ad-hoc groups" and the user can't add/remove members, create a QR invite code, or set an avatar. These options should therefore be disabled in the UI.
|
||||
* <p>
|
||||
* Note that it can happen that an encrypted chat contains unencrypted messages that were received in core <= v1.159.* and vice versa.
|
||||
* <p>
|
||||
* See also `is_key_contact` on `Contact`.
|
||||
*/
|
||||
public Boolean isEncrypted;
|
||||
public Boolean isMuted;
|
||||
public Boolean isSelfTalk;
|
||||
public Boolean isUnpromoted;
|
||||
public String name;
|
||||
public Boolean pinned;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String profileImage;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = ChatListItemFetchResult.ChatListItem.class, name="ChatListItem"), @Type(value = ChatListItemFetchResult.ArchiveLink.class, name="ArchiveLink"), @Type(value = ChatListItemFetchResult.Error.class, name="Error")})
|
||||
public abstract class ChatListItemFetchResult {
|
||||
|
||||
public static class ChatListItem extends ChatListItemFetchResult {
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String avatarPath;
|
||||
public ChatType chatType;
|
||||
public String color;
|
||||
/* contact id if this is a dm chat (for view profile entry in context menu) */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer dmChatContact;
|
||||
public Integer freshMessageCounter;
|
||||
public Integer id;
|
||||
public Boolean isArchived;
|
||||
public Boolean isContactRequest;
|
||||
public Boolean isDeviceTalk;
|
||||
/**
|
||||
* True if the chat is encrypted. This means that all messages in the chat are encrypted, and all contacts in the chat are "key-contacts", i.e. identified by the PGP key fingerprint.
|
||||
* <p>
|
||||
* False if the chat is unencrypted. This means that all messages in the chat are unencrypted, and all contacts in the chat are "address-contacts", i.e. identified by the email address. The UI should mark this chat e.g. with a mail-letter icon.
|
||||
* <p>
|
||||
* Unencrypted groups are called "ad-hoc groups" and the user can't add/remove members, create a QR invite code, or set an avatar. These options should therefore be disabled in the UI.
|
||||
* <p>
|
||||
* Note that it can happen that an encrypted chat contains unencrypted messages that were received in core <= v1.159.* and vice versa.
|
||||
* <p>
|
||||
* See also `is_key_contact` on `Contact`.
|
||||
*/
|
||||
public Boolean isEncrypted;
|
||||
/* deprecated 2025-07, use chat_type instead */
|
||||
public Boolean isGroup;
|
||||
public Boolean isMuted;
|
||||
public Boolean isPinned;
|
||||
public Boolean isSelfInGroup;
|
||||
public Boolean isSelfTalk;
|
||||
public Boolean isSendingLocation;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer lastMessageId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Viewtype lastMessageType;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer lastUpdated;
|
||||
public String name;
|
||||
/* showing preview if last chat message is image */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String summaryPreviewImage;
|
||||
public Integer summaryStatus;
|
||||
public String summaryText1;
|
||||
public String summaryText2;
|
||||
public Boolean wasSeenRecently;
|
||||
}
|
||||
|
||||
public static class ArchiveLink extends ChatListItemFetchResult {
|
||||
public Integer freshMessageCounter;
|
||||
}
|
||||
|
||||
public static class Error extends ChatListItemFetchResult {
|
||||
public String error;
|
||||
public Integer id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum ChatType {
|
||||
Single,
|
||||
Group,
|
||||
Mailinglist,
|
||||
OutBroadcast,
|
||||
InBroadcast,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum ChatVisibility {
|
||||
Normal,
|
||||
Archived,
|
||||
Pinned,
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class Contact {
|
||||
public String address;
|
||||
public String authName;
|
||||
public String color;
|
||||
public String displayName;
|
||||
/**
|
||||
* Is encryption available for this contact.
|
||||
* <p>
|
||||
* This can only be true for key-contacts. However, it is possible to have a key-contact for which encryption is not available because we don't have a key yet, e.g. if we just scanned the fingerprint from a QR code.
|
||||
*/
|
||||
public Boolean e2eeAvail;
|
||||
public Integer id;
|
||||
public Boolean isBlocked;
|
||||
/* If the contact is a bot. */
|
||||
public Boolean isBot;
|
||||
/* Is the contact a key contact. */
|
||||
public Boolean isKeyContact;
|
||||
/**
|
||||
* True if the contact can be added to protected chats because SELF and contact have verified their fingerprints in both directions.
|
||||
* <p>
|
||||
* See [`Self::verifier_id`]/`Contact.verifierId` for a guidance how to display these information.
|
||||
*/
|
||||
public Boolean isVerified;
|
||||
/* the contact's last seen timestamp */
|
||||
public Integer lastSeen;
|
||||
public String name;
|
||||
public String nameAndAddr;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String profileImage;
|
||||
public String status;
|
||||
/**
|
||||
* The contact ID that verified a contact.
|
||||
* <p>
|
||||
* As verifier may be unknown, use [`Self::is_verified`]/`Contact.isVerified` to check if a contact can be added to a protected chat.
|
||||
* <p>
|
||||
* UI should display the information in the contact's profile as follows:
|
||||
* <p>
|
||||
* - If `verifierId` != 0, display text "Introduced by ..." with the name and address of the contact formatted by `name_and_addr`/`nameAndAddr`. Prefix the text by a green checkmark.
|
||||
* <p>
|
||||
* - If `verifierId` == 0 and `isVerified` != 0, display "Introduced" prefixed by a green checkmark.
|
||||
* <p>
|
||||
* - if `verifierId` == 0 and `isVerified` == 0, display nothing
|
||||
* <p>
|
||||
* This contains the contact ID of the verifier. If it is `DC_CONTACT_ID_SELF`, we verified the contact ourself. If it is None/Null, we don't have verifier information or the contact is not verified.
|
||||
*/
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer verifierId;
|
||||
public Boolean wasSeenRecently;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum DownloadState {
|
||||
Done,
|
||||
Available,
|
||||
Failure,
|
||||
Undecipherable,
|
||||
InProgress,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = EphemeralTimer.Disabled.class, name="Disabled"), @Type(value = EphemeralTimer.Enabled.class, name="Enabled")})
|
||||
public abstract class EphemeralTimer {
|
||||
|
||||
/* Timer is disabled. */
|
||||
public static class Disabled extends EphemeralTimer {
|
||||
}
|
||||
|
||||
/* Timer is enabled. */
|
||||
public static class Enabled extends EphemeralTimer {
|
||||
/**
|
||||
* Timer duration in seconds.
|
||||
* <p>
|
||||
* The value cannot be 0.
|
||||
*/
|
||||
public Integer duration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class Event {
|
||||
/* Account ID. */
|
||||
public Integer contextId;
|
||||
/* Event payload. */
|
||||
public EventType event;
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = EventType.Info.class, name="Info"), @Type(value = EventType.SmtpConnected.class, name="SmtpConnected"), @Type(value = EventType.ImapConnected.class, name="ImapConnected"), @Type(value = EventType.SmtpMessageSent.class, name="SmtpMessageSent"), @Type(value = EventType.ImapMessageDeleted.class, name="ImapMessageDeleted"), @Type(value = EventType.ImapMessageMoved.class, name="ImapMessageMoved"), @Type(value = EventType.ImapInboxIdle.class, name="ImapInboxIdle"), @Type(value = EventType.NewBlobFile.class, name="NewBlobFile"), @Type(value = EventType.DeletedBlobFile.class, name="DeletedBlobFile"), @Type(value = EventType.Warning.class, name="Warning"), @Type(value = EventType.Error.class, name="Error"), @Type(value = EventType.ErrorSelfNotInGroup.class, name="ErrorSelfNotInGroup"), @Type(value = EventType.MsgsChanged.class, name="MsgsChanged"), @Type(value = EventType.ReactionsChanged.class, name="ReactionsChanged"), @Type(value = EventType.IncomingReaction.class, name="IncomingReaction"), @Type(value = EventType.IncomingWebxdcNotify.class, name="IncomingWebxdcNotify"), @Type(value = EventType.IncomingMsg.class, name="IncomingMsg"), @Type(value = EventType.IncomingMsgBunch.class, name="IncomingMsgBunch"), @Type(value = EventType.MsgsNoticed.class, name="MsgsNoticed"), @Type(value = EventType.MsgDelivered.class, name="MsgDelivered"), @Type(value = EventType.MsgFailed.class, name="MsgFailed"), @Type(value = EventType.MsgRead.class, name="MsgRead"), @Type(value = EventType.MsgDeleted.class, name="MsgDeleted"), @Type(value = EventType.ChatModified.class, name="ChatModified"), @Type(value = EventType.ChatEphemeralTimerModified.class, name="ChatEphemeralTimerModified"), @Type(value = EventType.ChatDeleted.class, name="ChatDeleted"), @Type(value = EventType.ContactsChanged.class, name="ContactsChanged"), @Type(value = EventType.LocationChanged.class, name="LocationChanged"), @Type(value = EventType.ConfigureProgress.class, name="ConfigureProgress"), @Type(value = EventType.ImexProgress.class, name="ImexProgress"), @Type(value = EventType.ImexFileWritten.class, name="ImexFileWritten"), @Type(value = EventType.SecurejoinInviterProgress.class, name="SecurejoinInviterProgress"), @Type(value = EventType.SecurejoinJoinerProgress.class, name="SecurejoinJoinerProgress"), @Type(value = EventType.ConnectivityChanged.class, name="ConnectivityChanged"), @Type(value = EventType.SelfavatarChanged.class, name="SelfavatarChanged"), @Type(value = EventType.ConfigSynced.class, name="ConfigSynced"), @Type(value = EventType.WebxdcStatusUpdate.class, name="WebxdcStatusUpdate"), @Type(value = EventType.WebxdcRealtimeData.class, name="WebxdcRealtimeData"), @Type(value = EventType.WebxdcRealtimeAdvertisementReceived.class, name="WebxdcRealtimeAdvertisementReceived"), @Type(value = EventType.WebxdcInstanceDeleted.class, name="WebxdcInstanceDeleted"), @Type(value = EventType.AccountsBackgroundFetchDone.class, name="AccountsBackgroundFetchDone"), @Type(value = EventType.ChatlistChanged.class, name="ChatlistChanged"), @Type(value = EventType.ChatlistItemChanged.class, name="ChatlistItemChanged"), @Type(value = EventType.AccountsChanged.class, name="AccountsChanged"), @Type(value = EventType.AccountsItemChanged.class, name="AccountsItemChanged"), @Type(value = EventType.EventChannelOverflow.class, name="EventChannelOverflow"), @Type(value = EventType.IncomingCall.class, name="IncomingCall"), @Type(value = EventType.IncomingCallAccepted.class, name="IncomingCallAccepted"), @Type(value = EventType.OutgoingCallAccepted.class, name="OutgoingCallAccepted"), @Type(value = EventType.CallEnded.class, name="CallEnded")})
|
||||
public abstract class EventType {
|
||||
|
||||
/**
|
||||
* The library-user may write an informational string to the log.
|
||||
* <p>
|
||||
* This event should *not* be reported to the end-user using a popup or something like that.
|
||||
*/
|
||||
public static class Info extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Emitted when SMTP connection is established and login was successful. */
|
||||
public static class SmtpConnected extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Emitted when IMAP connection is established and login was successful. */
|
||||
public static class ImapConnected extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Emitted when a message was successfully sent to the SMTP server. */
|
||||
public static class SmtpMessageSent extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Emitted when an IMAP message has been marked as deleted */
|
||||
public static class ImapMessageDeleted extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Emitted when an IMAP message has been moved */
|
||||
public static class ImapMessageMoved extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Emitted before going into IDLE on the Inbox folder. */
|
||||
public static class ImapInboxIdle extends EventType {
|
||||
}
|
||||
|
||||
/* Emitted when an new file in the $BLOBDIR was created */
|
||||
public static class NewBlobFile extends EventType {
|
||||
public String file;
|
||||
}
|
||||
|
||||
/* Emitted when an file in the $BLOBDIR was deleted */
|
||||
public static class DeletedBlobFile extends EventType {
|
||||
public String file;
|
||||
}
|
||||
|
||||
/**
|
||||
* The library-user should write a warning string to the log.
|
||||
* <p>
|
||||
* This event should *not* be reported to the end-user using a popup or something like that.
|
||||
*/
|
||||
public static class Warning extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* The library-user should report an error to the end-user.
|
||||
* <p>
|
||||
* As most things are asynchronous, things may go wrong at any time and the user should not be disturbed by a dialog or so. Instead, use a bubble or so.
|
||||
* <p>
|
||||
* However, for ongoing processes (eg. configure()) or for functions that are expected to fail (eg. autocryptContinueKeyTransfer()) it might be better to delay showing these events until the function has really failed (returned false). It should be sufficient to report only the *last* error in a message box then.
|
||||
*/
|
||||
public static class Error extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* An action cannot be performed because the user is not in the group. Reported eg. after a call to setChatName(), setChatProfileImage(), addContactToChat(), removeContactFromChat(), and messages sending functions. */
|
||||
public static class ErrorSelfNotInGroup extends EventType {
|
||||
public String msg;
|
||||
}
|
||||
|
||||
/* Messages or chats changed. One or more messages or chats changed for various reasons in the database: - Messages sent, received or removed - Chats created, deleted or archived - A draft has been set */
|
||||
public static class MsgsChanged extends EventType {
|
||||
/* Set if only a single chat is affected by the changes, otherwise 0. */
|
||||
public Integer chatId;
|
||||
/* Set if only a single message is affected by the changes, otherwise 0. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/* Reactions for the message changed. */
|
||||
public static class ReactionsChanged extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chatId;
|
||||
/* ID of the contact whose reaction set is changed. */
|
||||
public Integer contactId;
|
||||
/* ID of the message for which reactions were changed. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* A reaction to one's own sent message received. Typically, the UI will show a notification for that.
|
||||
* <p>
|
||||
* In addition to this event, ReactionsChanged is emitted.
|
||||
*/
|
||||
public static class IncomingReaction extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chatId;
|
||||
/* ID of the contact whose reaction set is changed. */
|
||||
public Integer contactId;
|
||||
/* ID of the message for which reactions were changed. */
|
||||
public Integer msgId;
|
||||
/* The reaction. */
|
||||
public String reaction;
|
||||
}
|
||||
|
||||
/* Incoming webxdc info or summary update, should be notified. */
|
||||
public static class IncomingWebxdcNotify extends EventType {
|
||||
/* ID of the chat. */
|
||||
public Integer chatId;
|
||||
/* ID of the contact sending. */
|
||||
public Integer contactId;
|
||||
/* Link assigned to this notification, if any. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String href;
|
||||
/* ID of the added info message or webxdc instance in case of summary change. */
|
||||
public Integer msgId;
|
||||
/* Text to notify. */
|
||||
public String text;
|
||||
}
|
||||
|
||||
/**
|
||||
* There is a fresh message. Typically, the user will show a notification when receiving this message.
|
||||
* <p>
|
||||
* There is no extra #DC_EVENT_MSGS_CHANGED event sent together with this event.
|
||||
*/
|
||||
public static class IncomingMsg extends EventType {
|
||||
/* ID of the chat where the message is assigned. */
|
||||
public Integer chatId;
|
||||
/* ID of the message. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/* Downloading a bunch of messages just finished. This is an event to allow the UI to only show one notification per message bunch, instead of cluttering the user with many notifications. */
|
||||
public static class IncomingMsgBunch extends EventType {
|
||||
}
|
||||
|
||||
/* Messages were seen or noticed. chat id is always set. */
|
||||
public static class MsgsNoticed extends EventType {
|
||||
public Integer chatId;
|
||||
}
|
||||
|
||||
/* A single message is sent successfully. State changed from DC_STATE_OUT_PENDING to DC_STATE_OUT_DELIVERED, see `Message.state`. */
|
||||
public static class MsgDelivered extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chatId;
|
||||
/* ID of the message that was successfully sent. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/* A single message could not be sent. State changed from DC_STATE_OUT_PENDING or DC_STATE_OUT_DELIVERED to DC_STATE_OUT_FAILED, see `Message.state`. */
|
||||
public static class MsgFailed extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chatId;
|
||||
/* ID of the message that could not be sent. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/* A single message is read by the receiver. State changed from DC_STATE_OUT_DELIVERED to DC_STATE_OUT_MDN_RCVD, see `Message.state`. */
|
||||
public static class MsgRead extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chatId;
|
||||
/* ID of the message that was read. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* A single message was deleted.
|
||||
* <p>
|
||||
* This event means that the message will no longer appear in the messagelist. UI should remove the message from the messagelist in response to this event if the message is currently displayed.
|
||||
* <p>
|
||||
* The message may have been explicitly deleted by the user or expired. Internally the message may have been removed from the database, moved to the trash chat or hidden.
|
||||
* <p>
|
||||
* This event does not indicate the message deletion from the server.
|
||||
*/
|
||||
public static class MsgDeleted extends EventType {
|
||||
/* ID of the chat where the message was prior to deletion. Never 0. */
|
||||
public Integer chatId;
|
||||
/* ID of the deleted message. Never 0. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chat changed. The name or the image of a chat group was changed or members were added or removed. See setChatName(), setChatProfileImage(), addContactToChat() and removeContactFromChat().
|
||||
* <p>
|
||||
* This event does not include ephemeral timer modification, which is a separate event.
|
||||
*/
|
||||
public static class ChatModified extends EventType {
|
||||
public Integer chatId;
|
||||
}
|
||||
|
||||
/* Chat ephemeral timer changed. */
|
||||
public static class ChatEphemeralTimerModified extends EventType {
|
||||
/* Chat ID. */
|
||||
public Integer chatId;
|
||||
/* New ephemeral timer value. */
|
||||
public Integer timer;
|
||||
}
|
||||
|
||||
/* Chat deleted. */
|
||||
public static class ChatDeleted extends EventType {
|
||||
/* Chat ID. */
|
||||
public Integer chat_id;
|
||||
}
|
||||
|
||||
/* Contact(s) created, renamed, blocked or deleted. */
|
||||
public static class ContactsChanged extends EventType {
|
||||
/* If set, this is the contact_id of an added contact that should be selected. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer contactId;
|
||||
}
|
||||
|
||||
/* Location of one or more contact has changed. */
|
||||
public static class LocationChanged extends EventType {
|
||||
/* contact_id of the contact for which the location has changed. If the locations of several contacts have been changed, this parameter is set to `None`. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer contactId;
|
||||
}
|
||||
|
||||
/* Inform about the configuration progress started by configure(). */
|
||||
public static class ConfigureProgress extends EventType {
|
||||
/* Progress comment or error, something to display to the user. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String comment;
|
||||
/**
|
||||
* Progress.
|
||||
* <p>
|
||||
* 0=error, 1-999=progress in permille, 1000=success and done
|
||||
*/
|
||||
public Integer progress;
|
||||
}
|
||||
|
||||
/* Inform about the import/export progress started by imex(). */
|
||||
public static class ImexProgress extends EventType {
|
||||
/* 0=error, 1-999=progress in permille, 1000=success and done */
|
||||
public Integer progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* A file has been exported. A file has been written by imex(). This event may be sent multiple times by a single call to imex().
|
||||
* <p>
|
||||
* A typical purpose for a handler of this event may be to make the file public to some system services.
|
||||
* <p>
|
||||
* @param data2 0
|
||||
*/
|
||||
public static class ImexFileWritten extends EventType {
|
||||
public String path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress event sent when SecureJoin protocol has finished from the view of the inviter (Alice, the person who shows the QR code).
|
||||
* <p>
|
||||
* These events are typically sent after a joiner has scanned the QR code generated by getChatSecurejoinQrCodeSvg().
|
||||
*/
|
||||
public static class SecurejoinInviterProgress extends EventType {
|
||||
/* ID of the chat in case of success. */
|
||||
public Integer chatId;
|
||||
/* The type of the joined chat. This can take the same values as `BasicChat.chatType` ([`crate::api::types::chat::BasicChat::chat_type`]). */
|
||||
public ChatType chatType;
|
||||
/* ID of the contact that wants to join. */
|
||||
public Integer contactId;
|
||||
/* Progress, always 1000. */
|
||||
public Integer progress;
|
||||
}
|
||||
|
||||
/* Progress information of a secure-join handshake from the view of the joiner (Bob, the person who scans the QR code). The events are typically sent while secureJoin(), which may take some time, is executed. */
|
||||
public static class SecurejoinJoinerProgress extends EventType {
|
||||
/* ID of the inviting contact. */
|
||||
public Integer contactId;
|
||||
/* Progress as: 400=vg-/vc-request-with-auth sent, typically shown as "alice@addr verified, introducing myself." (Bob has verified alice and waits until Alice does the same for him) 1000=vg-member-added/vc-contact-confirm received */
|
||||
public Integer progress;
|
||||
}
|
||||
|
||||
/* The connectivity to the server changed. This means that you should refresh the connectivity view and possibly the connectivtiy HTML; see getConnectivity() and getConnectivityHtml() for details. */
|
||||
public static class ConnectivityChanged extends EventType {
|
||||
}
|
||||
|
||||
/* Deprecated by `ConfigSynced`. */
|
||||
public static class SelfavatarChanged extends EventType {
|
||||
}
|
||||
|
||||
/* A multi-device synced config value changed. Maybe the app needs to refresh smth. For uniformity this is emitted on the source device too. The value isn't here, otherwise it would be logged which might not be good for privacy. */
|
||||
public static class ConfigSynced extends EventType {
|
||||
/* Configuration key. */
|
||||
public String key;
|
||||
}
|
||||
|
||||
public static class WebxdcStatusUpdate extends EventType {
|
||||
/* Message ID. */
|
||||
public Integer msgId;
|
||||
/* Status update ID. */
|
||||
public Integer statusUpdateSerial;
|
||||
}
|
||||
|
||||
/* Data received over an ephemeral peer channel. */
|
||||
public static class WebxdcRealtimeData extends EventType {
|
||||
/* Realtime data. */
|
||||
public java.util.List<Integer> data;
|
||||
/* Message ID. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/* Advertisement received over an ephemeral peer channel. This can be used by bots to initiate peer-to-peer communication from their side. */
|
||||
public static class WebxdcRealtimeAdvertisementReceived extends EventType {
|
||||
/* Message ID of the webxdc instance. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/* Inform that a message containing a webxdc instance has been deleted */
|
||||
public static class WebxdcInstanceDeleted extends EventType {
|
||||
/* ID of the deleted message. */
|
||||
public Integer msgId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells that the Background fetch was completed (or timed out). This event acts as a marker, when you reach this event you can be sure that all events emitted during the background fetch were processed.
|
||||
* <p>
|
||||
* This event is only emitted by the account manager
|
||||
*/
|
||||
public static class AccountsBackgroundFetchDone extends EventType {
|
||||
}
|
||||
|
||||
/**
|
||||
* Inform that set of chats or the order of the chats in the chatlist has changed.
|
||||
* <p>
|
||||
* Sometimes this is emitted together with `UIChatlistItemChanged`.
|
||||
*/
|
||||
public static class ChatlistChanged extends EventType {
|
||||
}
|
||||
|
||||
/* Inform that a single chat list item changed and needs to be rerendered. If `chat_id` is set to None, then all currently visible chats need to be rerendered, and all not-visible items need to be cleared from cache if the UI has a cache. */
|
||||
public static class ChatlistItemChanged extends EventType {
|
||||
/* ID of the changed chat */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer chatId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inform that the list of accounts has changed (an account removed or added or (not yet implemented) the account order changes)
|
||||
* <p>
|
||||
* This event is only emitted by the account manager
|
||||
*/
|
||||
public static class AccountsChanged extends EventType {
|
||||
}
|
||||
|
||||
/**
|
||||
* Inform that an account property that might be shown in the account list changed, namely: - is_configured (see is_configured()) - displayname - selfavatar - private_tag
|
||||
* <p>
|
||||
* This event is emitted from the account whose property changed.
|
||||
*/
|
||||
public static class AccountsItemChanged extends EventType {
|
||||
}
|
||||
|
||||
/* Inform than some events have been skipped due to event channel overflow. */
|
||||
public static class EventChannelOverflow extends EventType {
|
||||
/* Number of events skipped. */
|
||||
public Integer n;
|
||||
}
|
||||
|
||||
/* Incoming call. */
|
||||
public static class IncomingCall extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chat_id;
|
||||
/* True if incoming call is a video call. */
|
||||
public Boolean has_video;
|
||||
/* ID of the info message referring to the call. */
|
||||
public Integer msg_id;
|
||||
/* User-defined info as passed to place_outgoing_call() */
|
||||
public String place_call_info;
|
||||
}
|
||||
|
||||
/* Incoming call accepted. This is esp. interesting to stop ringing on other devices. */
|
||||
public static class IncomingCallAccepted extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chat_id;
|
||||
/* ID of the info message referring to the call. */
|
||||
public Integer msg_id;
|
||||
}
|
||||
|
||||
/* Outgoing call accepted. */
|
||||
public static class OutgoingCallAccepted extends EventType {
|
||||
/* User-defined info passed to dc_accept_incoming_call( */
|
||||
public String accept_call_info;
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chat_id;
|
||||
/* ID of the info message referring to the call. */
|
||||
public Integer msg_id;
|
||||
}
|
||||
|
||||
/* Call ended. */
|
||||
public static class CallEnded extends EventType {
|
||||
/* ID of the chat which the message belongs to. */
|
||||
public Integer chat_id;
|
||||
/* ID of the info message referring to the call. */
|
||||
public Integer msg_id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class FullChat {
|
||||
public Boolean archived;
|
||||
public Boolean canSend;
|
||||
public ChatType chatType;
|
||||
public String color;
|
||||
public java.util.List<Integer> contactIds;
|
||||
public java.util.List<Contact> contacts;
|
||||
public Integer ephemeralTimer;
|
||||
public Integer freshMessageCounter;
|
||||
public Integer id;
|
||||
public Boolean isContactRequest;
|
||||
public Boolean isDeviceChat;
|
||||
/**
|
||||
* True if the chat is encrypted. This means that all messages in the chat are encrypted, and all contacts in the chat are "key-contacts", i.e. identified by the PGP key fingerprint.
|
||||
* <p>
|
||||
* False if the chat is unencrypted. This means that all messages in the chat are unencrypted, and all contacts in the chat are "address-contacts", i.e. identified by the email address. The UI should mark this chat e.g. with a mail-letter icon.
|
||||
* <p>
|
||||
* Unencrypted groups are called "ad-hoc groups" and the user can't add/remove members, create a QR invite code, or set an avatar. These options should therefore be disabled in the UI.
|
||||
* <p>
|
||||
* Note that it can happen that an encrypted chat contains unencrypted messages that were received in core <= v1.159.* and vice versa.
|
||||
* <p>
|
||||
* See also `is_key_contact` on `Contact`.
|
||||
*/
|
||||
public Boolean isEncrypted;
|
||||
public Boolean isMuted;
|
||||
public Boolean isSelfTalk;
|
||||
public Boolean isUnpromoted;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String mailingListAddress;
|
||||
public String name;
|
||||
/* Contact IDs of the past chat members. */
|
||||
public java.util.List<Integer> pastContactIds;
|
||||
public Boolean pinned;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String profileImage;
|
||||
/* Note that this is different from [`ChatListItem::is_self_in_group`](`crate::api::types::chat_list::ChatListItemFetchResult::ChatListItem::is_self_in_group`). This property should only be accessed when [`FullChat::chat_type`] is [`Chattype::Group`]. */
|
||||
public Boolean selfInGroup;
|
||||
public Boolean wasSeenRecently;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class Location {
|
||||
public Float accuracy;
|
||||
public Integer chatId;
|
||||
public Integer contactId;
|
||||
public Boolean isIndependent;
|
||||
public Float latitude;
|
||||
public Integer locationId;
|
||||
public Float longitude;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String marker;
|
||||
public Integer msgId;
|
||||
public Integer timestamp;
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class Message {
|
||||
public Integer chatId;
|
||||
public Integer dimensionsHeight;
|
||||
public Integer dimensionsWidth;
|
||||
public DownloadState downloadState;
|
||||
public Integer duration;
|
||||
/* An error text, if there is one. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String error;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String file;
|
||||
public Integer fileBytes;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String fileMime;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String fileName;
|
||||
public Integer fromId;
|
||||
public Boolean hasDeviatingTimestamp;
|
||||
public Boolean hasHtml;
|
||||
/* Check if a message has a POI location bound to it. These locations are also returned by `get_locations` method. The UI may decide to display a special icon beside such messages. */
|
||||
public Boolean hasLocation;
|
||||
public Integer id;
|
||||
/* if is_info is set, this refers to the contact profile that should be opened when the info message is tapped. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer infoContactId;
|
||||
/* True if the message was sent by a bot. */
|
||||
public Boolean isBot;
|
||||
public Boolean isEdited;
|
||||
public Boolean isForwarded;
|
||||
public Boolean isInfo;
|
||||
public Boolean isSetupmessage;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer originalMsgId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String overrideSenderName;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer parentId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public MessageQuote quote;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Reactions reactions;
|
||||
public Integer receivedTimestamp;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer savedMessageId;
|
||||
public Contact sender;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String setupCodeBegin;
|
||||
/**
|
||||
* True if the message was correctly encrypted&signed, false otherwise. Historically, UIs showed a small padlock on the message then.
|
||||
* <p>
|
||||
* Today, the UIs should instead show a small email-icon on the message if `show_padlock` is `false`, and nothing if it is `true`.
|
||||
*/
|
||||
public Boolean showPadlock;
|
||||
public Integer sortTimestamp;
|
||||
public Integer state;
|
||||
public String subject;
|
||||
/* when is_info is true this describes what type of system message it is */
|
||||
public SystemMessageType systemMessageType;
|
||||
public String text;
|
||||
public Integer timestamp;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public VcardContact vcardContact;
|
||||
public Viewtype viewType;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String webxdcHref;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class MessageData {
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String file;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String filename;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String html;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Pair<Float, Float> location;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String overrideSenderName;
|
||||
/* Quoted message id. Takes preference over `quoted_text` (see below). */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer quotedMessageId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String quotedText;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String text;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Viewtype viewtype;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class MessageInfo {
|
||||
public EphemeralTimer ephemeralTimer;
|
||||
/* When message is ephemeral this contains the timestamp of the message expiry */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer ephemeralTimestamp;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String error;
|
||||
public String hopInfo;
|
||||
public String rfc724Mid;
|
||||
public java.util.List<String> serverUrls;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = MessageListItem.Message.class, name="Message"), @Type(value = MessageListItem.DayMarker.class, name="DayMarker")})
|
||||
public abstract class MessageListItem {
|
||||
|
||||
public static class Message extends MessageListItem {
|
||||
public Integer msg_id;
|
||||
}
|
||||
|
||||
/* Day marker, separating messages that correspond to different days according to local time. */
|
||||
public static class DayMarker extends MessageListItem {
|
||||
/* Marker timestamp, for day markers, in unix milliseconds */
|
||||
public Integer timestamp;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = MessageLoadResult.Message.class, name="Message"), @Type(value = MessageLoadResult.LoadingError.class, name="LoadingError")})
|
||||
public abstract class MessageLoadResult {
|
||||
|
||||
public static class Message extends MessageLoadResult {
|
||||
public Integer chatId;
|
||||
public Integer dimensionsHeight;
|
||||
public Integer dimensionsWidth;
|
||||
public DownloadState downloadState;
|
||||
public Integer duration;
|
||||
/* An error text, if there is one. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String error;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String file;
|
||||
public Integer fileBytes;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String fileMime;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String fileName;
|
||||
public Integer fromId;
|
||||
public Boolean hasDeviatingTimestamp;
|
||||
public Boolean hasHtml;
|
||||
/* Check if a message has a POI location bound to it. These locations are also returned by `get_locations` method. The UI may decide to display a special icon beside such messages. */
|
||||
public Boolean hasLocation;
|
||||
public Integer id;
|
||||
/* if is_info is set, this refers to the contact profile that should be opened when the info message is tapped. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer infoContactId;
|
||||
/* True if the message was sent by a bot. */
|
||||
public Boolean isBot;
|
||||
public Boolean isEdited;
|
||||
public Boolean isForwarded;
|
||||
public Boolean isInfo;
|
||||
public Boolean isSetupmessage;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer originalMsgId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String overrideSenderName;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer parentId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public MessageQuote quote;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Reactions reactions;
|
||||
public Integer receivedTimestamp;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer savedMessageId;
|
||||
public Contact sender;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String setupCodeBegin;
|
||||
/**
|
||||
* True if the message was correctly encrypted&signed, false otherwise. Historically, UIs showed a small padlock on the message then.
|
||||
* <p>
|
||||
* Today, the UIs should instead show a small email-icon on the message if `show_padlock` is `false`, and nothing if it is `true`.
|
||||
*/
|
||||
public Boolean showPadlock;
|
||||
public Integer sortTimestamp;
|
||||
public Integer state;
|
||||
public String subject;
|
||||
/* when is_info is true this describes what type of system message it is */
|
||||
public SystemMessageType systemMessageType;
|
||||
public String text;
|
||||
public Integer timestamp;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public VcardContact vcardContact;
|
||||
public Viewtype viewType;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String webxdcHref;
|
||||
}
|
||||
|
||||
public static class LoadingError extends MessageLoadResult {
|
||||
public String error;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class MessageNotificationInfo {
|
||||
public Integer accountId;
|
||||
public Integer chatId;
|
||||
public String chatName;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String chatProfileImage;
|
||||
public Integer id;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String image;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String imageMimeType;
|
||||
/* also known as summary_text1 */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String summaryPrefix;
|
||||
/* also known as summary_text2 */
|
||||
public String summaryText;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = MessageQuote.JustText.class, name="JustText"), @Type(value = MessageQuote.WithMessage.class, name="WithMessage")})
|
||||
public abstract class MessageQuote {
|
||||
|
||||
public static class JustText extends MessageQuote {
|
||||
public String text;
|
||||
}
|
||||
|
||||
public static class WithMessage extends MessageQuote {
|
||||
public String authorDisplayColor;
|
||||
public String authorDisplayName;
|
||||
/* The quoted message does not always belong to the same chat, e.g. when "Reply Privately" is used. */
|
||||
public Integer chatId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String image;
|
||||
public Boolean isForwarded;
|
||||
public Integer messageId;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String overrideSenderName;
|
||||
public String text;
|
||||
public Viewtype viewType;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class MessageReadReceipt {
|
||||
public Integer contactId;
|
||||
public Integer timestamp;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class MessageSearchResult {
|
||||
public String authorColor;
|
||||
public Integer authorId;
|
||||
/* if sender name if overridden it will show it as ~alias */
|
||||
public String authorName;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String authorProfileImage;
|
||||
public String chatColor;
|
||||
public Integer chatId;
|
||||
public String chatName;
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String chatProfileImage;
|
||||
public ChatType chatType;
|
||||
public Integer id;
|
||||
public Boolean isChatArchived;
|
||||
public Boolean isChatContactRequest;
|
||||
public String message;
|
||||
public Integer timestamp;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = MuteDuration.NotMuted.class, name="NotMuted"), @Type(value = MuteDuration.Forever.class, name="Forever"), @Type(value = MuteDuration.Until.class, name="Until")})
|
||||
public abstract class MuteDuration {
|
||||
|
||||
public static class NotMuted extends MuteDuration {
|
||||
}
|
||||
|
||||
public static class Forever extends MuteDuration {
|
||||
}
|
||||
|
||||
public static class Until extends MuteDuration {
|
||||
public Integer duration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum NotifyState {
|
||||
/* Not subscribed to push notifications. */
|
||||
NotConnected,
|
||||
|
||||
/* Subscribed to heartbeat push notifications. */
|
||||
Heartbeat,
|
||||
|
||||
/* Subscribed to push notifications for new messages. */
|
||||
Connected,
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class Pair<T1, T2> {
|
||||
private final T1 v1;
|
||||
private final T2 v2;
|
||||
|
||||
public Pair(T1 v1, T2 v2) {
|
||||
this.v1 = v1;
|
||||
this.v2 = v2;
|
||||
}
|
||||
|
||||
public T1 first(){
|
||||
return v1;
|
||||
}
|
||||
|
||||
public T2 second(){
|
||||
return v2;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof Pair &&
|
||||
equal(((Pair) o).first(), first()) &&
|
||||
equal(((Pair) o).second(), second());
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return first().hashCode() ^ second().hashCode();
|
||||
}
|
||||
|
||||
private boolean equal(Object first, Object second) {
|
||||
if (first == null && second == null) return true;
|
||||
if (first == null || second == null) return false;
|
||||
return first.equals(second);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class ProviderInfo {
|
||||
public String beforeLoginHint;
|
||||
/* Unique ID, corresponding to provider database filename. */
|
||||
public String id;
|
||||
public String overviewPage;
|
||||
public Integer status;
|
||||
}
|
||||
@@ -0,0 +1,254 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
|
||||
|
||||
@JsonTypeInfo(use=Id.NAME, include=As.PROPERTY, property="kind")
|
||||
@JsonSubTypes({@Type(value = Qr.AskVerifyContact.class, name="AskVerifyContact"), @Type(value = Qr.AskVerifyGroup.class, name="AskVerifyGroup"), @Type(value = Qr.AskJoinBroadcast.class, name="AskJoinBroadcast"), @Type(value = Qr.FprOk.class, name="FprOk"), @Type(value = Qr.FprMismatch.class, name="FprMismatch"), @Type(value = Qr.FprWithoutAddr.class, name="FprWithoutAddr"), @Type(value = Qr.Account.class, name="Account"), @Type(value = Qr.Backup2.class, name="Backup2"), @Type(value = Qr.BackupTooNew.class, name="BackupTooNew"), @Type(value = Qr.WebrtcInstance.class, name="WebrtcInstance"), @Type(value = Qr.Proxy.class, name="Proxy"), @Type(value = Qr.Addr.class, name="Addr"), @Type(value = Qr.Url.class, name="Url"), @Type(value = Qr.Text.class, name="Text"), @Type(value = Qr.WithdrawVerifyContact.class, name="WithdrawVerifyContact"), @Type(value = Qr.WithdrawVerifyGroup.class, name="WithdrawVerifyGroup"), @Type(value = Qr.WithdrawJoinBroadcast.class, name="WithdrawJoinBroadcast"), @Type(value = Qr.ReviveVerifyContact.class, name="ReviveVerifyContact"), @Type(value = Qr.ReviveVerifyGroup.class, name="ReviveVerifyGroup"), @Type(value = Qr.ReviveJoinBroadcast.class, name="ReviveJoinBroadcast"), @Type(value = Qr.Login.class, name="Login")})
|
||||
public abstract class Qr {
|
||||
|
||||
/**
|
||||
* Ask the user whether to verify the contact.
|
||||
* <p>
|
||||
* If the user agrees, pass this QR code to [`crate::securejoin::join_securejoin`].
|
||||
*/
|
||||
public static class AskVerifyContact extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* ID of the contact. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
}
|
||||
|
||||
/* Ask the user whether to join the group. */
|
||||
public static class AskVerifyGroup extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* ID of the contact. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Group ID. */
|
||||
public String grpid;
|
||||
/* Group name. */
|
||||
public String grpname;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
}
|
||||
|
||||
/* Ask the user whether to join the broadcast channel. */
|
||||
public static class AskJoinBroadcast extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* ID of the contact who owns the broadcast channel and created the QR code. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the broadcast channel owner's key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* A string of random characters, uniquely identifying this broadcast channel across all databases/clients. Called `grpid` for historic reasons: The id of multi-user chats is always called `grpid` in the database because groups were once the only multi-user chats. */
|
||||
public String grpid;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
/* The user-visible name of this broadcast channel */
|
||||
public String name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact fingerprint is verified.
|
||||
* <p>
|
||||
* Ask the user if they want to start chatting.
|
||||
*/
|
||||
public static class FprOk extends Qr {
|
||||
/* Contact ID. */
|
||||
public Integer contact_id;
|
||||
}
|
||||
|
||||
/* Scanned fingerprint does not match the last seen fingerprint. */
|
||||
public static class FprMismatch extends Qr {
|
||||
/* Contact ID. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public Integer contact_id;
|
||||
}
|
||||
|
||||
/* The scanned QR code contains a fingerprint but no e-mail address. */
|
||||
public static class FprWithoutAddr extends Qr {
|
||||
/* Key fingerprint. */
|
||||
public String fingerprint;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to create an account on the given domain. */
|
||||
public static class Account extends Qr {
|
||||
/* Server domain name. */
|
||||
public String domain;
|
||||
}
|
||||
|
||||
/* Provides a backup that can be retrieved using iroh-net based backup transfer protocol. */
|
||||
public static class Backup2 extends Qr {
|
||||
/* Authentication token. */
|
||||
public String auth_token;
|
||||
/* Iroh node address. */
|
||||
public String node_addr;
|
||||
}
|
||||
|
||||
public static class BackupTooNew extends Qr {
|
||||
}
|
||||
|
||||
/* Ask the user if they want to use the given service for video chats. */
|
||||
public static class WebrtcInstance extends Qr {
|
||||
public String domain;
|
||||
public String instance_pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask the user if they want to use the given proxy.
|
||||
* <p>
|
||||
* Note that HTTP(S) URLs without a path and query parameters are treated as HTTP(S) proxy URL. UI may want to still offer to open the URL in the browser if QR code contents starts with `http://` or `https://` and the QR code was not scanned from the proxy configuration screen.
|
||||
*/
|
||||
public static class Proxy extends Qr {
|
||||
/* Host extracted from the URL to display in the UI. */
|
||||
public String host;
|
||||
/* Port extracted from the URL to display in the UI. */
|
||||
public Integer port;
|
||||
/**
|
||||
* Proxy URL.
|
||||
* <p>
|
||||
* This is the URL that is going to be added.
|
||||
*/
|
||||
public String url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Contact address is scanned.
|
||||
* <p>
|
||||
* Optionally, a draft message could be provided. Ask the user if they want to start chatting.
|
||||
*/
|
||||
public static class Addr extends Qr {
|
||||
/* Contact ID. */
|
||||
public Integer contact_id;
|
||||
/* Draft message. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String draft;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL scanned.
|
||||
* <p>
|
||||
* Ask the user if they want to open a browser or copy the URL to clipboard.
|
||||
*/
|
||||
public static class Url extends Qr {
|
||||
public String url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Text scanned.
|
||||
* <p>
|
||||
* Ask the user if they want to copy the text to clipboard.
|
||||
*/
|
||||
public static class Text extends Qr {
|
||||
public String text;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to withdraw their own QR code. */
|
||||
public static class WithdrawVerifyContact extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* Contact ID. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to withdraw their own group invite QR code. */
|
||||
public static class WithdrawVerifyGroup extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* Contact ID. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Group ID. */
|
||||
public String grpid;
|
||||
/* Group name. */
|
||||
public String grpname;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to withdraw their own broadcast channel invite QR code. */
|
||||
public static class WithdrawJoinBroadcast extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* Contact ID. Always `ContactId::SELF`. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* ID, uniquely identifying this chat. Called grpid for historic reasons. */
|
||||
public String grpid;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
/* Broadcast name. */
|
||||
public String name;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to revive their own QR code. */
|
||||
public static class ReviveVerifyContact extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* Contact ID. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to revive their own group invite QR code. */
|
||||
public static class ReviveVerifyGroup extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* Contact ID. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Group ID. */
|
||||
public String grpid;
|
||||
/* Contact ID. */
|
||||
public String grpname;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
}
|
||||
|
||||
/* Ask the user if they want to revive their own broadcast channel invite QR code. */
|
||||
public static class ReviveJoinBroadcast extends Qr {
|
||||
/* Authentication code. */
|
||||
public String authcode;
|
||||
/* Contact ID. Always `ContactId::SELF`. */
|
||||
public Integer contact_id;
|
||||
/* Fingerprint of the contact key as scanned from the QR code. */
|
||||
public String fingerprint;
|
||||
/* Globally unique chat ID. Called grpid for historic reasons. */
|
||||
public String grpid;
|
||||
/* Invite number. */
|
||||
public String invitenumber;
|
||||
/* Broadcast name. */
|
||||
public String name;
|
||||
}
|
||||
|
||||
/**
|
||||
* `dclogin:` scheme parameters.
|
||||
* <p>
|
||||
* Ask the user if they want to login with the email address.
|
||||
*/
|
||||
public static class Login extends Qr {
|
||||
public String address;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum SecurejoinSource {
|
||||
/* Because of some problem, it is unknown where the QR code came from. */
|
||||
Unknown,
|
||||
|
||||
/* The user opened a link somewhere outside Delta Chat */
|
||||
ExternalLink,
|
||||
|
||||
/* The user clicked on a link in a message inside Delta Chat */
|
||||
InternalLink,
|
||||
|
||||
/* The user clicked "Paste from Clipboard" in the QR scan activity */
|
||||
Clipboard,
|
||||
|
||||
/* The user clicked "Load QR code as image" in the QR scan activity */
|
||||
ImageLoaded,
|
||||
|
||||
/* The user scanned a QR code */
|
||||
Scan,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum SecurejoinUiPath {
|
||||
/* The UI path is unknown, or the user didn't open the QR code screen at all. */
|
||||
Unknown,
|
||||
|
||||
/* The user directly clicked on the QR icon in the main screen */
|
||||
QrIcon,
|
||||
|
||||
/* The user first clicked on the `+` button in the main screen, and then on "New Contact" */
|
||||
NewContact,
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum SystemMessageType {
|
||||
Unknown,
|
||||
GroupNameChanged,
|
||||
GroupImageChanged,
|
||||
MemberAddedToGroup,
|
||||
MemberRemovedFromGroup,
|
||||
AutocryptSetupMessage,
|
||||
SecurejoinMessage,
|
||||
LocationStreamingEnabled,
|
||||
LocationOnly,
|
||||
InvalidUnencryptedMail,
|
||||
ChatE2ee,
|
||||
ChatProtectionEnabled,
|
||||
ChatProtectionDisabled,
|
||||
WebxdcStatusUpdate,
|
||||
CallAccepted,
|
||||
CallEnded,
|
||||
|
||||
/* 1:1 chats info message telling that SecureJoin has started and the user should wait for it to complete. */
|
||||
SecurejoinWait,
|
||||
|
||||
/* 1:1 chats info message telling that SecureJoin is still running, but the user may already send messages. */
|
||||
SecurejoinWaitTimeout,
|
||||
|
||||
/* Chat ephemeral message timer is changed. */
|
||||
EphemeralTimerChanged,
|
||||
|
||||
/* Self-sent-message that contains only json used for multi-device-sync; if possible, we attach that to other messages as for locations. */
|
||||
MultiDeviceSync,
|
||||
|
||||
/* Webxdc info added with `info` set in `send_webxdc_status_update()`. */
|
||||
WebxdcInfoMessage,
|
||||
|
||||
/* This message contains a users iroh node address. */
|
||||
IrohNodeAddr,
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public enum Viewtype {
|
||||
Unknown,
|
||||
|
||||
/* Text message. */
|
||||
Text,
|
||||
|
||||
/* Image message. If the image is an animated GIF, the type `Viewtype.Gif` should be used. */
|
||||
Image,
|
||||
|
||||
/* Animated GIF message. */
|
||||
Gif,
|
||||
|
||||
/**
|
||||
* Message containing a sticker, similar to image. NB: When sending, the message viewtype may be changed to `Image` by some heuristics like checking for transparent pixels. Use `Message::force_sticker()` to disable them.
|
||||
* <p>
|
||||
* If possible, the ui should display the image without borders in a transparent way. A click on a sticker will offer to install the sticker set in some future.
|
||||
*/
|
||||
Sticker,
|
||||
|
||||
/* Message containing an Audio file. */
|
||||
Audio,
|
||||
|
||||
/* A voice message that was directly recorded by the user. For all other audio messages, the type `Viewtype.Audio` should be used. */
|
||||
Voice,
|
||||
|
||||
/* Video messages. */
|
||||
Video,
|
||||
|
||||
/* Message containing any file, eg. a PDF. */
|
||||
File,
|
||||
|
||||
/* Message is a call. */
|
||||
Call,
|
||||
|
||||
/* Message is an webxdc instance. */
|
||||
Webxdc,
|
||||
|
||||
/* Message containing shared contacts represented as a vCard (virtual contact file) with email addresses and possibly other fields. Use `parse_vcard()` to retrieve them. */
|
||||
Vcard,
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/* Autogenerated file, do not edit manually */
|
||||
package chat.delta.rpc.types;
|
||||
|
||||
public class WebxdcMessageInfo {
|
||||
/* if the Webxdc represents a document, then this is the name of the document */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String document;
|
||||
/**
|
||||
* App icon file name. Defaults to an standard icon if nothing is set in the manifest.
|
||||
* <p>
|
||||
* To get the file, use dc_msg_get_webxdc_blob(). (not yet in jsonrpc, use rust api or cffi for it)
|
||||
* <p>
|
||||
* App icons should should be square, the implementations will add round corners etc. as needed.
|
||||
*/
|
||||
public String icon;
|
||||
/* True if full internet access should be granted to the app. */
|
||||
public Boolean internetAccess;
|
||||
/**
|
||||
* The name of the app.
|
||||
* <p>
|
||||
* Defaults to the filename if not set in the manifest.
|
||||
*/
|
||||
public String name;
|
||||
/* Address to be used for `window.webxdc.selfAddr` in JS land. */
|
||||
public String selfAddr;
|
||||
/* Milliseconds to wait before calling `sendUpdate()` again since the last call. Should be exposed to `window.sendUpdateInterval` in JS land. */
|
||||
public Integer sendUpdateInterval;
|
||||
/* Maximum number of bytes accepted for a serialized update object. Should be exposed to `window.sendUpdateMaxSize` in JS land. */
|
||||
public Integer sendUpdateMaxSize;
|
||||
/* URL where the source code of the Webxdc and other information can be found; defaults to an empty string. Implementations may offer an menu or a button to open this URL. */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String sourceCodeUrl;
|
||||
/* short string describing the state of the app, sth. as "2 votes", "Highscore: 123", can be changed by the apps */
|
||||
@com.fasterxml.jackson.annotation.JsonSetter(nulls = com.fasterxml.jackson.annotation.Nulls.SET)
|
||||
public String summary;
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class DcAccounts {
|
||||
public native void maybeNetwork ();
|
||||
public native void setPushDeviceToken (String token);
|
||||
public native boolean backgroundFetch (int timeoutSeconds);
|
||||
public native void stopBackgroundFetch ();
|
||||
|
||||
public native int migrateAccount (String dbfile);
|
||||
public native boolean removeAccount (int accountId);
|
||||
|
||||
@@ -68,8 +68,10 @@ public class DcContext {
|
||||
public final static int DC_QR_ERROR = 400;
|
||||
public final static int DC_QR_WITHDRAW_VERIFYCONTACT = 500;
|
||||
public final static int DC_QR_WITHDRAW_VERIFYGROUP = 502;
|
||||
public final static int DC_QR_WITHDRAW_JOINBROADCAST = 504;
|
||||
public final static int DC_QR_REVIVE_VERIFYCONTACT = 510;
|
||||
public final static int DC_QR_REVIVE_VERIFYGROUP = 512;
|
||||
public final static int DC_QR_REVIVE_JOINBROADCAST = 514;
|
||||
public final static int DC_QR_LOGIN = 520;
|
||||
|
||||
public final static int DC_SOCKET_AUTO = 0;
|
||||
|
||||
@@ -132,6 +132,11 @@ public class ApplicationContext extends MultiDexApplication {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 2025.11.12: this is needed until core starts ignoring "delete_server_after" for chatmail
|
||||
if (ac.isChatmail()) {
|
||||
ac.setConfig("delete_server_after", null); // reset
|
||||
}
|
||||
}
|
||||
if (allAccounts.length == 0) {
|
||||
try {
|
||||
|
||||
@@ -785,7 +785,7 @@ public class ConversationFragment extends MessageSelectorFragment
|
||||
&& messageRecord.getText().contains(self_mail)
|
||||
&& getListAdapter().getChat().isDeviceTalk()) {
|
||||
// This is a device message informing the user that the password is wrong
|
||||
startActivity(new Intent(getActivity(), RegistrationActivity.class));
|
||||
startActivity(new Intent(getActivity(), EditTransportActivity.class));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,9 +447,6 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_export_attachment) {
|
||||
handleSaveAttachment();
|
||||
} else if (itemId == R.id.menu_public_bots) {
|
||||
handleShowBot("botsindex@arcanechat.me", "https://i.delta.chat/#67889B0362BEDBFEE05ACD92C1D737FA632A9582&a=botsindex%40arcanechat.me&n=Public%20Bots&i=336MTEz38EH-RJxM9OKWygYK&s=TpVVGK6C4KrJmRG0bwHLalXt");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -508,21 +505,6 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
|
||||
private void handleShowBot(String addr, String qrdata) {
|
||||
final DcContext dcContext = DcHelper.getContext(this);
|
||||
int contactId = dcContext.lookupContactIdByAddr(addr);
|
||||
int chatId = 0;
|
||||
if (contactId!=0 && dcContext.getChatIdByContactId(contactId)!=0) {
|
||||
chatId = dcContext.createChatByContactId(contactId);
|
||||
}
|
||||
if (chatId != 0 && dcContext.getChat(chatId).isEncrypted()) {
|
||||
openConversation(chatId, -1);
|
||||
} else {
|
||||
QrCodeHandler qrCodeHandler = new QrCodeHandler(this);
|
||||
qrCodeHandler.handleQrData(qrdata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateConversation(int chatId) {
|
||||
openConversation(chatId, -1);
|
||||
|
||||
@@ -21,6 +21,7 @@ import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -59,10 +60,6 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
}
|
||||
|
||||
public void setTitle(@NonNull GlideRequests glideRequests, @NonNull DcChat dcChat) {
|
||||
setTitle(glideRequests, dcChat, false);
|
||||
}
|
||||
|
||||
public void setTitle(@NonNull GlideRequests glideRequests, @NonNull DcChat dcChat, boolean profileView) {
|
||||
final int chatId = dcChat.getId();
|
||||
final Context context = getContext();
|
||||
final DcContext dcContext = DcHelper.getContext(context);
|
||||
@@ -74,23 +71,16 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
boolean isOnline = false;
|
||||
int[] chatContacts = dcContext.getChatContacts(chatId);
|
||||
if (dcChat.isMailingList()) {
|
||||
subtitleStr = dcChat.getMailinglistAddr();
|
||||
if (!profileView) {
|
||||
if (TextUtils.isEmpty(subtitleStr)) {
|
||||
subtitleStr = context.getString(R.string.channel);
|
||||
} else {
|
||||
subtitleStr = context.getString(R.string.super_group);
|
||||
}
|
||||
}
|
||||
subtitleStr = context.getString(R.string.mailing_list);
|
||||
} else if (dcChat.isInBroadcast()) {
|
||||
subtitleStr = context.getString(R.string.channel);
|
||||
} else if (dcChat.isOutBroadcast()) {
|
||||
if (!profileView) {
|
||||
subtitleStr = context.getResources().getQuantityString(R.plurals.n_recipients, chatContacts.length, chatContacts.length);
|
||||
}
|
||||
subtitleStr = context.getResources().getQuantityString(R.plurals.n_recipients, chatContacts.length, chatContacts.length);
|
||||
} else if( dcChat.isMultiUser() ) {
|
||||
if (!profileView) {
|
||||
if (chatContacts.length > 1 || Util.contains(chatContacts, DcContact.DC_CONTACT_ID_SELF)) {
|
||||
subtitleStr = context.getResources().getQuantityString(R.plurals.n_members, chatContacts.length, chatContacts.length);
|
||||
} else {
|
||||
subtitleStr = "…";
|
||||
}
|
||||
} else if( chatContacts.length>=1 ) {
|
||||
if( dcChat.isSelfTalk() ) {
|
||||
@@ -102,7 +92,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
else {
|
||||
DcContact dcContact = dcContext.getContact(chatContacts[0]);
|
||||
isOnline = dcContact.wasSeenRecently();
|
||||
if (profileView || !dcChat.isEncrypted()) {
|
||||
if (!dcChat.isEncrypted()) {
|
||||
subtitleStr = dcContact.getAddr();
|
||||
} else if (dcContact.isBot()) {
|
||||
subtitleStr = context.getString(R.string.bot);
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_ADDRESS;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MAIL_PASSWORD;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MAIL_PORT;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MAIL_SECURITY;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MAIL_SERVER;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_MAIL_USER;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_PROXY_ENABLED;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SEND_PASSWORD;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SEND_PORT;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SEND_SECURITY;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SEND_SERVER;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.CONFIG_SEND_USER;
|
||||
import static org.thoughtcrime.securesms.connect.DcHelper.getContext;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
@@ -53,13 +42,15 @@ import org.thoughtcrime.securesms.util.Util;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
import org.thoughtcrime.securesms.util.views.ProgressDialog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import chat.delta.rpc.Rpc;
|
||||
import chat.delta.rpc.RpcException;
|
||||
import chat.delta.rpc.types.EnteredCertificateChecks;
|
||||
import chat.delta.rpc.types.EnteredLoginParam;
|
||||
import chat.delta.rpc.types.Socket;
|
||||
|
||||
public class RegistrationActivity extends BaseActionBarActivity implements DcEventCenter.DcEventDelegate {
|
||||
public class EditTransportActivity extends BaseActionBarActivity implements DcEventCenter.DcEventDelegate {
|
||||
|
||||
private enum VerificationType {
|
||||
EMAIL,
|
||||
@@ -88,12 +79,17 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
|
||||
private SwitchCompat proxySwitch;
|
||||
|
||||
Rpc rpc;
|
||||
int accId;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
dynamicTheme.onCreate(this);
|
||||
rpc = DcHelper.getRpc(this);
|
||||
accId = DcHelper.getContext(this).getAccountId();
|
||||
|
||||
setContentView(R.layout.registration_activity);
|
||||
setContentView(R.layout.activity_edittransport);
|
||||
|
||||
emailInput = findViewById(R.id.email_text);
|
||||
passwordInput = findViewById(R.id.password_text);
|
||||
@@ -122,14 +118,23 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
startActivity(new Intent(this, ProxySettingsActivity.class));
|
||||
});
|
||||
|
||||
EnteredLoginParam config = null;
|
||||
try {
|
||||
List<EnteredLoginParam> relays = rpc.listTransports(accId);
|
||||
if (!relays.isEmpty()) config = relays.get(0);
|
||||
} catch (RpcException ignored) {}
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setTitle(R.string.manual_account_setup_option);
|
||||
actionBar.setTitle(
|
||||
config != null? R.string.edit_transport : R.string.manual_account_setup_option
|
||||
);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
|
||||
actionBar.setElevation(0); // TODO: use custom toolbar instead
|
||||
}
|
||||
|
||||
if (config != null) emailInput.setEnabled(false);
|
||||
emailInput.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) { }
|
||||
@@ -148,68 +153,55 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
advancedIcon.setRotation(45);
|
||||
viewLogText.setOnClickListener((view) -> showLog());
|
||||
|
||||
boolean isConfigured = DcHelper.isConfigured(getApplicationContext());
|
||||
boolean expandAdvanced = false;
|
||||
String strVal;
|
||||
int intVal;
|
||||
|
||||
intVal = DcHelper.getInt(this, CONFIG_PROXY_ENABLED);
|
||||
proxySwitch.setChecked(intVal == 1);
|
||||
expandAdvanced = expandAdvanced || intVal == 1;
|
||||
|
||||
if (isConfigured) {
|
||||
String email = DcHelper.get(this, CONFIG_ADDRESS);
|
||||
emailInput.setText(email);
|
||||
if(!TextUtils.isEmpty(email)) {
|
||||
emailInput.setSelection(email.length(), email.length());
|
||||
if (config != null) { // configured
|
||||
emailInput.setText(config.addr);
|
||||
if(!TextUtils.isEmpty(config.addr)) {
|
||||
emailInput.setSelection(config.addr.length(), config.addr.length());
|
||||
}
|
||||
passwordInput.setText(DcHelper.get(this, CONFIG_MAIL_PASSWORD));
|
||||
passwordInput.setText(config.password);
|
||||
|
||||
TextInputEditText imapLoginInput = findViewById(R.id.imap_login_text);
|
||||
strVal = DcHelper.get(this, CONFIG_MAIL_USER);
|
||||
imapLoginInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
imapLoginInput.setText(config.imapUser);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(config.imapUser);
|
||||
|
||||
strVal = DcHelper.get(this, CONFIG_MAIL_SERVER);
|
||||
imapServerInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
imapServerInput.setText(config.imapServer);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(config.imapServer);
|
||||
|
||||
strVal = DcHelper.get(this, CONFIG_MAIL_PORT);
|
||||
imapPortInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
if (config.imapPort != null) imapPortInput.setText(config.imapPort.toString());
|
||||
expandAdvanced = expandAdvanced || config.imapPort != null;
|
||||
|
||||
intVal = DcHelper.getInt(this, CONFIG_MAIL_SECURITY);
|
||||
intVal = socketSecurityToInt(config.imapSecurity);
|
||||
imapSecurity.setSelection(ViewUtil.checkBounds(intVal, imapSecurity));
|
||||
expandAdvanced = expandAdvanced || intVal != 0;
|
||||
|
||||
TextInputEditText smtpLoginInput = findViewById(R.id.smtp_login_text);
|
||||
strVal = DcHelper.get(this, CONFIG_SEND_USER);
|
||||
smtpLoginInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
smtpLoginInput.setText(config.smtpUser);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(config.smtpUser);
|
||||
|
||||
TextInputEditText smtpPasswordInput = findViewById(R.id.smtp_password_text);
|
||||
strVal = DcHelper.get(this, CONFIG_SEND_PASSWORD);
|
||||
smtpPasswordInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
smtpPasswordInput.setText(config.smtpPassword);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(config.smtpPassword);
|
||||
|
||||
strVal = DcHelper.get(this, CONFIG_SEND_SERVER);
|
||||
smtpServerInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
smtpServerInput.setText(config.smtpServer);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(config.smtpServer);
|
||||
|
||||
strVal = DcHelper.get(this, CONFIG_SEND_PORT);
|
||||
smtpPortInput.setText(strVal);
|
||||
expandAdvanced = expandAdvanced || !TextUtils.isEmpty(strVal);
|
||||
if (config.smtpPort != null) smtpPortInput.setText(config.smtpPort.toString());
|
||||
expandAdvanced = expandAdvanced || config.smtpPort != null;
|
||||
|
||||
intVal = DcHelper.getInt(this, CONFIG_SEND_SECURITY);
|
||||
intVal = socketSecurityToInt(config.smtpSecurity);
|
||||
smtpSecurity.setSelection(ViewUtil.checkBounds(intVal, smtpSecurity));
|
||||
expandAdvanced = expandAdvanced || intVal != 0;
|
||||
|
||||
int imapCertificateChecks = DcHelper.getInt(this, "imap_certificate_checks");
|
||||
if (imapCertificateChecks == 3) {
|
||||
imapCertificateChecks = 2; // 3 is a deprecated alias for 2
|
||||
}
|
||||
certCheck.setSelection(ViewUtil.checkBounds(imapCertificateChecks, certCheck));
|
||||
expandAdvanced = expandAdvanced || imapCertificateChecks != 0;
|
||||
intVal = certificateChecksToInt(config.certificateChecks);
|
||||
certCheck.setSelection(ViewUtil.checkBounds(intVal, certCheck));
|
||||
expandAdvanced = expandAdvanced || intVal != 0;
|
||||
}
|
||||
|
||||
if (expandAdvanced) { onAdvancedSettings(); }
|
||||
@@ -426,6 +418,20 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
throw new IllegalArgumentException("Invalid certificate position: " + position);
|
||||
}
|
||||
|
||||
private int certificateChecksToInt(EnteredCertificateChecks check) {
|
||||
if (check == null) return 0;
|
||||
|
||||
switch (check) {
|
||||
case strict:
|
||||
return 1;
|
||||
case acceptInvalidCertificates:
|
||||
return 2;
|
||||
case automatic:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static Socket socketSecurityFromInt(int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
@@ -440,6 +446,22 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
throw new IllegalArgumentException("Invalid socketSecurity position: " + position);
|
||||
}
|
||||
|
||||
public static int socketSecurityToInt(Socket security) {
|
||||
if (security == null) return 0;
|
||||
|
||||
switch (security) {
|
||||
case ssl:
|
||||
return 1;
|
||||
case starttls:
|
||||
return 2;
|
||||
case plain:
|
||||
return 3;
|
||||
case automatic:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void setupConfig() {
|
||||
DcHelper.getEventCenter(this).captureNextError();
|
||||
|
||||
@@ -458,9 +480,8 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve
|
||||
param.certificateChecks = certificateChecksFromInt(certCheck.getSelectedItemPosition());
|
||||
|
||||
new Thread(() -> {
|
||||
Rpc rpc = DcHelper.getRpc(this);
|
||||
try {
|
||||
rpc.addOrUpdateTransport(DcHelper.getContext(this).getAccountId(), param);
|
||||
rpc.addOrUpdateTransport(accId, param);
|
||||
DcHelper.getEventCenter(this).endCaptureNextError();
|
||||
progressDialog.dismiss();
|
||||
Intent conversationList = new Intent(getApplicationContext(), ConversationListActivity.class);
|
||||
@@ -350,7 +350,7 @@ public class InstantOnboardingActivity extends BaseActionBarActivity implements
|
||||
}
|
||||
|
||||
private void startRegistrationActivity() {
|
||||
Intent intent = new Intent(this, RegistrationActivity.class);
|
||||
Intent intent = new Intent(this, EditTransportActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
|
||||
private DcChatlist itemDataSharedChats;
|
||||
private String itemDataStatusText;
|
||||
private boolean isOutBroadcast;
|
||||
private int memberCount;
|
||||
private int[] memberList;
|
||||
private final Set<Integer> selectedMembers;
|
||||
|
||||
private final LayoutInflater layoutInflater;
|
||||
@@ -205,7 +205,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
|
||||
else if(holder.itemView instanceof ProfileAvatarItem) {
|
||||
ProfileAvatarItem item = (ProfileAvatarItem) holder.itemView;
|
||||
item.setAvatarClickListener(view -> clickListener.onAvatarClicked());
|
||||
item.set(glideRequests, dcChat, dcContact, memberCount);
|
||||
item.set(glideRequests, dcChat, dcContact, memberList);
|
||||
}
|
||||
else if(holder.itemView instanceof ProfileTextItem) {
|
||||
ProfileTextItem item = (ProfileTextItem) holder.itemView;
|
||||
@@ -281,7 +281,7 @@ public class ProfileAdapter extends RecyclerView.Adapter
|
||||
boolean isInBroadcast = dcChat != null && dcChat.isInBroadcast();
|
||||
boolean isSelfTalk = dcChat != null && dcChat.isSelfTalk();
|
||||
boolean isDeviceTalk = dcChat != null && dcChat.isDeviceTalk();
|
||||
memberCount = memberList!=null ? memberList.length : 0;
|
||||
this.memberList = memberList;
|
||||
|
||||
itemData.add(new ItemData(ITEM_AVATAR, null, 0));
|
||||
|
||||
|
||||
@@ -47,8 +47,9 @@ public class ProfileAvatarItem extends LinearLayout implements RecipientModified
|
||||
ViewUtil.setTextViewGravityStart(nameView, getContext());
|
||||
}
|
||||
|
||||
public void set(@NonNull GlideRequests glideRequests, @Nullable DcChat dcChat, @Nullable DcContact dcContact, int memberCount) {
|
||||
public void set(@NonNull GlideRequests glideRequests, @Nullable DcChat dcChat, @Nullable DcContact dcContact, @Nullable int[] members) {
|
||||
this.glideRequests = glideRequests;
|
||||
int memberCount = members != null ? members.length : 0;
|
||||
|
||||
String name = "";
|
||||
String subtitle = null;
|
||||
@@ -61,7 +62,9 @@ public class ProfileAvatarItem extends LinearLayout implements RecipientModified
|
||||
} else if (dcChat.isOutBroadcast()) {
|
||||
subtitle = getContext().getResources().getQuantityString(R.plurals.n_recipients, memberCount, memberCount);
|
||||
} else if (dcChat.getType() == DcChat.DC_CHAT_TYPE_GROUP) {
|
||||
subtitle = getContext().getResources().getQuantityString(R.plurals.n_members, memberCount, memberCount);
|
||||
if (memberCount > 1 || Util.contains(members, DcContact.DC_CONTACT_ID_SELF)) {
|
||||
subtitle = getContext().getResources().getQuantityString(R.plurals.n_members, memberCount, memberCount);
|
||||
}
|
||||
} else if (dcContact != null && !dcChat.isSelfTalk() && !dcChat.isDeviceTalk()) {
|
||||
long timestamp = dcContact.getLastSeen();
|
||||
if (timestamp == 0) {
|
||||
|
||||
@@ -15,14 +15,19 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.webkit.ProxyConfig;
|
||||
import androidx.webkit.ProxyController;
|
||||
import androidx.webkit.WebSettingsCompat;
|
||||
import androidx.webkit.WebViewFeature;
|
||||
|
||||
import org.thoughtcrime.securesms.qr.QrCodeHandler;
|
||||
import org.thoughtcrime.securesms.util.DynamicTheme;
|
||||
import org.thoughtcrime.securesms.util.IntentUtils;
|
||||
import org.thoughtcrime.securesms.util.Util;
|
||||
|
||||
import java.net.IDN;
|
||||
|
||||
public class WebViewActivity extends PassphraseRequiredActionBarActivity
|
||||
implements SearchView.OnQueryTextListener,
|
||||
@@ -32,6 +37,8 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
protected WebView webView;
|
||||
|
||||
protected boolean shouldAskToOpenLink() { return false; }
|
||||
|
||||
protected void toggleFakeProxy(boolean enable) {
|
||||
if (WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE)) {
|
||||
if (enable) {
|
||||
@@ -60,7 +67,7 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
webView = findViewById(R.id.webview);
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
// IMPORTANT: this is will likely not be called inside iframes.
|
||||
// IMPORTANT: this is will likely not be called inside iframes unless target=_blank is used in the anchor/link tag.
|
||||
// `shouldOverrideUrlLoading()` is called when the user clicks a URL,
|
||||
// returning `true` causes the WebView to abort loading the URL,
|
||||
// returning `false` causes the WebView to continue loading the URL as usual.
|
||||
@@ -72,20 +79,8 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
|
||||
// so, to support all systems, for now, using the old one seems to be the simplest way.
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url != null) {
|
||||
String schema = url.split(":")[0].toLowerCase();
|
||||
switch (schema) {
|
||||
case "http":
|
||||
case "https":
|
||||
case "mailto":
|
||||
case "openpgp4fpr":
|
||||
return openOnlineUrl(url);
|
||||
}
|
||||
}
|
||||
// by returning `true`, we also abort loading other URLs in our WebView;
|
||||
// eg. that might be weird or internal protocols.
|
||||
// if we come over really useful things, we should allow that explicitly.
|
||||
return true;
|
||||
if (url != null) return openOnlineUrl(url);
|
||||
return true; // returning `true` aborts loading
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -277,7 +272,28 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
|
||||
// the default behavior (close the activity) is just fine eg. for Webxdc, Connectivity, HTML-mails
|
||||
|
||||
protected boolean openOnlineUrl(String url) {
|
||||
IntentUtils.showInBrowser(this, url);
|
||||
// invite-links should be handled directly
|
||||
String schema = url.split(":")[0].toLowerCase();
|
||||
if (schema.equals("openpgp4fpr") || url.startsWith("https://" + Util.INVITE_DOMAIN + "/")) {
|
||||
new QrCodeHandler(this).handleQrData(url);
|
||||
return true; // abort internal loading
|
||||
}
|
||||
|
||||
if (shouldAskToOpenLink()) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.open_url_confirmation)
|
||||
.setMessage(IDN.toASCII(url))
|
||||
.setNeutralButton(R.string.cancel, null)
|
||||
.setPositiveButton(R.string.open, (d, w) -> IntentUtils.showInBrowser(this, url))
|
||||
.setNegativeButton(R.string.global_menu_edit_copy_desktop, (d, w) -> {
|
||||
Util.writeTextToClipboard(this, url);
|
||||
Toast.makeText(this, R.string.copied_to_clipboard, Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
IntentUtils.showInBrowser(this, url);
|
||||
}
|
||||
|
||||
// returning `true` causes the WebView to abort loading
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -300,6 +300,8 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
|
||||
if (itemId == R.id.menu_add_to_home_screen) {
|
||||
addToHomeScreen(this, dcAppMsg.getId());
|
||||
return true;
|
||||
} else if (itemId == R.id.webxdc_help) {
|
||||
DcHelper.openHelp(this, "#webxdc");
|
||||
} else if (itemId == R.id.source_code) {
|
||||
IntentUtils.showInBrowser(this, sourceCodeUrl);
|
||||
return true;
|
||||
@@ -341,17 +343,23 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldAskToOpenLink() { return true; }
|
||||
|
||||
// This is usually only called when internetAccess == true or for mailto/openpgp4fpr scheme,
|
||||
// because when internetAccess == false, the page is loaded inside an iframe,
|
||||
// and WebViewClient.shouldOverrideUrlLoading is not called for HTTP(S) links inside the iframe
|
||||
// and WebViewClient.shouldOverrideUrlLoading is not called for HTTP(S) links inside the iframe unless target=_blank is used
|
||||
@Override
|
||||
protected boolean openOnlineUrl(String url) {
|
||||
Log.i(TAG, "openOnlineUrl: " + url);
|
||||
boolean openExternally = !internetAccess && !url.startsWith(baseURL +"/");
|
||||
if (openExternally || url.startsWith("mailto:") || url.startsWith("openpgp4fpr:")) {
|
||||
return super.openOnlineUrl(url);
|
||||
|
||||
// if there is internet access, allow internal loading of http
|
||||
if (internetAccess && url.startsWith("http")) {
|
||||
// returning `false` continues loading in WebView; returning `true` let WebView abort loading
|
||||
return false;
|
||||
}
|
||||
return false; // continue loading in the WebView
|
||||
|
||||
return super.openOnlineUrl(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,19 +49,7 @@ public class DcHelper {
|
||||
|
||||
private static final String TAG = DcHelper.class.getSimpleName();
|
||||
|
||||
public static final String CONFIG_ADDRESS = "addr";
|
||||
public static final String CONFIG_CONFIGURED_ADDRESS = "configured_addr";
|
||||
public static final String CONFIG_MAIL_SERVER = "mail_server";
|
||||
public static final String CONFIG_MAIL_USER = "mail_user";
|
||||
public static final String CONFIG_MAIL_PASSWORD = "mail_pw";
|
||||
public static final String CONFIG_MAIL_PORT = "mail_port";
|
||||
public static final String CONFIG_MAIL_SECURITY = "mail_security";
|
||||
public static final String CONFIG_SEND_SERVER = "send_server";
|
||||
public static final String CONFIG_SEND_USER = "send_user";
|
||||
public static final String CONFIG_SEND_PASSWORD = "send_pw";
|
||||
public static final String CONFIG_SEND_PORT = "send_port";
|
||||
public static final String CONFIG_SEND_SECURITY = "send_security";
|
||||
public static final String CONFIG_SERVER_FLAGS = "server_flags";
|
||||
public static final String CONFIG_DISPLAY_NAME = "displayname";
|
||||
public static final String CONFIG_SELF_STATUS = "selfstatus";
|
||||
public static final String CONFIG_SELF_AVATAR = "selfavatar";
|
||||
@@ -171,6 +159,11 @@ public class DcHelper {
|
||||
dcContext.setStockTranslation(118, context.getString(R.string.secure_join_replies));
|
||||
dcContext.setStockTranslation(119, context.getString(R.string.qrshow_join_contact_hint));
|
||||
|
||||
// HACK: svg does not handle entities correctly and shows `"` as the text `quot;`.
|
||||
// until that is fixed, we fix the most obvious errors (core uses encode_minimal, so this does not affect so many characters)
|
||||
// cmp. https://github.com/deltachat/deltachat-android/issues/2187
|
||||
dcContext.setStockTranslation(120, context.getString(R.string.qrshow_join_group_hint).replace("\"", ""));
|
||||
dcContext.setStockTranslation(121, context.getString(R.string.connectivity_not_connected));
|
||||
dcContext.setStockTranslation(124, context.getString(R.string.group_name_changed_by_you));
|
||||
dcContext.setStockTranslation(125, context.getString(R.string.group_name_changed_by_other));
|
||||
dcContext.setStockTranslation(126, context.getString(R.string.group_image_changed_by_you));
|
||||
@@ -189,8 +182,6 @@ public class DcHelper {
|
||||
dcContext.setStockTranslation(139, context.getString(R.string.ephemeral_timer_disabled_by_other));
|
||||
dcContext.setStockTranslation(140, context.getString(R.string.ephemeral_timer_seconds_by_you));
|
||||
dcContext.setStockTranslation(141, context.getString(R.string.ephemeral_timer_seconds_by_other));
|
||||
dcContext.setStockTranslation(142, context.getString(R.string.ephemeral_timer_1_minute_by_you));
|
||||
dcContext.setStockTranslation(143, context.getString(R.string.ephemeral_timer_1_minute_by_other));
|
||||
dcContext.setStockTranslation(144, context.getString(R.string.ephemeral_timer_1_hour_by_you));
|
||||
dcContext.setStockTranslation(145, context.getString(R.string.ephemeral_timer_1_hour_by_other));
|
||||
dcContext.setStockTranslation(146, context.getString(R.string.ephemeral_timer_1_day_by_you));
|
||||
@@ -207,12 +198,6 @@ public class DcHelper {
|
||||
dcContext.setStockTranslation(157, context.getString(R.string.ephemeral_timer_weeks_by_other));
|
||||
dcContext.setStockTranslation(158, context.getString(R.string.ephemeral_timer_1_year_by_you));
|
||||
dcContext.setStockTranslation(159, context.getString(R.string.ephemeral_timer_1_year_by_other));
|
||||
|
||||
// HACK: svg does not handle entities correctly and shows `"` as the text `quot;`.
|
||||
// until that is fixed, we fix the most obvious errors (core uses encode_minimal, so this does not affect so many characters)
|
||||
// cmp. https://github.com/deltachat/deltachat-android/issues/2187
|
||||
dcContext.setStockTranslation(120, context.getString(R.string.qrshow_join_group_hint).replace("\"", ""));
|
||||
dcContext.setStockTranslation(121, context.getString(R.string.connectivity_not_connected));
|
||||
dcContext.setStockTranslation(162, context.getString(R.string.multidevice_qr_subtitle));
|
||||
dcContext.setStockTranslation(163, context.getString(R.string.multidevice_transfer_done_devicemsg));
|
||||
dcContext.setStockTranslation(170, context.getString(R.string.chat_protection_enabled_tap_to_learn_more));
|
||||
@@ -221,6 +206,7 @@ public class DcHelper {
|
||||
dcContext.setStockTranslation(174, context.getString(R.string.invalid_unencrypted_tap_to_learn_more));
|
||||
dcContext.setStockTranslation(176, context.getString(R.string.reaction_by_you));
|
||||
dcContext.setStockTranslation(177, context.getString(R.string.reaction_by_other));
|
||||
dcContext.setStockTranslation(178, context.getString(R.string.member_x_removed));
|
||||
dcContext.setStockTranslation(190, context.getString(R.string.secure_join_wait));
|
||||
dcContext.setStockTranslation(193, context.getString(R.string.donate_device_msg));
|
||||
dcContext.setStockTranslation(194, context.getString(R.string.outgoing_call));
|
||||
@@ -228,6 +214,14 @@ public class DcHelper {
|
||||
dcContext.setStockTranslation(196, context.getString(R.string.declined_call));
|
||||
dcContext.setStockTranslation(197, context.getString(R.string.canceled_call));
|
||||
dcContext.setStockTranslation(198, context.getString(R.string.missed_call));
|
||||
dcContext.setStockTranslation(200, context.getString(R.string.channel_left_by_you));
|
||||
dcContext.setStockTranslation(201, context.getString(R.string.qrshow_join_channel_hint));
|
||||
dcContext.setStockTranslation(202, context.getString(R.string.you_joined_the_channel));
|
||||
dcContext.setStockTranslation(203, context.getString(R.string.secure_join_channel_started));
|
||||
dcContext.setStockTranslation(210, context.getString(R.string.stats_msg_body));
|
||||
dcContext.setStockTranslation(220, context.getString(R.string.proxy_enabled));
|
||||
dcContext.setStockTranslation(221, context.getString(R.string.proxy_enabled_hint));
|
||||
dcContext.setStockTranslation(230, context.getString(R.string.chat_unencrypted_explanation));
|
||||
}
|
||||
|
||||
public static File getImexDir() {
|
||||
|
||||
@@ -5,9 +5,12 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.location.Location;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
|
||||
import java.util.LinkedList;
|
||||
@@ -23,11 +26,13 @@ public class DcLocationManager implements Observer {
|
||||
private final Context context;
|
||||
private DcLocation dcLocation = DcLocation.getInstance();
|
||||
private final LinkedList<Integer> pendingShareLastLocation = new LinkedList<>();
|
||||
private boolean serviceBound = false;
|
||||
private final ServiceConnection serviceConnection = new ServiceConnection() {
|
||||
@Override
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
Log.d(TAG, "background service connected");
|
||||
serviceBinder = (LocationBackgroundService.LocationBackgroundServiceBinder) service;
|
||||
serviceBound = true;
|
||||
while (!pendingShareLastLocation.isEmpty()) {
|
||||
shareLastLocation(pendingShareLastLocation.pop());
|
||||
}
|
||||
@@ -37,6 +42,7 @@ public class DcLocationManager implements Observer {
|
||||
public void onServiceDisconnected(ComponentName name) {
|
||||
Log.d(TAG, "background service disconnected");
|
||||
serviceBinder = null;
|
||||
serviceBound = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -49,19 +55,29 @@ public class DcLocationManager implements Observer {
|
||||
}
|
||||
|
||||
public void startLocationEngine() {
|
||||
if (serviceBinder == null) {
|
||||
if (serviceBinder == null || !serviceBound) {
|
||||
Intent intent = new Intent(context.getApplicationContext(), LocationBackgroundService.class);
|
||||
// Start as foreground service
|
||||
ContextCompat.startForegroundService(context, intent);
|
||||
// Then bind to it
|
||||
context.bindService(intent, serviceConnection, BIND_AUTO_CREATE);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopLocationEngine() {
|
||||
if (serviceBinder == null) {
|
||||
if (serviceBinder == null || !serviceBound) {
|
||||
return;
|
||||
}
|
||||
context.unbindService(serviceConnection);
|
||||
serviceBinder.stop();
|
||||
try {
|
||||
context.unbindService(serviceConnection);
|
||||
if (serviceBinder != null) {
|
||||
serviceBinder.stop();
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.w(TAG, "Service not registered", e);
|
||||
}
|
||||
serviceBinder = null;
|
||||
serviceBound = false;
|
||||
}
|
||||
|
||||
public void stopSharingLocation(int chatId) {
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
package org.thoughtcrime.securesms.geolocation;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.ServiceInfo;
|
||||
import android.location.Location;
|
||||
import android.location.LocationListener;
|
||||
import android.location.LocationManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.ServiceCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.location.LocationListenerCompat;
|
||||
import androidx.core.location.LocationManagerCompat;
|
||||
import androidx.core.location.LocationRequestCompat;
|
||||
|
||||
import org.thoughtcrime.securesms.ConversationListActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationCenter;
|
||||
import org.thoughtcrime.securesms.util.IntentUtils;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class LocationBackgroundService extends Service {
|
||||
|
||||
@@ -22,6 +40,7 @@ public class LocationBackgroundService extends Service {
|
||||
private static final int LOCATION_INTERVAL = 1000;
|
||||
private static final float LOCATION_DISTANCE = 25F;
|
||||
ServiceLocationListener locationListener;
|
||||
private final AtomicBoolean isForeground = new AtomicBoolean(false);
|
||||
|
||||
private final IBinder mBinder = new LocationBackgroundServiceBinder();
|
||||
|
||||
@@ -37,12 +56,21 @@ public class LocationBackgroundService extends Service {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
|
||||
locationManager = (LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
|
||||
if (locationManager == null) {
|
||||
Log.e(TAG, "Unable to initialize location service");
|
||||
// Must start foreground to avoid crash, then stop immediately
|
||||
initializeForegroundService();
|
||||
stopForeground(true);
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize foreground service after successful location manager setup
|
||||
initializeForegroundService();
|
||||
|
||||
locationListener = new ServiceLocationListener();
|
||||
Location lastLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
|
||||
if (lastLocation != null) {
|
||||
@@ -51,14 +79,19 @@ public class LocationBackgroundService extends Service {
|
||||
DcLocation.getInstance().updateLocation(lastLocation);
|
||||
}
|
||||
}
|
||||
//requestLocationUpdate(LocationManager.NETWORK_PROVIDER);
|
||||
// Request location updates from both GPS and network providers for better coverage
|
||||
requestLocationUpdate(LocationManager.GPS_PROVIDER);
|
||||
requestLocationUpdate(LocationManager.NETWORK_PROVIDER);
|
||||
initialLocationUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
super.onStartCommand(intent, flags, startId);
|
||||
|
||||
// Ensure foreground notification is shown (handles edge cases)
|
||||
initializeForegroundService();
|
||||
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@@ -66,23 +99,93 @@ public class LocationBackgroundService extends Service {
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (locationManager == null) {
|
||||
// Stop foreground notification
|
||||
stopForeground(true);
|
||||
|
||||
if (locationManager == null || locationListener == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
locationManager.removeUpdates(locationListener);
|
||||
LocationManagerCompat.removeUpdates(locationManager, locationListener);
|
||||
} catch (Exception ex) {
|
||||
Log.i(TAG, "fail to remove location listeners, ignore", ex);
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeForegroundService() {
|
||||
if (isForeground.compareAndSet(false, true)) {
|
||||
createNotificationChannel();
|
||||
Notification notification = createNotification();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
|
||||
// Android 14+ requires foregroundServiceType in startForeground
|
||||
ServiceCompat.startForeground(this, NotificationCenter.ID_LOCATION, notification,
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION);
|
||||
} else {
|
||||
startForeground(NotificationCenter.ID_LOCATION, notification);
|
||||
}
|
||||
Log.d(TAG, "Foreground service started with notification");
|
||||
}
|
||||
}
|
||||
|
||||
private void createNotificationChannel() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannel channel = new NotificationChannel(
|
||||
NotificationCenter.CH_LOCATION,
|
||||
getString(R.string.location),
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
);
|
||||
channel.setDescription("Location sharing notification");
|
||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||
if (notificationManager != null) {
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Notification createNotification() {
|
||||
Intent intent = new Intent(this, ConversationListActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(
|
||||
this,
|
||||
0,
|
||||
intent,
|
||||
IntentUtils.FLAG_IMMUTABLE()
|
||||
);
|
||||
|
||||
return new NotificationCompat.Builder(this, NotificationCenter.CH_LOCATION)
|
||||
.setContentTitle(getString(R.string.location_sharing_notification_title))
|
||||
.setContentText(getString(R.string.location_sharing_notification_text))
|
||||
.setSmallIcon(R.drawable.ic_location_on_white_24dp)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setOngoing(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_LOW)
|
||||
.build();
|
||||
}
|
||||
|
||||
private void requestLocationUpdate(String provider) {
|
||||
try {
|
||||
locationManager.requestLocationUpdates(
|
||||
provider, LOCATION_INTERVAL, LOCATION_DISTANCE,
|
||||
locationListener);
|
||||
} catch (SecurityException | IllegalArgumentException ex) {
|
||||
// Check if provider is available
|
||||
if (!locationManager.isProviderEnabled(provider)) {
|
||||
Log.w(TAG, String.format("Provider %s is not enabled", provider));
|
||||
return;
|
||||
}
|
||||
|
||||
// Use LocationManagerCompat for better compatibility with modern Android
|
||||
LocationRequestCompat locationRequest = new LocationRequestCompat.Builder(LOCATION_INTERVAL)
|
||||
.setMinUpdateDistanceMeters(LOCATION_DISTANCE)
|
||||
.setQuality(LocationRequestCompat.QUALITY_HIGH_ACCURACY)
|
||||
.build();
|
||||
|
||||
Executor executor = ContextCompat.getMainExecutor(this);
|
||||
LocationManagerCompat.requestLocationUpdates(
|
||||
locationManager,
|
||||
provider,
|
||||
locationRequest,
|
||||
executor,
|
||||
locationListener
|
||||
);
|
||||
Log.d(TAG, String.format("Requested location updates from %s provider", provider));
|
||||
} catch (SecurityException | IllegalArgumentException ex) {
|
||||
Log.e(TAG, String.format("Unable to request %s provider based location updates.", provider), ex);
|
||||
}
|
||||
}
|
||||
@@ -93,9 +196,16 @@ public class LocationBackgroundService extends Service {
|
||||
if (gpsLocation != null && System.currentTimeMillis() - gpsLocation.getTime() < INITIAL_TIMEOUT) {
|
||||
locationListener.onLocationChanged(gpsLocation);
|
||||
}
|
||||
|
||||
// Also try network provider for initial location
|
||||
Location networkLocation = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
|
||||
if (networkLocation != null && System.currentTimeMillis() - networkLocation.getTime() < INITIAL_TIMEOUT) {
|
||||
// Use network location if GPS location is not available or network location is newer
|
||||
if (gpsLocation == null || networkLocation.getTime() > gpsLocation.getTime()) {
|
||||
locationListener.onLocationChanged(networkLocation);
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException | SecurityException e) {
|
||||
e.printStackTrace();
|
||||
Log.e(TAG, "Error getting initial location", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,30 +220,22 @@ public class LocationBackgroundService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
private class ServiceLocationListener implements LocationListener {
|
||||
private class ServiceLocationListener implements LocationListenerCompat {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NonNull Location location) {
|
||||
Log.d(TAG, "onLocationChanged: " + location);
|
||||
if (location == null) {
|
||||
return;
|
||||
}
|
||||
DcLocation.getInstance().updateLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderDisabled(@NonNull String provider) {
|
||||
Log.e(TAG, "onProviderDisabled: " + provider);
|
||||
Log.w(TAG, "onProviderDisabled: " + provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProviderEnabled(@NonNull String provider) {
|
||||
Log.e(TAG, "onProviderEnabled: " + provider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(String provider, int status, Bundle extras) {
|
||||
Log.e(TAG, "onStatusChanged: " + provider + " status: " + status);
|
||||
Log.d(TAG, "onProviderEnabled: " + provider);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -484,7 +484,7 @@ public class AttachmentManager {
|
||||
// for rationale dialog requirements
|
||||
Permissions.PermissionsBuilder permissionsBuilder = Permissions.with(activity)
|
||||
.ifNecessary()
|
||||
.withRationaleDialog("To share your live location with chat members, allow ArcaneChat to use your location data.\n\nTo make live location work gaplessly, location data is used even when the app is closed or not in use.", R.drawable.ic_location_on_white_24dp)
|
||||
.withRationaleDialog("To share your live location with chat members, allow ArcaneChat to use your location data.", R.drawable.ic_location_on_white_24dp)
|
||||
.withPermanentDenialDialog(activity.getString(R.string.perm_explain_access_to_location_denied))
|
||||
.onAllGranted(() -> {
|
||||
ShareLocationDialog.show(activity, durationInSeconds -> {
|
||||
@@ -495,11 +495,7 @@ public class AttachmentManager {
|
||||
}
|
||||
});
|
||||
});
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
|
||||
permissionsBuilder.request(Manifest.permission.ACCESS_BACKGROUND_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||
} else {
|
||||
permissionsBuilder.request(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||
}
|
||||
permissionsBuilder.request(Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);
|
||||
permissionsBuilder.execute();
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ public class NotificationCenter {
|
||||
public static final int ID_MSG_SUMMARY = 2;
|
||||
public static final int ID_GENERIC = 3;
|
||||
public static final int ID_FETCH = 4;
|
||||
public static final int ID_LOCATION = 5;
|
||||
public static final int ID_MSG_OFFSET = 0; // msgId is added - as msgId start at 10, there are no conflicts with lower numbers
|
||||
|
||||
|
||||
@@ -243,6 +244,7 @@ public class NotificationCenter {
|
||||
public static final String CH_MSG_VERSION = "5";
|
||||
public static final String CH_PERMANENT = "dc_fg_notification_ch";
|
||||
public static final String CH_GENERIC = "ch_generic";
|
||||
public static final String CH_LOCATION = "ch_location";
|
||||
public static final String CH_CALLS_PREFIX = "call_chan";
|
||||
|
||||
private boolean notificationChannelsSupported() {
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
|
||||
import org.thoughtcrime.securesms.ConversationActivity;
|
||||
import org.thoughtcrime.securesms.LogViewActivity;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.RegistrationActivity;
|
||||
import org.thoughtcrime.securesms.EditTransportActivity;
|
||||
import org.thoughtcrime.securesms.connect.DcEventCenter;
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.proxy.ProxySettingsActivity;
|
||||
@@ -56,7 +56,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
private static final String TAG = AdvancedPreferenceFragment.class.getSimpleName();
|
||||
|
||||
private ListPreference showEmails;
|
||||
CheckBoxPreference bccSelfCheckbox;
|
||||
CheckBoxPreference multiDeviceCheckbox;
|
||||
CheckBoxPreference mvboxMoveCheckbox;
|
||||
CheckBoxPreference onlyFetchMvboxCheckbox;
|
||||
CheckBoxPreference webxdcRealtimeCheckbox;
|
||||
@@ -74,17 +74,24 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
});
|
||||
}
|
||||
|
||||
Preference sendAsm = this.findPreference("pref_send_autocrypt_setup_message");
|
||||
if (sendAsm != null) {
|
||||
sendAsm.setOnPreferenceClickListener(new SendAsmListener());
|
||||
}
|
||||
|
||||
bccSelfCheckbox = (CheckBoxPreference) this.findPreference("pref_bcc_self");
|
||||
if (bccSelfCheckbox != null) {
|
||||
bccSelfCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
multiDeviceCheckbox = (CheckBoxPreference) this.findPreference("pref_bcc_self");
|
||||
if (multiDeviceCheckbox != null) {
|
||||
multiDeviceCheckbox.setOnPreferenceChangeListener((preference, newValue) -> {
|
||||
boolean enabled = (Boolean) newValue;
|
||||
dcContext.setConfigInt(CONFIG_BCC_SELF, enabled? 1 : 0);
|
||||
return true;
|
||||
if (enabled) {
|
||||
dcContext.setConfigInt(CONFIG_BCC_SELF, 1);
|
||||
return true;
|
||||
} else {
|
||||
new AlertDialog.Builder(requireContext())
|
||||
.setMessage(R.string.pref_multidevice_change_warn)
|
||||
.setPositiveButton(R.string.ok, (dialogInterface, i) -> {
|
||||
dcContext.setConfigInt(CONFIG_BCC_SELF, 0);
|
||||
((CheckBoxPreference)preference).setChecked(false);
|
||||
})
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -157,7 +164,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
Preference passwordAndAccount = this.findPreference("password_account_settings_button");
|
||||
if (passwordAndAccount != null) {
|
||||
passwordAndAccount.setOnPreferenceClickListener(((preference) -> {
|
||||
boolean result = ScreenLockUtil.applyScreenLock(requireActivity(), getString(R.string.pref_password_and_account_settings), getString(R.string.enter_system_secret_to_continue), REQUEST_CODE_CONFIRM_CREDENTIALS_ACCOUNT);
|
||||
boolean result = ScreenLockUtil.applyScreenLock(requireActivity(), getString(R.string.edit_transport), getString(R.string.enter_system_secret_to_continue), REQUEST_CODE_CONFIRM_CREDENTIALS_ACCOUNT);
|
||||
if (!result) {
|
||||
openRegistrationActivity();
|
||||
}
|
||||
@@ -166,9 +173,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
}
|
||||
|
||||
if (dcContext.isChatmail()) {
|
||||
sendAsm.setVisible(false);
|
||||
showEmails.setVisible(false);
|
||||
bccSelfCheckbox.setVisible(false);
|
||||
mvboxMoveCheckbox.setVisible(false);
|
||||
onlyFetchMvboxCheckbox.setVisible(false);
|
||||
}
|
||||
@@ -188,7 +193,7 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
showEmails.setValue(value);
|
||||
updateListSummary(showEmails, value);
|
||||
|
||||
bccSelfCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
|
||||
multiDeviceCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_BCC_SELF));
|
||||
mvboxMoveCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_MVBOX_MOVE));
|
||||
onlyFetchMvboxCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_ONLY_FETCH_MVBOX));
|
||||
webxdcRealtimeCheckbox.setChecked(0!=dcContext.getConfigInt(CONFIG_WEBXDC_REALTIME_ENABLED));
|
||||
@@ -266,44 +271,8 @@ public class AdvancedPreferenceFragment extends ListSummaryPreferenceFragment
|
||||
}
|
||||
|
||||
private void openRegistrationActivity() {
|
||||
Intent intent = new Intent(requireActivity(), RegistrationActivity.class);
|
||||
Intent intent = new Intent(requireActivity(), EditTransportActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
/***********************************************************************************************
|
||||
* Autocrypt
|
||||
**********************************************************************************************/
|
||||
|
||||
private class SendAsmListener implements Preference.OnPreferenceClickListener {
|
||||
@Override
|
||||
public boolean onPreferenceClick(@NonNull Preference preference) {
|
||||
Activity activity = requireActivity();
|
||||
new AlertDialog.Builder(activity)
|
||||
.setTitle(activity.getString(R.string.autocrypt_send_asm_title))
|
||||
.setMessage(activity.getString(R.string.autocrypt_send_asm_explain_before))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(R.string.autocrypt_send_asm_button, (dialog, which) -> {
|
||||
final String sc = dcContext.initiateKeyTransfer();
|
||||
if( sc != null ) {
|
||||
String scFormatted = "";
|
||||
try {
|
||||
scFormatted = sc.substring(0, 4) + " - " + sc.substring(5, 9) + " - " + sc.substring(10, 14) + " -\n\n" +
|
||||
sc.substring(15, 19) + " - " + sc.substring(20, 24) + " - " + sc.substring(25, 29) + " -\n\n" +
|
||||
sc.substring(30, 34) + " - " + sc.substring(35, 39) + " - " + sc.substring(40, 44);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "Unexpected exception", e);
|
||||
}
|
||||
new AlertDialog.Builder(activity)
|
||||
.setTitle(activity.getString(R.string.autocrypt_send_asm_title))
|
||||
.setMessage(activity.getString(R.string.autocrypt_send_asm_explain_after) + "\n\n" + scFormatted)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.setCancelable(false) // prevent the dialog from being dismissed accidentally (when the dialog is closed, the setup code is gone forever and the user has to create a new setup message)
|
||||
.show();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -153,12 +153,11 @@ public class ChatsPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
.ifNecessary()
|
||||
.withPermanentDenialDialog(getString(R.string.perm_explain_access_to_storage_denied))
|
||||
.onAllGranted(() -> {
|
||||
final String addr = DcHelper.get(getActivity(), DcHelper.CONFIG_CONFIGURED_ADDRESS);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity())
|
||||
.setTitle(R.string.pref_backup)
|
||||
.setMessage(R.string.pref_backup_export_explain)
|
||||
.setNeutralButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(requireActivity().getString(R.string.pref_backup_export_this, addr), (dialogInterface, i) -> startImexOne(DcContext.DC_IMEX_EXPORT_BACKUP));
|
||||
.setPositiveButton(R.string.pref_backup_export_this, (dialogInterface, i) -> startImexOne(DcContext.DC_IMEX_EXPORT_BACKUP));
|
||||
int[] allAccounts = DcHelper.getAccounts(requireActivity()).getAll();
|
||||
if (allAccounts.length > 1) {
|
||||
String exportAllString = requireActivity().getString(R.string.pref_backup_export_all, allAccounts.length);
|
||||
|
||||
@@ -57,11 +57,7 @@ public class PrivacyPreferenceFragment extends ListSummaryPreferenceFragment {
|
||||
autoDelServer = findPreference("autodel_server");
|
||||
autoDelServer.setOnPreferenceChangeListener(new AutodelChangeListener("delete_server_after"));
|
||||
if (dcContext.isChatmail()) {
|
||||
autoDelServer.setEntries(new CharSequence[]{getString(R.string.automatic), getString(R.string.autodel_at_once)});
|
||||
autoDelServer.setEntryValues(new CharSequence[]{"0", "1"});
|
||||
if (dcContext.getConfigInt("delete_server_after") > 1) {
|
||||
dcContext.setConfigInt("delete_server_after", 0 /*never/automatic*/);
|
||||
}
|
||||
autoDelServer.setVisible(false);
|
||||
}
|
||||
|
||||
Preference screenSecurity = this.findPreference(Prefs.SCREEN_SECURITY_PREF);
|
||||
|
||||
@@ -112,8 +112,10 @@ public class QrCodeHandler {
|
||||
|
||||
case DcContext.DC_QR_WITHDRAW_VERIFYCONTACT:
|
||||
case DcContext.DC_QR_WITHDRAW_VERIFYGROUP:
|
||||
case DcContext.DC_QR_WITHDRAW_JOINBROADCAST:
|
||||
String message = qrParsed.getState() == DcContext.DC_QR_WITHDRAW_VERIFYCONTACT ? activity.getString(R.string.withdraw_verifycontact_explain)
|
||||
: activity.getString(R.string.withdraw_verifygroup_explain, qrParsed.getText1());
|
||||
: qrParsed.getState() == DcContext.DC_QR_WITHDRAW_VERIFYCONTACT ? activity.getString(R.string.withdraw_verifygroup_explain, qrParsed.getText1())
|
||||
: activity.getString(R.string.withdraw_joinbroadcast_explain, qrParsed.getText1());
|
||||
builder.setTitle(R.string.qrshow_title);
|
||||
builder.setMessage(message);
|
||||
builder.setNeutralButton(R.string.reset, (dialog, which) -> {
|
||||
@@ -126,6 +128,7 @@ public class QrCodeHandler {
|
||||
|
||||
case DcContext.DC_QR_REVIVE_VERIFYCONTACT:
|
||||
case DcContext.DC_QR_REVIVE_VERIFYGROUP:
|
||||
case DcContext.DC_QR_REVIVE_JOINBROADCAST:
|
||||
builder.setTitle(R.string.qrshow_title);
|
||||
builder.setMessage(activity.getString(R.string.revive_verifycontact_explain));
|
||||
builder.setNeutralButton(R.string.revive_qr_code, (dialog, which) -> {
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.b44t.messenger.DcEvent;
|
||||
import com.caverock.androidsvg.SVG;
|
||||
@@ -144,8 +145,17 @@ public class QrShowFragment extends Fragment implements DcEventCenter.DcEventDel
|
||||
|
||||
public void withdrawQr() {
|
||||
Activity activity = getActivity();
|
||||
String message = chatId == 0 ? activity.getString(R.string.withdraw_verifycontact_explain)
|
||||
: activity.getString(R.string.withdraw_verifygroup_explain, dcContext.getChat(chatId).getName());
|
||||
String message;
|
||||
if (chatId == 0) {
|
||||
message = activity.getString(R.string.withdraw_verifycontact_explain);
|
||||
} else {
|
||||
DcChat chat = dcContext.getChat(chatId);
|
||||
if (chat.getType() == DcChat.DC_CHAT_TYPE_GROUP) {
|
||||
message = activity.getString(R.string.withdraw_verifygroup_explain, chat.getName());
|
||||
} else {
|
||||
message = activity.getString(R.string.withdraw_joinbroadcast_explain, chat.getName());
|
||||
}
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle(R.string.withdraw_qr_code);
|
||||
builder.setMessage(message);
|
||||
|
||||
@@ -108,4 +108,11 @@ public final class FetchForegroundService extends Service {
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeout(int startId, int fgsType) {
|
||||
ApplicationContext.dcAccounts.stopBackgroundFetch();
|
||||
stopSelf();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,4 +39,12 @@ public class IntentUtils {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static int FLAG_IMMUTABLE() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
return PendingIntent.FLAG_IMMUTABLE;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.util.Linkify;
|
||||
@@ -10,8 +11,28 @@ import java.util.regex.Pattern;
|
||||
/* Utility for text linkify-ing */
|
||||
public class Linkifier {
|
||||
private static final Pattern CMD_PATTERN = Pattern.compile("(?<=^|\\s)/[a-zA-Z][a-zA-Z@\\d_/.-]{0,254}");
|
||||
private static final Pattern CUSTOM_PATTERN = Pattern.compile("(?<=^|\\s)(OPENPGP4FPR|openpgp4fpr|mumble):[^ \\n]+");
|
||||
private static final Pattern CUSTOM_PATTERN = Pattern.compile("(?<=^|\\s)(OPENPGP4FPR|openpgp4fpr|mumble|geo|gemini):[^ \\n]+");
|
||||
private static final Pattern PROXY_PATTERN = Pattern.compile("(?<=^|\\s)(SOCKS5|socks5|ss|SS):[^ \\n]+");
|
||||
private static final Pattern PHONE_PATTERN
|
||||
= Pattern.compile( // sdd = space, dot, or dash
|
||||
"(?<=^|\\s|\\.|\\()" // no letter at start
|
||||
+ "(\\+[0-9]+[\\- \\.]*)?" // +<digits><sdd>*
|
||||
+ "(\\([0-9]+\\)[\\- \\.]*)?" // (<digits>)<sdd>*
|
||||
+ "([0-9][0-9\\- \\.]{3,}[0-9])" // <digit><digit|sdd>+<digit> (5 characters min)
|
||||
+ "(?=$|\\s|\\.|\\))"); // no letter at end
|
||||
|
||||
private static int brokenPhoneLinkifier = -1;
|
||||
|
||||
private static boolean internalPhoneLinkifierNeeded() {
|
||||
if (brokenPhoneLinkifier == -1) { // unset
|
||||
if(Linkify.addLinks(new SpannableString("a100b"), Linkify.PHONE_NUMBERS)) {
|
||||
brokenPhoneLinkifier = 1; // true
|
||||
} else {
|
||||
brokenPhoneLinkifier = 0; // false
|
||||
}
|
||||
}
|
||||
return brokenPhoneLinkifier == 1;
|
||||
}
|
||||
|
||||
private static void replaceURLSpan(Spannable messageBody) {
|
||||
URLSpan[] urlSpans = messageBody.getSpans(0, messageBody.length(), URLSpan.class);
|
||||
@@ -36,8 +57,18 @@ public class Linkifier {
|
||||
replaceURLSpan(messageBody); // replace URLSpan so that it is not removed on the next addLinks() call
|
||||
}
|
||||
|
||||
int flags;
|
||||
if (internalPhoneLinkifierNeeded()) {
|
||||
if (Linkify.addLinks(messageBody, PHONE_PATTERN, "tel:", Linkify.sPhoneNumberMatchFilter, Linkify.sPhoneNumberTransformFilter)) {
|
||||
replaceURLSpan(messageBody); // replace URLSpan so that it is not removed on the next addLinks() call
|
||||
}
|
||||
flags = Linkify.EMAIL_ADDRESSES|Linkify.WEB_URLS;
|
||||
} else {
|
||||
flags = Linkify.EMAIL_ADDRESSES|Linkify.WEB_URLS|Linkify.PHONE_NUMBERS;
|
||||
}
|
||||
|
||||
// linkyfiy urls etc., this removes all existing URLSpan
|
||||
if (Linkify.addLinks(messageBody, Linkify.EMAIL_ADDRESSES|Linkify.WEB_URLS|Linkify.PHONE_NUMBERS)) {
|
||||
if (Linkify.addLinks(messageBody, flags)) {
|
||||
replaceURLSpan(messageBody);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
|
||||
public class Util {
|
||||
private static final String TAG = Util.class.getSimpleName();
|
||||
private static final String INVITE_DOMAIN = "i.delta.chat";
|
||||
public static final String INVITE_DOMAIN = "i.delta.chat";
|
||||
|
||||
public static final Handler handler = new Handler(Looper.getMainLooper());
|
||||
|
||||
@@ -126,6 +126,18 @@ public class Util {
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static boolean contains(@Nullable int[] array, int val) {
|
||||
if (array == null) {
|
||||
return false;
|
||||
}
|
||||
for (int element : array) {
|
||||
if (element == val) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void wait(Object lock, long timeout) {
|
||||
try {
|
||||
lock.wait(timeout);
|
||||
|
||||
@@ -554,6 +554,8 @@ public class VideoRecoder {
|
||||
// the function fills out missing information and also recodes the video as needed.
|
||||
// return: true=video might be prepared, can be sent, false=error
|
||||
public static boolean prepareVideo(Context context, int chatId, DcMsg msg) {
|
||||
final long MAX_BYTES = DcHelper.getInt(context, "sys.msgsize_max_recommended");
|
||||
final String TOO_BIG_FILE = "Video cannot be compressed to a reasonable size. Try a shorter video or a lower quality.";
|
||||
try {
|
||||
String inPath = msg.getFile();
|
||||
Log.i(TAG, "Preparing video: " + inPath);
|
||||
@@ -561,9 +563,14 @@ public class VideoRecoder {
|
||||
// try to get information from video file
|
||||
VideoEditedInfo vei = getVideoEditInfoFromFile(inPath);
|
||||
if (vei == null) {
|
||||
alert(context, String.format("Recoding failed for %s: cannot get info", inPath));
|
||||
return false;
|
||||
Log.w(TAG, String.format("Recoding failed for %s: cannot get info", inPath));
|
||||
if (msg.getFilebytes() > MAX_BYTES+MAX_BYTES/4) {
|
||||
alert(context, TOO_BIG_FILE);
|
||||
return false;
|
||||
}
|
||||
return true; // if the file is small, send it without recoding
|
||||
}
|
||||
|
||||
vei.rotationValue = vei.originalRotationValue;
|
||||
vei.startTime = 0;
|
||||
vei.endTime = -1;
|
||||
@@ -579,7 +586,6 @@ public class VideoRecoder {
|
||||
|
||||
// check if video bitrate is already reasonable
|
||||
final int MAX_KBPS = 1500000;
|
||||
final long MAX_BYTES = DcHelper.getInt(context, "sys.msgsize_max_recommended");
|
||||
long inBytes = new File(inPath).length();
|
||||
if (inBytes > 0 && inBytes <= MAX_BYTES && vei.originalVideoBitrate <= MAX_KBPS*2 /*be tolerant as long the file size matches*/) {
|
||||
Log.i(TAG, String.format("recoding for %s is not needed, %d bytes and %d kbps are ok", inPath, inBytes, vei.originalVideoBitrate));
|
||||
@@ -627,7 +633,7 @@ public class VideoRecoder {
|
||||
vei.resultVideoBitrate, vei.originalDurationMs, vei.originalAudioBytes);
|
||||
|
||||
if (vei.estimatedBytes > MAX_BYTES+MAX_BYTES/4) {
|
||||
alert(context, "Video cannot be compressed to a reasonable size. Try a shorter video or a lower quality.");
|
||||
alert(context, TOO_BIG_FILE);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:background="?android:attr/windowBackground"
|
||||
tools:context=".RegistrationActivity">
|
||||
tools:context=".EditTransportActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -71,7 +71,7 @@
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/email"
|
||||
app:passwordToggleEnabled="true">
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/password_text"
|
||||
@@ -291,7 +291,7 @@
|
||||
app:layout_constraintEnd_toEndOf="@id/guideline_root_end"
|
||||
app:layout_constraintStart_toStartOf="@id/guideline_root_start"
|
||||
app:layout_constraintTop_toBottomOf="@id/smtp_login"
|
||||
app:passwordToggleEnabled="true">
|
||||
>
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/smtp_password_text"
|
||||
@@ -192,7 +192,7 @@
|
||||
style="@style/Signal.Text.Body"
|
||||
android:paddingTop="@dimen/message_bubble_top_padding"
|
||||
android:textColor="?conversation_item_incoming_text_primary_color"
|
||||
android:textColorLink="?conversation_item_incoming_text_primary_color"
|
||||
android:textColorLink="?attr/colorAccent"
|
||||
android:importantForAccessibility="no"
|
||||
tools:text="Mango pickle lorem ipsum"/>
|
||||
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
style="@style/Signal.Text.Body"
|
||||
android:paddingTop="@dimen/message_bubble_top_padding"
|
||||
android:textColor="?conversation_item_outgoing_text_primary_color"
|
||||
android:textColorLink="?conversation_item_outgoing_text_primary_color"
|
||||
android:textColorLink="?attr/colorAccent"
|
||||
android:importantForAccessibility="no"
|
||||
tools:text="Mango pickle lorem ipsum"/>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
android:gravity="start|center_vertical"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:textColor="?attr/emoji_text_color"
|
||||
android:textColorLink="?attr/emoji_text_color"
|
||||
android:textColorLink="?attr/colorAccent"
|
||||
android:background="?attr/contact_list_divider"/>
|
||||
|
||||
</org.thoughtcrime.securesms.ProfileStatusItem>
|
||||
|
||||
@@ -24,16 +24,6 @@
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/instant_onboarding_other_server"/>
|
||||
|
||||
<Button
|
||||
style="@style/ButtonSecondary"
|
||||
android:id="@+id/login_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/manual_account_setup_option"/>
|
||||
|
||||
<Button
|
||||
style="@style/ButtonSecondary"
|
||||
android:id="@+id/scan_qr_button"
|
||||
@@ -41,8 +31,18 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:text="@string/scan_invitation_code"/>
|
||||
|
||||
<Button
|
||||
style="@style/ButtonSecondary"
|
||||
android:id="@+id/login_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="24dp"
|
||||
android:paddingRight="24dp"
|
||||
android:text="@string/manual_account_setup_option"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
@@ -28,11 +28,4 @@
|
||||
<item android:title="@string/menu_settings"
|
||||
android:id="@+id/menu_settings" />
|
||||
|
||||
<group android:id="@+id/extra_services" >
|
||||
|
||||
<item android:title="@string/public_bots"
|
||||
android:id="@+id/menu_public_bots" />
|
||||
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:title="@string/add_to_home_screen"
|
||||
android:id="@+id/menu_add_to_home_screen" />
|
||||
<item android:id="@+id/show_in_chat"
|
||||
android:title="@string/show_in_chat" />
|
||||
<item android:title="@string/add_to_home_screen"
|
||||
android:id="@+id/menu_add_to_home_screen" />
|
||||
<item android:title="@string/what_is_webxdc"
|
||||
android:id="@+id/webxdc_help" />
|
||||
<item android:title="@string/source_code"
|
||||
android:id="@+id/source_code" />
|
||||
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
<string name="media">الوسائط</string>
|
||||
<string name="main_menu">القائمة الرئيسية</string>
|
||||
<string name="start_chat">ابدأ الدردشة</string>
|
||||
<!-- deprecated, UI must not offer an option to show the password -->
|
||||
<string name="show_password">اظهر الكلمة السرية</string>
|
||||
<!-- deprecated, UI must not offer an option to show the password -->
|
||||
<string name="hide_password">أخفِ الكلمة السرية</string>
|
||||
<string name="not_now">ليس الآن</string>
|
||||
<string name="never">أبدا</string>
|
||||
@@ -143,6 +145,7 @@
|
||||
<string name="tab_map">الخريطة</string>
|
||||
<string name="media_preview">معاينة الصورة</string>
|
||||
<string name="login_title">الولوج</string>
|
||||
<!-- deprecated -->
|
||||
<string name="login_header">الإتصال بخادومك</string>
|
||||
<string name="login_inbox">صندوق الوارد</string>
|
||||
<string name="login_imap_login">مستخدم IMAP</string>
|
||||
@@ -164,6 +167,7 @@
|
||||
<string name="pref_profile_info_headline">معلومات ملفك التعريفي</string>
|
||||
<string name="pref_profile_photo">صورة الملف التعريفي</string>
|
||||
<string name="pref_blocked_contacts">المراسلون المحبوسون</string>
|
||||
<!-- deprecated -->
|
||||
<string name="pref_password_and_account_settings">الكلمة السرية والحساب</string>
|
||||
<string name="pref_your_name">اسمك</string>
|
||||
<!-- Label of the Bio/Signature/Status/Motto field -->
|
||||
|
||||
@@ -242,10 +242,10 @@
|
||||
<string name="tab_docs_empty_hint">Bu söhbətdə paylaşılan sənədlər, musiqi və digər fayllar burada göstəriləcək.</string>
|
||||
<string name="media_preview">Fayllara baxmaq</string>
|
||||
<string name="login_title">Daxil ol</string>
|
||||
<!-- deprecated -->
|
||||
<string name="login_header">Serverinə daxil ol</string>
|
||||
<!-- deprecated -->
|
||||
<string name="login_explain">Mövcud e-mail hesabı ilə daxil olun</string>
|
||||
<string name="login_subheader">Məlum elektron poçt provayderləri üçün əlavə parametrlər avtomatik olaraq quraşdırılır. Bəzən IMAP-ın web məkanında aktiv olması lazımdır. Yardım üçün e-poçt provayderinizə və ya dostlarınıza müraciət edin.</string>
|
||||
<string name="login_no_servers_hint">Delta Chat serverləri yoxdur, məlumatlarınız cihazınızda qalır!</string>
|
||||
<string name="login_inbox">Gələn</string>
|
||||
<string name="login_imap_login">IMAP logini</string>
|
||||
<string name="login_imap_server">IMAP server</string>
|
||||
@@ -257,9 +257,6 @@
|
||||
<string name="login_smtp_server">SMTP server</string>
|
||||
<string name="login_smtp_port">SMTP port</string>
|
||||
<string name="login_smtp_security">SMTP təhlükəsizliyi</string>
|
||||
<string name="login_auth_method">Yetkiləndirmə metodu</string>
|
||||
<string name="login_info_oauth2_title">Sadələşdirilmiş tənzimləmə ilə davam edirsiniz?</string>
|
||||
<string name="login_info_oauth2_text">Daxil edilmiş e-poçt ünvanı sadələşdirilmiş bir quraşdırma (OAuth2) dəstəkləyir. \n\nNövbəti addımda Delta Chat e-poçt tətbiqinizlə söhbət etməyə icazə verin. \n\n Delta Chat serverləri, cihazınızda qalır!</string>
|
||||
<string name="login_certificate_checks">Sertifikat yoxlanmaları</string>
|
||||
<string name="login_error_mail">Xahiş edirik düzgün bir e-poçt ünvanı daxil et</string>
|
||||
<string name="login_error_server">Xahiş edirik, düzgün bir server / IP ünvanı daxil et</string>
|
||||
@@ -335,8 +332,6 @@
|
||||
<string name="pref_background_btn_default">Hal hazırdaki şəkili istifadə edin</string>
|
||||
<string name="pref_background_btn_gallery">Fotoalbomdan götürün</string>
|
||||
<string name="pref_imap_folder_warn_disable_defaults">Bu seçimi ləğv etsəniz, serverinizin və digər müştərilərinizin müvafiq olaraq konfiqurasiya olunduğundan əmin olun. \n\nAyrıca şeylər işləməyəcəkdir.</string>
|
||||
<string name="pref_watch_sent_folder">Göndərilmişlərin qovluğunu izləyin</string>
|
||||
<string name="pref_send_copy_to_self">Özünə kopya göndər</string>
|
||||
<string name="pref_auto_folder_moves">DeltaChat qovluğuna avtomatik keçid</string>
|
||||
<string name="pref_auto_folder_moves_explain">Çat söhbətləri Daxil olanlar qovluğunun yığılmaması üçün taşınır</string>
|
||||
<string name="pref_show_emails">Klassik e-poçtları göstər</string>
|
||||
@@ -359,18 +354,18 @@
|
||||
<!-- %1$s will be replaced by the old group name, %2$s will be replaced by the new group name, %3$s will be replaced by name and address of the contact who did the action. -->
|
||||
<string name="group_name_changed_by_other">Qrupun adı \"%1$s\" - dən \"%2$s\" - yə deyişildi ilə %3$s.</string>
|
||||
<string name="group_image_changed_by_you">Qrup şəkili dəyişildi məndən. </string>
|
||||
<!-- %1$s will be replaced by name and address of the contact who did the action -->
|
||||
<!-- %1$s will be replaced by name of the contact who did the action -->
|
||||
<string name="group_image_changed_by_other">Qrup şəkili dəyişildi ilə %1$s.</string>
|
||||
<!-- %1$s will be replaced by name and address of the contact added to the group -->
|
||||
<!-- %1$s will be replaced by name of the contact added to the group -->
|
||||
<string name="add_member_by_you">Üzv %1$s əlavə olundu məndən. </string>
|
||||
<!-- %1$s will be replaced by name and address of the contact added to the group, %2$s will be replaced by name and address of the contact who did the action -->
|
||||
<!-- %1$s will be replaced by name of the contact added to the group, %2$s will be replaced by name of the contact who did the action -->
|
||||
<string name="add_member_by_other">Üzv %1$s əlavə olundu ilə %2$s.</string>
|
||||
<!-- %1$s will be replaced by name and address of the contact removed from the group -->
|
||||
<!-- %1$s will be replaced by name of the contact removed from the group -->
|
||||
<string name="remove_member_by_you">%1$s üzv silindi məndən. </string>
|
||||
<!-- %1$s will be replaced by name and address of the contact removed from the group, %2$s will be replaced by name and address of the contact who did the action -->
|
||||
<!-- %1$s will be replaced by name of the contact removed from the group, %2$s will be replaced by name of the contact who did the action -->
|
||||
<string name="remove_member_by_other">%1$s üzv silindi ilə %2$s.</string>
|
||||
<string name="group_image_deleted_by_you">Qrupun şəkili silindi məndən. </string>
|
||||
<!-- %1$s will be replaced by name and address of the contact -->
|
||||
<!-- %1$s will be replaced by name of the contact -->
|
||||
<string name="group_image_deleted_by_other">Qrupun şəkili silindi ilə %1$s.</string>
|
||||
<string name="qrscan_title">Qr kodu skan edin</string>
|
||||
<string name="qrscan_hint">QR kodu kamera ilə izləyin</string>
|
||||
@@ -388,7 +383,7 @@
|
||||
<!-- This text is shown inside the "QR code card" with very limited space; please formulate the text as short as possible therefore. The placeholder will be replaced by the group name, eg. "Scan to join group \"Testing group\"" -->
|
||||
<string name="qrshow_join_group_hint"> \"%1$s\" qrupuna qoşulmaq üçün bunu skan edin. </string>
|
||||
<string name="qrshow_join_contact_title">Dəvət QR-kodu</string>
|
||||
<!-- This text is shown inside the "QR code card" with very limited space; please formulate the text as short as possible therefore. The placeholder will be replaced by name and address eg. "Scan to chat with Alice (alice@example.org)" -->
|
||||
<!-- This text is shown inside the "QR code card" with very limited space; please formulate the text as short as possible therefore. The placeholder will be replaced by the profile name eg. "Scan to chat with Alice" -->
|
||||
<string name="qrshow_join_contact_hint">%1$silə əlaqə qurmaq üçün bunu skan edin</string>
|
||||
<string name="qrshow_join_contact_no_connection_toast">İnternet bağlantısı yoxdur, QR kodunu qura bilmir.</string>
|
||||
<string name="contact_verified">%1$s yoxlanıldı.</string>
|
||||
|
||||