Merge remote-tracking branch 'upstream/main' into adb/merge-code-tree-changes

This commit is contained in:
adbenitez 2024-06-13 18:50:37 +02:00
commit 18384f9c69
25 changed files with 197 additions and 154 deletions

5
.gitignore vendored
View file

@ -5,7 +5,7 @@ project.properties
.settings
bin/
gen/
gplay/
/gplay/
.idea/
*.iml
*.so
@ -47,4 +47,5 @@ jni/armeabi-v7a
jni/arm64-v8a
artwork/drawable*/
artwork/mipmap-*/
artwork/mipmap-*/
*~

View file

@ -3,8 +3,8 @@ host = https://www.transifex.com
lang_map = id: in, ja_JP: ja, nl_NL: nl, pt_BR: pt-rBR, zh_CN: zh-rCN, zh_TW: zh-rTW
[o:delta-chat:p:delta-chat-app:r:stringsxml]
file_filter = res/values-<lang>/strings.xml
source_file = res/values/strings.xml
file_filter = src/main/res/values-<lang>/strings.xml
source_file = src/main/res/values/strings.xml
source_lang = en
type = ANDROID

View file

@ -1,5 +1,12 @@
# Delta Chat Android Changelog
## v1.46.3
2024-06
* Disable FCM PUSH notification support for F-Droid and other non-Google-Play-builds
* using core 1.139.5
## v1.46.2
2024-06

View file

