-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat: 自动签到 #165
feat: 自动签到 #165
Conversation
刚刚操作失误,不小心删掉了远程feature分支。。。 |
|
||
public class NgaClientApp extends Application { | ||
|
||
private static final String TAG = NgaClientApp.class.getSimpleName(); | ||
|
||
private static boolean sNewVersion; | ||
|
||
private CheckInTask mCheckInTask; |
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.
这里缓存一个变量没什么意义
@@ -109,6 +114,13 @@ private void checkNewVersion() { | |||
} | |||
} | |||
|
|||
private void checkIn() { | |||
if (mCheckInTask == null) { | |||
mCheckInTask = new CheckInTask(); |
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.
这个方法是静态方法,没有必要创建对象去调用
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.
我对java不太熟,我改了一下,你看行不
public class CheckInTask { | ||
private static final String url = Utils.getNGAHost() + "nuke.php?__lib=check_in&__act=check_in&lite=js"; | ||
|
||
public static void execute() { |
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.
这里的时间判断似乎有点问题
上次签到成功的时间-24小时,和当前的时间比较天数
这样是不是永远条件都是成立的?是不用应该直接用上次签到成功的时间和当前时间比较天数?
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.
new Date().getTime() - 24 * 3600 * 1000 这里设置的是缺省值,也就是如果没查询到上次签到时间,才会是这个这个值,正常签到情况下存的是时间戳,取的也是时间戳。
feat: 自动签到