Skip to content

Commit

Permalink
修复部分功能不启动的问题,修复两次扫描中间手动使用双击卡不自动双击的问题,调整每天只捐一次每次捐一个鸡蛋,增强保活强度。
Browse files Browse the repository at this point in the history
  • Loading branch information
constanline committed Jul 19, 2023
1 parent 7a46a85 commit dce8ec1
Show file tree
Hide file tree
Showing 25 changed files with 604 additions and 1,172 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
minSdkVersion 23
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 29
versionCode 2
versionName "1.0.0"
versionCode 4
versionName "1.0.1"
}
buildTypes {
release {
Expand Down
53 changes: 20 additions & 33 deletions app/src/main/java/pansong291/xposed/quickenergy/AntCooperate.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ public class AntCooperate
{
private static final String TAG = AntCooperate.class.getCanonicalName();

public static void start(ClassLoader loader, int times)
{
if(!Config.cooperateWater() || times != 0)
private static boolean firstTime = true;

public static void start() {
if(!Config.cooperateWater() || !firstTime)
return;
new Thread()
{
private ClassLoader loader;

public Thread setData(ClassLoader cl)
{
loader = cl;
return this;
}

@Override
public void run()
Expand All @@ -35,24 +29,21 @@ public void run()
{
while(FriendIdMap.currentUid == null || FriendIdMap.currentUid.isEmpty())
Thread.sleep(100);
String s = AntCooperateRpcCall.rpcCall_queryUserCooperatePlantList(loader);
if(s == null)
{
String s = AntCooperateRpcCall.queryUserCooperatePlantList();
if(s == null) {
Thread.sleep(RandomUtils.delay());
s = AntCooperateRpcCall.rpcCall_queryUserCooperatePlantList(loader);
s = AntCooperateRpcCall.queryUserCooperatePlantList();
}
JSONObject jo = new JSONObject(s);
if(jo.getString("resultCode").equals("SUCCESS"))
{
if(jo.getString("resultCode").equals("SUCCESS")) {
int userCurrentEnergy = jo.getInt("userCurrentEnergy");
JSONArray ja = jo.getJSONArray("cooperatePlants");
for(int i = 0; i < ja.length(); i++)
{
jo = ja.getJSONObject(i);
String cooperationId = jo.getString("cooperationId");
if(!jo.has("name"))
{
s = AntCooperateRpcCall.rpcCall_queryCooperatePlant(loader, cooperationId);
if(!jo.has("name")) {
s = AntCooperateRpcCall.queryCooperatePlant(cooperationId);
jo = new JSONObject(s).getJSONObject("cooperatePlant");
}
String name = jo.getString("name");
Expand All @@ -61,44 +52,40 @@ public void run()
if(!Statistics.canCooperateWaterToday(FriendIdMap.currentUid, cooperationId))
continue;
int index = -1;
for(int j = 0; j < Config.getCooperateWaterList().size(); j++)
{
if(Config.getCooperateWaterList().get(j).equals(cooperationId))
{
for(int j = 0; j < Config.getCooperateWaterList().size(); j++) {
if(Config.getCooperateWaterList().get(j).equals(cooperationId)) {
index = j;
break;
}
}
if(index >= 0)
{
if(index >= 0) {
int num = Config.getcooperateWaterNumList().get(index);
if(num > waterDayLimit)
num = waterDayLimit;
if(num > userCurrentEnergy)
num = userCurrentEnergy;
if(num > 0)
cooperateWater(loader, FriendIdMap.currentUid, cooperationId, num, name);
cooperateWater(FriendIdMap.currentUid, cooperationId, num, name);
}
}
}else
{
} else {
Log.i(TAG, jo.getString("resultDesc"));
}
}catch(Throwable t)
{
} catch(Throwable t) {
Log.i(TAG, "start.run err:");
Log.printStackTrace(TAG, t);
}
CooperationIdMap.saveIdMap();
firstTime = false;
}
}.setData(loader).start();
}.start();
}

private static void cooperateWater(ClassLoader loader, String uid, String coopId, int count, String name)
private static void cooperateWater(String uid, String coopId, int count, String name)
{
try
{
String s = AntCooperateRpcCall.rpcCall_cooperateWater(loader, uid, coopId, count);
String s = AntCooperateRpcCall.cooperateWater(uid, coopId, count);
JSONObject jo = new JSONObject(s);
if(jo.getString("resultCode").equals("SUCCESS"))
{
Expand Down
Loading

0 comments on commit dce8ec1

Please sign in to comment.