Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No ads #551

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3f93a70
[TF] modify .gitignore
thermatk Nov 7, 2020
e204ed6
[TF][JNI] remove native deps to be replaced
thermatk Jun 26, 2021
a45a669
[TF][JNI][UPDATE] libwebp 1.2.0
thermatk Nov 7, 2020
fa0b6ae
[TF][JNI][UPDATE] FFmpeg 4.3.2 from source
thermatk Mar 22, 2021
9e2cc4d
[TF][JNI][FIX] Update usage of FFmpeg to fix infinite loop (#436)
kdrag0n Aug 16, 2020
f83864b
[TF][JNI][FIX] ffmpeg header included and patched
thermatk Oct 12, 2020
266283c
[TF][JNI][FIX] ffmpeg, additional headers
thermatk Jun 26, 2021
9f35c5f
[TF][JNI][FIX] ffmpeg include path
thermatk Aug 4, 2021
8473fd0
[TF][JNI][UPDATE] BoringSSL from source (master)
thermatk Mar 22, 2021
c09e071
[TF] API keys
thermatk Sep 15, 2019
c9bf4af
[TF] TravisCI support
thermatk Jan 4, 2021
e17f202
[TF] various build adjustments
thermatk Apr 18, 2021
cb2f9a8
[TF][FEATURE] Support installing APKs
thermatk Feb 9, 2019
46172fe
[TF][KILL] Hockey analytics
thermatk Jan 24, 2019
7520910
[TF][KILL] Google Vision
thermatk Jul 26, 2020
d6773d4
[TF][KILL] Google Wallet and Android Pay
thermatk Jan 25, 2019
d149294
[TF][KILL] remaining GMS(GCM, Wear, etc), except for Maps
thermatk Jan 25, 2019
3654270
[TF][CENSOR] PWN RKN without Firebase
thermatk Jan 25, 2019
ea432e8
[TF][CENSOR] allow to set a proxy before login
thermatk Jan 3, 2020
d72403b
[TF][MAPS] force Telegram's static map previews
thermatk Jan 26, 2019
ec00600
[TF][PUSH] push service adjustments
thermatk Jan 26, 2019
46cee97
[TF][PUSH] notification in foregroung on Oreo+
thermatk Jul 21, 2019
c527db1
[TF][PUSH] remove one of the confusing toggles
thermatk Mar 9, 2019
6891ba7
[TF][BRAND] Do not send to Google Play for update
thermatk Jan 23, 2019
882b0d5
[TF][BRAND] Send invite link to F-Droid
thermatk May 2, 2020
af472cb
[TF][BRAND] AppName
thermatk May 2, 2020
9f4fc75
[TF][KILL] remove fusedlocationprovider
thermatk Oct 13, 2020
38787ec
[TF][KILL] GMS SMS Receiver
thermatk Sep 15, 2019
6bd2198
[TF][KILL] Google Voice
thermatk Jan 4, 2020
f8c0c49
[TF][FIX] missing viewpager dependency
thermatk Jan 11, 2020
1700d88
[TF][MAPS] replace Google Maps with OSMDroid: LocationActivity
thermatk Apr 4, 2020
d623c07
[TF][MAPS] replace Google Maps with OSMDroid: ChatAttachAlertLocation…
thermatk May 2, 2020
b51dafa
[TF][MAPS] support geo: intents
thermatk Jan 2, 2021
f57164e
[TF][MAPS] OSMDroid useragent and cache directory configuration
nekohasekai Apr 30, 2020
dfed6fa
[TF][PUSH] default is true
thermatk Jan 12, 2020
d8fdce4
[TF][PUSH] Enable push in migration case
thermatk Jan 25, 2020
fd37d67
[TF][FIX] missing interpolator dependency
thermatk Oct 12, 2020
e990f4f
[TF][BRAND] in settings
thermatk Jul 26, 2020
7e13328
[TF][FEATURE] no restrictions
thermatk Apr 19, 2021
b571a79
[TF][FIX] the inverse color QR code scanned without vision
nekohasekai Jun 26, 2021
02c1adb
[TF][FEATURE] replace Apple's emojis with twemoji
thermatk Aug 8, 2021
3f4a7a3
[TF][FIX] kill yasm libraries until we can build them
thermatk Sep 1, 2021
5702713
[TF][FIX] android gradle 7.0.2
thermatk Sep 2, 2021
233b59f
[TF][FIX] explicitily filter architectures for cmake
thermatk Sep 4, 2021
ed3facd
[TF] Readme + Changelog
thermatk Jan 12, 2020
740b304
Removed duplicated define for BoringSSL. (#550)
23rd Nov 8, 2021
30b60f0
Fix audio in Video stream (#547)
luvletter2333 Nov 8, 2021
1f23d6b
New local setting for control of displaying the "sponsored" ads in ch…
terachad Nov 8, 2021
0b4e40b
Logic fix
terachad Nov 9, 2021
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.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.idea/
.gradle/
.cxx/
build/
obj/
*.iml
local.properties
API_KEYS
*.hprof
TMessagesProj/.externalNativeBuild/
TMessagesProj/jni/ffmpeg/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"
583 changes: 583 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)

**Important:**

1. You need the Android NDK, Go(Golang) and [Ninja](https://ninja-build.org/) to build the 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 (define the paths to your NDK and Ninja):

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

**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.1.2"

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