@ -14,90 +14,6 @@ repositories {
jcenter()
}
final def markwon_version = '4.6.2'
dependencies {
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
implementation "io.noties.markwon:inline-parser:$markwon_version"
implementation 'androidx.sharetarget:sharetarget:1.2.0'
implementation 'androidx.webkit:webkit:1.8.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation ('androidx.preference:preference:1.2.1') {
exclude group: 'androidx.lifecycle', module:'lifecycle-viewmodel'
exclude group: 'androidx.lifecycle', module:'lifecycle-viewmodel-ktx'
}
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation 'androidx.work:work-runtime:2.8.1'
implementation 'androidx.emoji2:emoji2-emojipicker:1.4.0'
implementation 'com.google.guava:guava:29.0-android'
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6' // plays video and audio
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.6'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.journeyapps:zxing-android-embedded:3.4.0' // QR Code scanner
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' // used as JSON library
implementation 'com.google.code.gson:gson:2.9.1' // used as JSON library. Don't upgrade to 2.10.1: https://github.com/deltachat/deltachat-android/pull/2610
implementation "me.leolin:ShortcutBadger:1.1.16" // display messagecount on the home screen icon.
implementation 'com.jpardogo.materialtabstrip:library:1.0.9' // used in the emoji selector for the tab selection.
implementation 'com.github.chrisbanes:PhotoView:2.1.3' // does the zooming on photos / media
implementation 'com.airbnb.android:lottie:4.2.2' // Lottie animations support.
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.25.0' // APNG & animated webp support.
implementation 'com.caverock:androidsvg-aar:1.4' // SVG support.
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
annotationProcessor 'androidx.annotation:annotation:1.7.0'
implementation 'com.makeramen:roundedimageview:2.1.0' // crops the avatars to circles
implementation 'com.pnikosis:materialish-progress:1.5' // used only in the "Progress Wheel" in Share Activity.
implementation 'com.soundcloud.android:android-crop:1.0.1@aar' // used for profile and group avatar selection in Android SDK<19
implementation 'mobi.upod:time-duration-picker:1.1.3' // Used to pick the time for inactivity.
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' // number of unread messages,
// the one-letter circle for the contacts (when there is not avatar) and a white background.
implementation 'com.googlecode.mp4parser:isoparser:1.0.6' // MP4 recoding; upgrading eg. to 1.1.22 breaks recoding, however, i have not investigated further, just reset to 1.0.6
implementation ('com.google.firebase:firebase-messaging:23.4.1') { // for PUSH notifications
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
}
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') { // for the zooming on photos / media
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation 'com.annimon:stream:1.1.8' // brings future java streams api to SDK Version < 24
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4' // glues the current time segment text in the gallery to the top.
// Replacement for ContentResolver
// that protects against the Surreptitious Sharing attack.
// <https://github.com/cketti/SafeContentResolver>
implementation 'de.cketti.safecontentresolver:safe-content-resolver-v14:1.0.0'
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.assertj:assertj-core:1.7.1'
testImplementation 'org.mockito:mockito-core:1.9.5'
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation ('org.assertj:assertj-core:1.7.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
}
android {
dependenciesInfo {
// Disables dependency metadata when building APKs.
@ -119,8 +35,8 @@ android {
useLibrary 'org.apache.http.legacy'
defaultConfig {
versionCode 678
versionName "1.46.2"
versionCode 679
versionName "1.46.3"
applicationId "com.b44t.messenger"
multiDexEnabled true
@ -193,10 +109,15 @@ android {
}
productFlavors {
foss {
dimension "none"
buildConfigField "boolean", "USE_PLAY_SERVICES", "false"
}
gplay {
dimension "none"
applicationId "chat.delta"
apply plugin: "com.google.gms.google-services"
buildConfigField "boolean", "USE_PLAY_SERVICES", "true"
}
}
@ -226,18 +147,8 @@ android {
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
androidTest {
java.srcDirs = ['androidTest']
}
}
lint {
abortOnError false
@ -249,6 +160,97 @@ android {
}
final def markwon_version = '4.6.2'
dependencies {
// DeltaLab-only dependencies:
implementation "io.noties.markwon:core:$markwon_version"
implementation "io.noties.markwon:ext-strikethrough:$markwon_version"
implementation "io.noties.markwon:inline-parser:$markwon_version"
implementation 'com.airbnb.android:lottie:4.2.2' // Lottie animations support.
implementation 'androidx.sharetarget:sharetarget:1.2.0'
implementation 'androidx.webkit:webkit:1.8.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.10.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation ('androidx.preference:preference:1.2.1') {
exclude group: 'androidx.lifecycle', module:'lifecycle-viewmodel'
exclude group: 'androidx.lifecycle', module:'lifecycle-viewmodel-ktx'
}
implementation 'androidx.legacy:legacy-preference-v14:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.6.2'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2'
implementation 'androidx.work:work-runtime:2.8.1'
implementation 'androidx.emoji2:emoji2-emojipicker:1.4.0'
implementation 'com.google.guava:guava:29.0-android'
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6' // plays video and audio
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.6'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.journeyapps:zxing-android-embedded:3.4.0' // QR Code scanner
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.1' // used as JSON library
implementation 'com.google.code.gson:gson:2.9.1' // used as JSON library. Don't upgrade to 2.10.1: https://github.com/deltachat/deltachat-android/pull/2610
implementation "me.leolin:ShortcutBadger:1.1.16" // display messagecount on the home screen icon.
implementation 'com.jpardogo.materialtabstrip:library:1.0.9' // used in the emoji selector for the tab selection.
implementation 'com.github.chrisbanes:PhotoView:2.1.3' // does the zooming on photos / media
implementation 'com.github.penfeizhou.android.animation:glide-plugin:2.25.0' // APNG & animated webp support.
implementation 'com.caverock:androidsvg-aar:1.4' // SVG support.
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
annotationProcessor 'androidx.annotation:annotation:1.7.0'
implementation 'com.makeramen:roundedimageview:2.1.0' // crops the avatars to circles
implementation 'com.pnikosis:materialish-progress:1.5' // used only in the "Progress Wheel" in Share Activity.
implementation 'com.soundcloud.android:android-crop:1.0.1@aar' // used for profile and group avatar selection in Android SDK<19
implementation 'mobi.upod:time-duration-picker:1.1.3' // Used to pick the time for inactivity.
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1' // number of unread messages,
// the one-letter circle for the contacts (when there is not avatar) and a white background.
implementation 'com.googlecode.mp4parser:isoparser:1.0.6' // MP4 recoding; upgrading eg. to 1.1.22 breaks recoding, however, i have not investigated further, just reset to 1.0.6
implementation ('com.google.firebase:firebase-messaging:23.4.1') { // for PUSH notifications
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
}
implementation ('com.davemorrissey.labs:subsampling-scale-image-view:3.6.0') { // for the zooming on photos / media
exclude group: 'com.android.support', module: 'support-annotations'
}
implementation 'com.annimon:stream:1.1.8' // brings future java streams api to SDK Version < 24
implementation 'com.codewaves.stickyheadergrid:stickyheadergrid:0.9.4' // glues the current time segment text in the gallery to the top.
// Replacement for ContentResolver
// that protects against the Surreptitious Sharing attack.
// <https://github.com/cketti/SafeContentResolver>
implementation 'de.cketti.safecontentresolver:safe-content-resolver-v14:1.0.0'
gplayImplementation('com.google.firebase:firebase-messaging:23.4.1') { // for PUSH notifications
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'com.google.firebase', module: 'firebase-analytics'
exclude group: 'com.google.firebase', module: 'firebase-measurement-connector'
}
testImplementation 'junit:junit:4.13.1'
testImplementation 'org.assertj:assertj-core:1.7.1'
testImplementation 'org.mockito:mockito-core:1.9.5'
testImplementation 'org.powermock:powermock-api-mockito:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4:1.6.1'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.1'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.1'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'com.android.support:support-annotations:28.0.0'
androidTestImplementation ('org.assertj:assertj-core:1.7.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
}
String buildConfigProperty(String name) {
return "\"${propertyOrEmpty(name)}\""
}

View file

@ -0,0 +1,7 @@
- new onboarding: you can create a new profile with one tap on "Create New Profile" - or use an existing login or second-device-setup as usual
- contacts can be attached as "Cards" at "Attach / Contact"; when the receiver taps the cards, guaranteed end-to-end encrypted can be established
- add contacts manually at "New Chat / New Contact / Add Contact Manually"
- send any emoji as reaction
- show reactions in summaries
- pin/archive/etc chats directly from search result
- bug fixed and more

View file

@ -7,18 +7,19 @@ then
fi
LANG=$1
RES=src/main/res
mkdir res/values-$LANG/
mkdir $RES/values-$LANG/
cp res/values/strings.xml res/values-$LANG/strings.xml
cp $RES/values/strings.xml $RES/values-$LANG/strings.xml
# set time to old date because transifex may have different file times
# and does not overwrite old file
# (using -t as sth. as -d "100 days ago" does not work on mac)
touch -t 201901010000 res/values-$LANG/strings.xml
touch -t 201901010000 $RES/values-$LANG/strings.xml
echo "res/values-$LANG/strings.xml added:"
echo "- add the name to res/values/arrays.xml"
echo "$RES/values-$LANG/strings.xml added:"
echo "- add the name to $RES/values/arrays.xml"
echo "- if needed, language mappings can be added to .tx/config"
echo "- pull translations using ./scripts/tx-pull-translations.sh"
echo " (on problems, 'tx -d pull' gives verbose output)"

View file

@ -1,20 +1,22 @@
echo potential errors, if any:
RES=./src/main/res
# a space after the percent sign
# results in an IllegalFormatException in getString()
grep --include='strings.xml' -r '\% [12]' ./res/
grep --include='strings.xml' -r '\%[$]' ./res/
grep --include='strings.xml' -r '\$ ' ./res/
grep --include='strings.xml' -r ' \$' ./res/
grep --include='strings.xml' -r '\% [12]' $RES
grep --include='strings.xml' -r '\%[$]' $RES
grep --include='strings.xml' -r '\$ ' $RES
grep --include='strings.xml' -r ' \$' $RES
# check for broken usage of escape sequences:
# - alert on `\ n`, `\ N`, `\n\Another paragraph` and so on
# - allow only `\n`, `\"`, `\'` and `\`
# (`` might not be escaped, but it is done often eg. in "sq", so we allow that for now)
grep --include='strings.xml' -r "\\\\[^n\"']" ./res/
grep --include='strings.xml' -r "\\\\[^n\"']" $RES
# check for usage of a single `&` - this has to be an `&amp;`
grep --include='strings.xml' -r "&[^a]" ./res/
grep --include='strings.xml' -r "&[^a]" $RES
# single <br> is not needed - and not allowed in xml, leading to error "matching end tag missing"
grep --include='strings.xml' -r "<br" ./res/
grep --include='strings.xml' -r "<br" $RES

View file

@ -1,4 +1,7 @@
#!/bin/sh
MAIN=./src/main
codespell \
--skip './.git,./build,./res/values-*/strings.xml,,./assets/help,./jni/deltachat-core-rust' \
--skip './.git,./build,$MAIN/res/values-*/strings.xml,,$MAIN/assets/help,./jni/deltachat-core-rust' \
--ignore-words-list formattings

View file

@ -1 +1 @@
../deltachat-pages/tools/create-local-help.py ../deltachat-pages/_site assets/help
../deltachat-pages/tools/create-local-help.py ../deltachat-pages/_site src/main/assets/help

View file

@ -1,4 +1,5 @@
RES=src/main/res
tx pull -l en
mv res/values-en/strings.xml res/values/strings.xml
rmdir res/values-en
mv $RES/values-en/strings.xml $RES/values/strings.xml
rmdir $RES/values-en
./scripts/check-translations.sh

View file

@ -1,3 +1,3 @@
read -p "Push res/values/strings.xml to transifex? Press ENTER to continue, CTRL-C to abort."
read -p "Push src/main/res/values/strings.xml to transifex? Press ENTER to continue, CTRL-C to abort."
tx push -s
./scripts/check-translations.sh

View file

@ -1,12 +0,0 @@
the main purpose of this directory is
to define a different ic_launcher icon for the build-type 'debug'.
the build-process seems to prefer files from /src/debug/res
over the ones from the /res, not totally sure, however, it
works :)
btw the dev-icon is not available as vector graphic,
the original source is in xxhdpi -
all other resolutions are just scaled with gimp.
via http://onebigfunction.com/android/2016/10/06/flavor-flav-android-product-flavors-explained/

View file

@ -0,0 +1,15 @@
package org.thoughtcrime.securesms.notifications;
import android.content.Context;
import androidx.annotation.Nullable;
/*
Fake do-nothing implementation of FcmReceiveService.
The real implementation is in the gplay flavor only.
*/
public class FcmReceiveService {
public static void register(Context context) {}
public static void waitForRegisterFinished() {}
public static void deleteToken() {}
@Nullable public static String getToken() { return null; }
}

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- force compiling emojipicker on sdk<21 and firebase on sdk<19; runtime checks are required then -->
<uses-sdk tools:overrideLibrary="androidx.emoji2.emojipicker, com.google.firebase.messaging, com.google.android.gms.cloudmessaging"/>
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
<application>
<service
android:name=".notifications.FcmReceiveService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
tools:node="remove">
</provider>
</application>
</manifest>

View file

@ -40,8 +40,8 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<!-- force compiling emojipicker on sdk<21 and firebase on sdk<19; runtime checks are required then -->
<uses-sdk tools:overrideLibrary="androidx.emoji2.emojipicker, com.google.firebase.messaging, com.google.android.gms.cloudmessaging"/>
<!-- force compiling emojipicker on sdk<21; runtime checks are required then -->
<uses-sdk tools:overrideLibrary="androidx.emoji2.emojipicker"/>
<application android:name=".ApplicationContext"
android:icon="@mipmap/ic_launcher"
@ -57,10 +57,6 @@
android:hasFragileUserData="true"
>
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
<meta-data android:name="google_analytics_adid_collection_enabled" android:value="false" />
<meta-data android:name="firebase_messaging_auto_init_enabled" android:value="false" />
<!-- android car support, see https://developer.android.com/training/auto/start/,
as this potentially blocks releases on gplay due to extra-checks,
we disable this during the first gplay releases -->
@ -394,12 +390,6 @@
</intent-filter>
</service>
<service android:name=".notifications.FcmReceiveService" android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver android:name=".notifications.MarkReadReceiver"
android:enabled="true"
android:exported="false">
@ -454,12 +444,6 @@
</provider>
<provider
android:name="com.google.firebase.provider.FirebaseInitProvider"
android:authorities="${applicationId}.firebaseinitprovider"
tools:node="remove">
</provider>
<receiver android:name=".service.BootReceiver"
android:exported="true">
<intent-filter>

View file

@ -253,10 +253,14 @@ public class ApplicationContext extends MultiDexApplication {
} catch (Throwable e) {}
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
if(Prefs.isPushEnabled(this)) {
FcmReceiveService.register(this);
if (BuildConfig.USE_PLAY_SERVICES) {
if (Prefs.isPushEnabled(this)) {
FcmReceiveService.register(this);
} else {
Log.i(TAG, "FCM disabled in user settings");
}
} else {
Log.i(TAG, "FCM disabled in user settings");
Log.i(TAG, "FCM disabled at build time");
}
}

View file

@ -21,6 +21,7 @@ import androidx.preference.Preference;
import android.text.TextUtils;
import org.thoughtcrime.securesms.ApplicationPreferencesActivity;
import org.thoughtcrime.securesms.BuildConfig;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.connect.DcHelper;
import org.thoughtcrime.securesms.connect.KeepAliveService;
@ -74,6 +75,7 @@ public class NotificationsPreferenceFragment extends ListSummaryPreferenceFragme
CheckBoxPreference usePushService = this.findPreference("pref_push_enabled");
usePushService.setChecked(Prefs.isPushEnabled(getContext()));
usePushService.setEnabled(BuildConfig.USE_PLAY_SERVICES);
usePushService.setOnPreferenceChangeListener((preference, newValue) -> {
final boolean enabled = (Boolean) newValue;
if (!enabled) {

View file

@ -173,9 +173,7 @@ public class Prefs {
}
public static boolean isPushEnabled(Context context) {
// Do not use PUSH for the the default application ID "com.b44t.messenger" which is used eg. used by F-Droid
boolean defaultPush = !BuildConfig.APPLICATION_ID.equals("com.b44t.messenger");
return getBooleanPreference(context, "pref_push_enabled", defaultPush);
return BuildConfig.USE_PLAY_SERVICES && getBooleanPreference(context, "pref_push_enabled", true);
}
public static boolean isHardCompressionEnabled(Context context) {

View file

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#7B00C8</color>
</resources>
</resources>