8000 Revert "Updated to 1.3.5" by gohj99 · Pull Request #42 · gohj99/Telewatch · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Revert "Updated to 1.3.5" #42

Merged
merged 1 commit into from
Mar 9, 2025
Merged
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
8 changes: 4 additions & 4 deletions .idea/appInsightsSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.jetbrains.kotlin.android)
alias(libs.plugins.compose.compiler)
id("com.google.gms.google-services")
}

android {
Expand All @@ -22,8 +21,8 @@ android {
minSdk = 26
//noinspection OldTargetApi
targetSdk = 34
versionCode = 26
versionName = "1.3.5"
versionCode = 25
versionName = "1.3.4"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -121,9 +120,6 @@ dependencies {
implementation(project(":libtd"))
implementation(libs.lottie)
implementation(libs.lottie.compose)
// Import the Firebase BoM
implementation(platform(libs.firebase.bom))
implementation(libs.firebase.messaging)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
Expand Down
8 changes: 0 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,6 @@
android:resource="@xml/file_paths" />
</provider>

<service
android:name=".TdFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>

</application>

<queries>
Expand Down
9 changes: 1 addition & 8 deletions app/src/main/java/com/gohj99/telewatch/AddProxyActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
package com.gohj99.telewatch

import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
Expand Down Expand Up @@ -101,10 +98,6 @@ class AddProxyActivity : ComponentActivity() {
SplashAddProxyScreen(
add = { server, port, type ->
tgApi?.addProxy(server, port, type)
Handler(Looper.getMainLooper()).post {
Toast.makeText(this, getString(R.string.Successful), Toast.LENGTH_SHORT).show()
}
finish()
},
parseServer = parseServer,
parsePort = parsePort,
Expand Down Expand Up @@ -147,7 +140,7 @@ fun SplashAddProxyScreen(add: (String, Int, TdApi.ProxyType) -> Unit, parseServe
verticalAlignment = Alignment.CenterVertically // 垂直方向居中对齐
) {
Text(
text = stringResource(id = R.string.Add_Proxy),
text = stringResource(id = R.string.Proxy),
color = Color.White,
fontWeight = FontWeight.Bold,
fontSize = 18.sp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Copyright (c) 2024 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
Expand Down Expand Up @@ -179,6 +179,6 @@ fun SplashAllowDataCollectionScreen(set: (Boolean) -> Unit) {
@Composable
fun SplashAllowDataCollectionScreenPreview() {
TelewatchTheme {
SplashAllowDataCollectionScreen { }
SplashAllowDataCollectionScreen { /*TODO*/ }
}
}
12 changes: 6 additions & 6 deletions app/src/main/java/com/gohj99/telewatch/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ class ChatActivity : ComponentActivity() {

override fun onDestroy() {
super.onDestroy()
TgApiManager.tgApi?.exitChatPage()
runBlocking {
lifecycleScope.launch {
TgApiManager.tgApi?.exitChatPage()
}.join() // 等待协程执行完毕
}
}

override fun onResume() {
Expand Down Expand Up @@ -142,11 +146,7 @@ class ChatActivity : ComponentActivity() {

// 异步获取当前用户 ID 和聊天记录
lifecycleScope.launch {
while (currentUserId.value == -1L) {
tgApi!!.getCurrentUser() ?.let {
currentUserId.value = it[0].toLong()
}
}
currentUserId.value = tgApi!!.getCurrentUser()[0].toLong()
tgApi!!.fetchMessages(0, chat!!.id)
}

Expand Down
98 changes: 34 additions & 64 deletions app/src/main/java/com/gohj99/telewatch/ChatInfoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import com.gohj99.telewatch.ui.SplashChatInfoScreen
import com.gohj99.telewatch.ui.main.ErrorScreen
import com.gohj99.telewatch.ui.main.SplashLoadingScreen
import com.gohj99.telewatch.ui.theme.TelewatchTheme
import com.gohj99.telewatch.utils.formatTimestampToDate
import com.gohj99.telewatch.utils.telegram.TgApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -93,41 +92,26 @@ class ChatInfoActivity : ComponentActivity() {
val userInfo = runBlocking {
tgApi!!.getUser(chatType.userId)
}
val userFullInfo = runBlocking {
tgApi!!.getUserFullInfo(chatType.userId)
}
if (userInfo != null) {
if (userInfo.type is TdApi.UserTypeBot) {
subtitle = getString(R.string.Bot)
} else {
when(val status = userInfo.status) {
is TdApi.UserStatusOnline ->
subtitle = getString(R.string.Online)
is TdApi.UserStatusEmpty ->
subtitle = getString(R.string.Unknown)
is TdApi.UserStatusRecently ->
subtitle = getString(R.string.Lately)
is TdApi.UserStatusLastWeek ->
subtitle = getString(R.string.Last_week)
is TdApi.UserStatusLastMonth ->
subtitle = getString(R.string.Last_month)
is TdApi.UserStatusOffline ->
if (status.wasOnline > 0) {
10000 subtitle = "${getString(R.string.last_seen)} ${formatTimestampToDate(status.wasOnline)}"
} else {
subtitle = getString(R.string.Offline)
}
}
if (userInfo.phoneNumber != "") {
info += "\n**${getString(R.string.phoneNumber)}**\n+${userInfo.phoneNumber}"
}
if (userInfo.usernames != null) {
info += "\n**${getString(R.string.username)}**\n@${userInfo.usernames!!.activeUsernames[0]}"
}
val bio = userFullInfo?.bio?.text?: ""
if (bio.isNotEmpty() == true) {
info += "\n**${getString(R.string.Bio)}**\n${bio}"
}
when(userInfo.status) {
is TdApi.UserStatusOnline ->
subtitle = getString(R.string.Online)
is TdApi.UserStatusEmpty ->
subtitle = getString(R.string.Unknown)
is TdApi.UserStatusRecently ->
subtitle = getString(R.string.Lately)
is TdApi.UserStatusLastWeek ->
subtitle = getString(R.string.Last_week)
is TdApi.UserStatusLastMonth ->
subtitle = getString(R.string.Last_month)
is TdApi.UserStatusOffline ->
subtitle = getString(R.string.Offline)
}
if (userInfo.phoneNumber != "") {
info += "\n**${getString(R.string.phoneNumber)}**\n+${userInfo.phoneNumber}"
}
if (userInfo.usernames != null) {
info += "\n**${getString(R.string.username)}**\n@${userInfo.usernames!!.activeUsernames[0]}"
}
}
}
Expand Down Expand Up @@ -161,7 +145,7 @@ class ChatInfoActivity : ComponentActivity() {

// 超级群组
is TdApi.ChatTypeSupergroup -> {
//println("超级群组")
println("超级群组")
subtitle = getString(R.string.Supergroup_Chat)
val supergroupInfo = runBlocking {
tgApi!!.getSupergroup(chatType.supergroupId)
Expand Down Expand Up @@ -199,37 +183,23 @@ class ChatInfoActivity : ComponentActivity() {
}

}
if (chatType is TdApi.ChatTypePrivate) {
runOnUiThread {
setContent {
TelewatchTheme {
SplashChatInfoScreen(
chatObject = chatObject!!,
subtitle = subtitle,
info = info,
deleteChat = {
lifecycleScope.launch(Dispatchers.IO) {
tgApi!!.deleteChat(safeChat.id)
finish()
}
runOnUiThread {
setContent {
TelewatchTheme {
SplashChatInfoScreen(
chatObject = chatObject!!,
subtitle = subtitle,
info = info,
deleteChat = {
lifecycleScope.launch(Dispatchers.IO) {
tgApi!!.deleteChat(safeChat.id)
finish()
}
)
}
}
}
} else {
runOnUiThread {
setContent {
TelewatchTheme {
SplashChatInfoScreen(
chatObject = chatObject!!,
subtitle = subtitle,
info = info
)
}
}
)
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Copyright (c) 2024 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
Expand Down Expand Up @@ -208,6 +208,6 @@ fun SplashConfirmLogoutActivityScreen(set: (Boolean) -> Unit) {
@Composable
fun SplashConfirmLogoutActivityScreenPreview() {
TelewatchTheme {
SplashConfirmLogoutActivityScreen { }
SplashConfirmLogoutActivityScreen { /*TODO*/ }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Copyright (c) 2024 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
Expand Down Expand Up @@ -157,6 +157,6 @@ fun SplashAnnouncementActivityScreen(set: (Boolean) -> Unit) {
@Composable
fun SplashGoToAnnouncementActivityPreview() {
TelewatchTheme {
SplashAnnouncementActivityScreen { }
SplashAnnouncementActivityScreen { /*TODO*/ }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,6 @@ fun SplashGoToCheckUpdateScreen(set: (Boolean) -> Unit) {
@Composable
fun SplashGoToCheckUpdateScreenPreview() {
TelewatchTheme {
SplashAllowDataCollectionScreen { }
SplashAllowDataCollectionScreen { /*TODO*/ }
}
}
20 changes: 7 additions & 13 deletions app/src/main/java/com/gohj99/telewatch/ImgViewActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
Expand All @@ -49,8 +48,6 @@ import androidx.media3.common.Player
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.ui.PlayerView
import coil.compose.rememberAsyncImagePainter
import coil.request.ImageRequest
import coil.size.Size
import com.airbnb.lottie.compose.LottieAnimation
import com.airbnb.lottie.compose.LottieCompositionSpec
import com.airbnb.lottie.compose.LottieConstants
Expand Down Expand Up @@ -363,18 +360,13 @@ fun saveImageToExternalStorage(context: Context, photoPath: String): String {
private fun SplashImgView(photoPath: String, saveImage: () -> Unit) {
Box(
modifier = Modifier
.padding(20.dp)
.padding(16.dp)
.fillMaxSize()
.aspectRatio(1f),
.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
Image(
painter = rememberAsyncImagePainter(
model = ImageRequest.Builder(LocalContext.current)
.data(photoPath)
.size(Size.ORIGINAL) // 确保使用原始尺寸
.build()
),
painter = rememberAsyncImagePainter(model = photoPath),
contentDescription = null,
modifier = Modifier
.zoomable(
Expand All @@ -392,7 +384,8 @@ private fun SplashTgsView(photoPath: String) {
Box(
modifier = Modifier
.padding(16.dp)
.fillMaxSize(),
.fillMaxSize()
.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
// Load the Lottie composition from the file path
Expand All @@ -417,7 +410,8 @@ private fun SplashMp4View(photoPath: String) {
Box(
modifier = Modifier
.padding(16.dp)
.fillMaxSize(),
.fillMaxSize()
.fillMaxWidth(),
contentAlignment = Alignment.Center
) {
LoopingVideoPlayer(Uri.parse(photoPath))
Expand Down
17 changes: 6 additions & 11 deletions app/src/main/java/com/gohj99/telewatch/LoginActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024-2025 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Copyright (c) 2024 gohj99. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
* Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
* Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
* Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
Expand Down Expand Up @@ -273,28 +273,23 @@ class LoginActivity : ComponentActivity() {
}
// 处理其他授权状态...
TdApi.AuthorizationStateClosed.CONSTRUCTOR -> {
// TDLib 已关闭
println("TDLib 已关闭")
TODO()
}

TdApi.AuthorizationStateClosing.CONSTRUCTOR -> {
// TDLib 正在关闭
println("TDLib 正在关闭")
TODO()
}

TdApi.AuthorizationStateLoggingOut.CONSTRUCTOR -> {
// 正在退出登录
println("正在退出登录")
TODO()
}

TdApi.AuthorizationStateWaitCode.CONSTRUCTOR -> {
// 请求验证码
println("请求验证码")
TODO()
}

TdApi.AuthorizationStateWaitRegistration.CONSTRUCTOR -> {
// 请求注册
println("请求注册")
TODO()
}
}
}
Expand Down
Loading
Loading
0