Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
fix: #350
Browse files Browse the repository at this point in the history
  • Loading branch information
fuqiuluo committed Aug 4, 2024
1 parent cdc9ca1 commit 976526a
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public class TroopInfo {
public byte[] troopInfoExtByte;
public String troopLevelMap;
public String troopRemark;
@Deprecated
public String troopcode;
public short troopface;
public String troopmemo;
Expand All @@ -154,6 +155,7 @@ public class TroopInfo {
public int trooptype;
public String troopuin;
public long udwCmdUinRingtoneID;
@Deprecated
public String uin;
public int wClickBAFTipCount;
public int wInsertBAFTipCount;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.tencent.qqnt.trooplist;

import androidx.lifecycle.LifecycleOwner;

import com.tencent.mobileqq.data.troop.TroopInfo;
import com.tencent.mobileqq.qroute.QRouteApi;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import kotlin.Unit;
import kotlin.jvm.functions.Function1;

public interface ITroopListRepoApi extends QRouteApi {
void fetchTroopLevelInfo(@NotNull String str, boolean z);

void fetchTroopList(boolean z);

//@NotNull
//a<Boolean> getFetchTroopListResultLiveData();

@NotNull
List<TroopInfo> getSortedValidTopTroopInfoFromCache();

@NotNull
List<TroopInfo> getSortedValidTroopInfoFromCache();

@NotNull
List<TroopInfo> getTopTroopListFromCache();

@Nullable
TroopInfo getTroopInfoFromCache(@NotNull String str);

@NotNull
List<TroopInfo> getTroopListFromCache();

//@Nullable
//a<List<TroopInfo>> getTroopListLiveData();

void preloadTroopList();

void requestSetTroopTop(@NotNull LifecycleOwner lifecycleOwner, @NotNull String str, boolean z, @NotNull Function1<? super Boolean, Unit> function1);
}
30 changes: 21 additions & 9 deletions xposed/src/main/java/moe/fuqiuluo/qqinterface/servlet/GroupSvc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import com.tencent.protofile.join_group_link.join_group_link
import com.tencent.qphone.base.remote.ToServiceMsg
import com.tencent.qqnt.kernel.nativeinterface.MemberInfo
import com.tencent.qqnt.kernel.nativeinterface.MsgConstant
import com.tencent.qqnt.trooplist.ITroopListRepoApi
import com.tencent.qqnt.troopmemberlist.ITroopMemberListRepoApi
import friendlist.stUinInfo
import io.ktor.client.call.body
Expand Down Expand Up @@ -76,6 +77,7 @@ import moe.fuqiuluo.shamrock.tools.putBuf32Long
import moe.fuqiuluo.shamrock.utils.FileUtils
import moe.fuqiuluo.shamrock.utils.PlatformUtils
import moe.fuqiuluo.shamrock.utils.PlatformUtils.QQ_9_0_71_VER
import moe.fuqiuluo.shamrock.utils.PlatformUtils.QQ_9_0_80_VER
import moe.fuqiuluo.shamrock.utils.PlatformUtils.QQ_9_0_8_VER
import moe.fuqiuluo.shamrock.xposed.helper.AppRuntimeFetcher
import moe.fuqiuluo.shamrock.xposed.helper.NTServiceFetcher
Expand Down Expand Up @@ -228,17 +230,27 @@ internal object GroupSvc: QQInterfaces() {
}

suspend fun getGroupList(refresh: Boolean): Result<List<TroopInfo>> {
val service = app.getRuntimeService(ITroopInfoService::class.java, "all")

var troopList = service.allTroopList
if(refresh || !service.isTroopCacheInited || troopList == null) {
if(!requestGroupInfo(service)) {
return Result.failure(Exception("获取群列表失败"))
} else {
troopList = service.allTroopList
if (PlatformUtils.getQQVersionCode() <= QQ_9_0_80_VER) {
val service = app.getRuntimeService(ITroopInfoService::class.java, "all")

var troopList = service.allTroopList
if(refresh || !service.isTroopCacheInited || troopList == null) {
if(!requestGroupInfo(service)) {
return Result.failure(Exception("获取群列表失败"))
} else {
troopList = service.allTroopList
}
}
return Result.success(troopList)
} else {
val service = QRoute.api(ITroopListRepoApi::class.java)
val troopList = service.troopListFromCache
if (troopList == null || troopList.isEmpty() || refresh) {
service.fetchTroopList(true)
return Result.success(service.troopListFromCache)
}
return Result.success(troopList)
}
return Result.success(troopList)
}

suspend fun getNotJoinedGroupInfo(groupId: Long): Result<NotJoinedGroupInfo> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import kotlin.random.Random
internal object PlatformUtils {
const val QQ_9_0_8_VER = 5540
const val QQ_9_0_71_VER = 6702
const val QQ_9_0_80_VER = 6869

fun getQUA(): String {
return "V1_AND_SQ_${getQQVersion(MobileQQ.getContext())}_${getQQVersionCode()}_YYB_D"
Expand Down

0 comments on commit 976526a

Please sign in to comment.