Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
623e7f02
Commit
623e7f02
authored
Oct 19, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新多语言先行卡下载地址
parent
52392bce
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
36 deletions
+44
-36
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
.../java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
+2
-5
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
...java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
...e/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
+35
-24
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
623e7f02
...
@@ -167,8 +167,8 @@ public interface Constants {
...
@@ -167,8 +167,8 @@ public interface Constants {
String
URL_YGO233_ADVANCE
=
""
;
//"https://ygo233.com/pre#pre_release_cards";//关闭233先行卡服务器,但不要删除该字段,许多未调用的遗留代码使用该contant
String
URL_YGO233_ADVANCE
=
""
;
//"https://ygo233.com/pre#pre_release_cards";//关闭233先行卡服务器,但不要删除该字段,许多未调用的遗留代码使用该contant
String
URL_CN_DATAVER
=
"https://cdn02.moecube.com:444/ygopro-super-pre/data/version.txt"
;
String
URL_CN_DATAVER
=
"https://cdn02.moecube.com:444/ygopro-super-pre/data/version.txt"
;
String
URL_PRE_CARD
=
"https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.json"
;
String
URL_PRE_CARD
=
"https://cdn02.moecube.com:444/ygopro-super-pre/data/test-release.json"
;
String
URL_
YGO233
_FILE
=
"https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk"
;
String
URL_
SUPERPRE_CN
_FILE
=
"https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk"
;
String
URL_
YGO233
_FILE_ALT
=
"https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk"
;
String
URL_
SUPERPRE_CN
_FILE_ALT
=
"https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk"
;
String
URL_YGO233_BUG_REPORT
=
"https://ygo233.com/pre#faq"
;
String
URL_YGO233_BUG_REPORT
=
"https://ygo233.com/pre#faq"
;
int
PORT_Mycard_Super_Pre_Server
=
888
;
int
PORT_Mycard_Super_Pre_Server
=
888
;
String
URL_Mycard_Super_Pre_Server
=
"mygo.superpre.pro"
;
String
URL_Mycard_Super_Pre_Server
=
"mygo.superpre.pro"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
View file @
623e7f02
package
cn.garymb.ygomobile.ex_card
;
package
cn.garymb.ygomobile.ex_card
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_CN_DATAVER
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_FILE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_FILE_ALT
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
DownloadUtil
.
TYPE_DOWNLOAD_EXCEPTION
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
DownloadUtil
.
TYPE_DOWNLOAD_EXCEPTION
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
ServerUtil
.
AddServer
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
ServerUtil
.
AddServer
;
...
@@ -93,7 +90,7 @@ public class ExCardListFragment extends Fragment {
...
@@ -93,7 +90,7 @@ public class ExCardListFragment extends Fragment {
LogUtil
.
i
(
TAG
,
"start download"
);
LogUtil
.
i
(
TAG
,
"start download"
);
if
(
downloadState
!=
DownloadState
.
DOWNLOAD_ING
)
{
if
(
downloadState
!=
DownloadState
.
DOWNLOAD_ING
)
{
downloadState
=
DownloadState
.
DOWNLOAD_ING
;
downloadState
=
DownloadState
.
DOWNLOAD_ING
;
downloadfromWeb
(
URL_FILE
);
downloadfromWeb
(
ServerUtil
.
downloadUrl
()
);
}
}
}
}
});
});
...
@@ -205,7 +202,7 @@ public class ExCardListFragment extends Fragment {
...
@@ -205,7 +202,7 @@ public class ExCardListFragment extends Fragment {
++
FailedCount
;
++
FailedCount
;
if
(
FailedCount
<=
2
)
{
if
(
FailedCount
<=
2
)
{
YGOUtil
.
showTextToast
(
getString
(
R
.
string
.
Ask_to_Change_Other_Way
));
YGOUtil
.
showTextToast
(
getString
(
R
.
string
.
Ask_to_Change_Other_Way
));
downloadfromWeb
(
URL_YGO233_FILE_ALT
);
downloadfromWeb
(
ServerUtil
.
downloadUrl
()
);
}
}
YGOUtil
.
showTextToast
(
"error:"
+
getString
(
R
.
string
.
Download_Precard_Failed
));
YGOUtil
.
showTextToast
(
"error:"
+
getString
(
R
.
string
.
Download_Precard_Failed
));
break
;
break
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
623e7f02
...
@@ -105,7 +105,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -105,7 +105,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
//showNewbieGuide("homePage");
//showNewbieGuide("homePage");
initBottomNavigationBar
();
initBottomNavigationBar
();
onNewIntent
(
getIntent
());
onNewIntent
(
getIntent
());
ServerUtil
.
initExCardState
(
this
);
//检查扩展卡版本
ServerUtil
.
initExCardState
();
//检查扩展卡版本
}
}
@Override
@Override
...
@@ -318,7 +318,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
...
@@ -318,7 +318,7 @@ public abstract class HomeActivity extends BaseActivity implements BottomNavigat
@Override
@Override
protected
void
onResume
()
{
protected
void
onResume
()
{
super
.
onResume
();
super
.
onResume
();
ServerUtil
.
initExCardState
(
this
);
//检查扩展卡版本
ServerUtil
.
initExCardState
();
//检查扩展卡版本
}
}
@Override
@Override
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
View file @
623e7f02
...
@@ -149,7 +149,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
...
@@ -149,7 +149,7 @@ public class HomeFragment extends BaseFragemnt implements OnDuelAssistantListene
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
{
//加上判断
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
{
//加上判断
EventBus
.
getDefault
().
register
(
this
);
EventBus
.
getDefault
().
register
(
this
);
}
}
ServerUtil
.
initExCardState
(
getActivity
()
);
//LogoActivity中会调用一次本函数,此处再次调用的原因:有时HomeFragment的onCreateView()函数执行较慢,导致initExCardState()中eventbus事件发布完毕后仍未注册,因此在此处再调用一次检查,再次发布
ServerUtil
.
initExCardState
();
//LogoActivity中会调用一次本函数,此处再次调用的原因:有时HomeFragment的onCreateView()函数执行较慢,导致initExCardState()中eventbus事件发布完毕后仍未注册,因此在此处再调用一次检查,再次发布
changeColor
();
changeColor
();
try
{
try
{
ServerUtil
.
refreshServer
(
activity
);
ServerUtil
.
refreshServer
(
activity
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/settings/SettingFragment.java
View file @
623e7f02
...
@@ -38,7 +38,7 @@ import static cn.garymb.ygomobile.Constants.SETTINGS_AVATAR;
...
@@ -38,7 +38,7 @@ import static cn.garymb.ygomobile.Constants.SETTINGS_AVATAR;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
SETTINGS_CARD_BG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
SETTINGS_CARD_BG
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
SETTINGS_COVER
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
SETTINGS_COVER
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_HOME_VERSION
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_HOME_VERSION
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_
YGO233
_FILE_ALT
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_
SUPERPRE_CN
_FILE_ALT
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
HomeActivity
.
Cache_pre_release_code
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
HomeActivity
.
Cache_pre_release_code
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
HomeActivity
.
pre_code_list
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
HomeActivity
.
pre_code_list
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
HomeActivity
.
released_code_list
;
import
static
cn
.
garymb
.
ygomobile
.
ui
.
home
.
HomeActivity
.
released_code_list
;
...
@@ -290,7 +290,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
...
@@ -290,7 +290,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
case
TYPE_SETTING_GET_VERSION_FAILED:
case
TYPE_SETTING_GET_VERSION_FAILED:
++
FailedCount
;
++
FailedCount
;
if
(
FailedCount
<=
2
)
{
if
(
FailedCount
<=
2
)
{
checkUpgrade
(
URL_
YGO233_FILE_ALT
);
checkUpgrade
(
URL_
HOME_VERSION
);
}
else
{
}
else
{
Toast
.
makeText
(
getContext
(),
getString
(
R
.
string
.
Checking_Update_Failed
)
+
msg
.
obj
.
toString
(),
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getContext
(),
getString
(
R
.
string
.
Checking_Update_Failed
)
+
msg
.
obj
.
toString
(),
Toast
.
LENGTH_SHORT
).
show
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
View file @
623e7f02
...
@@ -41,12 +41,6 @@ import okhttp3.Response;
...
@@ -41,12 +41,6 @@ import okhttp3.Response;
public
class
ServerUtil
{
public
class
ServerUtil
{
private
static
final
String
TAG
=
ServerUtil
.
class
.
getSimpleName
();
private
static
final
String
TAG
=
ServerUtil
.
class
.
getSimpleName
();
public
enum
ExCardState
{
/* 已安装最新版扩展卡,扩展卡不是最新版本,无法查询到服务器版本 */
UNCHECKED
,
UPDATED
,
NEED_UPDATE
,
ERROR
}
/* 存储了当前先行卡是否需要更新的状态,UI逻辑直接读取该变量就能获知是否已安装先行卡 */
/* 存储了当前先行卡是否需要更新的状态,UI逻辑直接读取该变量就能获知是否已安装先行卡 */
public
volatile
static
ExCardState
exCardState
=
ExCardState
.
UNCHECKED
;
//TODO 可能有并发问题
public
volatile
static
ExCardState
exCardState
=
ExCardState
.
UNCHECKED
;
//TODO 可能有并发问题
public
volatile
static
String
serverExCardVersion
=
""
;
public
volatile
static
String
serverExCardVersion
=
""
;
...
@@ -57,26 +51,23 @@ public class ServerUtil {
...
@@ -57,26 +51,23 @@ public class ServerUtil {
* 比对服务器的先行卡版本号与本地先行卡版本号,
* 比对服务器的先行卡版本号与本地先行卡版本号,
* 更新全局变量exCardVersion(如删除先行卡、重新安装先行卡等)
* 更新全局变量exCardVersion(如删除先行卡、重新安装先行卡等)
*/
*/
public
static
void
initExCardState
(
Context
context
)
{
public
static
void
initExCardState
()
{
String
oldVer
=
SharedPreferenceUtil
.
getExpansionDataVer
();
String
oldVer
=
SharedPreferenceUtil
.
getExpansionDataVer
();
LogUtil
.
i
(
TAG
,
"server util, old pre-card version:"
+
oldVer
);
LogUtil
.
i
(
TAG
,
"server util, old pre-card version:"
+
oldVer
);
String
language
=
context
.
getResources
().
getConfiguration
().
locale
.
getLanguage
();
String
id
=
""
;
String
id
=
""
;
String
URL_DATAVER
=
URL_CN_DATAVER
;
String
URL_DATAVER
=
URL_CN_DATAVER
;
if
(!
language
.
isEmpty
())
{
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
-
1
)
{
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Korean
.
code
)
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
English
.
name
))
id
=
"EN"
;
id
=
"KR"
;
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
Korean
.
name
))
id
=
"KR"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
English
.
code
)
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
Spanish
.
name
))
id
=
"ES"
;
id
=
"EN"
;
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
Japanese
))
id
=
"JP"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Spanish
.
code
)
}
else
{
id
=
"ES"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Korean
.
code
)
id
=
"KR"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Japanese
.
code
)
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
English
.
code
)
id
=
"EN"
;
id
=
"JP"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Spanish
.
code
)
id
=
"ES"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Japanese
.
code
)
id
=
"JP"
;
}
URL_DATAVER
=
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Chinese
.
code
)
?
URL_CN_DATAVER
:
"https://github.com/DaruKani/TransSuperpre/blob/main/"
+
id
+
"/version.txt"
;
URL_DATAVER
=
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Chinese
.
code
)
?
URL_CN_DATAVER
:
"https://github.com/DaruKani/TransSuperpre/blob/main/"
+
id
+
"/version.txt"
;
}
Log
.
w
(
"seesee"
,
URL_DATAVER
);
OkhttpUtil
.
get
(
URL_DATAVER
,
new
Callback
()
{
OkhttpUtil
.
get
(
URL_DATAVER
,
new
Callback
()
{
@Override
@Override
public
void
onFailure
(
Call
call
,
IOException
e
)
{
public
void
onFailure
(
Call
call
,
IOException
e
)
{
...
@@ -87,7 +78,7 @@ public class ServerUtil {
...
@@ -87,7 +78,7 @@ public class ServerUtil {
if
(
failCounter
<
10
)
{
if
(
failCounter
<
10
)
{
LogUtil
.
i
(
TAG
,
"network failed, retry fetch pre-card version:"
);
LogUtil
.
i
(
TAG
,
"network failed, retry fetch pre-card version:"
);
failCounter
++;
failCounter
++;
initExCardState
(
context
);
initExCardState
();
}
}
}
}
...
@@ -192,7 +183,6 @@ public class ServerUtil {
...
@@ -192,7 +183,6 @@ public class ServerUtil {
}
}
}
}
/**
/**
* 读取xmlFile指定的本地文件server_list.xml和apk资源文件(assets)下的serverlist.xml,返回其中版本最新的
* 读取xmlFile指定的本地文件server_list.xml和apk资源文件(assets)下的serverlist.xml,返回其中版本最新的
*
*
...
@@ -320,4 +310,25 @@ public class ServerUtil {
...
@@ -320,4 +310,25 @@ public class ServerUtil {
return
(
port
==
Constants
.
PORT_Mycard_Super_Pre_Server
&&
(
addr
.
equals
(
Constants
.
URL_Mycard_Super_Pre_Server
)
||
addr
.
equals
(
Constants
.
URL_Mycard_Super_Pre_Server_2
)));
return
(
port
==
Constants
.
PORT_Mycard_Super_Pre_Server
&&
(
addr
.
equals
(
Constants
.
URL_Mycard_Super_Pre_Server
)
||
addr
.
equals
(
Constants
.
URL_Mycard_Super_Pre_Server_2
)));
}
}
public
static
String
downloadUrl
()
{
String
url
;
String
id
=
""
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Korean
.
code
)
id
=
"KR"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
English
.
code
)
id
=
"EN"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Spanish
.
code
)
id
=
"ES"
;
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Japanese
.
code
)
id
=
"JP"
;
url
=
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Chinese
.
code
)
?
URL_CN_DATAVER
:
"https://raw.githubusercontent.com/DaruKani/TransSuperpre/refs/heads/main/"
+
id
+
"/ygopro-super-pre.ypk"
;
Log
.
w
(
"seesee"
,
url
);
return
url
;
}
public
enum
ExCardState
{
/* 已安装最新版扩展卡,扩展卡不是最新版本,无法查询到服务器版本 */
UNCHECKED
,
UPDATED
,
NEED_UPDATE
,
ERROR
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment