Skip to content

Commit

Permalink
0.9.8: release
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazyeraser committed Jan 9, 2018
1 parent 7e6cf91 commit 3039fd3
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public interface CGSSService {
@Headers("X-Unity-Version:" + SStaticR.UNITY_VERSION)
Observable<ResponseBody> getResources(@Path("hash") String hash);

@GET("http://346lab.org/dl/cgss_assets/{version}/manifests/Android_AHigh_SHigh")
Observable<ResponseBody> getManifestsRP(@Path("version") String version);

@GET("http://346lab.org/dl/cgss_assets/resources/Generic/{hash}")
// @Headers("X-Unity-Version:" + SStaticR.UNITY_VERSION)
Observable<ResponseBody> getResourcesRP(@Path("hash") String hash);
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ private void getCurVersion() {
private boolean needNoUpdateHint = false;
private String verjson, versionInfo;
//检查更新
public void checkUpdate(boolean needNoUpdateHint) {
private OnUpdateCheckedListener onUpdateCheckedListener;
public interface OnUpdateCheckedListener{
void onChecked();
}
public void checkUpdate(boolean needNoUpdateHint){
checkUpdate(needNoUpdateHint, null);
}
public void checkUpdate(boolean needNoUpdateHint, OnUpdateCheckedListener listener) {
this.onUpdateCheckedListener = listener;
this.needNoUpdateHint = needNoUpdateHint;
Utils.mPrint("checkUpdate:" + needNoUpdateHint);
hasNewVersion = false;
Expand Down Expand Up @@ -309,6 +317,9 @@ public void downloadCanceled()
//检查更新
public void checkUpdateCompleted(Boolean hasUpdate,
CharSequence updateInfo) {
if (onUpdateCheckedListener != null){
onUpdateCheckedListener.onChecked();
}
if (hasUpdate) {
new SweetAlertDialog(mContext, SweetAlertDialog.NORMAL_TYPE)
.setTitleText(mContext.getString(R.string.dialog_update_title))
Expand Down
51 changes: 25 additions & 26 deletions app/src/main/java/com/lazyeraser/imas/cgss/view/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,13 @@ private void askRestart(){

private void checkUpdate(boolean hint){
needUpdateHint = hint;
if (hint) {
umi.showLoading();
}
if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions((Activity) mContext, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
}else {
updateManager.checkUpdate(hint);
updateManager.checkUpdate(hint, () -> umi.dismissLoading());
}
}

Expand All @@ -180,7 +183,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 1 && permissions[0].equals(Manifest.permission.WRITE_EXTERNAL_STORAGE)){
if (grantResults[0] == PackageManager.PERMISSION_GRANTED){
updateManager.checkUpdate(needUpdateHint);
updateManager.checkUpdate(needUpdateHint, () -> umi.dismissLoading());
}else {
umi.makeToast(R.string.permission_denied_hint);
}
Expand All @@ -202,31 +205,27 @@ private void initDialog(MainViewModel mainViewModel){
Messenger.getDefault().sendNoMsg(TOKEN_DATA_UPDATED);
})
.setConfirmClickListener(alertDialog -> {
if (!SStaticR.isCnMainLand){
alertDialog.dismiss();
mainViewModel.agree.set(true);
alertDialog.dismiss();
if (SStaticR.isCnMainLand && TextUtils.isEmpty(umi.spRead(SharedHelper.KEY_USE_REVERSE_PROXY))){
SweetAlertDialog askRPDialog = new SweetAlertDialog(mContext, SweetAlertDialog.WARNING_TYPE)
.setTitleText("开启下载加速?")
.setContentText("可以解决部分网络环境谱面下载过慢的问题\n\n加速由346lab.org提供")
.setConfirmText("开启加速")
.setCancelText("直接下载")
.setConfirmClickListener(dialog -> {
umi.spSave(SharedHelper.KEY_USE_REVERSE_PROXY, "true");
dialog.dismiss();
mainViewModel.agree.set(true);
})
.setCancelClickListener(dialog ->{
umi.spSave(SharedHelper.KEY_USE_REVERSE_PROXY, "false");
dialog.dismiss();
mainViewModel.agree.set(true);
});
askRPDialog.setCanceledOnTouchOutside(false);
askRPDialog.show();
}else {
if (TextUtils.isEmpty(umi.spRead(SharedHelper.KEY_USE_REVERSE_PROXY))){
SweetAlertDialog askRPDialog = new SweetAlertDialog(mContext, SweetAlertDialog.WARNING_TYPE)
.setTitleText("开启下载加速?")
.setContentText("可以解决部分网络环境谱面下载过慢的问题\n\n加速由346lab.org提供")
.setConfirmText("开启加速")
.setCancelText("直接下载")
.setConfirmClickListener(dialog -> {
umi.spSave(SharedHelper.KEY_USE_REVERSE_PROXY, "true");
dialog.dismiss();
alertDialog.dismiss();
mainViewModel.agree.set(true);
})
.setCancelClickListener(dialog ->{
umi.spSave(SharedHelper.KEY_USE_REVERSE_PROXY, "false");
dialog.dismiss();
alertDialog.dismiss();
mainViewModel.agree.set(true);
});
askRPDialog.setCanceledOnTouchOutside(false);
askRPDialog.show();
}
mainViewModel.agree.set(true);
}
});
progressDialog = new SweetAlertDialog(mContext, SweetAlertDialog.PROGRESS_TYPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,27 +139,27 @@ private void checkData() {
}
if (update){
haveUpdate.set(true);
android.databinding.Observable.OnPropertyChangedCallback agreeCallBack = new android.databinding.Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(android.databinding.Observable observable, int i) {
if (agree.get()) {
agree.set(false);
solved = 0;
boolean isUpdateManifest = info != null && !TextUtils.isEmpty(info.getTruth_version());
isShowProgress.set(true);
total = allIds_card.size();
if (newIds_card.size() > 0 || isUpdateManifest) {
upDateDB(isUpdateManifest, isUpdateManifest ? info.getTruth_version() : null);
}
agree.removeOnPropertyChangedCallback(this);
}
}
};
agree.addOnPropertyChangedCallback(agreeCallBack);
}else {
upToDate.set(true);
}
umi.dismissLoading();
android.databinding.Observable.OnPropertyChangedCallback agreeCallBack = new android.databinding.Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(android.databinding.Observable observable, int i) {
if (agree.get()) {
agree.set(false);
solved = 0;
boolean isUpdateManifest = info != null && !TextUtils.isEmpty(info.getTruth_version());
isShowProgress.set(true);
total = allIds_card.size();
if (newIds_card.size() > 0 || isUpdateManifest) {
upDateDB(isUpdateManifest, isUpdateManifest ? info.getTruth_version() : null);
}
agree.removeOnPropertyChangedCallback(this);
}
}
};
agree.addOnPropertyChangedCallback(agreeCallBack);
}, ExceptionHandler::handleException);


Expand All @@ -170,10 +170,12 @@ public void onPropertyChanged(android.databinding.Observable observable, int i)
private void updateManifest(String truthVersion) {
progress.set(-1);
progressTxt.set(mContext.getString(R.string.update_hint_manifest));
RetrofitProvider.getInstance(false).create(CGSSService.class)
.getManifests(truthVersion)
.subscribeOn(Schedulers.io())
.subscribe(body -> {
useReverseProxy = umi.getSP(SharedHelper.KEY_USE_REVERSE_PROXY);
Observable<ResponseBody> manifestFile = useReverseProxy ?
RetrofitProvider.getInstance(false).create(CGSSService.class).getManifestsRP(truthVersion) :
RetrofitProvider.getInstance(false).create(CGSSService.class).getManifests(truthVersion);

manifestFile.subscribeOn(Schedulers.io()).subscribe(body -> {
try {
FileHelper.writeFile(LZ4Helper.uncompressCGSS(body.bytes()),
mContext.getFilesDir().getAbsolutePath(), DBHelper.DB_NAME_manifest);
Expand All @@ -186,7 +188,6 @@ private void updateManifest(String truthVersion) {

fileToDownload = new HashMap<>();
hashToDownload = new ArrayList<>();
useReverseProxy = umi.getSP(SharedHelper.KEY_USE_REVERSE_PROXY);
if (!masterHash.equals(umi.spRead(SharedHelper.KEY_MasterDbHash))) {
// update master.db
addFileDownloadMission(masterHash, DBHelper.DB_NAME_master, mContext.getFilesDir().getAbsolutePath());
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/java/com/lazyeraser/imas/main/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,10 @@ public interface OnBackBtnClickedListener {
@Override
protected void onResume() {
super.onResume();
if (SStaticR.ANALYTICS_ON){

}
}

@Override
protected void onPause() {
super.onPause();
if (SStaticR.ANALYTICS_ON){

}
}
}
6 changes: 5 additions & 1 deletion app/src/main/res/layout/activity_beat_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/scrollView">
android:id="@+id/scrollView"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true">

<com.lazyeraser.imas.cgss.utils.view.BeatMapView
android:id="@+id/beat_map"
Expand All @@ -29,6 +31,8 @@
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBarWrapper
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:layout_alignParentEnd="true">
<com.h6ah4i.android.widget.verticalseekbar.VerticalSeekBar
android:id="@+id/seekBar"
Expand Down
12 changes: 6 additions & 6 deletions appupdate/version.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"appname": "DereHelper",
"apkname": "DereHelper.apk",
"verName": "0.9.7",
"url": "http://45.32.111.67:8080/derehelper/DereHelper-0.9.7.apk",
"verInfo": "1.新增星座名翻译\n2.小的修复和改进",
"verInfo_jp": "細かいバグの修正",
"verInfo_en": "Minor bug fixes",
"verCode": 7
"verName": "0.9.8",
"url": "http://45.32.111.67:8080/derehelper/DereHelper-0.9.8.apk",
"verInfo": "1.改进用户体验\n2.数据收集服务改为Google Analytics\n3.为简体中文用户增加下载加速功能,解决部分谱面下载失败问题(加速服务由346lab.org提供)\n4.繁体中文对应",
"verInfo_jp": "1.ユーザー体験向上\n2.集計機能をGoogle Analyticsに移行\n3.翻訳データの修正",
"verInfo_en": "Minor bug fixes&Improvements",
"verCode": 8
}

0 comments on commit 3039fd3

Please sign in to comment.