Compare commits

...

118 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 0bc34daf35 move ConversationListRelayingActivity.finishActivity into completion callback
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/97d2da3a-a390-4296-9c53-970922fe75f1

Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
2026-05-12 22:16:48 +00:00
copilot-swe-agent[bot] c47482851b guard recoding progress dialog creation
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/b8e9e663-8e3c-4ea7-bed3-67efe44ad239

Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
2026-05-12 17:55:43 +00:00
copilot-swe-agent[bot] e2fb3968ca delay finishing until relay completion
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/b8e9e663-8e3c-4ea7-bed3-67efe44ad239

Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
2026-05-12 17:53:40 +00:00
copilot-swe-agent[bot] ceffc5df1c address code review: use AtomicReference, remove redundant null check, log failed videos
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/46f23f6d-d5a5-48b9-8b1d-4aa5cfdda115

Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
2026-04-29 15:00:18 +00:00
copilot-swe-agent[bot] e6fd96bf35 recode videos when multiple are shared/attached, show progress dialog
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/46f23f6d-d5a5-48b9-8b1d-4aa5cfdda115

Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
2026-04-29 14:57:53 +00:00
adbenitez 60ab7f2826 Merge remote-tracking branch 'upstream/main' 2026-04-29 16:48:31 +02:00
adb e511237e5e Merge pull request #4384 from deltachat/adb/issue-4345
add highlight to input panel buttons for keyboard navigation
2026-04-28 17:17:27 +02:00
adb f249fd6174 Merge pull request #4386 from deltachat/adb/issue-4342
add mapping.txt to symbols zip
2026-04-28 17:16:29 +02:00
B. Petersen 6db45c1911 add translator hints for new call strings 2026-04-28 17:01:47 +02:00
adb 06a1114744 Merge pull request #4388 from deltachat/adb/issue-4328
fix migration while upgrading from 1.10.1 and similar old versions
2026-04-28 16:54:19 +02:00
adb 3afff5625b Merge branch 'main' into adb/issue-4328 2026-04-28 16:40:53 +02:00
adbenitez cef8ddeedb update changelog 2026-04-28 16:32:33 +02:00
adbenitez 2f0ac973c0 fix migration from 1.10.1 and similar old versions 2026-04-28 16:28:25 +02:00
adbenitez 9465776715 add mapping.txt to symbols zip 2026-04-28 16:04:07 +02:00
B. Petersen 39685a575d feat: better wording for "Media Quality" option
this changes "Worse quality, small size" to "Worse quality, save data".

this makes it more clearer, what the advantage of that option is.

