Compare commits

...
1 Commits
Author SHA1 Message Date
seven332 50178613b2 修正登陆错误 2014-08-24 21:43:28 +08:00
5 changed files with 47 additions and 9 deletions

No files matched your search

+2 -2
View File
@@ -16,8 +16,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hippo.ehviewer"
android:versionCode="22"
android:versionName="0.6.1" >
android:versionCode="23"
android:versionName="0.6.2" >
<uses-sdk
android:minSdkVersion="14"
+5
View File
@@ -1,3 +1,8 @@
Version 0.6.2 (2014-08-23)
* 修正登陆错误
* 修正翻译错误
* 修正一处可能的崩溃
Version 0.6.1 (2014-08-23)
* 修正早期系统版本布局错误
* 修正可能出现的通知闪烁
+15
View File
@@ -25,10 +25,13 @@ import java.text.SimpleDateFormat;
import android.annotation.SuppressLint;
import android.app.Application;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import com.hippo.ehviewer.cache.ImageCache;
import com.hippo.ehviewer.data.Data;
import com.hippo.ehviewer.ehclient.EhClient;
import com.hippo.ehviewer.ehclient.EhInfo;
import com.hippo.ehviewer.ehclient.ExDownloaderManager;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Crash;
@@ -82,6 +85,18 @@ public class AppContext extends Application implements UncaughtExceptionHandler
new FileOutputStream(nomedia).close();
} catch (IOException e) {}
}
// Fix <=22 error
if (Config.getVersionCode() <= 22) {
EhInfo.getInstance(this).logout();
}
// Update version code
try {
PackageInfo pi= getPackageManager().getPackageInfo(getPackageName(), 0);
Config.setVersionCode(pi.versionCode);
} catch (NameNotFoundException e) {}
}
/**
+13 -7
View File
@@ -59,9 +59,9 @@ public class EhInfo {
private static final String KEY_DISPLAYNAME = "displayname";
private static final String DEFAULT_NAME = "Hippo";
private static final String KEY_MEMBER_ID = "ipb_member_id";
private static final String DEFAULT_MEMBER_ID = "1936857";
private static final String DEFAULT_MEMBER_ID = null;
private static final String KEY_PASS_HASH = "ipb_pass_hash";
private static final String DEFAULT_PASS_HASH = "725e2726990bc34ae3852bb4f7c7879a";
private static final String DEFAULT_PASS_HASH = null;
private final Context mContext;
private final SharedPreferences mInfoPref;
@@ -171,11 +171,17 @@ public class EhInfo {
}
public void setCookie(HttpURLConnection conn, String previewMode) {
String cookie = "ipb_member_id=" + mInfoPref.getString(KEY_MEMBER_ID, DEFAULT_MEMBER_ID) +
"; ipb_pass_hash=" + mInfoPref.getString(KEY_PASS_HASH, DEFAULT_PASS_HASH) +
"; uconfig=" + (previewMode == null ? mUconfig : getUconfigString(previewMode)) +
"; xres=" + Config.getLofiResolution();
conn.setRequestProperty("Cookie", cookie);
StringBuilder sb = new StringBuilder();
String id = mInfoPref.getString(KEY_MEMBER_ID, DEFAULT_MEMBER_ID);
String hash = mInfoPref.getString(KEY_PASS_HASH, DEFAULT_PASS_HASH);
sb.append("uconfig=").append(previewMode == null ? mUconfig : getUconfigString(previewMode))
.append("; xres=").append(Config.getLofiResolution());
if (id != null)
sb.append("; ipb_member_id=").append(id);
if (hash != null)
sb.append("; ipb_pass_hash=").append(hash);
conn.setRequestProperty("Cookie", sb.toString());
}
public boolean isLogin() {
+12
View File
@@ -363,6 +363,18 @@ public class Config {
KEY_PREVIEW_COLUMNS_LANDSCAPE, DEFAULT_PREVIEW_COLUMNS_LANDSCAPE);
}
private static final String KEY_VERSION_CODE = "version_code";
private static final int DEFAULT_VERSION_CODE = 0;
public static int getVersionCode() {
return mConfigPre.getInt(KEY_VERSION_CODE,
DEFAULT_VERSION_CODE);
}
public static void setVersionCode(int versionCode) {
mConfigPre.edit().putInt(KEY_VERSION_CODE, versionCode).apply();
}
/****** GalleryActivity ******/
private static final String KEY_GALLERY_FIRST = "gallery_first";