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

Accessibility inprovements #1809

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 40 additions & 18 deletions TMessagesProj/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

apply plugin: 'com.android.library'

repositories {
mavenCentral()
google()
import org.gradle.internal.os.OperatingSystem
import java.nio.file.Paths
plugins {
id 'com.android.library'
id 'com.google.gms.google-services'
}

configurations {
compile.exclude module: 'support-v4'
compile.exclude module: 'support-v4'
}

configurations.all {
Expand All @@ -29,16 +28,17 @@ dependencies {

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.1.0'
implementation 'com.google.firebase:firebase-messaging:23.2.0'
implementation 'com.google.firebase:firebase-config:21.4.1'
implementation 'com.google.firebase:firebase-datatransport:18.1.8'
implementation 'com.google.firebase:firebase-appindexing:20.0.0'
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation 'com.google.android.gms:play-services-auth:20.4.0'
implementation 'com.google.android.gms:play-services-auth:20.6.0'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
implementation 'com.google.android.gms:play-services-wearable:18.0.0'
implementation 'com.google.android.gms:play-services-location:21.0.1'
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
implementation 'com.google.android.gms:play-services-wallet:19.2.0'
implementation 'com.google.android.gms:play-services-safetynet:18.0.1'
implementation 'com.googlecode.mp4parser:isoparser:1.0.6'
implementation 'com.stripe:stripe-android:2.0.2'
implementation 'com.google.mlkit:language-id:16.1.1'
Expand All @@ -64,15 +64,21 @@ dependencies {

def isWindows = String.valueOf(DefaultNativePlatform.currentOperatingSystem.toFamilyName() == OperatingSystemFamily.WINDOWS)
android {
<<<<<<< HEAD
compileSdkVersion 34
buildToolsVersion '34.0.0'
=======
namespace 'org.telegram.messenger'
compileSdkVersion 33
buildToolsVersion '33.0.0'
>>>>>>> b27b9ff56 (updated gradle)
ndkVersion "21.4.7075529"

sourceSets.main.jniLibs.srcDirs = ['./jni/']

externalNativeBuild {
cmake {
path 'jni/CMakeLists.txt'
path 'jni/CMakeLists.txt'
}
}

Expand All @@ -87,14 +93,15 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17

coreLibraryDesugaringEnabled true
}


defaultConfig {
defaultConfig.versionCode Integer.parseInt(APP_VERSION_CODE)
minSdkVersion 19
targetSdkVersion 34

Expand All @@ -106,10 +113,20 @@ android {
cmake {
version '3.10.2'
arguments '-DANDROID_STL=c++_static', '-DANDROID_PLATFORM=android-16'
<<<<<<< HEAD
=======
System.getenv("PATH").split(File.pathSeparator).any { path ->
var file = Paths.get("${path}${File.separator}ccache${if (OperatingSystem.current().windows) ".exe" else ""}").toFile()
if (file.exists()) {
println("Using ccache ${file.getAbsolutePath()}")
arguments += "-DANDROID_CCACHE=${file.getAbsolutePath()}"
return true
}
}
>>>>>>> b27b9ff56 (updated gradle)
}
}
}

buildTypes {
debug {
jniDebuggable true
Expand Down Expand Up @@ -179,7 +196,7 @@ android {

release {
jniDebuggable false
minifyEnabled true
minifyEnabled false
shrinkResources false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
Expand All @@ -189,6 +206,7 @@ android {
buildConfigField "boolean", "DEBUG_VERSION", "false"
buildConfigField "boolean", "DEBUG_PRIVATE_VERSION", "false"
buildConfigField "boolean", "BUILD_HOST_IS_WINDOWS", isWindows
signingConfig signingConfigs.debug
}
}
namespace 'org.telegram.messenger'
Expand All @@ -204,6 +222,7 @@ def getProps(String propName) {
} else {
return "";
}
<<<<<<< HEAD
}
apply plugin: 'com.google.gms.google-services'

Expand All @@ -227,4 +246,7 @@ task checkVisibility {
}
}

preBuild.dependsOn checkVisibility
preBuild.dependsOn checkVisibility
=======
}
>>>>>>> b27b9ff56 (updated gradle)
Original file line number Diff line number Diff line change
Expand Up @@ -22926,7 +22926,9 @@ public SeekBar getSeekBar() {
public SeekBarWaveform getSeekBarWaveform() {
return seekBarWaveform;
}

private boolean canAddOrUseProfileNode() {
return isChat && !currentMessageObject.isOut() &&(currentUser !=null ||currentChat!=null &&currentMessageObject.isFromGroup());
}
private class MessageAccessibilityNodeProvider extends AccessibilityNodeProvider {

public static final int PROFILE = 5000;
Expand All @@ -22950,17 +22952,18 @@ private class MessageAccessibilityNodeProvider extends AccessibilityNodeProvider
private Rect rect = new Rect();

private class ProfileSpan extends ClickableSpan {
private TLRPC.User user;

public ProfileSpan(TLRPC.User user) {
this.user = user;
}

private Object profile;
public ProfileSpan(Object profile) {
this.profile = profile;
}
@Override
public void onClick(@NonNull View view) {
if (delegate != null) {
delegate.didPressUserAvatar(ChatMessageCell.this, user, 0, 0, false);
if (delegate != null) {
if(profile instanceof TLRPC.User) {
if(((TLRPC.User) profile).id !=0) delegate.didPressUserAvatar(ChatMessageCell.this, (TLRPC.User) profile, 0, 0,false); else delegate.didPressHiddenForward(ChatMessageCell.this);
}
else delegate.didPressChannelAvatar(ChatMessageCell.this,(TLRPC.Chat) profile,0,0,0,false);
}
}
}

Expand All @@ -22976,11 +22979,19 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
final long fileSize = currentMessageObject != null ? currentMessageObject.loadedFileSize : 0;
if (accessibilityText == null || accessibilityTextUnread != unread || accessibilityTextContentUnread != contentUnread || accessibilityTextFileSize != fileSize) {
SpannableStringBuilder sb = new SpannableStringBuilder();
if (isChat && currentUser != null && !currentMessageObject.isOut()) {
sb.append(UserObject.getUserName(currentUser));
sb.setSpan(new ProfileSpan(currentUser), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
if (isChat && !currentMessageObject.isOut()) {
if(currentUser !=null) {
sb.append(UserObject.getUserName(currentUser));
sb.setSpan(new ProfileSpan(currentUser), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
else if(currentChat !=null &&currentMessageObject.isFromGroup()) {
sb.append(currentChat.title);
sb.setSpan(new ProfileSpan(currentChat), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
sb.append('\n');
}
//add information,if something write from channel,but not from user name (it can do,for example,channel creators).
else if(currentUser ==null && currentMessageObject.customName !=null &&currentMessageObject.customName.length()>0) sb.append(currentMessageObject.customName+"\n");
if (drawForwardedName) {
for (int a = 0; a < 2; a++) {
if (forwardedNameLayout[a] != null && forwardedNameLayout[a].getText() != null) {
Expand Down Expand Up @@ -23054,14 +23065,14 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
sb.append(AndroidUtilities.formatFileSize(documentAttach.size));
}
}
//even if we switch on voice transcription,we should announce caption too.
if (currentMessageObject.messageOwner.media != null && !TextUtils.isEmpty(currentMessageObject.caption)) {
sb.append("\n");
sb.append(currentMessageObject.caption);
}
if (currentMessageObject.isVoiceTranscriptionOpen()) {
sb.append("\n");
sb.append(currentMessageObject.getVoiceTranscription());
} else {
if (MessageObject.getMedia(currentMessageObject.messageOwner) != null && !TextUtils.isEmpty(currentMessageObject.caption)) {
sb.append("\n");
sb.append(currentMessageObject.caption);
}
}
if (currentMessageObject.isOut()) {
if (currentMessageObject.isSent()) {
Expand All @@ -23084,10 +23095,14 @@ public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) {
sb.append("\n");
sb.append(getString("AccDescrMsgSendingError", R.string.AccDescrMsgSendingError));
}
} else {
} else if(currentTimeString.length()>0) {
sb.append("\n");
sb.append(LocaleController.formatString("AccDescrReceivedDate", R.string.AccDescrReceivedDate, getString("TodayAt", R.string.TodayAt) + " " + currentTimeString));
}
if(currentMessageObject.isSponsored()) {
sb.append("\n");
sb.append(LocaleController.getString("SponsoredMessage",R.string.SponsoredMessage));
}
if (getRepliesCount() > 0 && !hasCommentLayout()) {
sb.append("\n");
sb.append(LocaleController.formatPluralString("AccDescrNumberOfReplies", getRepliesCount()));
Expand Down Expand Up @@ -23225,7 +23240,7 @@ public void onClick(View view) {

int i;
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
if (isChat && currentUser != null && !currentMessageObject.isOut()) {
if (canAddOrUseProfileNode()) {
info.addChild(ChatMessageCell.this, PROFILE);
}
if (currentMessageObject.messageText instanceof Spannable) {
Expand Down Expand Up @@ -23305,10 +23320,10 @@ public void onClick(View view) {
info.setParent(ChatMessageCell.this);
info.setPackageName(getContext().getPackageName());
if (virtualViewId == PROFILE) {
if (currentUser == null) {
if (!canAddOrUseProfileNode()) {
return null;
}
String content = UserObject.getUserName(currentUser);
String content = currentUser != null ? UserObject.getUserName(currentUser) : currentChat.title;
info.setText(content);
rect.set((int) nameX, (int) nameY, (int) (nameX + nameWidth), (int) (nameY + (nameLayout != null ? nameLayout.getHeight() : 10)));
info.setBoundsInParent(rect);
Expand Down Expand Up @@ -23428,11 +23443,11 @@ public void onClick(View view) {
}
PollButton button = pollButtons.get(buttonIndex);
StringBuilder sb = new StringBuilder(button.title.getText());
if (!pollVoted) {
if(pollVoted ||pollClosed) sb.append(", ").append(button.percent).append("%");
if (!pollVoted &&!pollClosed) {
info.setClassName("android.widget.Button");
} else {
} else if (pollVoted) {
info.setSelected(button.chosen);
sb.append(", ").append(button.percent).append("%");
if (lastPoll != null && lastPoll.quiz && (button.chosen || button.correct)) {
sb.append(", ").append(button.correct ? getString("AccDescrQuizCorrectAnswer", R.string.AccDescrQuizCorrectAnswer) : getString("AccDescrQuizIncorrectAnswer", R.string.AccDescrQuizIncorrectAnswer));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6426,6 +6426,7 @@ protected void onDestroy() {
} catch (Exception e) {
FileLog.e(e);
}
clearFragments();
super.onDestroy();
onFinish();
FloatingDebugController.onDestroy();
Expand Down
14 changes: 5 additions & 9 deletions TMessagesProj_App/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
apply plugin: 'com.android.application'

repositories {
mavenCentral()
google()
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

configurations {
compile.exclude module: 'support-v4'
}
Expand All @@ -22,6 +19,7 @@ dependencies {
}

android {
namespace 'org.telegram.messenger.regular'
compileSdkVersion 34
buildToolsVersion '34.0.0'

Expand Down Expand Up @@ -91,7 +89,7 @@ android {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
minifyEnabled true
minifyEnabled false
shrinkResources false
multiDexEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), '../TMessagesProj/proguard-rules.pro'
Expand Down Expand Up @@ -199,5 +197,3 @@ android {
checkReleaseBuilds false
}
}

apply plugin: 'com.google.gms.google-services'
11 changes: 4 additions & 7 deletions TMessagesProj_AppHockeyApp/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
apply plugin: 'com.android.application'

repositories {
mavenCentral()
google()
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

configurations {
Expand All @@ -28,6 +26,7 @@ dependencies {
}

android {
namespace 'org.telegram.messenger.regular'
compileSdkVersion 34
buildToolsVersion '34.0.0'

Expand Down Expand Up @@ -184,5 +183,3 @@ android {
checkReleaseBuilds false
}
}

apply plugin: 'com.google.gms.google-services'
15 changes: 6 additions & 9 deletions TMessagesProj_AppHuawei/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
apply plugin: 'com.android.application'
apply plugin: 'com.huawei.agconnect'

repositories {
mavenCentral()
google()
maven { url 'https://developer.huawei.com/repo/' }
plugins {
id 'com.android.application'
//id 'com.huawei.agconnect'
id 'com.google.gms.google-services'
}

configurations {
Expand All @@ -30,8 +27,10 @@ dependencies {
}

android {
namespace 'org.telegram.messenger.huawei'
compileSdkVersion 34
buildToolsVersion '34.0.0'
>>>>>>> b27b9ff56 (updated gradle)

defaultConfig.applicationId = APP_PACKAGE

Expand Down Expand Up @@ -163,5 +162,3 @@ android {
checkReleaseBuilds false
}
}

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