also, the recently added hint about sending as original also speaks about "data"
(https://github.com/deltachat/deltachat-android/pull/4259)
which is more known to the average user, knowing that of "mobile data" etc.
2026-04-28 15:51:37 +02:00
B. Petersen 8601736387 update translations 2026-04-28 15:49:37 +02:00
adbenitez 98d8572baf add highlight to input panel buttons for keyboard navigation 2026-04-28 15:16:36 +02:00
wchen342 917e764b6f Promote call FGS asap (#4377)
* Promote call FGS as soon as possible

* Add resource strings for call notification

* Launch with only phone call type on 14+
2026-04-27 20:34:51 +02:00
adb 52263150c8 Merge pull request #4374 from deltachat/adb/location-streaming-time-tweaks
allow to share location for 24 hours, remove 5 minutes
2026-04-27 17:27:12 +02:00
B. Petersen c2aba94b34 mark deprecated strings as such 2026-04-25 02:07:46 +02:00
adbenitez 1278dfd395 Merge remote-tracking branch 'upstream/main' 2026-04-24 19:55:16 +02:00
wchen342 44a688470f Merge pull request #4370 from deltachat/wch423/change-tag-names
Remove usages of `class.getSimpleName()`
2026-04-24 12:18:37 -04:00
wch423 e9a09d9c72 Correct tag name 2026-04-24 15:59:37 +02:00
wchen342 abc49a3b95 Update src/main/java/com/b44t/messenger/DcMsg.java
Co-authored-by: adb <adb@merlinux.eu>
2026-04-23 17:55:20 +02:00
wch423 cdd4e5eccd Code formatting 2026-04-23 17:55:18 +02:00
wch423 fa8ed2b881 Remove usages of class.getSimpleName() 2026-04-23 17:55:16 +02:00
B. Petersen 0731fe9447 fix warning string, make reuse of new explicit button strings 2026-04-23 15:57:42 +02:00
adbenitez d3567d9f0c fix arrays.xml 2026-04-23 14:51:48 +02:00
adbenitez 66ab1f8051 update changelog 2026-04-23 14:51:04 +02:00
adbenitez 872fd17f5e allow to share location for 24 hours, remove 5 minutes 2026-04-23 14:49:18 +02:00
B. Petersen af49018911 add strings from desktop, add some missing strings 2026-04-23 00:43:12 +02:00
adbenitez f870e9c8fd Merge remote-tracking branch 'upstream/main' 2026-04-22 21:48:58 +02:00
wchen342 d5982ba09f Merge pull request #4361 from deltachat/wch423/location-streaming
Add foreground service for location streaming
2026-04-18 17:30:56 -04:00
adbenitez 22d70d7bd4 Merge remote-tracking branch 'upstream/main' 2026-04-18 22:15:03 +02:00
adb 09bdc32a9c Merge pull request #4315 from deltachat/r10s/markfresh
feat: mark messages as "unread"
2026-04-18 21:09:18 +02:00
adb 7763ba17bf Merge branch 'main' into r10s/markfresh 2026-04-18 20:15:57 +02:00
adb 965204c46f Merge branch 'main' into wch423/location-streaming 2026-04-18 19:56:00 +02:00
adbenitez 815e4def6f Merge branch 'wch423/location-streaming' of https://github.com/deltachat/deltachat-android into wch423/location-streaming 2026-04-18 19:54:17 +02:00
adbenitez dc3ca8ff70 use "Location Streaming" for notification title and channel name 2026-04-18 19:48:39 +02:00
adb 3bccb3fb84 Apply suggestion from @adbenitez 2026-04-18 19:44:39 +02:00
adb 402d93b5a4 Merge pull request #4363 from deltachat/adb/allow-autoplay
allow webxdc to auto-play audio without requiring user gesture/touch
2026-04-18 17:10:48 +02:00
adbenitez 927dc46431 update changelog 2026-04-18 00:02:19 +02:00
adbenitez 87c32b1904 allow webxdc to auto-play audio without requiring user gesture/touch 2026-04-17 23:59:51 +02:00
adbenitez bb97213460 apply spotless 2026-04-17 23:52:22 +02:00
adbenitez 9ca9bf1acd remove unnecessary entry in src/main/res/xml/file_provider_paths.xml 2026-04-17 23:45:36 +02:00
wch423 885c902b14 Allow fallback to different providers 2026-04-17 21:11:56 +02:00
adbenitez dc4ee3f686 Merge remote-tracking branch 'upstream/main' 2026-04-17 20:52:30 +02:00
wch423 61bf5aaad4 Change how location sources work 2026-04-17 20:30:57 +02:00
link2xt 18595cbee1 Run nix flake update
This fixes some deprecation warnings.
I used it to build the app after update,
it still works.
2026-04-17 18:08:53 +00:00
wch423 5d76586ac1 Add foreground service for location streaming 2026-04-15 19:07:34 +02:00
adb dc78307df7 Merge pull request #4335 from deltachat/adb/re-enable-full-screen-intent-perm
get calls out of experimental
2026-04-14 18:23:39 +02:00
adbenitez 86a9cbfb45 update changelog 2026-04-14 18:19:52 +02:00
adb 623b20f713 Merge branch 'main' into adb/re-enable-full-screen-intent-perm 2026-04-14 18:12:05 +02:00
adb 5f4eae798f Merge pull request #4359 from deltachat/prep-2.49.0
prepare 2.49.0
2026-04-13 16:39:18 +02:00
adbenitez 4a8609822d prepare 2.49.0 2026-04-13 16:23:27 +02:00
adb 89ddc1e01f Merge pull request #4358 from deltachat/update-core-and-stuff-2026-04-13
Update core to 2.49.0
2026-04-13 16:20:44 +02:00
adbenitez 0ce42578fa update changelog 2026-04-13 15:44:42 +02:00
adbenitez faa7ad0a35 update translations 2026-04-13 15:44:33 +02:00
adbenitez 38e8ceb253 update RPC 2026-04-13 15:33:58 +02:00
adbenitez a32460f253 update deltachat-core-rust to 'chore(release): prepare for 2.49.0' of 'v2.49.0' 2026-04-13 15:29:06 +02:00
adbenitez 198268a4c3 Merge remote-tracking branch 'upstream/main' 2026-04-11 14:35:01 +02:00
adb 71158970ae Merge pull request #4357 from deltachat/wch423/external-cache-fix
Add fallback for getExternalCacheDir() in case primary storage is SD
2026-04-10 18:40:34 +02:00
wch423 1383b06e86 Add fallback for getExternalCacheDir() in case primary storage is SD card 2026-04-10 15:36:56 +02:00
B. Petersen 24165e311b deprecate sticker string, pointing to deeply nested profile folder 2026-04-09 17:34:14 +02:00
adb 5ec892db34 Merge pull request #4352 from deltachat/wch423/call-microphone-permission
Refine call permission checks and gates
2026-04-08 20:46:21 +02:00
wch423 caef7eda29 Add fixes for PiP caused bug and potential Android 16 problem with permission popups 2026-04-08 18:21:49 +02:00
wch423 cf53af4778 Refine permission checks and gates 2026-04-08 16:08:14 +02:00
adb 415e0c2b5f Merge branch 'main' into adb/re-enable-full-screen-intent-perm 2026-04-03 17:55:46 +02:00
adbenitez 9a22597473 delete zapstore 2026-04-03 17:18:08 +02:00
B. Petersen beb45af440 prefer 'mark noticed' over 'mark fresh' 2026-04-02 15:50:40 +02:00
adbenitez 87a21eb0f2 apply spotless 2026-04-02 15:41:41 +02:00
adbenitez dea51cd356 use RPC API instead of C API 2026-04-02 15:41:41 +02:00
B. Petersen ed540e5584 update CHANGLOG 2026-04-02 15:41:38 +02:00
B. Petersen 9f80c9f35f make spotless formatter happy 2026-04-02 15:40:32 +02:00
B. Petersen 5dec1b24cd option to mark chat fresh 2026-04-02 15:40:32 +02:00
adb acb4eb2ae1 Merge pull request #4334 from deltachat/adb/issue-4316
remove proxy switch from EditRelayActivity
2026-04-01 00:14:06 +02:00
wchen342 20c0354938 Merge pull request #4336 from deltachat/wch423/call-multidevice-incoming
Fix wrong states when an incoming call is answered on a second device
2026-03-31 17:36:30 -04:00
adbenitez eac112d602 update changelog 2026-03-31 23:09:29 +02:00
wch423 9b4f659f67 Fix crash when an incoming call is answered on a second device 2026-03-31 17:17:11 +02:00
adbenitez 0166d4e656 remove "Debug Calls" 2026-03-31 16:20:16 +02:00
adbenitez 92b3761d2d re-enable full intent permission 2026-03-31 15:59:22 +02:00
adbenitez 484cee21c6 apply Spotless 2026-03-31 15:24:03 +02:00
adbenitez 0e40318050 rmeove proxy switch from EditRelayActivity 2026-03-31 15:15:02 +02:00
wchen342 b2cc76ff2e Merge pull request #4333 from deltachat/wch423/call-mirror-self
Mirror self video during call
2026-03-30 13:24:01 -04:00
adb 96acaaf000 Merge pull request #4332 from deltachat/adb/remove-deprecated-stock-str-2026-03-30
remove deprecated stock strings 99 and 100
2026-03-30 18:44:31 +02:00
adbenitez 400e5ea671 Merge branch 'adb/remove-deprecated-stock-str-2026-03-30' of https://github.com/deltachat/deltachat-android into adb/remove-deprecated-stock-str-2026-03-30 2026-03-30 18:41:03 +02:00
adbenitez 4fac460926 remove unused strings 2026-03-30 18:40:44 +02:00
wch423 94a5631566 Fix camera iterating through multiple back cameras; Formatting code 2026-03-30 18:00:39 +02:00
wch423 ea91075107 Mirror self video during calls; Minor thread-safe fixes 2026-03-30 17:29:43 +02:00
adbenitez 0c7b82b9e4 Merge remote-tracking branch 'upstream/main' 2026-03-30 16:27:17 +02:00
adb d765d3ddeb Merge branch 'main' into adb/remove-deprecated-stock-str-2026-03-30 2026-03-30 16:01:06 +02:00
adbenitez 094fb1e2a4 remove deprecated stock strings 99 and 100 2026-03-30 15:47:35 +02:00
wchen342 f7244c2152 Merge pull request #4323 from deltachat/wch423/fix-file-sharing
Fix file sharing to certain apps
2026-03-30 09:38:02 -04:00
wch423 2b5d1005e3 Fix missing query method in AttachmentsContentProvider 2026-03-30 15:32:50 +02:00
adb b1eadf0716 Merge pull request #4331 from deltachat/prep-2.48.0
prepare 2.48.0
2026-03-30 15:27:07 +02:00
adbenitez c001c13053 prepare 2.48.0 2026-03-30 15:15:25 +02:00
adb ea4ec343bc Merge pull request #4330 from deltachat/update-core-and-stuff-2026-03-30
update core to 2.48.0
2026-03-30 15:10:46 +02:00
adb 5642e86f6a Merge branch 'main' into update-core-and-stuff-2026-03-30 2026-03-30 14:56:05 +02:00
adbenitez 46db14fc3e update changelog 2026-03-30 14:54:53 +02:00
adbenitez 0f6d9670ff update RPC 2026-03-30 14:45:47 +02:00
adbenitez 4c3c24ae5a update translations 2026-03-30 14:45:16 +02:00
B. Petersen eeb558d94d sticker alerts: do not repeat text in title and message
moreover, the "Delete" button is shown as being destructive.
this removes noise and is more consistent with other confirmations.
2026-03-30 14:33:50 +02:00
adbenitez 5e08f56dd3 update deltachat-core-rust to 'chore(release): prepare for 2.48.0' of 'v2.48.0' 2026-03-30 14:11:27 +02:00
biörn d99f150dd2 relay update warning (#4325)
* add a warning to the existing hint; desktop and iOS will pick that up without code changes

* add hint to the relay list

* add padding

* move relay up

* update CHANGELOG

* make spotless happy
2026-03-28 19:36:28 +01:00
adbenitez 82b3100570 Merge remote-tracking branch 'upstream/main' 2026-03-26 19:37:59 +01:00
B. Petersen 348b6fd3c1 update store descriptions 2026-03-26 15:38:57 +01:00
adb c2f492463f Merge pull request #4321 from deltachat/prep-2.47.0
prepare 2.47.0
2026-03-24 17:35:18 +01:00
adbenitez 38239b2644 prepare 2.47.0 2026-03-24 16:37:41 +01:00
adb 4b996c95de Merge pull request #4320 from deltachat/update-core-and-stuff-2026-03-24
Update core 2.47.0
2026-03-24 16:35:18 +01:00
adbenitez 89d90efcef update changelog 2026-03-24 16:05:36 +01:00
adb d5b4bae502 Merge pull request #4319 from deltachat/adb/issue-4318
only pass URL domain to IDN.toASCII()
2026-03-24 15:53:49 +01:00
adbenitez c3ec163e1a update translations 2026-03-24 15:51:25 +01:00
adbenitez a927a32909 update deltachat-core-rust to 'chore(release): prepare for 2.47.0' of 'v2.47.0' 2026-03-24 15:49:02 +01:00
adbenitez 9aab4517ef only pass URL domain to IDN.toASCII()
Avoid crashes due to IllegalArgumentException launched by
IDN.toASCII() if URL is too long
2026-03-23 22:58:01 +01:00
adb 727e68edc7 Merge pull request #4317 from deltachat/adb/disable-full-screen-intent-for-gplay
temporarily don't require android.permission.USE_FULL_SCREEN_INTENT for gplay
2026-03-23 12:46:20 +01:00
adbenitez 9047de85c2 update version 2026-03-23 12:35:42 +01:00
adbenitez 29c313ba58 Merge remote-tracking branch 'upstream/adb/disable-full-screen-intent-for-gplay' 2026-03-23 12:35:00 +01:00
adbenitez 487f601c09 temporarily don't require android.permission.USE_FULL_SCREEN_INTENT for gplay 2026-03-23 12:15:47 +01:00
198 changed files with 4525 additions and 1410 deletions
-11
View File
@@ -72,14 +72,3 @@ jobs:
files: |
build/outputs/apk/foss/release/*.apk
build/outputs/mapping/fossRelease/mapping-*.txt
- name: Release on ZapStore
run: |
export CHECKSUM=6e2c7cf6da53c3f1a78b523a6aacd6316dce3d74ace6f859c2676729ee439990
curl -sL https://cdn.zapstore.dev/$CHECKSUM -o zapstore
if echo "$CHECKSUM zapstore" | sha256sum -c --status; then
chmod +x zapstore
SIGN_WITH=${{ secrets.NOSTR_KEY }} ./zapstore publish --indexer-mode
else
echo "ERROR: checksum doesn't match!"
fi
+12
View File
@@ -243,3 +243,15 @@ $ANDROID_NDK_ROOT/ndk-stack --sym obj/local/armeabi-v7a --dump crash.txt > decod
`obj/local/armeabi-v7a` is the extracted path from `deltachat-gplay-release-X.X.X.apk-symbols.zip` file from https://download.delta.chat/android/symbols/
Replace `armeabi-v7a` by the correct architecture the logs come from (can be guessed by trial and error)
### Deobfuscating Java Stack Traces
Because the app uses code minification (ProGuard/R8), Java stack traces in crash reports are obfuscated.
To decode them, use `retrace` with the `mapping.txt` file that is included in the symbols zip:
```
retrace mapping.txt crash.txt > decoded-crash.txt
```
`mapping.txt` is extracted from the same `deltachat-gplay-release-X.X.X.apk-symbols.zip` file available at https://download.delta.chat/android/symbols/
+32 -2
View File
@@ -1,6 +1,36 @@
# Delta Chat Android Changelog
## v2.46.0
## Unreleased
* Better incoming call system integration
* Calls are not experimental anymore and don't need to be manually enabled
* Display a permanent notification when doing location streaming and get rid of dangerous "Access Location in Background" permission
* Allow to share location for 24 hours
* Allow mini-apps to play audio without user interaction
* Mark chats as unread (long tap a chat and select the corresponding option from the three-dot-menu)
* Fix process of upgrading from a very old version of the app
## v2.49.0
2026-04
* Fix file sharing to certain apps (e.g. Material Files, etc.)
* Fix problem with calls when microphone permission is not granted
* Fix taking pictures and videos in devices with SD cards
* Fix flipped orientation for some images
* Fix: avoid empty contact request chats when using invite links in a multi-device setup
* Remove proxy toggle from profile editing to avoid confusion
* Updated translations
* Update to core 2.49.0
## v2.48.0
2026-03
* Add a warning when editing relays
* Fix message reordering problems in multi-relay setups
* Some more bug fixes and updated translations
* Update to core 2.48.0
## v2.47.0
2026-03
* Allow to set chat description
@@ -19,7 +49,7 @@
* Fix: avoid "reply privately" not quoting the selected message sometimes
* Fix: properly hide the calls button
* Some more bug fixes and updated translations
* Update to core 2.46.0
* Update to core 2.47.0
## v2.43.0
2026-02
+4 -3
View File
@@ -34,8 +34,8 @@ android {
useLibrary 'org.apache.http.legacy'
defaultConfig {
versionCode 30000738
versionName "2.46.0"
versionCode 30000742
versionName "2.49.0"
applicationId "chat.delta.lite"
multiDexEnabled true
@@ -223,7 +223,7 @@ spotless {
}
format 'xml', {
target 'src/*/res/**/*.xml', 'src/*/AndroidManifest.xml'
targetExclude 'src/*/res/values*/strings.xml' // line-break changes invalidate translations
targetExclude 'src/*/res/values*/strings*.xml' // line-break changes invalidate translations
eclipseWtp('xml').configFile('spotless/eclipse-wtp-xml.prefs')
trimTrailingWhitespace()
endWithNewline()
@@ -307,6 +307,7 @@ dependencies {
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
}
gplayImplementation 'com.google.android.gms:play-services-location:21.3.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.assertj:assertj-core:3.27.3'
@@ -1,6 +1,8 @@
ArcaneChat is a decentralized and secure instant messenger that is easy to use for friends and family.
Anonymous. Instant onboarding without a phone number, e-mail or other private data.
Private. Instant on-boarding without a phone number or other private data.
• Friends & Family: Only chat with people you know. Unknown users cannot message or follow you without mutual consent.
• Flexible. Supports multiple chat profiles and is easy to setup on multiple devices.
@@ -23,7 +25,7 @@ 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>Extra option to share location for 12 hours</li>
<li>Extra option to share location for 24 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>
Generated
+15 -15
View File
@@ -7,11 +7,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1756239746,
"narHash": "sha256-0ibN685tT+u/Nbmbrrq9G3mRUzct2Votyv/a7Wwv26s=",
"lastModified": 1775939535,
"narHash": "sha256-Zq1U7Vhw5ctvhJQy+3ShqIv7Mplf3XkgJY+QJnhfUGQ=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
"rev": "256631d162ec883b2341ee59621516e1f65f0f6b",
"rev": "d2e16192309bf3101e4998ffa62e914819dee077",
"type": "github"
},
"original": {
@@ -28,11 +28,11 @@
]
},
"locked": {
"lastModified": 1741473158,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
"lastModified": 1768818222,
"narHash": "sha256-460jc0+CZfyaO8+w8JNtlClB2n4ui1RbHfPTLkpwhU8=",
"owner": "numtide",
"repo": "devshell",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
"rev": "255a2b1725a20d060f566e4755dbf571bbbb5f76",
"type": "github"
},
"original": {
@@ -79,11 +79,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1756125398,
"narHash": "sha256-XexyKZpf46cMiO5Vbj+dWSAXOnr285GHsMch8FBoHbc=",
"lastModified": 1775710090,
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3b9f00d7a7bf68acd4c4abb9d43695afb04e03a5",
"rev": "4c1018dae018162ec878d42fec712642d214fdfa",
"type": "github"
},
"original": {
@@ -95,11 +95,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1756159630,
"narHash": "sha256-ohMvsjtSVdT/bruXf5ClBh8ZYXRmD4krmjKrXhEvwMg=",
"lastModified": 1775823930,
"narHash": "sha256-ALT447J7FcxP/97J01A/gp/hgdO5lXRsm+zLMt+gIjc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "84c256e42600cb0fdf25763b48d28df2f25a0c8b",
"rev": "8c11f88bb9573a10a7d6bf87161ef08455ac70b9",
"type": "github"
},
"original": {
@@ -138,11 +138,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1763347184,
"narHash": "sha256-6QH8hpCYJxifvyHEYg+Da0BotUn03BwLIvYo3JAxuqQ=",
"lastModified": 1775877051,
"narHash": "sha256-wpSQm2PD/w4uRo2wb8utk0b5hOBkkg/CZ1xICY+qB7M=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "08895cce80433978d5bfd668efa41c5e24578cbd",
"rev": "08b4f3633471874c8894632ade1b78d75dbda002",
"type": "github"
},
"original": {
+1
View File
@@ -1393,6 +1393,7 @@ JNIEXPORT jint Java_com_b44t_messenger_DcMsg_getId(JNIEnv *env, jobject obj)
return dc_msg_get_id(get_dc_msg(env, obj));
}
JNIEXPORT jstring Java_com_b44t_messenger_DcMsg_getText(JNIEnv *env, jobject obj)
{
char* temp = dc_msg_get_text(get_dc_msg(env, obj));
+1
View File
@@ -34,6 +34,7 @@ cd ../..
SYMBOLS_ZIP="$APK-symbols.zip"
rm $SYMBOLS_ZIP
zip -r $SYMBOLS_ZIP obj
zip $SYMBOLS_ZIP build/outputs/mapping/gplayRelease/mapping.txt
ls -l $SYMBOLS_ZIP
rsync --progress $SYMBOLS_ZIP jekyll@download.delta.chat:/var/www/html/download/android/symbols/
@@ -39,7 +39,7 @@ public class EnterChatsBenchmark {
// PLEASE BACKUP YOUR ACCOUNT BEFORE RUNNING THIS!
// ==============================================================================================
private static final String TAG = EnterChatsBenchmark.class.getSimpleName();
private static final String TAG = "EnterChatsBenchmark";
@Rule
public ActivityScenarioRule<ConversationListActivity> activityRule =
@@ -0,0 +1,17 @@
package org.thoughtcrime.securesms.geolocation;
import android.content.Context;
import android.util.Log;
/** Non-GMS, always uses the platform LocationManager. */
public final class LocationSourceFactory {
private static final String TAG = "LocationSourceFactory";
private LocationSourceFactory() {}
public static LocationSource create(Context context) {
Log.i(TAG, "Non-GMS build, Using platform LocationManager");
return new PlatformLocationSource();
}
}
@@ -0,0 +1,61 @@
package org.thoughtcrime.securesms.geolocation;
import android.content.Context;
import android.location.Location;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.NonNull;
import com.google.android.gms.location.FusedLocationProviderClient;
import com.google.android.gms.location.LocationCallback;
import com.google.android.gms.location.LocationRequest;
import com.google.android.gms.location.LocationResult;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.Priority;
public class GmsLocationSource implements LocationSource {
private static final String TAG = "GmsLocationSource";
private static final long UPDATE_INTERVAL_MS = 3_000;
private static final long FASTEST_INTERVAL_MS = 1_000;
private FusedLocationProviderClient client;
private LocationCallback locationCallback;
@Override
public void startUpdates(@NonNull Context context, @NonNull Callback callback) {
client = LocationServices.getFusedLocationProviderClient(context);
LocationRequest request =
new LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, UPDATE_INTERVAL_MS)
.setMinUpdateIntervalMillis(FASTEST_INTERVAL_MS)
.setMinUpdateDistanceMeters(0)
.setWaitForAccurateLocation(false)
.build();
locationCallback =
new LocationCallback() {
@Override
public void onLocationResult(@NonNull LocationResult result) {
Location loc = result.getLastLocation();
if (loc != null) {
callback.onLocationUpdate(loc);
}
}
};
try {
client.requestLocationUpdates(request, locationCallback, Looper.getMainLooper());
} catch (SecurityException e) {
Log.e(TAG, "Missing location permission", e);
}
}
@Override
public void stopUpdates() {
if (client != null && locationCallback != null) {
client.removeLocationUpdates(locationCallback);
client = null;
locationCallback = null;
}
}
}
@@ -0,0 +1,35 @@
package org.thoughtcrime.securesms.geolocation;
import android.content.Context;
import android.util.Log;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
/**
* Prefers FusedLocationProviderClient, falls back to platform LocationManager if Play Services are
* somehow unavailable.
*/
public final class LocationSourceFactory {
private static final String TAG = "LocationSourceFactory";
private LocationSourceFactory() {}
public static LocationSource create(Context context) {
if (isGmsAvailable(context)) {
Log.i(TAG, "Using FusedLocationProviderClient");
return new GmsLocationSource();
}
Log.i(TAG, "GMS unavailable, falling back to LocationManager");
return new PlatformLocationSource();
}
private static boolean isGmsAvailable(Context context) {
try {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context)
== ConnectionResult.SUCCESS;
} catch (Exception e) {
return false;
}
}
}
@@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.service.FetchForegroundService;
import org.thoughtcrime.securesms.util.Util;
public class FcmReceiveService extends FirebaseMessagingService {
private static final String TAG = FcmReceiveService.class.getSimpleName();
private static final String TAG = "FcmReceiveService";
private static final Object INIT_LOCK = new Object();
private static boolean initialized;
private static volatile boolean triedRegistering;
+9 -7
View File
@@ -37,7 +37,6 @@
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="29" />
@@ -50,6 +49,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<!-- normal/instant permissions - adding them here is enough -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
@@ -71,6 +71,8 @@
android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
<!-- force compiling libs on older sdk than supported; runtime checks are required -->
@@ -81,7 +83,6 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
tools:replace="android:allowBackup"
android:allowBackup="false"
android:theme="@style/TextSecure.LightTheme"
android:largeHeap="true"
@@ -464,10 +465,6 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize">
</activity>
<service
android:name=".geolocation.LocationBackgroundService"
android:foregroundServiceType="location" />
<service
android:name=".service.GenericForegroundService"
android:foregroundServiceType="dataSync" />
@@ -476,6 +473,11 @@
android:name=".service.FetchForegroundService"
android:foregroundServiceType="dataSync" />
<service
android:name=".geolocation.LocationStreamingService"
android:foregroundServiceType="location"
android:exported="false" />
<service
android:name=".service.AudioPlaybackService"
android:foregroundServiceType="mediaPlayback"
@@ -489,7 +491,7 @@
android:name=".calls.CallService"
android:enabled="true"
android:exported="false"
android:foregroundServiceType="camera|microphone" />
android:foregroundServiceType="camera|microphone|phoneCall" />
<receiver
android:name=".notifications.MarkReadReceiver"
+12 -8
View File
@@ -1043,22 +1043,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1574,7 +1578,7 @@ See <a href="https://delta.chat/en/2023-05-22-webxdc-security">here for the full
<li>
<p>2023 March, <a href="https://cure53.de">Cure53</a> analyzed both the transport encryption of
Delta Chats network connections and a reproducible mail server setup as
<a href="https://delta.chat/cs/serverguide">recommended on this site</a>.
<a href="https://delta.chat/serverguide">recommended on this site</a>.
You can read more about the audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">on our blog</a>
or read the <a href="https://delta.chat/assets/blog/MER-01-report.pdf">full report here</a>.</p>
</li>
+7 -9
View File
@@ -970,18 +970,16 @@ kannst du jedoch unter <strong>Einstellungen → Erweitert → Relays</strong>
<ul>
<li>
<p>Du kannst ein Relay <strong>hinzufügen</strong>, indem du einen QR-Code scannst,
z.B. von <a href="https://chatmail.at/relays">https://chatmail.at/relays</a>.
Bei mehreren Relays, empfängst du die Nachrichten von allen Relays.</p>
<p>Du kannst ein Relay <strong>hinzufügen</strong>, indem du einen QR-Code scannst, z.B. von <a href="https://chatmail.at/relays">chatmail.at/relays</a>. Bei mehreren Relays, empfängst du die Nachrichten von allen Relays. Deine Kontakte lernen deine Relays automatisch, sobald du ihnen schreibst.</p>
</li>
<li>
<p><strong>Standard</strong> legt das Relay fest, an das deine Chatpartner zukünftig Nachrichten senden.</p>
<p>Tippe ein Relay an, um es <strong>Zum Senden zu verwenden</strong></p>
</li>
<li>
<p>Wenn du ein Relay <strong>entfernst</strong>,
stelle sicher, dass ein anderes Standard-Relay ausreichend lange verwendet wurde.
Andernfalls erreichen dich keine Nachrichten von deinen Kontakten.
Im Zweifelsfall entferne das Relay später.</p>
<p>Wenn du ein Relay <strong>entfernst</strong>, können Kontakte, die nur dieses Relay kennen, dich nicht erreichen, bis du ihnen wieder schreibst. Um erreichbar zu bleiben, wähle <strong>Vor Kontakten verstecken</strong> im Bestätigungsdialog anstelle das Relay direkt zu löschen.</p>
</li>
<li>
<p>Um ein verstecktes Relay wieder <strong>anzuzeigen</strong> tippe es an.</p>
</li>
</ul>
@@ -1470,7 +1468,7 @@ Weitere Informationen findest du in unserem Blogbeitrag über <a href="https://d
<p>Im April 2023 haben wir Sicherheits- und Datenschutzprobleme mit dem “In Chats geteilten Apps”-Feature behoben, die mit Fehlern beim Sandboxing, insbesondere mit Chromium zusammenhängen. Wir haben daraufhin eine unabhängige Sicherheitsprüfung von Cure53 durchführen lassen, und alle gefundenen Probleme wurden mit den im April 2023 veröffentlichten 1.36 Releases behoben. Siehe <a href="https://delta.chat/en/2023-05-22-webxdc-security">hier für die vollständige Hintergrundgeschichte</a>.</p>
</li>
<li>
<p>Im März 2023 analysierte <a href="https://cure53.de">Cure53</a> sowohl die Transportverschlüsselung von Delta Chats Netzwerkverbindungen als auch das reproduzierbare Mailserver-Setup wie <a href="https://delta.chat/de/serverguide">auf dieser Seite empfohlen</a>. Du kannst mehr über das Audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">in unserem Blog</a> lesen oder du liest den <a href="https://delta.chat/assets/blog/MER-01-report.pdf">vollständigen Bericht hier</a>.</p>
<p>Im März 2023 analysierte <a href="https://cure53.de">Cure53</a> sowohl die Transportverschlüsselung von Delta Chats Netzwerkverbindungen als auch das reproduzierbare Mailserver-Setup wie <a href="https://delta.chat/serverguide">auf dieser Seite empfohlen</a>. Du kannst mehr über das Audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">in unserem Blog</a> lesen oder du liest den <a href="https://delta.chat/assets/blog/MER-01-report.pdf">vollständigen Bericht hier</a>.</p>
</li>
<li>
<p>Im Jahr 2020 analysierte <a href="https://includesecurity.com">Include Security</a> Delta Chats Rust <a href="https://github.com/deltachat/deltachat-core-rust/">core</a>, <a href="https://github.com/async-email/async-imap">IMAP</a>,<a href="https://github.com/async-email/async-smtp">SMTP</a>, und <a href="https://github.com/async-email/async-native-tls">TLS</a> Bibliotheken.
+12 -8
View File
@@ -1043,22 +1043,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1574,7 +1578,7 @@ See <a href="https://delta.chat/en/2023-05-22-webxdc-security">here for the full
<li>
<p>2023 March, <a href="https://cure53.de">Cure53</a> analyzed both the transport encryption of
Delta Chats network connections and a reproducible mail server setup as
<a href="https://delta.chat/en/serverguide">recommended on this site</a>.
<a href="https://delta.chat/serverguide">recommended on this site</a>.
You can read more about the audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">on our blog</a>
or read the <a href="https://delta.chat/assets/blog/MER-01-report.pdf">full report here</a>.</p>
</li>
+13 -10
View File
@@ -105,8 +105,7 @@
</h2>
<p>Delta Chat is a reliable, decentralized and secure instant messaging app,
available for mobile and desktop platforms.</p>
<p>Delta Chat es una aplicación de mensajería instantánea confiable, descentralizada y segura, disponible para dispositivos móviles y computadoras de escritorio.</p>
<ul>
<li>
@@ -1039,22 +1038,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1563,7 +1566,7 @@ See <a href="https://delta.chat/en/2023-05-22-webxdc-security">here for the full
<li>
<p>2023 March, <a href="https://cure53.de">Cure53</a> analyzed both the transport encryption of
Delta Chats network connections and a reproducible mail server setup as
<a href="https://delta.chat/es/serverguide">recommended on this site</a>.
<a href="https://delta.chat/serverguide">recommended on this site</a>.
You can read more about the audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">on our blog</a>
or read the <a href="https://delta.chat/assets/blog/MER-01-report.pdf">full report here</a>.</p>
</li>
File diff suppressed because it is too large Load Diff
+12 -8
View File
@@ -957,22 +957,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1479,7 +1483,7 @@ research paper published afterwards.</p>
Vous trouverez <a href="https://delta.chat/en/2023-05-22-webxdc-security">ici un article de fond complet à propos de la sécurité du chiffrement de bout-en-bout sur internet</a>.</p>
</li>
<li>
<p>Début 2023, <a href="https://cure53.de">Cure53</a> a analysé le chiffrement dacheminement des connexions réseau de Delta Chat et testé une configuration de serveur de courriel reproductible, telle que <a href="https://delta.chat/fr/serverguide">recommandée sur ce site</a>.
<p>Début 2023, <a href="https://cure53.de">Cure53</a> a analysé le chiffrement dacheminement des connexions réseau de Delta Chat et testé une configuration de serveur de courriel reproductible, telle que <a href="https://delta.chat/serverguide">recommandée sur ce site</a>.
Vous trouverez plus dinformations sur cet audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">sur notre blog</a> ou dans <a href="https://delta.chat/assets/blog/MER-01-report.pdf">le rapport complet ici</a>.</p>
</li>
<li>
+12 -8
View File
@@ -1043,22 +1043,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1574,7 +1578,7 @@ See <a href="https://delta.chat/en/2023-05-22-webxdc-security">here for the full
<li>
<p>2023 March, <a href="https://cure53.de">Cure53</a> analyzed both the transport encryption of
Delta Chats network connections and a reproducible mail server setup as
<a href="https://delta.chat/id/serverguide">recommended on this site</a>.
<a href="https://delta.chat/serverguide">recommended on this site</a>.
You can read more about the audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">on our blog</a>
or read the <a href="https://delta.chat/assets/blog/MER-01-report.pdf">full report here</a>.</p>
</li>
+20 -14
View File
@@ -13,7 +13,7 @@
<li><a href="#cosa-significa-il-punto-verde">Cosa significa il punto verde?</a></li>
<li><a href="#cosa-significano-i-segni-di-spunta-visualizzati-accanto-ai-messaggi-in-uscita">Cosa significano i segni di spunta visualizzati accanto ai messaggi in uscita?</a></li>
<li><a href="#edit">Correggi gli errori e cancella i messaggi dopo averli inviati</a></li>
<li><a href="#mediaquality">How is media quality handled?</a></li>
<li><a href="#mediaquality">Come viene gestita la qualità dei media?</a></li>
<li><a href="#ephemeralmsgs">Come funzionano i messaggi a scomparsa?</a></li>
<li><a href="#delold">Cosa succede se attivo “Elimina Messaggi dal Dispositivo”?</a></li>
<li><a href="#remove-account">Come posso eliminare il mio profilo chat?</a></li>
@@ -399,7 +399,7 @@ che avrebbero già potuto rispondere, inoltrare, salvare, scattare una schermata
<h3 id="mediaquality">
How is media quality handled? <a href="#mediaquality" class="anchor"></a>
Come viene gestita la qualità dei media? <a href="#mediaquality" class="anchor"></a>
</h3>
@@ -409,16 +409,16 @@ o <img style="vertical-align:middle; width:0.8em; margin:1px" src="../mic.png" a
<ul>
<li>
<p>By default, compression ensures <strong>fast, efficient delivery</strong> that respects everyones data limits and storage.
This is ideal for everyday communication.</p>
<p>Per impostazione predefinita, la compressione garantisce una <strong>consegna rapida ed efficiente</strong> che rispetta i limiti di dati e di spazio di archiviazione di tutti.
Questa soluzione è ideale per la comunicazione quotidiana.</p>
</li>
<li>
<p>In regions with worse connectivity,
you can choose higher compression at <strong>Settings → ChatsOutgoing Media Quality</strong>.</p>
<p>Nelle regioni con connettività peggiore,
è possibile scegliere una compressione più elevata in <strong>Impostazioni → Chat → Qualità Media in Uscita</strong>.</p>
</li>
<li>
<p>If you specifically need to send media in its <strong>original quality</strong>, use <img style="vertical-align:middle; width:1.0em; margin:1px" src="../paperclip.png" alt="Paperclip" /> <strong>Attach → File</strong> in the chat.
Please use this method sparingly, as sending original files will significantly increase data usage for you and all recipients in the chat.</p>
<p>Se hai bisogno di inviare i file multimediali nella loro <strong>qualità originale</strong>, usa <img style="vertical-align:middle; width:1.0em; margin:1px" src="../paperclip.png" alt="Paperclip" /> <strong>Allega → File</strong> nella chat.
Si prega di utilizzare questo metodo con parsimonia, poiché linvio di file originali aumenterà significativamente il consumo di dati per te e per tutti i destinatari della chat.</p>
</li>
</ul>
@@ -1034,16 +1034,22 @@ Tuttavia, se lo si desidera,
<ul>
<li>
<p>Puoi <strong>aggiungere</strong> un ripetitore scansionando il suo codice QR;<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> ne mostra alcuni noti.
Se hai più ripetitori, riceverai messaggi su tutti.</p>
<p>Puoi <strong>aggiungere</strong> un ripetitore scansionando il suo codice QR;
<a href="https://chatmail.at/relays">chatmail.at/relays</a> mostra alcuni ripetitori noti.
Se hai più ripetitori, riceverai i messaggi su tutti.
I contatti vengono a conoscenza automaticamente dei tuoi ripetitori attuali quando invii loro un messaggio.</p>
</li>
<li>
<p>Lopzione <strong>predefinita</strong> definisce quella a cui i tuoi partner di chat invieranno messaggi futuri.</p>
<p>Tocca un ripetitore per impostarlo come <strong>utilizzato per linvio</strong>.</p>
</li>
<li>
<p>Se <strong>rimuovi</strong> un ripetitore,
assicurati che un altro ripetitore predefinito sia stato utilizzato per un periodo di tempo sufficiente.
In caso contrario, i messaggi dei tuoi interlocutori di chat non ti arriveranno.In caso di dubbio, rimuovilo in seguito.</p>
i contatti che conoscono solo quel ripetitore potrebbero non raggiungerti finché non invierai loro un nuovo messaggio.
Per rimanere raggiungibile nel frattempo, seleziona <strong>Nascondi dai Contatti</strong> nella finestra di dialogo di conferma
invece di rimuoverlo immediatamente.</p>
</li>
<li>
<p>Per <strong>visualizzare</strong> nuovamente un ripetitore nascosto, toccalo.</p>
</li>
</ul>
@@ -1560,7 +1566,7 @@ Vedi <a href="https://delta.chat/en/2023-05-22-webxdc-security">qui per la stori
<li>
<p>A partire dal 2023, <a href="https://cure53.de">Cure53</a> ha analizzato sia la crittografia del trasporto delle
Connessioni di rete di Delta Chat e una configurazione del server di posta riproducibile come
<a href="https://delta.chat/it/serverguide">consigliato su questo sito</a>.
<a href="https://delta.chat/serverguide">consigliato su questo sito</a>.
Puoi leggere ulteriori informazioni sullaudit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">sul nostro blog</a>
o leggere il <a href="https://delta.chat/assets/blog/MER-01-report.pdf">rapporto completo qui</a>.</p>
</li>
+12 -8
View File
@@ -1037,22 +1037,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1568,7 +1572,7 @@ Lees <a href="https://delta.chat/en/2023-05-22-webxdc-security">hier het volledi
<li>
<p>Aan het begin van 2023 heeft <a href="https://cure53.de">Cure53</a> de transportversleuteling van
Delta Chats netwerkverbindingen getest, evenals de e-mailserveropzet zoals
<a href="https://delta.chat/nl/serverguide">beschreven op onze site</a>.
<a href="https://delta.chat/serverguide">beschreven op onze site</a>.
Meer informatie over deze test is te lezen <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">op ons blog</a>
of in het <a href="https://delta.chat/assets/blog/MER-01-report.pdf">volledige verslag</a>.</p>
</li>
+12 -8
View File
@@ -959,22 +959,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1409,7 +1413,7 @@ od najnowszych do najstarszych:</p>
<p>W kwietniu 2023 r. naprawiliśmy problemy z bezpieczeństwem i prywatnością w funkcji „aplikacje internetowe udostępniane na czacie”, związane z awariami piaskownicy, szczególnie w przypadku Chromium. Następnie przeprowadziliśmy niezależny audyt bezpieczeństwa od Cure53 i wszystkie wykryte problemy zostały naprawione w aplikacji z serii 1.36 wydanej w kwietniu 2023 r. <a href="https://delta.chat/en/2023-05-22-webxdc-security">Pełną historię bezpieczeństwa end-to-end w sieci można znaleźć tutaj</a>.</p>
</li>
<li>
<p>W marcu 2023 r. firma <a href="https://cure53.de">Cure53</a> przeanalizowała zarówno szyfrowanie transportu połączeń sieciowych Delta Chat, jak i powtarzalną konfigurację serwera pocztowego zgodnie z <a href="https://delta.chat/pl/serverguide">zaleceniami na tej stronie</a>. Możesz przeczytać więcej o audycie <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">na naszym blogu</a> lub przeczytać pełny raport <a href="https://delta.chat/assets/blog/MER-01-report.pdf">tutaj</a>.</p>
<p>W marcu 2023 r. firma <a href="https://cure53.de">Cure53</a> przeanalizowała zarówno szyfrowanie transportu połączeń sieciowych Delta Chat, jak i powtarzalną konfigurację serwera pocztowego zgodnie z <a href="https://delta.chat/serverguide">zaleceniami na tej stronie</a>. Możesz przeczytać więcej o audycie <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">na naszym blogu</a> lub przeczytać pełny raport <a href="https://delta.chat/assets/blog/MER-01-report.pdf">tutaj</a>.</p>
</li>
<li>
<p>W 2020 r. firma <a href="https://includesecurity.com">Include Security</a> przeanalizowała biblioteki Rust <a href="https://github.com/deltachat/deltachat-core-rust/">core</a>, <a href="https://github.com/async-email/async-imap">IMAP</a>, <a href="https://github.com/async-email/async-smtp">SMTP</a> i <a href="https://github.com/async-email/async-native-tls">TLS</a> Delta Chat. Nie znalazła żadnych problemów krytycznych ani poważnych. W raporcie zwrócono uwagę na kilka słabych punktów o średniej wadze same w sobie nie stanowią zagrożenia dla użytkowników Delta Chat, ponieważ zależą od środowiska, w którym używany jest Delta Chat. Ze względu na użyteczność i kompatybilność nie możemy złagodzić wszystkich z nich i zdecydowaliśmy się przedstawić zalecenia dotyczące bezpieczeństwa zagrożonym użytkownikom. Pełny raport można przeczytać <a href="https://delta.chat/assets/blog/2020-second-security-review.pdf">tutaj</a>.</p>
+12 -8
View File
@@ -1038,22 +1038,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1569,7 +1573,7 @@ See <a href="https://delta.chat/en/2023-05-22-webxdc-security">here for the full
<li>
<p>2023 March, <a href="https://cure53.de">Cure53</a> analyzed both the transport encryption of
Delta Chats network connections and a reproducible mail server setup as
<a href="https://delta.chat/pt/serverguide">recommended on this site</a>.
<a href="https://delta.chat/serverguide">recommended on this site</a>.
You can read more about the audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">on our blog</a>
or read the <a href="https://delta.chat/assets/blog/MER-01-report.pdf">full report here</a>.</p>
</li>
+16 -13
View File
@@ -1037,22 +1037,26 @@ PIN-код разблокировки экрана, графический кл
<p>По умолчанию, после установки, релей <strong>настраивается автоматически</strong>,
поэтому вам не нужно об этом волноваться.
Однако, если хотите,
вы можете настроить релеи в <strong>Настройки → Дополнительно → Релеи</strong>:</p>
вы можете настроить релеи в меню <strong>Настройки → Дополнительно → Релеи</strong>:</p>
<ul>
<li>
<p>Вы можете <strong>добавить</strong> релей, отсканировав его QR-код;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> содержит список известных релеев.
Если у вас несколько релеев, вы будете получать сообщения на все из них.</p>
на сайте <a href="https://chatmail.at/relays">chatmail.at/relays</a> представлен список известных.
Если у вас настроено несколько релеев, сообщения будут доставляться через все из них.
Ваши контакты автоматически узнают о текущих используемых вами релеях при обмене сообщениями.</p>
</li>
<li>
<p><strong>По умолчанию</strong> определяет релей, на который ваши собеседники будут отправлять будущие сообщения.</p>
<p>Нажмите на релей, чтобы установить его как <strong>используемый для отправки</strong>.</p>
</li>
<li>
<p>Если вы <strong>удаляете</strong> релей,
убедитесь, что другой релей по умолчанию использовался в течение достаточного количества времени.
В противном случае сообщения от ваших собеседников не будут доходить до вас.
Если сомневаетесь, удалите его позже.</p>
<p>Если вы <strong>удалите</strong> релей,
контакты, которые знают только этот релей, не смогут связаться с вами до тех пор, пока вы снова не напишите им.
Чтобы оставаться на связи в это время, выберите опцию <strong>Скрыть из контактов</strong> во всплывающем окне
вместо того, чтобы удалять его сразу.</p>
</li>
<li>
<p>Чтобы снова <strong>показать</strong> скрытый релей, нажмите на него.</p>
</li>
</ul>
@@ -1567,11 +1571,10 @@ Applied Cryptography в ETH Цюрихе и устранили все выявл
См. здесь <a href="https://delta.chat/en/2023-05-22-webxdc-security">полную информацию о безопасности сквозного шифрования в Интернете</a>.</p>
</li>
<li>
<p>В Марте 2023 года, <a href="https://cure53.de">Cure53</a> проанализировал как протокол защиты транспортного уровня
сетевого соединения Delta Chat, так и воспроизводимую установку почтового сервера,
<a href="https://delta.chat/ru/serverguide">рекомендуемую на этом сайте</a>.
Подробнее об аудите можно узнать <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">в нашем блоге</a>
или прочитать <a href="https://delta.chat/assets/blog/MER-01-report.pdf">полный отчёт здесь</a>.</p>
<p>В марте 2023 года компания <a href="https://cure53.de">Cure53</a> провела анализ шифрования транспортного уровня сетевых соединений Delta Chat, а также проверку воспроизводимой конфигурации почтового сервера,
<a href="https://delta.chat/serverguide">рекомендованной на этом сайте</a>.
Подробнее об аудите можно узнать <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">в нашем блоге</a>,
а <a href="https://delta.chat/assets/blog/MER-01-report.pdf">полный отчет доступен по этой ссылке</a>.</p>
</li>
<li>
<p>2020 год, <a href="https://includesecurity.com">Include Security</a> проанализировала Delta
+12 -8
View File
@@ -1043,22 +1043,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1574,7 +1578,7 @@ See <a href="https://delta.chat/en/2023-05-22-webxdc-security">here for the full
<li>
<p>2023 March, <a href="https://cure53.de">Cure53</a> analyzed both the transport encryption of
Delta Chats network connections and a reproducible mail server setup as
<a href="https://delta.chat/sk/serverguide">recommended on this site</a>.
<a href="https://delta.chat/serverguide">recommended on this site</a>.
You can read more about the audit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">on our blog</a>
or read the <a href="https://delta.chat/assets/blog/MER-01-report.pdf">full report here</a>.</p>
</li>
+12 -8
View File
@@ -1045,22 +1045,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1577,7 +1581,7 @@ Shihni <a href="https://delta.chat/en/2023-05-22-webxdc-security">këtu, për sh
<li>
<p>Në fillim të 2023-it, <a href="https://cure53.de">Cure53</a> analizoi qoftë fshehtëzimin
e transporteve për lidhje rrjeti të Delta Chat-it, qoftë një formësim të riprodhueshëm
shërbyesi poste si <a href="https://delta.chat/sq/serverguide">të rekomanduarin në këtë sajt</a>.
shërbyesi poste si <a href="https://delta.chat/serverguide">të rekomanduarin në këtë sajt</a>.
Mund të lexoni më tepër rreth auditimit <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">në blogun tonë</a>,
ose të lexoni <a href="https://delta.chat/assets/blog/MER-01-report.pdf">raportin e plotë këtu</a>.</p>
</li>
+12 -8
View File
@@ -945,22 +945,26 @@ Relays are operated by different groups and people.</p>
<p>By default, after installation, a relay is <strong>automatically set up</strong>,
so you do not need to care about that.
However, if you want to,
you can configure relays at At <strong>Settings → Advanced → Relays</strong>:</p>
you can configure relays at <strong>Settings → Advanced → Relays</strong>:</p>
<ul>
<li>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">https://chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.</p>
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>The <strong>default</strong> defines the one where your chat partners send future messages to.</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
make sure another default relay was used for a sufficient amount of time.
Otherwise, messages from your chat partners wont reach you.
If in doubt, remove later.</p>
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
@@ -1387,7 +1391,7 @@ you need to look it up in the “keypairs” SQLite table of a profile backup ta
<p>Починаючи з 2023 року, ми виправили проблеми з безпекою та конфіденційністю у функції “веб застосунків, що поширені у чаті”, пов’язані зі збоями в роботі пісочниці особливо в Chromium. Згодом ми отримали незалежний аудит безпеки аудит безпеки від Cure53, і всі знайдені проблеми були виправлені в серії додатків 1.36, випущених у квітні 2023 року. Повну історію про наскрізну безпеку в Інтернеті дивіться <a href="https://delta.chat/en/2023-05-22-webxdc-security">тут</a>.</p>
</li>
<li>
<p>Починаючи з 2023 року <a href="https://cure53.de">Cure53</a> проаналізував транспортне шифрування мережевих з’єднань Delta Chat і відтворюване налаштування поштового сервера як <a href="https://delta.chat/uk/serverguide">рекомендовано на цьому сайті</a>. Ви можете прочитати більше про аудит <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">у нашому блозі</a> або прочитайте <a href="https://delta.chat/assets/blog/MER-01-report.pdf">повний звіт тут</a>.</p>
<p>Починаючи з 2023 року <a href="https://cure53.de">Cure53</a> проаналізував транспортне шифрування мережевих з’єднань Delta Chat і відтворюване налаштування поштового сервера як <a href="https://delta.chat/serverguide">рекомендовано на цьому сайті</a>. Ви можете прочитати більше про аудит <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">у нашому блозі</a> або прочитайте <a href="https://delta.chat/assets/blog/MER-01-report.pdf">повний звіт тут</a>.</p>
</li>
<li>
<p>У 2020 році <a href="https://includesecurity.com">Include Security</a> проаналізувала Rust-<a href="https://github.com/deltachat/deltachat-core-rust/">ядро</a> Delta Chat і бібліотеки <a href="https://github.com/async-email/async-imap">IMAP</a>, <a href="https://github.com/async-email/async-smtp">SMTP</a> та <a href="https://github.com/async-email/async-native-tls">TLS</a>. Він не виявив критичних або серйозних проблем. У звіті виявлено кілька слабких місць середнього ступеня тяжкості – вони самі по собі не становлять загрози для користувачів Delta Chat оскільки вони залежать від середовища, у якому використовується Delta Chat. З міркувань зручності використання та сумісності ми не можемо пом’якшити їх усі тому вирішили надати рекомендації щодо безпеки користувачам, яким загрожує небезпека. Ви можете прочитати <a href="https://delta.chat/assets/blog/2020-second-security-review.pdf">повний звіт тут</a>.</p>
+15 -17
View File
@@ -1032,29 +1032,27 @@ Please use this method sparingly, as sending original files will significantly i
<p>可以在“设置 → 高级 → 中继服务器”中配置:</p>
<ul>
<li>您可以通过扫描二维码来<strong>添加</strong>中继;</li>
</ul>
<p><a href="https://chatmail.at/relays">https://chatmail.at/relays</a> 显示了一些已知的中继服务器。</p>
<p>如果您添加了多个中继,您将在所有中继上收到消息。</p>
<ul>
<li>
<p><strong>默认</strong>地址确定了聊天伙伴今后发送消息的目标地址。</p>
<p>You can <strong>add</strong> a relay by scanning its QR code;
<a href="https://chatmail.at/relays">chatmail.at/relays</a> shows some known ones.
If you have multiple relays, you will receive messages on all of them.
Contacts learn your current relays automatically when you message them.</p>
</li>
<li>
<p>如果您<strong>移除</strong>某个中继服务器,</p>
<p>Tap on a relay to set it as <strong>used for sending</strong>.</p>
</li>
<li>
<p>If you <strong>remove</strong> a relay,
contacts who only know this relay may not reach you until you message them again.
To stay reachable in the meantime, choose <strong>Hide from Contacts</strong> in the confirmation dialog
instead of removing it right away.</p>
</li>
<li>
<p>To <strong>show</strong> a hidden relay again, tap on it.</p>
</li>
</ul>
<p>请确保已使用另一个默认中继服务器足够长的时间。</p>
<p>否则,您将无法收到聊天伙伴的消息。</p>
<p>如有问题,请稍后再移除。</p>
<p>有关中继服务器的更多细节和未来可能性、
您可以关注 <a href="https://support.delta.chat">论坛</a> 中的讨论。</p>
@@ -1559,7 +1557,7 @@ Delta Chat 长期接受第三方独立机构的安全审计与漏洞分析,
</li>
<li>
<p>2023 年 3 月,<a href="https://cure53.de">Cure53</a> 分析了 Delta Chat 网络连接的传输加密和一个可重现的邮件服务器设置,如
<a href="https://delta.chat/zh_CN/serverguide">本网站</a> 推荐的那样。
<a href="https://delta.chat/serverguide">本网站</a> 推荐的那样。
你可以在 <a href="https://delta.chat/en/2023-03-27-third-independent-security-audit">我们的博客</a> 上阅读有关审计的更多信息
,或在此处阅读 <a href="https://delta.chat/assets/blog/MER-01-report.pdf">完整报告</a></p>
</li>
+26 -2
View File
@@ -396,7 +396,7 @@ public class Rpc {
}
/**
* Gets messages to be processed by the bot and returns their IDs.
* (deprecated) Gets messages to be processed by the bot and returns their IDs.
* <p>
* Only messages with database ID higher than `last_msg_id` config value
* are returned. After processing the messages, the bot should
@@ -404,6 +404,13 @@ public class Rpc {
* or manually updating the value to avoid getting already
* processed messages.
* <p>
* Deprecated 2026-04: This returns the message's id as soon as the first part arrives,
* even if it is not fully downloaded yet.
* The bot needs to wait for the message to be fully downloaded.
* Since this is usually not the desired behavior,
* bots should instead use the #DC_EVENT_INCOMING_MSG / [`types::events::EventType::IncomingMsg`]
* event for getting notified about new messages.
* <p>
* [`markseen_msgs`]: Self::markseen_msgs
*/
public java.util.List<Integer> getNextMsgs(Integer accountId) throws RpcException {
@@ -411,7 +418,7 @@ public class Rpc {
}
/**
* Waits for messages to be processed by the bot and returns their IDs.
* (deprecated) Waits for messages to be processed by the bot and returns their IDs.
* <p>
* This function is similar to [`get_next_msgs`],
* but waits for internal new message notification before returning.
@@ -422,6 +429,13 @@ public class Rpc {
* To shutdown the bot, stopping I/O can be used to interrupt
* pending or next `wait_next_msgs` call.
* <p>
* Deprecated 2026-04: This returns the message's id as soon as the first part arrives,
* even if it is not fully downloaded yet.
* The bot needs to wait for the message to be fully downloaded.
* Since this is usually not the desired behavior,
* bots should instead use the #DC_EVENT_INCOMING_MSG / [`types::events::EventType::IncomingMsg`]
* event for getting notified about new messages.
* <p>
* [`get_next_msgs`]: Self::get_next_msgs
*/
public java.util.List<Integer> waitNextMsgs(Integer accountId) throws RpcException {
@@ -820,6 +834,16 @@ public class Rpc {
transport.call("marknoticed_chat", mapper.valueToTree(accountId), mapper.valueToTree(chatId));
}
/**
* Marks the last incoming message in the chat as _fresh_.
* <p>
* UI can use this to offer a "mark unread" option,
* so that already noticed chats get a badge counter again.
*/
public void markfreshChat(Integer accountId, Integer chatId) throws RpcException {
transport.call("markfresh_chat", mapper.valueToTree(accountId), mapper.valueToTree(chatId));
}
/**
* Returns the message that is immediately followed by the last seen
* message.
@@ -59,8 +59,6 @@ public class DcMsg {
public static final int DC_VIDEOCHATTYPE_UNKNOWN = 0;
public static final int DC_VIDEOCHATTYPE_BASICWEBRTC = 1;
private static final String TAG = DcMsg.class.getSimpleName();
public DcMsg(DcContext context, int viewtype) {
msgCPtr = context.createMsgCPtr(viewtype);
}
@@ -35,7 +35,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class AllMediaActivity extends PassphraseRequiredActionBarActivity
implements DcEventCenter.DcEventDelegate {
private static final String TAG = AllMediaActivity.class.getSimpleName();
private static final String TAG = "AllMediaActivity";
public static final String CHAT_ID_EXTRA = "chat_id";
public static final String CONTACT_ID_EXTRA = "contact_id";
@@ -40,7 +40,6 @@ import org.thoughtcrime.securesms.connect.KeepAliveService;
import org.thoughtcrime.securesms.connect.NetworkStateReceiver;
import org.thoughtcrime.securesms.crypto.DatabaseSecret;
import org.thoughtcrime.securesms.crypto.DatabaseSecretProvider;
import org.thoughtcrime.securesms.geolocation.DcLocationManager;
import org.thoughtcrime.securesms.jobmanager.JobManager;
import org.thoughtcrime.securesms.notifications.FcmReceiveService;
import org.thoughtcrime.securesms.notifications.InChatSounds;
@@ -53,7 +52,7 @@ import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.webxdc.WebxdcGarbageCollectionWorker;
public class ApplicationContext extends MultiDexApplication {
private static final String TAG = ApplicationContext.class.getSimpleName();
private static final String TAG = "ApplicationContext";
private static final Object initLock = new Object();
private static volatile boolean isInitialized = false;
@@ -61,7 +60,6 @@ public class ApplicationContext extends MultiDexApplication {
private Rpc rpc;
private DcContext dcContext;
private DcLocationManager dcLocationManager;
private DcEventCenter eventCenter;
private NotificationCenter notificationCenter;
private JobManager jobManager;
@@ -126,15 +124,6 @@ public class ApplicationContext extends MultiDexApplication {
}
}
/**
* Get DcLocationManager instance, waiting for initialization if necessary. This method is
* thread-safe and will block until initialization is complete.
*/
public DcLocationManager getLocationManager() {
ensureInitialized();
return dcLocationManager;
}
/**
* Get DcEventCenter instance, waiting for initialization if necessary. This method is thread-safe
* and will block until initialization is complete.
@@ -229,7 +218,7 @@ public class ApplicationContext extends MultiDexApplication {
Log.i(TAG, "DcAccounts created");
rpc = new Rpc(new FFITransport(dcAccounts.getJsonrpcInstance()));
Log.i(TAG, "Rpc created");
AccountManager.getInstance().migrateToDcAccounts(this);
AccountManager.getInstance().migrateToDcAccounts(this, dcAccounts);
int[] allAccounts = dcAccounts.getAll();
Log.i(TAG, "Number of profiles: " + allAccounts.length);
@@ -282,7 +271,6 @@ public class ApplicationContext extends MultiDexApplication {
}
dcContext = dcAccounts.getSelectedAccount();
notificationCenter = new NotificationCenter(this);
dcLocationManager = new DcLocationManager(this, dcContext);
isInitialized = true;
initLock.notifyAll();
@@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public abstract class BaseActionBarActivity extends AppCompatActivity {
private static final String TAG = BaseActionBarActivity.class.getSimpleName();
private static final String TAG = "BaseActionBarActivity";
protected DynamicTheme dynamicTheme = new DynamicTheme();
protected void onPreCreate() {
@@ -13,6 +13,7 @@ import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.AsyncTask;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -26,6 +27,8 @@ import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutManagerCompat;
import androidx.core.graphics.drawable.IconCompat;
import androidx.fragment.app.Fragment;
import chat.delta.rpc.Rpc;
import chat.delta.rpc.RpcException;
import com.b44t.messenger.DcChat;
import com.b44t.messenger.DcContact;
import com.b44t.messenger.DcContext;
@@ -44,6 +47,7 @@ import org.thoughtcrime.securesms.util.task.SnackbarAsyncTask;
import org.thoughtcrime.securesms.util.views.ProgressDialog;
public abstract class BaseConversationListFragment extends Fragment implements ActionMode.Callback {
private static final String TAG = "BaseConversationListFragment";
protected ActionMode actionMode;
protected PulsingFloatingActionButton fab;
@@ -118,9 +122,6 @@ public abstract class BaseConversationListFragment extends Fragment implements A
Context context = getContext();
if (context != null) {
if (SendRelayedMessageUtil.containsVideoType(context, uris)) {
message += "\n\n" + getString(R.string.videos_sent_without_recoding);
}
new AlertDialog.Builder(context)
.setMessage(message)
.setCancelable(false)
@@ -128,11 +129,16 @@ public abstract class BaseConversationListFragment extends Fragment implements A
.setPositiveButton(
R.string.menu_send,
(dialog, which) -> {
Activity activity = getActivity();
if (activity == null) {
return;
}
SendRelayedMessageUtil.immediatelyRelay(
getActivity(), selectedChats.toArray(new Long[selectedChats.size()]));
activity,
selectedChats.toArray(new Long[selectedChats.size()]),
() -> activity.finish());
actionMode.finish();
actionMode = null;
getActivity().finish();
})
.show();
}
@@ -170,6 +176,17 @@ public abstract class BaseConversationListFragment extends Fragment implements A
return false;
}
private boolean areSomeSelectedChatsFresh() {
DcContext dcContext = DcHelper.getContext(requireActivity());
final Set<Long> selectedChats = getListAdapter().getBatchSelections();
for (long chatId : selectedChats) {
if (dcContext.getFreshMsgCount((int) chatId) > 0) {
return true;
}
}
return false;
}
private void handlePinAllSelected() {
final DcContext dcContext = DcHelper.getContext(requireActivity());
final Set<Long> selectedConversations =
@@ -229,6 +246,26 @@ public abstract class BaseConversationListFragment extends Fragment implements A
}
}
private void handleMarkfreshSelected() {
final Set<Long> selectedConversations =
new HashSet<Long>(getListAdapter().getBatchSelections());
final Rpc rpc = DcHelper.getRpc(requireActivity());
try {
int accId = rpc.getSelectedAccountId();
for (long chatId : selectedConversations) {
rpc.markfreshChat(accId, (int) chatId);
}
} catch (RpcException e) {
Log.e(TAG, "RPC error", e);
}
if (actionMode != null) {
actionMode.finish();
actionMode = null;
}
}
@SuppressLint("StaticFieldLeak")
private void handleArchiveAllSelected() {
final DcContext dcContext = DcHelper.getContext(requireActivity());
@@ -409,6 +446,7 @@ public abstract class BaseConversationListFragment extends Fragment implements A
if (!isRelayingMessageContent(requireActivity())) {
final int selectedCount = getListAdapter().getBatchSelections().size();
menu.findItem(R.id.menu_add_to_home_screen).setVisible(selectedCount == 1);
MenuItem archiveItem = menu.findItem(R.id.menu_archive_selected);
if (offerToArchive()) {
archiveItem.setIcon(R.drawable.ic_archive_white_24dp);
@@ -417,6 +455,7 @@ public abstract class BaseConversationListFragment extends Fragment implements A
archiveItem.setIcon(R.drawable.ic_unarchive_white_24dp);
archiveItem.setTitle(R.string.menu_unarchive_chat);
}
MenuItem pinItem = menu.findItem(R.id.menu_pin_selected);
if (areSomeSelectedChatsUnpinned()) {
pinItem.setIcon(R.drawable.ic_pin_white);
@@ -425,12 +464,17 @@ public abstract class BaseConversationListFragment extends Fragment implements A
pinItem.setIcon(R.drawable.ic_unpin_white);
pinItem.setTitle(R.string.unpin_chat);
}
MenuItem muteItem = menu.findItem(R.id.menu_mute_selected);
if (areSomeSelectedChatsUnmuted()) {
muteItem.setTitle(R.string.menu_mute);
} else {
muteItem.setTitle(R.string.menu_unmute);
}
final boolean someAreFresh = areSomeSelectedChatsFresh();
menu.findItem(R.id.menu_marknoticed_selected).setVisible(someAreFresh);
menu.findItem(R.id.menu_markfresh_selected).setVisible(!someAreFresh);
}
}
@@ -484,6 +528,9 @@ public abstract class BaseConversationListFragment extends Fragment implements A
} else if (itemId == R.id.menu_marknoticed_selected) {
handleMarknoticedSelected();
return true;
} else if (itemId == R.id.menu_markfresh_selected) {
handleMarkfreshSelected();
return true;
} else if (itemId == R.id.menu_add_to_home_screen) {
handleAddToHomeScreen();
return true;
@@ -29,7 +29,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
*/
public abstract class ContactSelectionActivity extends PassphraseRequiredActionBarActivity
implements ContactSelectionListFragment.OnContactSelectedListener {
private static final String TAG = ContactSelectionActivity.class.getSimpleName();
private static final String TAG = "ContactSelectionActivity";
protected ContactSelectionListFragment contactsFragment;
@@ -67,7 +67,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
*/
public class ContactSelectionListFragment extends Fragment
implements LoaderManager.LoaderCallbacks<DcContactsLoader.Ret>, DcEventCenter.DcEventDelegate {
private static final String TAG = ContactSelectionListFragment.class.getSimpleName();
private static final String TAG = "ContactSelectionListFragment";
public static final String MULTI_SELECT = "multi_select";
public static final String SELECT_UNENCRYPTED_EXTRA = "select_unencrypted_extra";
@@ -148,7 +148,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
InputPanel.Listener,
InputPanel.MediaListener,
AudioView.OnActionListener {
private static final String TAG = ConversationActivity.class.getSimpleName();
private static final String TAG = "ConversationActivity";
public static final String ACCOUNT_ID_EXTRA = "account_id";
public static final String CHAT_ID_EXTRA = "chat_id";
@@ -536,8 +536,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
menu.findItem(R.id.menu_start_call)
.setVisible(
Prefs.isCallsEnabled(this)
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& dcChat.canSend()
&& dcChat.isEncrypted()
&& !dcChat.isSelfTalk()
@@ -861,9 +860,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
private void askSendingFiles(ArrayList<Uri> uriList, Runnable onConfirm) {
String message =
String.format(getString(R.string.ask_send_files_to_chat), uriList.size(), dcChat.getName());
if (SendRelayedMessageUtil.containsVideoType(context, uriList)) {
message += "\n\n" + getString(R.string.videos_sent_without_recoding);
}
new AlertDialog.Builder(this)
.setMessage(message)
.setCancelable(false)
@@ -80,7 +80,7 @@ import org.thoughtcrime.securesms.util.views.ConversationAdaptiveActionsToolbar;
@SuppressLint("StaticFieldLeak")
public class ConversationFragment extends MessageSelectorFragment {
private static final String TAG = ConversationFragment.class.getSimpleName();
private static final String TAG = "ConversationFragment";
private static final int SCROLL_ANIMATION_THRESHOLD = 50;
@@ -1059,7 +1059,6 @@ public class ConversationFragment extends MessageSelectorFragment {
@Override
public void onStickerClicked(DcMsg messageRecord) {
new AlertDialog.Builder(getContext())
.setTitle(R.string.add_to_sticker_collection)
.setMessage(R.string.ask_add_sticker_to_collection)
.setPositiveButton(
R.string.ok,
@@ -86,7 +86,7 @@ import org.thoughtcrime.securesms.util.views.Stub;
* @author Moxie Marlinspike
*/
public class ConversationItem extends BaseConversationItem {
private static final String TAG = ConversationItem.class.getSimpleName();
private static final String TAG = "ConversationItem";
private static final Rect SWIPE_RECT = new Rect();
@@ -69,6 +69,7 @@ import org.thoughtcrime.securesms.components.SearchToolbar;
import org.thoughtcrime.securesms.connect.AccountManager;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.connect.DirectShareUtil;
import org.thoughtcrime.securesms.geolocation.LocationStreamingService;
import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.providers.PersistentBlobProvider;
@@ -90,7 +91,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class ConversationListActivity extends PassphraseRequiredActionBarActivity
implements ConversationListFragment.ConversationSelectedListener {
private static final String TAG = ConversationListActivity.class.getSimpleName();
private static final String TAG = "ConversationListActivity";
private static final String OPENPGP4FPR = "openpgp4fpr";
private static final String NDK_ARCH_WARNED = "ndk_arch_warned";
public static final String CLEAR_NOTIFICATIONS = "clear_notifications";
@@ -449,6 +450,9 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
refreshTitle();
invalidateOptionsMenu();
DirectShareUtil.triggerRefreshDirectShare(this);
if (DcHelper.getContext(this).isSendingLocationsToChat(0)) {
LocationStreamingService.ensureRunning(this);
}
}
@Override
@@ -622,14 +626,18 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
final DcContext dcContext = DcHelper.getContext(this);
int fwdAccId = getForwardedMessageAccountId(this);
if (fwdAccId == dcContext.getAccountId() && dcContext.getChat(chatId).isSelfTalk()) {
SendRelayedMessageUtil.immediatelyRelay(this, chatId);
Toast.makeText(
this,
DynamicTheme.getCheckmarkEmoji(this) + " " + getString(R.string.saved),
Toast.LENGTH_SHORT)
.show();
handleResetRelaying();
finish();
SendRelayedMessageUtil.immediatelyRelay(
this,
chatId,
() -> {
Toast.makeText(
this,
DynamicTheme.getCheckmarkEmoji(this) + " " + getString(R.string.saved),
Toast.LENGTH_SHORT)
.show();
handleResetRelaying();
finish();
});
} else {
Intent intent = new Intent(this, ConversationActivity.class);
intent.putExtra(ConversationActivity.ACCOUNT_ID_EXTRA, dcContext.getAccountId());
@@ -688,7 +696,11 @@ public class ConversationListActivity extends PassphraseRequiredActionBarActivit
// Util.copy(inputStream, new FileOutputStream(outputFile));
// msg.setFile(outputFile, "image/jpeg");
msg.setText(getString(R.string.update_2_46ac, "https://arcanechat.me/#contribute", "https://i.delta.chat/#0A45953086F0C166D3BAF1D4BB2025496E4C2704&x=MVPi07rQBEmHO4FRb3brpwDe&j=n8mkKqu42WAKKUCx1bQOVh23&s=AM1YCd_2hKuiSiTEb-2177On&a=arcanechat%40arcanechat.me&n=ArcaneChat&b=ArcaneChat+Channel"));
msg.setText(
getString(
R.string.update_2_46ac,
"https://arcanechat.me/#contribute",
"https://i.delta.chat/#0A45953086F0C166D3BAF1D4BB2025496E4C2704&x=MVPi07rQBEmHO4FRb3brpwDe&j=n8mkKqu42WAKKUCx1bQOVh23&s=AM1YCd_2hKuiSiTEb-2177On&a=arcanechat%40arcanechat.me&n=ArcaneChat&b=ArcaneChat+Channel"));
}
dcContext.addDeviceMsg(deviceMsgLabel, msg);
@@ -56,7 +56,7 @@ public class ConversationListFragment extends BaseConversationListFragment
public static final String ARCHIVE = "archive";
public static final String RELOAD_LIST = "reload_list";
private static final String TAG = ConversationListFragment.class.getSimpleName();
private static final String TAG = "ConversationListFragment";
private RecyclerView list;
private View emptyState;
@@ -42,7 +42,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
@SuppressLint("StaticFieldLeak")
public class CreateProfileActivity extends BaseActionBarActivity {
private static final String TAG = CreateProfileActivity.class.getSimpleName();
private static final String TAG = "CreateProfileActivity";
private static final int REQUEST_CODE_AVATAR = 1;
@@ -15,7 +15,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class EphemeralMessagesDialog {
private static final String TAG = EphemeralMessagesDialog.class.getSimpleName();
private static final String TAG = "EphemeralMessagesDialog";
public static void show(
final Context context,
@@ -46,7 +46,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
implements ItemClickListener {
private static final String TAG = GroupCreateActivity.class.getSimpleName();
private static final String TAG = "GroupCreateActivity";
public static final String EDIT_GROUP_CHAT_ID = "edit_group_chat_id";
public static final String CREATE_BROADCAST = "create_broadcast";
public static final String UNENCRYPTED = "unencrypted";
@@ -307,8 +307,7 @@ public class GroupCreateActivity extends PassphraseRequiredActionBarActivity
private boolean showGroupNameEmptyToast(String groupName) {
if (groupName == null) {
Toast.makeText(this, getString(R.string.group_please_enter_group_name), Toast.LENGTH_LONG)
.show();
Toast.makeText(this, getString(R.string.please_enter_chat_name), Toast.LENGTH_LONG).show();
return true;
}
return false;
@@ -65,7 +65,7 @@ import org.thoughtcrime.securesms.util.views.ProgressDialog;
public class InstantOnboardingActivity extends BaseActionBarActivity
implements DcEventCenter.DcEventDelegate {
private static final String TAG = InstantOnboardingActivity.class.getSimpleName();
private static final String TAG = "InstantOnboardingActivity";
private static final String DCACCOUNT = "dcaccount";
private static final String DCLOGIN = "dclogin";
private static final String INSTANCES_URL = "https://chatmail.at/relays";
@@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.util.FileProviderUtil;
public class LogViewActivity extends BaseActionBarActivity {
private static final String TAG = LogViewActivity.class.getSimpleName();
private static final String TAG = "LogViewActivity";
LogViewFragment logViewFragment;
@@ -69,7 +69,7 @@ import org.thoughtcrime.securesms.util.Util;
public class MediaPreviewActivity extends PassphraseRequiredActionBarActivity
implements RecipientModifiedListener, LoaderManager.LoaderCallbacks<DcMediaGalleryElement> {
private static final String TAG = MediaPreviewActivity.class.getSimpleName();
private static final String TAG = "MediaPreviewActivity";
public static final String ACTIVITY_TITLE_EXTRA = "activity_title";
public static final String EDIT_AVATAR_CHAT_ID = "avatar_for_chat_id";
@@ -41,7 +41,7 @@ import org.thoughtcrime.securesms.qr.QrCodeHandler;
*/
public class NewConversationActivity extends ContactSelectionActivity {
private static final String TAG = NewConversationActivity.class.getSimpleName();
private static final String TAG = "NewConversationActivity";
@Override
public void onCreate(Bundle bundle, boolean ready) {
@@ -7,7 +7,7 @@ import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.service.GenericForegroundService;
public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarActivity {
private static final String TAG = PassphraseRequiredActionBarActivity.class.getSimpleName();
private static final String TAG = "PassphraseRequiredActionBarActivity";
@Override
protected final void onCreate(Bundle savedInstanceState) {
@@ -29,7 +29,7 @@ import org.thoughtcrime.securesms.mms.GlideRequests;
import org.thoughtcrime.securesms.util.Util;
public class ProfileAdapter extends RecyclerView.Adapter {
private static final String TAG = ProfileAdapter.class.getSimpleName();
private static final String TAG = "ProfileAdapter";
public static final int ITEM_AVATAR = 10;
public static final int ITEM_DIVIDER = 20;
@@ -38,7 +38,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class ProfileFragment extends Fragment
implements ProfileAdapter.ItemClickListener, DcEventCenter.DcEventDelegate {
private static final String TAG = ProfileFragment.class.getSimpleName();
private static final String TAG = "ProfileFragment";
public static final String CHAT_ID_EXTRA = "chat_id";
public static final String CONTACT_ID_EXTRA = "contact_id";
@@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.providers.PersistentBlobProvider;
public class ResolveMediaTask extends AsyncTask<Uri, Void, Uri> {
private static final String TAG = ResolveMediaTask.class.getSimpleName();
private static final String TAG = "ResolveMediaTask";
interface OnMediaResolvedListener {
void onMediaResolved(Uri uri);
@@ -47,7 +47,7 @@ import org.thoughtcrime.securesms.util.ShareUtil;
*/
public class ShareActivity extends PassphraseRequiredActionBarActivity
implements ResolveMediaTask.OnMediaResolvedListener {
private static final String TAG = ShareActivity.class.getSimpleName();
private static final String TAG = "ShareActivity";
public static final String EXTRA_ACC_ID = "acc_id";
public static final String EXTRA_CHAT_ID = "chat_id";
@@ -18,22 +18,19 @@ public class ShareLocationDialog {
switch (which) {
default:
case 0:
shareLocationUnit = 5 * 60;
break;
case 1:
shareLocationUnit = 30 * 60;
break;
case 2:
case 1:
shareLocationUnit = 60 * 60;
break;
case 3:
case 2:
shareLocationUnit = 2 * 60 * 60;
break;
case 4:
case 3:
shareLocationUnit = 6 * 60 * 60;
break;
case 5:
shareLocationUnit = 12 * 60 * 60;
case 4:
shareLocationUnit = 24 * 60 * 60;
break;
}
@@ -22,6 +22,8 @@ import androidx.webkit.WebSettingsCompat;
import androidx.webkit.WebViewFeature;
import chat.delta.rpc.types.SecurejoinSource;
import java.net.IDN;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.thoughtcrime.securesms.qr.QrCodeHandler;
import org.thoughtcrime.securesms.util.DynamicTheme;
import org.thoughtcrime.securesms.util.IntentUtils;
@@ -30,7 +32,10 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class WebViewActivity extends PassphraseRequiredActionBarActivity
implements SearchView.OnQueryTextListener, WebView.FindListener {
private static final String TAG = WebViewActivity.class.getSimpleName();
private static final String TAG = "WebViewActivity";
// Regex to extract the host from a URL for IDN conversion.
private static final Pattern URL_PATTERN =
Pattern.compile("^((?:[a-zA-Z0-9]+://)?)([^/?#]+)(.*)$");
protected WebView webView;
@@ -320,9 +325,17 @@ public class WebViewActivity extends PassphraseRequiredActionBarActivity
}
if (shouldAskToOpenLink()) {
String displayUrl;
try {
Matcher m = URL_PATTERN.matcher(url);
displayUrl = m.find() ? m.group(1) + IDN.toASCII(m.group(2)) + m.group(3) : url;
} catch (IllegalArgumentException e) {
// IDN.toASCII() failed (e.g. string too long), fall back to raw url
displayUrl = url;
}
new AlertDialog.Builder(this)
.setTitle(R.string.open_url_confirmation)
.setMessage(IDN.toASCII(url))
.setMessage(displayUrl)
.setNeutralButton(R.string.cancel, null)
.setPositiveButton(R.string.open, (d, w) -> IntentUtils.showInBrowser(this, url))
.setNegativeButton(
@@ -59,7 +59,7 @@ import org.thoughtcrime.securesms.util.MediaUtil;
import org.thoughtcrime.securesms.util.Util;
public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcEventDelegate {
private static final String TAG = WebxdcActivity.class.getSimpleName();
private static final String TAG = "WebxdcActivity";
private static final String EXTRA_ACCOUNT_ID = "accountId";
private static final String EXTRA_APP_MSG_ID = "appMessageId";
private static final String EXTRA_HIDE_ACTION_BAR = "hideActionBar";
@@ -240,6 +240,7 @@ public class WebxdcActivity extends WebViewActivity implements DcEventCenter.DcE
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setMediaPlaybackRequiresUserGesture(false);
webSettings.setAllowFileAccess(false);
webSettings.setBlockNetworkLoads(!internetAccess);
webSettings.setAllowContentAccess(false);
@@ -30,7 +30,7 @@ import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil;
public class WebxdcStoreActivity extends PassphraseRequiredActionBarActivity {
private static final String TAG = WebxdcStoreActivity.class.getSimpleName();
private static final String TAG = "WebxdcStoreActivity";
private DcContext dcContext;
private Rpc rpc;
@@ -48,7 +48,7 @@ public class WelcomeActivity extends BaseActionBarActivity
implements DcEventCenter.DcEventDelegate {
public static final String BACKUP_QR_EXTRA = "backup_qr_extra";
public static final int PICK_BACKUP = 20574;
private static final String TAG = WelcomeActivity.class.getSimpleName();
private static final String TAG = "WelcomeActivity";
public static final String TMP_BACKUP_FILE = "tmp-backup-file";
private ProgressDialog progressDialog = null;
@@ -41,7 +41,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
public class AccountSelectionListFragment extends DialogFragment
implements DcEventCenter.DcEventDelegate {
private static final String TAG = AccountSelectionListFragment.class.getSimpleName();
private static final String TAG = "AccountSelectionListFragment";
private static final String ARG_SELECT_ONLY = "select_only";
private RecyclerView recyclerView;
private AccountSelectionListAdapter adapter;
@@ -15,7 +15,7 @@ import org.thoughtcrime.securesms.util.Prefs;
public class AudioCodec {
private static final String TAG = AudioCodec.class.getSimpleName();
private static final String TAG = "AudioCodec";
private static final int SAMPLE_RATE_BALANCED = 44100;
private static final int BIT_RATE_BALANCED = 32000;
@@ -196,7 +196,7 @@ public class AudioCodec {
setFinished();
}
},
AudioCodec.class.getSimpleName())
"AudioCodec")
.start();
}
@@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.util.Util;
public class AudioRecorder {
private static final String TAG = AudioRecorder.class.getSimpleName();
private static final String TAG = "AudioRecorder";
private static final ExecutorService executor = ThreadUtil.newDynamicSingleThreadedExecutor();
@@ -20,7 +20,7 @@ import org.thoughtcrime.securesms.R;
/** Bottom sheet dialog for selecting audio output device */
@RequiresApi(Build.VERSION_CODES.O)
public class AudioDevicePickerDialog extends BottomSheetDialog {
private static final String TAG = AudioDevicePickerDialog.class.getSimpleName();
private static final String TAG = "AudioDevicePickerDialog";
public interface OnDeviceSelectedListener {
void onDeviceSelected(CallEndpointCompat endpoint);
@@ -51,8 +51,9 @@ import org.webrtc.VideoTrack;
@RequiresApi(api = Build.VERSION_CODES.O)
public class CallActivity extends AppCompatActivity {
private static final String TAG = CallActivity.class.getSimpleName();
private static final int PERMISSION_REQUEST_CODE = 1001;
private static final String TAG = "CallActivity";
private static final int MIC_PERMISSION_REQUEST_CODE = 1001;
private static final int CAMERA_PERMISSION_REQUEST_CODE = 1002;
public static final String ACTION_ANSWER_CALL = BuildConfig.APPLICATION_ID + ".ANSWER_CALL";
public static final String ACTION_DECLINE_CALL = BuildConfig.APPLICATION_ID + ".DECLINE_CALL";
@@ -94,10 +95,30 @@ public class CallActivity extends AppCompatActivity {
private PowerManager.WakeLock proximityWakeLock;
// States
private boolean awaitingPermissionResult = false;
private boolean pausedWhileAwaitingPermission = false;
private boolean intentHandled = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Destructive actions need nothing
String action = getIntent() != null ? getIntent().getAction() : null;
if (ACTION_DECLINE_CALL.equals(action)) {
Log.d(TAG, "Handling DECLINE_CALL action from notification");
CallCoordinator.getInstance(getApplication()).declineCall();
finish();
return;
}
if (ACTION_HANGUP_CALL.equals(action)) {
Log.d(TAG, "Handling HANGUP_CALL action from notification");
CallCoordinator.getInstance(getApplication()).hangUp();
finish();
return;
}
setContentView(R.layout.activity_call);
setupWindowFlags();
@@ -108,11 +129,6 @@ public class CallActivity extends AppCompatActivity {
initializeProximityWakeLock();
if (!hasRequiredPermissions()) {
requestRequiredPermissions();
return;
}
// PiP listener
addOnPictureInPictureModeChangedListener(
pipModeInfo -> {
@@ -139,47 +155,74 @@ public class CallActivity extends AppCompatActivity {
initializeViewModel();
// Intent handling needs permissions
if (!hasMicrophonePermission()) {
awaitingPermissionResult = true;
ActivityCompat.requestPermissions(
this, new String[] {Manifest.permission.RECORD_AUDIO}, MIC_PERMISSION_REQUEST_CODE);
return;
}
if (shouldRequestCameraPermission()) {
awaitingPermissionResult = true;
ActivityCompat.requestPermissions(
this, new String[] {Manifest.permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
return;
}
handleIntents(getIntent());
intentHandled = true;
}
private void handleIntents(Intent intent) {
if (intent == null || viewModel == null) {
if (intent == null) {
return;
}
CallCoordinator coordinator = CallCoordinator.getInstance(getApplication());
if (!coordinator.hasActiveCall()) {
Log.e(TAG, "No active call exists, cannot proceed");
Toast.makeText(this, "No active call", Toast.LENGTH_SHORT).show();
finish();
return;
}
String action = intent.getAction();
Log.d(TAG, "handleIntents: action=" + action);
// Handle notification actions
if (ACTION_ANSWER_CALL.equals(action)) {
Log.d(TAG, "Handling ANSWER_CALL action from notification");
viewModel.handleNotificationAnswer();
return;
}
// Destructive actions without ViewModel
if (ACTION_DECLINE_CALL.equals(action)) {
Log.d(TAG, "Handling DECLINE_CALL action from notification");
viewModel.handleNotificationDecline();
Log.d(TAG, "Handling DECLINE_CALL action");
if (viewModel != null) {
viewModel.handleNotificationDecline();
} else {
coordinator.declineCall();
}
finish();
return;
}
if (ACTION_HANGUP_CALL.equals(action)) {
Log.d(TAG, "Handling HANGUP_CALL action from notification");
viewModel.handleNotificationHangup();
Log.d(TAG, "Handling HANGUP_CALL action");
if (viewModel != null) {
viewModel.handleNotificationHangup();
} else {
coordinator.hangUp();
}
finish();
return;
}
if (viewModel == null) {
return;
}
if (!coordinator.hasActiveCall()) {
Log.e(TAG, "No active call exists, cannot proceed");
finish();
return;
}
if (ACTION_ANSWER_CALL.equals(action)) {
Log.d(TAG, "Handling ANSWER_CALL action from notification");
viewModel.handleNotificationAnswer();
return;
}
if (coordinator.hasOngoingCall()) {
Log.d(TAG, "Resuming existing call");
} else if (!coordinator.isIncomingCall()) {
@@ -373,6 +416,7 @@ public class CallActivity extends AppCompatActivity {
case INITIALIZING:
case PROMPTING_USER_ACCEPT:
case ENDED:
case ANSWERED_ELSEWHERE:
case ERROR:
default:
finish();
@@ -504,6 +548,8 @@ public class CallActivity extends AppCompatActivity {
viewModel.getVideoEnabled(), v -> videoConfigChanged.setValue(true));
videoConfigChanged.addSource(
viewModel.getRemoteVideoEnabled(), v -> videoConfigChanged.setValue(true));
videoConfigChanged.addSource(
viewModel.getIsFrontCamera(), v -> videoConfigChanged.setValue(true));
// Video layout
videoConfigChanged.observe(
@@ -578,6 +624,23 @@ public class CallActivity extends AppCompatActivity {
statusText.setText(R.string.call_reconnecting);
break;
case ANSWERED_ELSEWHERE:
statusText.setText(R.string.call_answered_elsewhere);
incomingCallPrompt.setVisibility(View.GONE);
bottomLayoutContainer.setVisibility(View.GONE);
callerIconContainer.setVisibility(View.GONE);
answerModeSelector.setVisibility(View.GONE);
new Handler(Looper.getMainLooper())
.postDelayed(
() -> {
if (!isFinishing()) {
finish();
}
},
1500);
break;
case ENDED:
statusText.setText(R.string.call_ended);
finish();
@@ -705,17 +768,21 @@ public class CallActivity extends AppCompatActivity {
VideoTrack localTrack = viewModel.getLocalVideoTrack().getValue();
VideoTrack remoteTrack = viewModel.getRemoteVideoTrack().getValue();
boolean isFront = Boolean.TRUE.equals(viewModel.getIsFrontCamera().getValue());
boolean showFullScreen = false;
if (state == CallViewModel.CallState.CONNECTED
&& remoteTrack != null
&& Boolean.TRUE.equals(remoteVideoEnabled)) {
remoteVideoView.setMirror(false);
remoteTrack.addSink(remoteVideoView);
showFullScreen = true;
} else if (!coordinator.isIncomingCall()
&& (state == CallViewModel.CallState.RINGING || state == CallViewModel.CallState.CONNECTING)
&& localTrack != null
&& Boolean.TRUE.equals(videoEnabled)) {
remoteVideoView.setMirror(isFront);
localTrack.addSink(remoteVideoView);
showFullScreen = true;
}
@@ -729,6 +796,7 @@ public class CallActivity extends AppCompatActivity {
&& !isInPictureInPictureMode();
if (showCorner) {
localVideoView.setMirror(isFront);
localTrack.addSink(localVideoView);
}
@@ -758,18 +826,46 @@ public class CallActivity extends AppCompatActivity {
// Permissions
private boolean hasRequiredPermissions() {
return ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED
&& ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
== PackageManager.PERMISSION_GRANTED;
private boolean hasMicrophonePermission() {
return ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)
== PackageManager.PERMISSION_GRANTED;
}
private void requestRequiredPermissions() {
ActivityCompat.requestPermissions(
this,
new String[] {Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO},
PERMISSION_REQUEST_CODE);
private boolean hasCameraPermission() {
return ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)
== PackageManager.PERMISSION_GRANTED;
}
private boolean shouldRequestCameraPermission() {
CallCoordinator coordinator = CallCoordinator.getInstance(getApplication());
return coordinator.isStartsWithVideo() && !hasCameraPermission();
}
private void handleMicPermissionDenied() {
Toast.makeText(this, R.string.call_requires_mic_permission, Toast.LENGTH_LONG).show();
CallCoordinator coordinator = CallCoordinator.getInstance(getApplication());
if (coordinator.hasActiveCall()
&& coordinator.isIncomingCall()
&& !coordinator.hasOngoingCall()) {
coordinator.declineCall();
}
finish();
}
private void proceedAfterPermissions() {
if (intentHandled) return;
if (shouldRequestCameraPermission()) {
awaitingPermissionResult = true;
ActivityCompat.requestPermissions(
this, new String[] {Manifest.permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
return;
}
handleIntents(getIntent());
intentHandled = true;
}
@Override
@@ -777,38 +873,34 @@ public class CallActivity extends AppCompatActivity {
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_CODE) {
boolean microphoneGranted = false;
boolean cameraGranted = false;
awaitingPermissionResult = false;
pausedWhileAwaitingPermission = false;
for (int i = 0; i < permissions.length; i++) {
if (permissions[i].equals(Manifest.permission.RECORD_AUDIO)) {
microphoneGranted = (grantResults[i] == PackageManager.PERMISSION_GRANTED);
} else if (permissions[i].equals(Manifest.permission.CAMERA)) {
cameraGranted = (grantResults[i] == PackageManager.PERMISSION_GRANTED);
}
}
CallCoordinator coordinator = CallCoordinator.getInstance(getApplication());
if (!microphoneGranted) {
Toast.makeText(this, "Microphone permission is required for calls", Toast.LENGTH_LONG)
.show();
finish();
if (requestCode == MIC_PERMISSION_REQUEST_CODE) {
boolean micGranted =
grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
if (!micGranted) {
handleMicPermissionDenied();
return;
}
CallCoordinator coordinator = CallCoordinator.getInstance(getApplication());
} else if (requestCode == CAMERA_PERMISSION_REQUEST_CODE) {
boolean cameraGranted =
grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
if (!cameraGranted && coordinator.isStartsWithVideo()) {
if (!cameraGranted) {
Log.w(TAG, "Camera permission denied, switching to audio-only");
Toast.makeText(
this, "Starting audio-only call (camera permission denied)", Toast.LENGTH_SHORT)
.show();
coordinator.setStartsWithVideo(false);
}
initializeViewModel();
handleIntents(getIntent());
}
proceedAfterPermissions();
}
// Picture-in-Picture
@@ -817,6 +909,11 @@ public class CallActivity extends AppCompatActivity {
public void onUserLeaveHint() {
super.onUserLeaveHint();
// Do not finish activity when a permission request is pending
if (awaitingPermissionResult) {
return;
}
// Enter PiP mode when user presses home button during active call
if (viewModel != null) {
CallViewModel.CallState state = viewModel.getCallState().getValue();
@@ -833,6 +930,7 @@ public class CallActivity extends AppCompatActivity {
case INITIALIZING:
case PROMPTING_USER_ACCEPT:
case ENDED:
case ANSWERED_ELSEWHERE:
case ERROR:
default:
finish();
@@ -873,17 +971,51 @@ public class CallActivity extends AppCompatActivity {
protected void onPause() {
super.onPause();
if (awaitingPermissionResult) {
pausedWhileAwaitingPermission = true;
}
if (proximityWakeLock != null && proximityWakeLock.isHeld()) {
proximityWakeLock.release();
Log.d(TAG, "Proximity wake lock released in onDestroy");
}
}
@Override
protected void onResume() {
super.onResume();
// Fallback for Android 16 bug: onRequestPermissionsResult not called
if (awaitingPermissionResult && pausedWhileAwaitingPermission) {
Log.w(TAG, "Permission result callback not received, handling in onResume");
awaitingPermissionResult = false;
pausedWhileAwaitingPermission = false;
if (!hasMicrophonePermission()) {
handleMicPermissionDenied();
return;
}
// Mic was granted without callback
if (shouldRequestCameraPermission()) {
awaitingPermissionResult = true;
ActivityCompat.requestPermissions(
this, new String[] {Manifest.permission.CAMERA}, CAMERA_PERMISSION_REQUEST_CODE);
return;
}
proceedAfterPermissions();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
detachAllTracks();
if (viewModel != null) {
detachAllTracks();
}
// Release video renderers
if (localVideoView != null) {
@@ -63,7 +63,7 @@ import org.webrtc.VideoTrack;
@RequiresApi(api = Build.VERSION_CODES.O)
public class CallCoordinator implements DcEventCenter.DcEventDelegate {
private static final String TAG = CallCoordinator.class.getSimpleName();
private static final String TAG = "CallCoordinator";
// Notification channels
private static final String CHANNEL_ID_INCOMING = "voip_incoming_calls";
@@ -95,6 +95,8 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
private final MutableLiveData<String> displayName = new MutableLiveData<>();
private final MutableLiveData<Icon> displayIcon = new MutableLiveData<>();
private final MutableLiveData<Boolean> outgoingCallPlaced = new MutableLiveData<>(false);
private final MutableLiveData<Boolean> answeredElsewhere = new MutableLiveData<>(false);
private final MutableLiveData<Boolean> isFrontCamera = new MutableLiveData<>(true);
// Audio Routing Support
private final MediatorLiveData<CallEndpointCompat> currentAudioEndpoint =
@@ -213,7 +215,8 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
calleeName = "Unknown";
}
showOrUpdateOngoingNotification("Calling " + calleeName + "...");
showOrUpdateOngoingNotification(
appContext.getString(R.string.calling_person, calleeName));
}
// Initialize call
@@ -317,6 +320,10 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
return outgoingCallPlaced;
}
public LiveData<Boolean> getAnsweredElsewhere() {
return answeredElsewhere;
}
public LiveData<CallEndpointCompat> getCurrentAudioEndpoint() {
return currentAudioEndpoint;
}
@@ -325,6 +332,10 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
return availableAudioEndpoints;
}
public LiveData<Boolean> getIsFrontCamera() {
return isFrontCamera;
}
// State Update Methods (CallService)
public void updateConnectionState(PeerConnection.PeerConnectionState state) {
@@ -359,6 +370,11 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
isRelayUsed.postValue(isRelay);
}
public void updateFrontCamera(boolean front) {
Log.d(TAG, "updateFrontCamera: " + front);
isFrontCamera.postValue(front);
}
public void reportError(String error) {
Log.e(TAG, "reportError: " + error);
errorMessage.postValue(error);
@@ -366,7 +382,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
// Delayed Media Initialization Support
public void startMediaCapture() {
public synchronized void startMediaCapture() {
Log.d(TAG, "startMediaCapture");
if (callService != null) {
callService.startMediaCapture();
@@ -375,7 +391,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
}
}
public void handleCallControlScopeAnswer() {
public synchronized void handleCallControlScopeAnswer() {
Log.d(TAG, "handleCallControlScopeAnswer");
if (!isIncomingCall) {
@@ -387,6 +403,15 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
callService.stopRingtone();
}
// Promote the service to foreground immediately. Waiting until onIncomingCallAccepted
// on executor pool thread is too late on stricter OEM.
//
// Do not cancel() but use showOrUpdateOngoingNotification to replace incoming
// notification without a gap.
String callerName = displayName.getValue();
if (callerName == null) callerName = "Unknown";
showOrUpdateOngoingNotification(appContext.getString(R.string.call_with, callerName));
// Notify Android system with CallControlScope
CallControlScope scope = activeCallControlScope;
if (scope != null) {
@@ -410,8 +435,6 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
}
});
}
notificationManager.cancel(NOTIFICATION_ID_CALL);
}
public void answerWebRTC() {
@@ -512,22 +535,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
return;
}
// Check microphone and camera permissions
if (!hasMicrophonePermission()) {
Log.e(TAG, "Microphone permission not granted");
Intent intent = new Intent(appContext, CallActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
appContext.startActivity(intent);
notificationManager.cancel(NOTIFICATION_ID_CALL);
return;
}
if (startsWithVideo && !hasCameraPermission()) {
Log.w(TAG, "Camera permission not granted");
startsWithVideo = false;
}
// Launch CallActivity with answer action
// Launch CallActivity
Intent intent = new Intent(appContext, CallActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
appContext.startActivity(intent);
@@ -628,7 +636,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
cleanupCall(activeAccId, activeCallId);
}
public void setAudioEnabled(boolean enabled) {
public synchronized void setAudioEnabled(boolean enabled) {
Log.d(TAG, "setAudioEnabled: " + enabled);
localAudioEnabled.postValue(enabled);
@@ -640,7 +648,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
}
}
public void setVideoEnabled(boolean enabled) {
public synchronized void setVideoEnabled(boolean enabled) {
Log.d(TAG, "setVideoEnabled: " + enabled);
localVideoEnabled.postValue(enabled);
@@ -652,14 +660,14 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
}
}
public void switchCamera() {
public synchronized void switchCamera() {
Log.d(TAG, "switchCamera");
if (callService != null) {
callService.switchCamera();
}
}
public void startOutgoingCall() {
public synchronized void startOutgoingCall() {
Log.d(TAG, "startOutgoingCall");
if (callService != null) {
callService.startOutgoingCall();
@@ -846,7 +854,8 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
onIncomingCall(accId, callId, event.getData2Str(), hasVideo);
break;
case DcContext.DC_EVENT_INCOMING_CALL_ACCEPTED:
onIncomingCallAccepted(callId);
boolean fromThisDevice = event.getData2Int() != 0; // Data2 is from_this_device
onIncomingCallAccepted(callId, fromThisDevice);
break;
case DcContext.DC_EVENT_OUTGOING_CALL_ACCEPTED:
String answerSDP = event.getData2Str();
@@ -902,8 +911,13 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
startAndBindService();
}
private synchronized void onIncomingCallAccepted(int callId) {
Log.d(TAG, "onIncomingCallAccepted: callId=" + callId);
private synchronized void onIncomingCallAccepted(int callId, boolean fromThisDevice) {
Log.d(TAG, "onIncomingCallAccepted: callId=" + callId + ", fromThisDevice=" + fromThisDevice);
if (!fromThisDevice) {
onCallAnsweredOnOtherDevice();
return;
}
if (activeCallId == null || !activeCallId.equals(callId)) {
Log.w(TAG, "Accepted call ID doesn't match active call");
@@ -915,7 +929,53 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
callerName = "Unknown";
}
showOrUpdateOngoingNotification("Call with " + callerName);
showOrUpdateOngoingNotification(appContext.getString(R.string.call_with, callerName));
}
private synchronized void onCallAnsweredOnOtherDevice() {
Log.d(TAG, "Call was answered on another device");
if (!hasActiveCall()) {
Log.d(TAG, "No active call, ignoring");
return;
}
// Prevent notifyBackendCallEnded() from firing during WebRTC teardown.
// The call is still active on the other device.
hasNotifiedBackend = true;
if (callService != null) {
callService.stopRingtone();
}
notificationManager.cancel(NOTIFICATION_ID_CALL);
answeredElsewhere.postValue(true);
// Disconnect from Telecom CallControlScope
CallControlScope scope = activeCallControlScope;
if (scope != null) {
scope.disconnect(
new DisconnectCause(DisconnectCause.REMOTE),
new Continuation<CallControlResult>() {
@NonNull
@Override
public CoroutineContext getContext() {
return EmptyCoroutineContext.INSTANCE;
}
@Override
public void resumeWith(@NonNull Object result) {
Log.d(TAG, "Disconnect (answered elsewhere) completed");
}
});
}
if (callService != null) {
callService.endCall();
}
cleanupCall(activeAccId, activeCallId);
}
private void onOutgoingCallAccepted(int callId, String answerSdp) {
@@ -956,7 +1016,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
if (calleeName == null) {
calleeName = "Unknown";
}
showOrUpdateOngoingNotification("Call with " + calleeName);
showOrUpdateOngoingNotification(appContext.getString(R.string.call_with, calleeName));
}
private synchronized void onCallEnded(int accId, int callId) {
@@ -1049,6 +1109,14 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
return;
}
if (callService != null) {
try {
callService.stopForegroundAndDismiss();
} catch (Exception e) {
Log.w(TAG, "stopForegroundAndDismiss failed", e);
}
}
// Clear state
this.activeAccId = null;
this.activeCallId = null;
@@ -1125,6 +1193,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
private void resetLiveDataForNewCall() {
connectionState.postValue(PeerConnection.PeerConnectionState.NEW);
answeredElsewhere.postValue(false); // clearLiveData() must not reset answeredElsewhere
clearLiveData();
}
@@ -1150,7 +1219,7 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
return;
}
// Check camera and microphone permissions
// Check microphone permission
if (!hasMicrophonePermission()) {
Log.e(TAG, "Microphone permission not granted");
@@ -1160,11 +1229,6 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
return;
}
if (startsWithVideo && !hasCameraPermission()) {
Log.w(TAG, "Camera permission not granted, will start audio-only");
startsWithVideo = false;
}
resetLiveDataForNewCall();
this.activeCallId = -1; // Placeholder call ID for Intent
@@ -1310,10 +1374,8 @@ public class CallCoordinator implements DcEventCenter.DcEventDelegate {
}
// Check full screen intent permission on Android 14+
boolean canUseFullScreen;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
canUseFullScreen = canUseFullScreenIntent();
if (!canUseFullScreen) {
if (!canUseFullScreenIntent()) {
Log.w(TAG, "Full screen intent permission not granted, notification will appear normally");
}
}
@@ -4,6 +4,7 @@ import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ServiceInfo;
import android.media.AudioAttributes;
import android.media.AudioFocusRequest;
import android.media.AudioManager;
@@ -13,7 +14,9 @@ import android.media.ToneGenerator;
import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@@ -33,7 +36,7 @@ import org.webrtc.VideoTrack;
@RequiresApi(api = Build.VERSION_CODES.O)
public class CallService extends Service implements WebRTCClient.Callbacks {
private static final String TAG = CallService.class.getSimpleName();
private static final String TAG = "CallService";
private final IBinder binder = new LocalBinder();
@@ -142,17 +145,13 @@ public class CallService extends Service implements WebRTCClient.Callbacks {
return;
}
// Check permissions
boolean hasMicrophone = callCoordinator.hasMicrophonePermission();
boolean hasCamera = callCoordinator.hasCameraPermission();
if (!hasMicrophone) {
if (!callCoordinator.hasMicrophonePermission()) {
Log.e(TAG, "Microphone permission not granted, cannot start call");
callCoordinator.reportError("Microphone permission is required for calls");
return;
}
boolean startsWithVideo = callCoordinator.isStartsWithVideo() && hasCamera;
boolean startsWithVideo = callCoordinator.isStartsWithVideo();
Log.d(TAG, "Creating media stream with video: " + startsWithVideo);
@@ -164,14 +163,18 @@ public class CallService extends Service implements WebRTCClient.Callbacks {
webRTCClient.setLocalMediaStream(stream);
callCoordinator.updateFrontCamera(mediaStreamManager.isFrontCamera());
callCoordinator.setVideoEnabled(startsWithVideo);
if (!stream.videoTracks.isEmpty()) {
VideoTrack localTrack = stream.videoTracks.get(0);
callCoordinator.updateLocalVideoTrack(localTrack);
} else {
Log.w(TAG, "Camera unavailable, call will be audio-only");
callCoordinator.reportError("Camera unavailable, using audio only");
Log.w(TAG, "No video track in stream, call will be audio-only");
if (startsWithVideo) {
callCoordinator.reportError("Camera unavailable, using audio only");
}
callCoordinator.setVideoEnabled(false);
}
@@ -181,7 +184,9 @@ public class CallService extends Service implements WebRTCClient.Callbacks {
@Override
public void onError(String error) {
Log.e(TAG, "Failed to setup media: " + error);
callCoordinator.reportError("Camera/microphone error: " + error);
if (startsWithVideo) {
callCoordinator.reportError("Camera/microphone error: " + error);
}
callCoordinator.setVideoEnabled(false);
}
});
@@ -410,7 +415,18 @@ public class CallService extends Service implements WebRTCClient.Callbacks {
Log.d(TAG, "switchCamera");
if (mediaStreamManager != null) {
mediaStreamManager.switchCamera();
mediaStreamManager.switchCamera(
new MediaStreamManager.CameraSwitchCallback() {
@Override
public void onCameraSwitch(boolean isFrontCamera) {
callCoordinator.updateFrontCamera(isFrontCamera);
}
@Override
public void onError(String error) {
Log.e(TAG, "Camera switch failed: " + error);
}
});
}
}
@@ -419,6 +435,12 @@ public class CallService extends Service implements WebRTCClient.Callbacks {
disposeWebRTC();
try {
stopForeground(STOP_FOREGROUND_REMOVE);
} catch (Exception e) {
Log.w(TAG, "stopForeground failed", e);
}
stopService();
}
@@ -481,13 +503,44 @@ public class CallService extends Service implements WebRTCClient.Callbacks {
// Foreground Notification
public void startForegroundWithNotification(int id, Notification notification) {
Log.d(TAG, "Starting foreground with notification id: " + id);
startForeground(id, notification);
// Always run on main thread
if (Looper.myLooper() != Looper.getMainLooper()) {
new Handler(Looper.getMainLooper())
.post(() -> startForegroundWithNotification(id, notification));
return;
}
Log.d(TAG, "Starting call FGS with notification id: " + id);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
startForeground(id, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
int types =
ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE
| ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA;
startForeground(id, notification, types);
} else {
startForeground(id, notification);
}
} catch (Exception e) {
Log.e(TAG, "startForeground failed", e);
if (callCoordinator != null) {
callCoordinator.reportError("Failed to activate call FGS: " + e.getMessage());
}
}
}
public void stopForegroundAndDismiss() {
Log.d(TAG, "Stopping foreground and dismissing notification");
stopForeground(STOP_FOREGROUND_REMOVE);
if (Looper.myLooper() != Looper.getMainLooper()) {
new Handler(Looper.getMainLooper()).post(this::stopForegroundAndDismiss);
return;
}
Log.d(TAG, "Stopping call FGS and dismissing notification");
try {
stopForeground(STOP_FOREGROUND_REMOVE);
} catch (Exception e) {
Log.w(TAG, "stopForeground failed", e);
}
}
// Cleanup
@@ -21,7 +21,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.BitmapUtil;
public class CallUtil {
private static final String TAG = CallUtil.class.getSimpleName();
private static final String TAG = "CallUtil";
@RequiresApi(api = Build.VERSION_CODES.O)
public static void startAudioCall(Context context, int chatId) {
@@ -13,13 +13,14 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.MediatorLiveData;
import androidx.lifecycle.Observer;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import org.webrtc.PeerConnection;
import org.webrtc.VideoTrack;
@RequiresApi(api = Build.VERSION_CODES.O)
public class CallViewModel extends AndroidViewModel {
private static final String TAG = CallViewModel.class.getSimpleName();
private static final String TAG = "CallViewModel";
private final CallCoordinator callCoordinator;
@@ -36,8 +37,10 @@ public class CallViewModel extends AndroidViewModel {
private final LiveData<String> displayName;
private final LiveData<Icon> displayIcon;
private final LiveData<Boolean> outgoingCallPlaced;
private final LiveData<Boolean> answeredElsewhere;
private final LiveData<CallEndpointCompat> currentAudioEndpoint;
private final LiveData<List<CallEndpointCompat>> availableAudioEndpoints;
private final LiveData<Boolean> isFrontCamera;
// Translated from coordinator's connectionState
private final MediatorLiveData<CallState> callState;
@@ -46,7 +49,7 @@ public class CallViewModel extends AndroidViewModel {
private Observer<VideoTrack> answerCallObserver;
private Observer<VideoTrack> startOutgoingCallObserver;
private boolean hasCallEnded = false;
private final AtomicBoolean hasCallEnded = new AtomicBoolean(false);
// User-facing call states
public enum CallState {
@@ -56,6 +59,7 @@ public class CallViewModel extends AndroidViewModel {
CONNECTING,
CONNECTED,
RECONNECTING,
ANSWERED_ELSEWHERE,
ENDED,
ERROR
}
@@ -77,8 +81,10 @@ public class CallViewModel extends AndroidViewModel {
this.displayName = callCoordinator.getDisplayName();
this.displayIcon = callCoordinator.getDisplayIcon();
this.outgoingCallPlaced = callCoordinator.getOutgoingCallPlaced();
this.answeredElsewhere = callCoordinator.getAnsweredElsewhere();
this.currentAudioEndpoint = callCoordinator.getCurrentAudioEndpoint();
this.availableAudioEndpoints = callCoordinator.getAvailableAudioEndpoints();
this.isFrontCamera = callCoordinator.getIsFrontCamera();
this.callState = new MediatorLiveData<>(CallState.INITIALIZING);
@@ -105,6 +111,10 @@ public class CallViewModel extends AndroidViewModel {
callState.addSource(
callCoordinator.getConnectionState(),
state -> {
if (callState.getValue() == CallState.ANSWERED_ELSEWHERE) {
return;
}
CallState newState = translateConnectionState(state);
if (callState.getValue() != newState) {
@@ -113,9 +123,7 @@ public class CallViewModel extends AndroidViewModel {
if (state == PeerConnection.PeerConnectionState.FAILED
|| state == PeerConnection.PeerConnectionState.CLOSED) {
if (!hasCallEnded) {
hasCallEnded = true;
}
hasCallEnded.set(true);
}
});
@@ -128,6 +136,15 @@ public class CallViewModel extends AndroidViewModel {
}
}
});
callState.addSource(
answeredElsewhere,
value -> {
if (Boolean.TRUE.equals(value)) {
hasCallEnded.set(true);
callState.setValue(CallState.ANSWERED_ELSEWHERE);
}
});
}
private CallState translateConnectionState(PeerConnection.PeerConnectionState state) {
@@ -257,11 +274,10 @@ public class CallViewModel extends AndroidViewModel {
public void declineCall() {
Log.d(TAG, "declineCall");
if (hasCallEnded) {
if (!hasCallEnded.compareAndSet(false, true)) {
Log.w(TAG, "Call already ended");
return;
}
hasCallEnded = true;
callCoordinator.declineCall();
}
@@ -269,11 +285,10 @@ public class CallViewModel extends AndroidViewModel {
public void hangUp() {
Log.d(TAG, "hangUp");
if (hasCallEnded) {
if (!hasCallEnded.compareAndSet(false, true)) {
Log.w(TAG, "Call already ended");
return;
}
hasCallEnded = true;
callCoordinator.hangUp();
}
@@ -354,8 +369,7 @@ public class CallViewModel extends AndroidViewModel {
public void onCallDisconnected(DisconnectCause disconnectCause) {
Log.d(TAG, "onCallDisconnected callback from CallControlScope, cause: " + disconnectCause);
if (!hasCallEnded) {
hasCallEnded = true;
if (hasCallEnded.compareAndSet(false, true)) {
callState.postValue(CallState.ENDED);
}
}
@@ -414,6 +428,10 @@ public class CallViewModel extends AndroidViewModel {
return availableAudioEndpoints;
}
public LiveData<Boolean> getIsFrontCamera() {
return isFrontCamera;
}
// Notification Action Handlers
public void handleNotificationAnswer() {
@@ -1,9 +1,14 @@
package org.thoughtcrime.securesms.calls;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.content.ContextCompat;
import org.thoughtcrime.securesms.EglUtils;
import org.webrtc.AudioSource;
import org.webrtc.AudioTrack;
@@ -19,7 +24,7 @@ import org.webrtc.VideoTrack;
public class MediaStreamManager {
private static final String TAG = MediaStreamManager.class.getSimpleName();
private static final String TAG = "MediaStreamManager";
private static final String STREAM_ID = "local_stream";
private static final String AUDIO_TRACK_ID = "audio_track";
private static final String VIDEO_TRACK_ID = "video_track";
@@ -31,6 +36,7 @@ public class MediaStreamManager {
private VideoSource videoSource;
private AudioSource audioSource;
private SurfaceTextureHelper surfaceTextureHelper;
private volatile boolean isFrontCamera = true;
public interface Callback {
void onMediaStreamReady(MediaStream stream);
@@ -38,6 +44,12 @@ public class MediaStreamManager {
void onError(String error);
}
public interface CameraSwitchCallback {
void onCameraSwitch(boolean isFrontCamera);
void onError(String error);
}
public MediaStreamManager(@NonNull Context context, PeerConnectionFactory peerConnectionFactory) {
this.context = context.getApplicationContext();
@@ -45,6 +57,7 @@ public class MediaStreamManager {
}
/** Create media stream with audio and optionally video */
@RequiresApi(api = Build.VERSION_CODES.M)
public void createMediaStream(Callback callback) {
try {
MediaStream mediaStream = peerConnectionFactory.createLocalMediaStream(STREAM_ID);
@@ -83,6 +96,12 @@ public class MediaStreamManager {
@Nullable
private VideoCapturer createVideoCapturer() {
if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
Log.w(TAG, "Camera permission not granted");
return null;
}
Camera2Enumerator enumerator = new Camera2Enumerator(context);
// Try front camera first
@@ -91,6 +110,7 @@ public class MediaStreamManager {
if (enumerator.isFrontFacing(deviceName)) {
VideoCapturer capturer = enumerator.createCapturer(deviceName, null);
if (capturer != null) {
isFrontCamera = true;
return capturer;
}
}
@@ -100,6 +120,7 @@ public class MediaStreamManager {
for (String deviceName : deviceNames) {
VideoCapturer capturer = enumerator.createCapturer(deviceName, null);
if (capturer != null) {
isFrontCamera = enumerator.isFrontFacing(deviceName);
return capturer;
}
}
@@ -107,12 +128,61 @@ public class MediaStreamManager {
return null;
}
public void switchCamera() {
if (videoCapturer instanceof CameraVideoCapturer) {
CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) videoCapturer;
cameraVideoCapturer.switchCamera(null);
Log.d(TAG, "Camera switched");
public void switchCamera(@Nullable CameraSwitchCallback callback) {
if (!(videoCapturer instanceof CameraVideoCapturer)) {
Log.e(TAG, "switchCamera called but videoCapturer is not a CameraVideoCapturer");
return;
}
CameraVideoCapturer cameraVideoCapturer = (CameraVideoCapturer) videoCapturer;
// Find the opposite-facing camera
Camera2Enumerator enumerator = new Camera2Enumerator(context);
String[] deviceNames = enumerator.getDeviceNames();
String targetCameraName = null;
for (String deviceName : deviceNames) {
boolean isTargetFront = !isFrontCamera;
boolean deviceIsFront = enumerator.isFrontFacing(deviceName);
if (deviceIsFront == isTargetFront) {
targetCameraName = deviceName;
break; // Take the first match
}
}
if (targetCameraName == null) {
Log.e(TAG, "No camera found with opposite facing direction");
if (callback != null) {
callback.onError("No opposite camera available");
}
return;
}
final String finalTargetCameraName = targetCameraName;
Log.d(TAG, "Switching to camera: " + finalTargetCameraName);
// Call with explicit camera name
cameraVideoCapturer.switchCamera(
new CameraVideoCapturer.CameraSwitchHandler() {
@Override
public void onCameraSwitchDone(boolean isFront) {
Log.d(TAG, "switchCamera SUCCESS, isFront=" + isFront);
isFrontCamera = isFront;
if (callback != null) callback.onCameraSwitch(isFront);
}
@Override
public void onCameraSwitchError(String errorDescription) {
Log.e(TAG, "switchCamera FAILED: " + errorDescription);
if (callback != null) callback.onError(errorDescription);
}
},
finalTargetCameraName);
}
public boolean isFrontCamera() {
return isFrontCamera;
}
/** Cleanup resources */
@@ -26,6 +26,7 @@ import androidx.loader.app.LoaderManager;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.permissions.Permissions;
import org.thoughtcrime.securesms.util.Prefs;
import org.thoughtcrime.securesms.util.ViewUtil;
public class AttachmentTypeSelector extends PopupWindow {
@@ -45,7 +46,7 @@ public class AttachmentTypeSelector extends PopupWindow {
private final @NonNull ImageView imageButton;
private final @NonNull ImageView documentButton;
private final @NonNull ImageView contactButton;
// private final @NonNull ImageView cameraButton;
// private final @NonNull ImageView cameraButton;
private final @NonNull ImageView videoButton;
private final @NonNull ImageView locationButton;
private final @NonNull ImageView webxdcButton;
@@ -87,11 +88,9 @@ public class AttachmentTypeSelector extends PopupWindow {
this.webxdcButton.setOnClickListener(new PropagatingClickListener(ADD_WEBXDC));
this.recentRail.setListener(new RecentPhotoSelectedListener());
// disable location streaming button for now
// if (!Prefs.isLocationStreamingEnabled(context)) {
this.locationButton.setVisibility(View.GONE);
ViewUtil.findById(layout, R.id.location_button_label).setVisibility(View.GONE);
// }
if (!Prefs.isLocationStreamingEnabled(context)) {
ViewUtil.findById(layout, R.id.location_linear_layout).setVisibility(View.GONE);
}
setLocationButtonImage(context);
@@ -15,7 +15,7 @@ import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.util.DateUtils;
public class CallItemView extends FrameLayout {
private static final String TAG = CallItemView.class.getSimpleName();
private static final String TAG = "CallItemView";
private final @NonNull ImageView icon;
private final @NonNull TextView title;
@@ -43,7 +43,7 @@ public class InputPanel extends ConstraintLayout
KeyboardAwareLinearLayout.OnKeyboardShownListener,
MediaKeyboard.MediaKeyboardListener {
private static final String TAG = InputPanel.class.getSimpleName();
private static final String TAG = "InputPanel";
private static final int FADE_TIME = 150;
@@ -38,7 +38,7 @@ import org.thoughtcrime.securesms.util.ViewUtil;
* been opened and what its height would be.
*/
public class KeyboardAwareLinearLayout extends LinearLayoutCompat {
private static final String TAG = KeyboardAwareLinearLayout.class.getSimpleName();
private static final String TAG = "KeyboardAwareLinearLayout";
private static final long KEYBOARD_DEBOUNCE = 150;
@@ -38,7 +38,7 @@ import org.thoughtcrime.securesms.util.Util;
public class QuoteView extends FrameLayout implements RecipientForeverObserver {
private static final String TAG = QuoteView.class.getSimpleName();
private static final String TAG = "QuoteView";
private static final int MESSAGE_TYPE_PREVIEW = 0;
@@ -30,7 +30,7 @@ public class ScaleStableImageView extends AppCompatImageView
implements KeyboardAwareLinearLayout.OnKeyboardShownListener,
KeyboardAwareLinearLayout.OnKeyboardHiddenListener {
private static final String TAG = ScaleStableImageView.class.getSimpleName();
private static final String TAG = "ScaleStableImageView";
private Drawable defaultDrawable;
private Drawable currentDrawable;
@@ -22,7 +22,7 @@ import org.thoughtcrime.securesms.animation.AnimationCompleteListener;
public class SearchToolbar extends LinearLayout {
private static final String TAG = SearchToolbar.class.getSimpleName();
private static final String TAG = "SearchToolbar";
private float x, y;
private MenuItem searchItem;
private EditText searchText;
@@ -30,7 +30,7 @@ import org.thoughtcrime.securesms.util.Util;
public class ThumbnailView extends FrameLayout {
private static final String TAG = ThumbnailView.class.getSimpleName();
private static final String TAG = "ThumbnailView";
private static final int WIDTH = 0;
private static final int HEIGHT = 1;
private static final int MIN_WIDTH = 0;
@@ -17,7 +17,7 @@ import org.thoughtcrime.securesms.mms.VcardSlide;
import org.thoughtcrime.securesms.recipients.Recipient;
public class VcardView extends FrameLayout {
private static final String TAG = VcardView.class.getSimpleName();
private static final String TAG = "VcardView";
private final @NonNull AvatarView avatar;
private final @NonNull TextView name;
@@ -21,7 +21,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class AudioPlaybackViewModel extends ViewModel {
private static final String TAG = AudioPlaybackViewModel.class.getSimpleName();
private static final String TAG = "AudioPlaybackViewModel";
private static final int NON_MESSAGE_AUDIO_MSG_ID =
0; // Audios not attached to a message doesn't have message id.
@@ -23,7 +23,7 @@ import org.thoughtcrime.securesms.util.DateUtils;
public class AudioView extends FrameLayout {
private static final String TAG = AudioView.class.getSimpleName();
private static final String TAG = "AudioView";
private final @NonNull ImageView playPauseButton;
private final AnimatedVectorDrawableCompat playToPauseDrawable;
@@ -22,7 +22,7 @@ import org.thoughtcrime.securesms.util.ResUtil;
public class MediaKeyboard extends LinearLayout
implements InputView, Consumer<EmojiViewItem>, StickerPickerView.StickerPickerListener {
private static final String TAG = MediaKeyboard.class.getSimpleName();
private static final String TAG = "MediaKeyboard";
@Nullable private MediaKeyboardListener keyboardListener;
private EmojiPickerView emojiPicker;
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
@@ -18,6 +19,7 @@ import java.util.List;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.mms.GlideApp;
import org.thoughtcrime.securesms.mms.GlideRequests;
import org.thoughtcrime.securesms.util.Util;
public class StickerPickerView extends RecyclerView {
@@ -130,25 +132,26 @@ public class StickerPickerView extends RecyclerView {
private void deleteSticker(File stickerFile) {
if (stickerFile != null && stickerFile.exists()) {
new androidx.appcompat.app.AlertDialog.Builder(context)
.setTitle(R.string.delete)
.setMessage(R.string.ask_delete_sticker)
.setPositiveButton(
R.string.delete,
(dialog, which) -> {
if (stickerFile.delete()) {
int position = stickerFiles.indexOf(stickerFile);
if (position >= 0) {
stickerFiles.remove(position);
notifyItemRemoved(position);
}
if (listener != null) {
listener.onStickerDeleted(stickerFile);
}
}
})
.setNegativeButton(R.string.cancel, null)
.show();
AlertDialog dialog =
new AlertDialog.Builder(context)
.setMessage(R.string.ask_delete_sticker)
.setPositiveButton(
R.string.delete,
(d, which) -> {
if (stickerFile.delete()) {
int position = stickerFiles.indexOf(stickerFile);
if (position >= 0) {
stickerFiles.remove(position);
notifyItemRemoved(position);
}
if (listener != null) {
listener.onStickerDeleted(stickerFile);
}
}
})
.setNegativeButton(R.string.cancel, null)
.show();
Util.redPositiveButton(dialog);
}
}
@@ -23,7 +23,7 @@ import org.thoughtcrime.securesms.util.Prefs;
@SuppressLint("BatteryLife")
public class DozeReminder {
private static final String TAG = DozeReminder.class.getSimpleName();
private static final String TAG = "DozeReminder";
public static boolean isEligible(Context context) {
if (context == null) {
@@ -19,7 +19,7 @@ import androidx.viewpager.widget.ViewPager;
*/
public class HackyViewPager extends ViewPager {
private static final String TAG = HackyViewPager.class.getSimpleName();
private static final String TAG = "HackyViewPager";
public HackyViewPager(Context context) {
super(context);
@@ -18,7 +18,7 @@ import org.thoughtcrime.securesms.accounts.AccountSelectionListFragment;
public class AccountManager {
private static final String TAG = AccountManager.class.getSimpleName();
private static final String TAG = "AccountManager";
private static final String LAST_ACCOUNT_ID = "last_account_id";
private static AccountManager self;
@@ -38,7 +38,7 @@ public class AccountManager {
return self;
}
public void migrateToDcAccounts(ApplicationContext context) {
public void migrateToDcAccounts(Context context, DcAccounts dcAccounts) {
try {
int selectAccountId = 0;
@@ -49,8 +49,7 @@ public class AccountManager {
if (!file.isDirectory()
&& file.getName().startsWith("messenger")
&& file.getName().endsWith(".db")) {
int accountId =
ApplicationContext.getDcAccounts().migrateAccount(file.getAbsolutePath());
int accountId = dcAccounts.migrateAccount(file.getAbsolutePath());
if (accountId != 0) {
String selName =
PreferenceManager.getDefaultSharedPreferences(context)
@@ -67,7 +66,7 @@ public class AccountManager {
}
if (selectAccountId != 0) {
ApplicationContext.getDcAccounts().selectAccount(selectAccountId);
dcAccounts.selectAccount(selectAccountId);
}
} catch (Exception e) {
Log.e(TAG, "Error in migrateToDcAccounts()", e);
@@ -3,18 +3,24 @@ package org.thoughtcrime.securesms.connect;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.OpenableColumns;
import android.webkit.MimeTypeMap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.b44t.messenger.DcContext;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Objects;
import org.thoughtcrime.securesms.util.MediaUtil;
public class AttachmentsContentProvider extends ContentProvider {
private static final String[] ALL_COLUMNS = {OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE};
/* We save all attachments in our private files-directory
that cannot be read by other apps.
@@ -46,7 +52,8 @@ public class AttachmentsContentProvider extends ContentProvider {
}
@Override
public int delete(@NonNull Uri arg0, String arg1, String[] arg2) {
public int delete(
@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
return 0;
}
@@ -55,7 +62,7 @@ public class AttachmentsContentProvider extends ContentProvider {
String file = uri.getPathSegments().get(0);
String mimeType = DcHelper.sharedFiles.get(file);
return DcHelper.checkMime(uri.toString(), mimeType);
return DcHelper.checkMime(uri.getPathSegments().get(1), mimeType);
}
@Override
@@ -65,22 +72,69 @@ public class AttachmentsContentProvider extends ContentProvider {
}
@Override
public Uri insert(@NonNull Uri arg0, ContentValues arg1) {
public Uri insert(@NonNull Uri arg0, ContentValues values) {
return null;
}
@Override
public boolean onCreate() {
return false;
return true;
}
@Override
public Cursor query(@NonNull Uri arg0, String[] arg1, String arg2, String[] arg3, String arg4) {
return null;
public Cursor query(
@NonNull Uri uri,
@Nullable String[] projection,
@Nullable String selection,
@Nullable String[] selectionArgs,
@Nullable String sortOrder) {
// Segment [0] is the blob file key ("ef39a39"), same as in openFile() and getType()
// Segment [1] is the original display name ("text.txt")
String file = uri.getPathSegments().get(0);
// Same guard used in openFile()
if (!DcHelper.sharedFiles.containsKey(file)) {
return null;
}
// Resolve the actual File
DcContext dcContext = DcHelper.getContext(Objects.requireNonNull(getContext()));
File privateFile = new File(dcContext.getBlobdir(), file);
// Default to all supported columns
if (projection == null) {
projection = ALL_COLUMNS;
}
// Build column-name and value arrays
String[] cols = new String[projection.length];
Object[] values = new Object[projection.length];
int i = 0;
for (String col : projection) {
if (OpenableColumns.DISPLAY_NAME.equals(col)) {
cols[i] = OpenableColumns.DISPLAY_NAME;
values[i++] = uri.getPathSegments().get(1);
} else if (OpenableColumns.SIZE.equals(col)) {
cols[i] = OpenableColumns.SIZE;
values[i++] = privateFile.length();
}
}
// Set arrays to only matched columns.
cols = Arrays.copyOf(cols, i);
values = Arrays.copyOf(values, i);
MatrixCursor cursor = new MatrixCursor(cols, 1);
cursor.addRow(values);
return cursor;
}
@Override
public int update(@NonNull Uri arg0, ContentValues arg1, String arg2, String[] arg3) {
public int update(
@NonNull Uri uri,
@Nullable ContentValues values,
@Nullable String selection,
@Nullable String[] selectionArgs) {
return 0;
}
}
@@ -14,7 +14,7 @@ import org.thoughtcrime.securesms.service.FetchForegroundService;
import org.thoughtcrime.securesms.util.Util;
public class DcEventCenter {
private static final String TAG = DcEventCenter.class.getSimpleName();
private static final String TAG = "DcEventCenter";
private @NonNull final Hashtable<Integer, ArrayList<DcEventDelegate>> currentAccountObservers =
new Hashtable<>();
private @NonNull final Hashtable<Integer, ArrayList<DcEventDelegate>> multiAccountObservers =
@@ -42,7 +42,7 @@ import org.thoughtcrime.securesms.util.Util;
public class DcHelper {
private static final String TAG = DcHelper.class.getSimpleName();
private static final String TAG = "DcHelper";
public static final String CONFIG_CONFIGURED_ADDRESS = "configured_addr";
public static final String CONFIG_DISPLAY_NAME = "displayname";
@@ -145,8 +145,6 @@ public class DcHelper {
dcContext.setStockTranslation(91, context.getString(R.string.devicemsg_self_deleted));
dcContext.setStockTranslation(97, context.getString(R.string.forwarded));
dcContext.setStockTranslation(98, context.getString(R.string.devicemsg_storage_exceeding));
dcContext.setStockTranslation(99, context.getString(R.string.n_bytes_message));
dcContext.setStockTranslation(100, context.getString(R.string.download_max_available_until));
dcContext.setStockTranslation(103, context.getString(R.string.incoming_messages));
dcContext.setStockTranslation(104, context.getString(R.string.outgoing_messages));
dcContext.setStockTranslation(107, context.getString(R.string.connectivity_connected));
@@ -227,6 +225,8 @@ public class DcHelper {
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(204, context.getString(R.string.channel_name_changed));
dcContext.setStockTranslation(205, context.getString(R.string.channel_image_changed));
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));
@@ -40,7 +40,7 @@ import org.thoughtcrime.securesms.util.Util;
*/
public class DirectShareUtil {
private static final String TAG = DirectShareUtil.class.getSimpleName();
private static final String TAG = "DirectShareUtil";
private static final String SHORTCUT_CATEGORY = "android.shortcut.conversation";
public static void clearShortcut(@NonNull Context context, int chatId) {
@@ -1,6 +1,5 @@
package org.thoughtcrime.securesms.connect;
import android.annotation.TargetApi;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
@@ -11,6 +10,7 @@ import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.content.ContextCompat;
import org.thoughtcrime.securesms.ConversationListActivity;
@@ -21,7 +21,7 @@ import org.thoughtcrime.securesms.util.Prefs;
public class KeepAliveService extends Service {
private static final String TAG = KeepAliveService.class.getSimpleName();
private static final String TAG = "KeepAliveService";
static KeepAliveService s_this = null;
@@ -119,7 +119,7 @@ public class KeepAliveService extends Service {
private static boolean ch_created = false;
@TargetApi(Build.VERSION_CODES.O)
@RequiresApi(Build.VERSION_CODES.O)
private static void createFgNotificationChannel(Context context) {
if (!ch_created) {
ch_created = true;
@@ -10,7 +10,7 @@ import android.util.Log;
public class NetworkStateReceiver extends BroadcastReceiver {
private static final String TAG = NetworkStateReceiver.class.getSimpleName();
private static final String TAG = "NetworkStateReceiver";
private int debugConnectedCount;
@Override
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.thoughtcrime.securesms.ContactSelectionListFragment;
import org.thoughtcrime.securesms.util.Hash;
import org.thoughtcrime.securesms.util.Prefs;
@@ -37,7 +36,7 @@ import org.thoughtcrime.securesms.util.Prefs;
* @author Moxie Marlinspike
*/
public class ContactAccessor {
private static final String TAG = ContactSelectionListFragment.class.getSimpleName();
private static final String TAG = "ContactAccessor";
private static final int CONTACT_CURSOR_NAME = 0;
@@ -12,7 +12,7 @@ import org.thoughtcrime.securesms.util.AsyncLoader;
public class PagingMediaLoader extends AsyncLoader<DcMediaGalleryElement> {
private static final String TAG = PagingMediaLoader.class.getSimpleName();
private static final String TAG = "PagingMediaLoader";
private final DcMsg msg;
private final boolean leftIsRecent;
@@ -0,0 +1,53 @@
package org.thoughtcrime.securesms.geolocation;
import android.content.Context;
import android.content.SharedPreferences;
import java.util.HashSet;
import java.util.Set;
public final class ActiveLocationChats {
private static final String PREFS_NAME = "location_streaming";
private static final String KEY_ACTIVE = "active_chat_ids";
private ActiveLocationChats() {}
private static SharedPreferences prefs(Context context) {
return context.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
}
/**
* Add a chat. Uses commit() to guarantee the write reaches disk before the process can die to
* preserve the superset invariant.
*/
static void add(Context context, int chatId) {
Set<String> current = new HashSet<>(getAll(context));
current.add(String.valueOf(chatId));
prefs(context).edit().putStringSet(KEY_ACTIVE, current).commit();
}
public static void remove(Context context, int chatId) {
Set<String> current = new HashSet<>(getAll(context));
current.remove(String.valueOf(chatId));
prefs(context).edit().putStringSet(KEY_ACTIVE, current).apply();
}
static void clear(Context context) {
prefs(context).edit().remove(KEY_ACTIVE).apply();
}
static Set<Integer> getAllIds(Context context) {
Set<Integer> ids = new HashSet<>();
for (String s : getAll(context)) {
try {
ids.add(Integer.parseInt(s));
} catch (NumberFormatException ignored) {
}
}
return ids;
}
private static Set<String> getAll(Context context) {
return prefs(context).getStringSet(KEY_ACTIVE, new HashSet<>());
}
}
@@ -1,128 +0,0 @@
package org.thoughtcrime.securesms.geolocation;
import android.location.Location;
import android.util.Log;
import java.util.Observable;
public class DcLocation extends Observable {
private static final String TAG = DcLocation.class.getSimpleName();
private Location lastLocation;
private static DcLocation instance;
private static final int TIMEOUT = 1000 * 15;
private static final int EARTH_RADIUS = 6371;
private DcLocation() {
lastLocation = getDefault();
}
public static DcLocation getInstance() {
if (instance == null) {
instance = new DcLocation();
}
return instance;
}
public Location getLastLocation() {
return lastLocation;
}
public boolean isValid() {
return !"?".equals(lastLocation.getProvider());
}
void updateLocation(Location location) {
if (isBetterLocation(location, lastLocation)) {
lastLocation = location;
instance.setChanged();
instance.notifyObservers();
}
}
void reset() {
updateLocation(getDefault());
}
private Location getDefault() {
return new Location("?");
}
/**
* https://developer.android.com/guide/topics/location/strategies Determines whether one Location
* reading is better than the current Location fix
*
* @param location The new Location that you want to evaluate
* @param currentBestLocation The current Location fix, to which you want to compare the new one
*/
private boolean isBetterLocation(Location location, Location currentBestLocation) {
if (currentBestLocation == null) {
// A new location is always better than no location
return true;
}
// Check whether the new location fix is newer or older
long timeDelta = location.getTime() - currentBestLocation.getTime();
boolean isSignificantlyOlder = timeDelta < -TIMEOUT;
if (isSignificantlyOlder) {
return false;
}
// Check whether the new location fix is more or less accurate
int accuracyDelta = (int) (location.getAccuracy() - currentBestLocation.getAccuracy());
Log.d(TAG, "accuracyDelta: " + accuracyDelta);
boolean isSignificantlyMoreAccurate = accuracyDelta > 50;
boolean isSameProvider =
isSameProvider(location.getProvider(), currentBestLocation.getProvider());
if (isSignificantlyMoreAccurate && isSameProvider) {
return true;
}
boolean isMoreAccurate = accuracyDelta > 0;
double distance = distance(location, currentBestLocation);
return hasLocationChanged(distance) && isMoreAccurate
|| hasLocationSignificantlyChanged(distance);
}
private boolean hasLocationSignificantlyChanged(double distance) {
return distance > 30D;
}
private boolean hasLocationChanged(double distance) {
return distance > 10D;
}
private double distance(Location location, Location currentBestLocation) {
double startLat = location.getLatitude();
double startLong = location.getLongitude();
double endLat = currentBestLocation.getLatitude();
double endLong = currentBestLocation.getLongitude();
double dLat = Math.toRadians(endLat - startLat);
double dLong = Math.toRadians(endLong - startLong);
startLat = Math.toRadians(startLat);
endLat = Math.toRadians(endLat);
double a = haversin(dLat) + Math.cos(startLat) * Math.cos(endLat) * haversin(dLong);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
double distance = EARTH_RADIUS * c * 1000;
Log.d(TAG, "Distance between location updates: " + distance);
return distance;
}
private double haversin(double val) {
return Math.pow(Math.sin(val / 2), 2);
}
/** Checks whether two providers are the same */
private boolean isSameProvider(String provider1, String provider2) {
if (provider1 == null) {
return provider2 == null;
}
return provider1.equals(provider2);
}
}
@@ -1,125 +0,0 @@
package org.thoughtcrime.securesms.geolocation;
import static android.content.Context.BIND_AUTO_CREATE;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.location.Location;
import android.os.IBinder;
import android.util.Log;
import com.b44t.messenger.DcContext;
import java.util.LinkedList;
import java.util.Observable;
import java.util.Observer;
import org.thoughtcrime.securesms.connect.DcHelper;
public class DcLocationManager implements Observer {
private static final String TAG = DcLocationManager.class.getSimpleName();
private LocationBackgroundService.LocationBackgroundServiceBinder serviceBinder;
private final Context context;
private DcLocation dcLocation = DcLocation.getInstance();
private final LinkedList<Integer> pendingShareLastLocation = new LinkedList<>();
private final ServiceConnection serviceConnection =
new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "background service connected");
serviceBinder = (LocationBackgroundService.LocationBackgroundServiceBinder) service;
while (!pendingShareLastLocation.isEmpty()) {
shareLastLocation(pendingShareLastLocation.pop());
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.d(TAG, "background service disconnected");
serviceBinder = null;
}
};
public DcLocationManager(Context context, DcContext dcContext) {
this.context = context.getApplicationContext();
DcLocation.getInstance().addObserver(this);
if (dcContext.isSendingLocationsToChat(0)) {
startLocationEngine();
}
}
public void startLocationEngine() {
if (serviceBinder == null) {
Intent intent = new Intent(context.getApplicationContext(), LocationBackgroundService.class);
context.bindService(intent, serviceConnection, BIND_AUTO_CREATE);
}
}
public void stopLocationEngine() {
if (serviceBinder == null) {
return;
}
context.unbindService(serviceConnection);
serviceBinder.stop();
serviceBinder = null;
}
public void stopSharingLocation(int chatId) {
DcHelper.getContext(context).sendLocationsToChat(chatId, 0);
if (!DcHelper.getContext(context).isSendingLocationsToChat(0)) {
stopLocationEngine();
}
}
public void shareLocation(int duration, int chatId) {
startLocationEngine();
Log.d(TAG, String.format("Share location in chat %d for %d seconds", chatId, duration));
DcHelper.getContext(context).sendLocationsToChat(chatId, duration);
if (dcLocation.isValid()) {
writeDcLocationUpdateMessage();
}
}
public void shareLastLocation(int chatId) {
if (serviceBinder == null) {
pendingShareLastLocation.push(chatId);
startLocationEngine();
return;
}
if (dcLocation.isValid()) {
DcHelper.getContext(context).sendLocationsToChat(chatId, 1);
writeDcLocationUpdateMessage();
}
}
@Override
public void update(Observable o, Object arg) {
if (o instanceof DcLocation) {
dcLocation = (DcLocation) o;
if (dcLocation.isValid()) {
writeDcLocationUpdateMessage();
}
}
}
private void writeDcLocationUpdateMessage() {
Log.d(
TAG,
"Share location: "
+ dcLocation.getLastLocation().getLatitude()
+ ", "
+ dcLocation.getLastLocation().getLongitude());
Location lastLocation = dcLocation.getLastLocation();
boolean continueLocationStreaming =
DcHelper.getContext(context)
.setLocation(
(float) lastLocation.getLatitude(),
(float) lastLocation.getLongitude(),
lastLocation.getAccuracy());
if (!continueLocationStreaming) {
stopLocationEngine();
}
}
}
@@ -1,142 +0,0 @@
package org.thoughtcrime.securesms.geolocation;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import androidx.annotation.NonNull;
public class LocationBackgroundService extends Service {
private static final int INITIAL_TIMEOUT = 1000 * 60 * 2;
private static final String TAG = LocationBackgroundService.class.getSimpleName();
private LocationManager locationManager = null;
private static final int LOCATION_INTERVAL = 1000;
private static final float LOCATION_DISTANCE = 25F;
ServiceLocationListener locationListener;
private final IBinder mBinder = new LocationBackgroundServiceBinder();
@Override
public boolean bindService(Intent service, ServiceConnection conn, int flags) {
return super.bindService(service, conn, flags);
}
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public void onCreate() {
locationManager =
(LocationManager) getApplicationContext().getSystemService(Context.LOCATION_SERVICE);
if (locationManager == null) {
Log.e(TAG, "Unable to initialize location service");
return;
}
locationListener = new ServiceLocationListener();
Location lastLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (lastLocation != null) {
long locationAge = System.currentTimeMillis() - lastLocation.getTime();
if (locationAge <= 600 * 1000) { // not older than 10 minutes
DcLocation.getInstance().updateLocation(lastLocation);
}
}
// requestLocationUpdate(LocationManager.NETWORK_PROVIDER);
requestLocationUpdate(LocationManager.GPS_PROVIDER);
initialLocationUpdate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
if (locationManager == null) {
return;
}
try {
locationManager.removeUpdates(locationListener);
} catch (Exception ex) {
Log.i(TAG, "fail to remove location listeners, ignore", ex);
}
}
private void requestLocationUpdate(String provider) {
try {
locationManager.requestLocationUpdates(
provider, LOCATION_INTERVAL, LOCATION_DISTANCE, locationListener);
} catch (SecurityException | IllegalArgumentException ex) {
Log.e(
TAG,
String.format("Unable to request %s provider based location updates.", provider),
ex);
}
}
private void initialLocationUpdate() {
try {
Location gpsLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
if (gpsLocation != null
&& System.currentTimeMillis() - gpsLocation.getTime() < INITIAL_TIMEOUT) {
locationListener.onLocationChanged(gpsLocation);
}
} catch (NullPointerException | SecurityException e) {
e.printStackTrace();
}
}
class LocationBackgroundServiceBinder extends Binder {
LocationBackgroundServiceBinder getService() {
return LocationBackgroundServiceBinder.this;
}
void stop() {
DcLocation.getInstance().reset();
stopSelf();
}
}
private class ServiceLocationListener implements LocationListener {
@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);
}
@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);
}
}
}
@@ -0,0 +1,40 @@
package org.thoughtcrime.securesms.geolocation;
import android.location.Location;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
/**
* Process-wide holder for the current streamed location. Foreground service writes, UI observes.
*/
public final class LocationData {
private static final LocationData INSTANCE = new LocationData();
private final MutableLiveData<Location> liveLocation = new MutableLiveData<>();
private LocationData() {}
public static LocationData getInstance() {
return INSTANCE;
}
public LiveData<Location> observable() {
return liveLocation;
}
@Nullable
public Location current() {
return liveLocation.getValue();
}
void post(@NonNull Location location) {
liveLocation.postValue(location);
}
void clear() {
liveLocation.postValue(null);
}
}

Some files were not shown because too many files have changed in this diff Show More