-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Add Unified Push support #715
base: master10-2-6
Are you sure you want to change the base?
Conversation
This reverts commit 53a4963.
This reverts the NotificationsSettingsActivity.java part of commit 53a4963.
1b67551
to
b8eac92
Compare
@drizzt Greetings |
TMessagesProj/src/main/java/org/telegram/messenger/UnifiedPushReceiver.java
Show resolved
Hide resolved
This simple implementation only triggers the networks to resume when an event is received, so Telegram can get the events by itself. This is not like the other push providers where the change information is processed by PushListenerController directly, but it still saves battery since the process disconnects from Telegram servers as soon as the updates are processed.
Due to android limitations the battery optimization should be turn off, but you don't have battery usage if you turn off keep alive and background tasks. |
TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java
Show resolved
Hide resolved
TMessagesProj/src/main/java/org/telegram/messenger/PushListenerController.java
Show resolved
Hide resolved
TMessagesProj/src/main/java/org/telegram/messenger/UnifiedPushReceiver.java
Show resolved
Hide resolved
if you agree with my objections I'll change the 3 remaining stuff and thank you for the review |
looks awesome. Sorry for not writing sooner or reviewing, I'm caught in a personal situation. I have switched base to non-master so that it is still clean and I can release update on master asap, while this can be tackled in a slow manner :) |
<action android:name="org.unifiedpush.android.connector.REGISTRATION_FAILED"/> | ||
</intent-filter> | ||
</receiver> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You only need to add this to TMessagesProj/src/main/AndroidManifest.xml
, all these manifest changes are not needed.
As suggested by @p1gp1g
Since android-connector is built with Java 17 some other build system modifications were needed. This also means ./gradlew must be called using Java 17+.
android-connector:2.3.0 uses jvmToolchain, it should work with java 1.8. You may have to add this to your build.gradle
|
I tried to do that, but it still needs a newer java:
|
Indeed, it seems you need gradle 8+ EDIT: with android-connector:2.4.0, you shouldn't have to upgrade gradle either. diff --git a/TMessagesProj/build.gradle b/TMessagesProj/build.gradle
index 5f733bef..edff97a0 100644
--- a/TMessagesProj/build.gradle
+++ b/TMessagesProj/build.gradle
@@ -39,7 +39,7 @@ dependencies {
implementation 'com.google.code.gson:gson:2.10'
implementation 'com.google.guava:guava:31.1-android'
- implementation 'com.github.UnifiedPush:android-connector:2.2.0'
+ implementation 'com.github.UnifiedPush:android-connector:2.3.1'
implementation 'org.osmdroid:osmdroid-android:6.1.14'
@@ -84,8 +84,8 @@ android {
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_17
- targetCompatibility JavaVersion.VERSION_17
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
@@ -193,6 +193,8 @@ android {
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
}
}
+
+ namespace = "org.telegram.messenger"
}
diff --git a/TMessagesProj_App/build.gradle b/TMessagesProj_App/build.gradle
index 7c2b7305..7d762e9e 100644
--- a/TMessagesProj_App/build.gradle
+++ b/TMessagesProj_App/build.gradle
@@ -44,8 +44,8 @@ android {
}
compileOptions {
- sourceCompatibility JavaVersion.VERSION_17
- targetCompatibility JavaVersion.VERSION_17
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
coreLibraryDesugaringEnabled true
}
@@ -181,4 +181,6 @@ android {
lintOptions {
checkReleaseBuilds false
}
+
+ namespace = "org.telegram.messenger.regular"
}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f48ee03c..addb3b69 100644
--- a/build.gradle
+++ b/build.gradle
@@ -5,9 +5,7 @@ buildscript {
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.0.3'
- // This is needed since android-connector:2.2.0 is built with Java 17
- classpath 'com.android.tools:r8:8.2.33'
+ classpath 'com.android.tools.build:gradle:8.2.0'
}
}
repositories {
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ffed3a25..b26d0324 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,6 @@
+#Thu Dec 28 14:56:03 CET 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists |
You shouldn't even have to upgrade gradle with connector:2.4.0. |
Hi. I've read the thread above, but it's not clear if this PR is blocked by something else in order to progress. Is that the case? |
Any progress on this PR? |
Can anyone confirm it works? I still find it hard to believe it does.
|
it works, but sometimes notifications are heavily delayed. Using Mercurygram latest and own ntfy server and ntfy client on android
|
interesting! the delay is on the T-server's side?
|
This simple implementation only triggers the networks to resume when an
event is received, so Telegram can get the events by itself.
This is not like the other push providers where the change information
is processed by PushListenerController directly, but it still saves battery
since the process disconnects from Telegram servers as soon as the
updates are processed.
I also reverted "[TF][PUSH] remove one of the confusing toggles", since with UnifiedPush it's worthless to enable the pushService when UnifiedPush is used.
It fixes #577