Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d4bb52f
[TF] modify .gitignore
thermatk Nov 7, 2020
f88bb28
[TF][JNI] remove native deps to be replaced
thermatk Jun 26, 2021
eada749
[TF][JNI][UPDATE] libwebp 1.2.0
thermatk Nov 7, 2020
af18b94
[TF][JNI][UPDATE] FFmpeg 4.3.2 from source
thermatk Mar 22, 2021
3123fc6
[TF][JNI][FIX] Update usage of FFmpeg to fix infinite loop (#436)
kdrag0n Aug 16, 2020
6939d25
[TF][JNI][FIX] ffmpeg header included and patched
thermatk Oct 12, 2020
9b46985
[TF][JNI][FIX] ffmpeg, additional headers
thermatk Jun 26, 2021
67217e3
[TF][JNI][FIX] ffmpeg include path
thermatk Aug 4, 2021
ae88059
[TF][JNI][UPDATE] BoringSSL from source (master)
thermatk Mar 22, 2021
1d0eab0
[TF] API keys
thermatk Sep 15, 2019
b2b64d6
[TF] TravisCI support
thermatk Jan 4, 2021
f31bf19
[TF] various build adjustments
thermatk Apr 18, 2021
6311fd3
[TF][FEATURE] Support installing APKs
thermatk Feb 9, 2019
688d617
[TF][KILL] Hockey analytics
thermatk Jan 24, 2019
db3d2b7
[TF][KILL] Google Vision
thermatk Jul 26, 2020
7353a34
[TF][KILL] Google Wallet and Android Pay
thermatk Jan 25, 2019
c122246
[TF][KILL] remaining GMS(GCM, Wear, etc), except for Maps
thermatk Jan 25, 2019
d71bdb4
[TF][CENSOR] PWN RKN without Firebase
thermatk Jan 25, 2019
6d39c58
[TF][CENSOR] allow to set a proxy before login
thermatk Jan 3, 2020
64ba63b
[TF][MAPS] force Telegram's static map previews
thermatk Jan 26, 2019
fb884c0
[TF][PUSH] push service adjustments
thermatk Jan 26, 2019
a2b0b7f
[TF][PUSH] notification in foregroung on Oreo+
thermatk Jul 21, 2019
0bf891f
[TF][PUSH] remove one of the confusing toggles
thermatk Mar 9, 2019
1f4f446
[TF][BRAND] Do not send to Google Play for update
thermatk Jan 23, 2019
1de23f7
[TF][BRAND] Send invite link to F-Droid
thermatk May 2, 2020
05a4f60
[TF][BRAND] AppName
thermatk May 2, 2020
c5cc692
[TF][KILL] remove fusedlocationprovider
thermatk Oct 13, 2020
6ed7153
[TF][KILL] GMS SMS Receiver
thermatk Sep 15, 2019
ce0efad
[TF][KILL] Google Voice
thermatk Jan 4, 2020
f4bbde5
[TF][FIX] missing viewpager dependency
thermatk Jan 11, 2020
29c207b
[TF][MAPS] replace Google Maps with OSMDroid: LocationActivity
thermatk Apr 4, 2020
21c25f6
[TF][MAPS] replace Google Maps with OSMDroid: ChatAttachAlertLocation…
thermatk May 2, 2020
0e0ab43
[TF][MAPS] support geo: intents
thermatk Jan 2, 2021
de84ff6
[TF][MAPS] OSMDroid useragent and cache directory configuration
nekohasekai Apr 30, 2020
372a8ef
[TF][PUSH] default is true
thermatk Jan 12, 2020
d2bdd7b
[TF][PUSH] Enable push in migration case
thermatk Jan 25, 2020
d14af02
[TF][FIX] missing interpolator dependency
thermatk Oct 12, 2020
38e8c3e
[TF][BRAND] in settings
thermatk Jul 26, 2020
e7539f2
[TF][FEATURE] no restrictions
thermatk Apr 19, 2021
4c905b5
[TF][FIX] the inverse color QR code scanned without vision
nekohasekai Jun 26, 2021
72bf190
[TF][FEATURE] replace Apple's emojis with twemoji
thermatk Aug 8, 2021
e0ed576
[TF] Readme + Changelog
thermatk Jan 12, 2020
4d172d0
[TF][FIX] kill yasm libraries until we can build them
thermatk Sep 1, 2021
f475cdd
[TF][FIX] android gradle 7.0.2
thermatk Sep 2, 2021
4c66600
[TF][FIX] explicitily filter architectures for cmake
thermatk Sep 4, 2021
ca4a70a
Simplify build instructions
xeruf Aug 3, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
.idea/
.gradle/
.cxx/
build/
obj/
.cxx/
*.iml
local.properties
API_KEYS
*.hprof
TMessagesProj/.externalNativeBuild/
TMessagesProj/jni/ffmpeg/android/
TMessagesProj/jni/ffmpeg/toolchain-android/
TMessagesProj/jni/ffmpeg/build/
TMessagesProj/jni/boringssl/build/
11 changes: 11 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[submodule "TMessagesProj/jni/libwebp"]
path = TMessagesProj/jni/libwebp
url = https://github.com/webmproject/libwebp
[submodule "TMessagesProj/jni/ffmpeg"]
path = TMessagesProj/jni/ffmpeg
url = https://github.com/FFmpeg/FFmpeg
ignore = all
[submodule "TMessagesProj/jni/boringssl"]
path = TMessagesProj/jni/boringssl
url = https://github.com/google/boringssl
ignore = all
40 changes: 40 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
language: android
dist: trusty
jdk:
- openjdk8
android:
components:
- build-tools-28.0.3
- android-28
addons:
apt_packages:
- ninja-build

install:
- set -e
- echo y | sdkmanager "ndk;21.1.6352462"
- echo y | sdkmanager "cmake;3.6.4111459"
- echo y | sdkmanager "cmake;3.10.2.4988404"
before_script:
- export NDK=$ANDROID_HOME/ndk/21.1.6352462
- export NINJA_PATH=/usr/bin/ninja
- export PATH=`echo $ANDROID_HOME/cmake/3.10.2.4988404/bin`:$PATH
- echo -e "APP_ID = ${APP_ID}\nAPP_HASH = ${APP_HASH}" > API_KEYS
script:
# If some stage fails, exit inmediatly
- set -e
# Prebuild
- "cd TMessagesProj/jni"
- "./build_ffmpeg_clang.sh"
- "./patch_ffmpeg.sh"
- "./patch_boringssl.sh"
- "./build_boringssl.sh"
- "cd ../.."
# Build
- "./gradlew assembleX64_SDK23Release"

after_success:
- "./gradlew test"

after_script:
- "rm API_KEYS"
575 changes: 575 additions & 0 deletions Changelog.md

Large diffs are not rendered by default.

Binary file added DigitalResistance.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions Notifications.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Notifications

Since [Android 8.0 Oreo, Google doesn't allow apps to run in the background anymore](https://developer.android.com/about/versions/oreo/background#services), requiring all apps which were previously keeping background connection to exclusively use its Firebase push messaging service.

As one can't use Google's push messaging in a FOSS app, Telegram-FOSS has to show you a notification to keep the background service running. Otherwise, you wouldn't be notified about new messages.

Sadly, if the app would set the notification to lower priority (to hide it a bit in the lower part of the notification screen), you would immediately get a system notification about Telegram "using battery", which is confusing and is the reason for this not being the default. Despite Google's misleading warnings, there is no difference in battery usage between v4.6 in "true background" and v4.9+ with notification.

## Make it better

You may still lower the priority of the notification channel or even hide it altogether manually (make a long tap on the notification). You will then receive the misleading system notification, which [may be disabled as well with another long tap](https://9to5google.com/2017/10/26/how-to-disable-android-oreo-using-battery-notification-android-basics/).
136 changes: 113 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,129 @@
## Telegram messenger for Android
[![Releases](https://img.shields.io/github/release/Telegram-FOSS-Team/Telegram-FOSS.svg)](https://github.com/Telegram-FOSS-Team/Telegram-FOSS/releases/latest)
[![Discussions](https://img.shields.io/badge/Offtopics-Telegram-blue.svg)](https://t.me/tfossofftop)

[![Donate](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/Telegram-FOSS/) or <img src="https://en.bitcoin.it/w/images/en/c/cb/BC_Logotype.png" alt="Bitcoin" height="25px" /> `1McafEgMvqAVujNLtcJumZHxp2UfaNByqs`

# Telegram-FOSS

[Telegram](https://telegram.org) is a messaging app with a focus on speed and security. It’s superfast, simple and free.
This repo contains the official source code for [Telegram App for Android](https://play.google.com/store/apps/details?id=org.telegram.messenger).

## Creating your Telegram Application
This is an unofficial, FOSS-friendly fork of the original [Telegram App for Android](https://github.com/DrKLO/Telegram).

This version of Telegram is available on FDroid:

[<img src="https://f-droid.org/badge/get-it-on.png"
alt="Get it on F-Droid"
height="80">](https://f-droid.org/app/org.telegram.messenger)

## Current Maintainers

- [thermatk](https://github.com/thermatk)
- [Bubu](https://github.com/Bubu)
- you? :)

## Contributors

- [slp](https://github.com/slp)
- [Sudokamikaze](https://github.com/Sudokamikaze)
- [l2dy](https://github.com/l2dy)
- [maximgrafin](https://github.com/maximgrafin)
- [vn971](https://github.com/vn971)
- [theel0ja](https://github.com/theel0ja)
- [AnXh3L0](https://github.com/AnXh3L0)
- [noplanman](https://github.com/noplanman)
- [vk496](https://github.com/vk496)
- [verdulo](https://github.com/verdulo)
- [anupritaisno1](https://github.com/anupritaisno1)
- [nekohasekai](https://github.com/nekohasekai)
- [kdrag0n](https://github.com/kdrag0n)
- [terachad](https://github.com/terachad)
- [ppnplus](https://github.com/ppnplus)

## Discussion

Join the [Telegram-FOSS Offtopics group](https://t.me/tfossofftop)

You can also join `#telegram-foss:matrix.org` via [matrix](https://matrix.to/#/#telegram-foss:matrix.org) or `#telegram-foss` on freenode.

## Changes:

We welcome all developers to use our API and source code to create applications on our platform.
There are several things we require from **all developers** for the moment.
*Replacement of non-FOSS, untrustworthy or suspicious binaries or source code:*
- Do location sharing with OpenStreetMap(osmdroid) instead of Google Maps
- Use Twemoji emoji set instead of Apple's emoji
- Google Play Services GCM replaced with Telegram's push service
- Has to show a notification on Oreo+, ask Google
- **SECURITY:** Old BoringSSL prebuilts are replaced with the newest upstream source code built at compile time
- **SECURITY:** Old FFmpeg prebuilts are replaced with the newest upstream source code built at compile time
- **SECURITY:** Bundled libWebP is updated

1. [**Obtain your own api_id**](https://core.telegram.org/api/obtaining_api_id) for your application.
2. Please **do not** use the name Telegram for your app — or make sure your users understand that it is unofficial.
3. Kindly **do not** use our standard logo (white paper plane in a blue circle) as your app's logo.
3. Please study our [**security guidelines**](https://core.telegram.org/mtproto/security_guidelines) and take good care of your users' data and privacy.
4. Please remember to publish **your** code too in order to comply with the licences.
*Removal of non-FOSS, untrustworthy or suspicious binaries or source code and their functionality:*
- Google Vision face detection and barcode scanning (Passport)
- Google Wallet and Android Pay integration
- Google Voice integration
- HockeyApp crash reporting and self-updates
- Google SMS retrieval. You have to type the code manually

### API, Protocol documentation
*Other:*
- Allow to set a proxy before login
- Added the ability to parse locations from intents containing a `geo:<lat>,<lon>,<zoom>` string
- Force static map previews from Telegram
- No content restrictions

## Versioning

This repository contains tags to make tracking versions easier.

Versions are in form "v$UPSTREAM$RELEASE" where:

* $UPSTREAM is the public, visible version of upstream.
* $RELEASE is a letter ([a-z]) indicating minor releases between official versions (sometimes, upstream is updated without relating the changes to an specific version).

## API, Protocol documentation

Telegram API manuals: https://core.telegram.org/api

MTproto protocol manuals: https://core.telegram.org/mtproto

### Compilation Guide
## Building

**NOTE: Building on Windows is, unfortunately, not supported.
Consider using a Linux VM or dual booting.**
![WindowsSupport](/tgfoss-build-under-win.gif?raw=true)

1. Install the Android NDK, [Go](https://golang.org) and [Ninja](https://ninja-build.org) to build an apk.

2. Don't forget to include the submodules when you clone:
`git clone --recursive https://github.com/Telegram-FOSS-Team/Telegram-FOSS.git`

3. Build native FFmpeg and BoringSSL dependencies:
Go to the `TMessagesProj/jni` folder and execute the following (substituting the respective paths to NDK and Ninja):

```sh
export NDK=[PATH_TO_NDK]
export NINJA_PATH=[PATH_TO_NINJA]
./build_ffmpeg_clang.sh
./patch_ffmpeg.sh
./patch_boringssl.sh
./build_boringssl.sh
```

You can also use the `build.sh` script which uses simple heuristics to find these paths automatically.

**Note**: In order to support [reproducible builds](https://core.telegram.org/reproducible-builds), this repo contains dummy release.keystore, google-services.json and filled variables inside BuildVars.java. Before publishing your own APKs please make sure to replace all these files with your own.
4. If you want to publish a modified version of Telegram:
- You should get **your own API key** here: https://core.telegram.org/api/obtaining_api_id and create a file called `API_KEYS` in the source root directory.
The contents should look like this:
```
APP_ID = 12345
APP_HASH = aaaaaaaabbbbbbccccccfffffff001122
```
- Do not use the name Telegram and the standard logo (white paper plane in a blue circle) for your app — or make sure your users understand that it is unofficial
- Take good care of your users' data and privacy
- **Please remember to publish your code too in order to comply with the licenses**

You will require Android Studio 3.4, Android NDK rev. 20 and Android SDK 8.1
The project can be built with Android Studio or from the command line with gradle:

1. Download the Telegram source code from https://github.com/DrKLO/Telegram ( git clone https://github.com/DrKLO/Telegram.git )
2. Copy your release.keystore into TMessagesProj/config
3. Fill out RELEASE_KEY_PASSWORD, RELEASE_KEY_ALIAS, RELEASE_STORE_PASSWORD in gradle.properties to access your release.keystore
4. Go to https://console.firebase.google.com/, create two android apps with application IDs org.telegram.messenger and org.telegram.messenger.beta, turn on firebase messaging and download google-services.json, which should be copied to the same folder as TMessagesProj.
5. Open the project in the Studio (note that it should be opened, NOT imported).
6. Fill out values in TMessagesProj/src/main/java/org/telegram/messenger/BuildVars.java – there’s a link for each of the variables showing where and which data to obtain.
7. You are ready to compile Telegram.
`./gradlew assembleAfatRelease`

### Localization
# DIGITAL RESISTANCE

We moved all translations to https://translations.telegram.org/en/android/. Please use it.
![DIGITALRESISTANCE](/DigitalResistance.jpg?raw=true "DIGITALRESISTANCE")
64 changes: 28 additions & 36 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,40 @@ configurations {
}

configurations.all {
exclude group: 'com.google.firebase', module: 'firebase-core'
exclude group: 'androidx.recyclerview', module: 'recyclerview'
}

dependencies {
implementation 'androidx.core:core:1.6.0'
implementation 'androidx.palette:palette:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.interpolator:interpolator:1.0.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.dynamicanimation:dynamicanimation:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.sharetarget:sharetarget:1.1.0"

compileOnly 'org.checkerframework:checker-qual:2.5.2'
compileOnly 'org.checkerframework:checker-compat-qual:2.5.0'
implementation 'com.google.firebase:firebase-messaging:22.0.0'
implementation 'com.google.firebase:firebase-config:21.0.1'
implementation 'com.google.firebase:firebase-datatransport:18.0.1'
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.1'
implementation 'com.google.android.gms:play-services-auth:19.2.0'
implementation 'com.google.android.gms:play-services-vision:16.2.0'
implementation 'com.google.android.gms:play-services-wearable:17.1.0'
implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.android.gms:play-services-wallet:18.1.3'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation files('libs/libgsaverification-client.aar')
implementation 'org.osmdroid:osmdroid-android:6.1.10'

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}

//return an api key from a properties file.
def getAppId(){
Properties properties = new Properties()
properties.load(new FileInputStream("./API_KEYS"))
return properties.get("APP_ID")
}
def getAppHash(){
Properties properties = new Properties()
properties.load(new FileInputStream("./API_KEYS"))
return "\"" + properties.get("APP_HASH") + "\""
}

android {
compileSdkVersion 31
buildToolsVersion '31.0.0'
Expand All @@ -64,6 +67,8 @@ android {

dexOptions {
jumboMode = true
// Telegram-FOSS
javaMaxHeapSize "2g"
}

compileOptions {
Expand All @@ -73,27 +78,10 @@ android {
coreLibraryDesugaringEnabled true
}

signingConfigs {
debug {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}

release {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}

buildTypes {
debug {
debuggable true
jniDebuggable true
signingConfig signingConfigs.debug
applicationIdSuffix ".beta"
minifyEnabled false
shrinkResources false
Expand Down Expand Up @@ -134,7 +122,6 @@ android {
HA {
debuggable false
jniDebuggable false
signingConfig signingConfigs.debug
applicationIdSuffix ".beta"
minifyEnabled true
multiDexEnabled true
Expand All @@ -145,7 +132,6 @@ android {
standalone {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
applicationIdSuffix ".web"
minifyEnabled true
multiDexEnabled true
Expand All @@ -156,7 +142,6 @@ android {
release {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources false
multiDexEnabled true
Expand Down Expand Up @@ -282,7 +267,7 @@ android {
}
afat {
ndk {
abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
abiFilters "armeabi-v7a", "arm64-v8a"
}
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest_SDK23.xml'
Expand All @@ -303,7 +288,6 @@ android {

applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "app.apk"
output.versionCodeOverride = defaultConfig.versionCode * 10 + variant.productFlavors.get(0).abiVersionCode
}
}
Expand All @@ -321,14 +305,22 @@ android {
versionName "8.0.0"

vectorDrawables.generatedDensities = ['mdpi', 'hdpi', 'xhdpi', 'xxhdpi']
//obtain your own keys at https://core.telegram.org/api/obtaining_api_id
buildConfigField 'int', 'APP_ID', getAppId()
buildConfigField 'String', 'APP_HASH', getAppHash()

externalNativeBuild {
cmake {
version '3.10.2'
arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-16', "-j=16"
if (project.hasProperty("armeabi-v7a")) {
abiFilters 'armeabi-v7a'
} else if (project.hasProperty("arm64-v8a")) {
abiFilters 'arm64-v8a'
} else {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
}
}
}

apply plugin: 'com.google.gms.google-services'
Loading