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
52392bce
Commit
52392bce
authored
Oct 17, 2024
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入多语言超先行更新检测下载
parent
d38e50bf
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
18 deletions
+34
-18
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-5
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
.../java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
+2
-1
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/utils/ServerUtil.java
...e/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
+27
-8
mobile/src/main/res/values-zh/strings.xml
mobile/src/main/res/values-zh/strings.xml
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
52392bce
...
@@ -165,12 +165,8 @@ public interface Constants {
...
@@ -165,12 +165,8 @@ public interface Constants {
String
ID3
=
"#pre_release_code"
;
String
ID3
=
"#pre_release_code"
;
//String URL_YGO233_DOWNLOAD_LINK = "https://ygo233.com/download/ygomobile";
//String URL_YGO233_DOWNLOAD_LINK = "https://ygo233.com/download/ygomobile";
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_
YGO233
_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_DATAVER = "http://192.168.0.103:8006/ygo/version.txt";
// String URL_PRE_CARD = "http://192.168.0.103:8006/ygo/test-release.json";
String
URL_YGO233_FILE
=
"https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk"
;
String
URL_YGO233_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_YGO233_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"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ex_card/ExCardListFragment.java
View file @
52392bce
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
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_YGO233_FILE_ALT
;
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
;
...
@@ -92,7 +93,7 @@ public class ExCardListFragment extends Fragment {
...
@@ -92,7 +93,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_
YGO233_
FILE
);
downloadfromWeb
(
URL_FILE
);
}
}
}
}
});
});
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
52392bce
...
@@ -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
();
//检查扩展卡版本
ServerUtil
.
initExCardState
(
this
);
//检查扩展卡版本
}
}
@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
();
//检查扩展卡版本
ServerUtil
.
initExCardState
(
this
);
//检查扩展卡版本
}
}
@Override
@Override
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeFragment.java
View file @
52392bce
...
@@ -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
();
//LogoActivity中会调用一次本函数,此处再次调用的原因:有时HomeFragment的onCreateView()函数执行较慢,导致initExCardState()中eventbus事件发布完毕后仍未注册,因此在此处再调用一次检查,再次发布
ServerUtil
.
initExCardState
(
getActivity
()
);
//LogoActivity中会调用一次本函数,此处再次调用的原因:有时HomeFragment的onCreateView()函数执行较慢,导致initExCardState()中eventbus事件发布完毕后仍未注册,因此在此处再调用一次检查,再次发布
changeColor
();
changeColor
();
try
{
try
{
ServerUtil
.
refreshServer
(
activity
);
ServerUtil
.
refreshServer
(
activity
);
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/ServerUtil.java
View file @
52392bce
package
cn.garymb.ygomobile.utils
;
package
cn.garymb.ygomobile.utils
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_SERVER_LIST
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_SERVER_LIST
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_
YGO233
_DATAVER
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
URL_
CN
_DATAVER
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
StringUtils
.
isHost
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
StringUtils
.
isHost
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
StringUtils
.
isNumeric
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
StringUtils
.
isNumeric
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
WebParseUtil
.
isValidIP
;
import
static
cn
.
garymb
.
ygomobile
.
utils
.
WebParseUtil
.
isValidIP
;
...
@@ -27,6 +27,7 @@ import java.util.ArrayList;
...
@@ -27,6 +27,7 @@ import java.util.ArrayList;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.List
;
import
java.util.List
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.ServerList
;
import
cn.garymb.ygomobile.bean.ServerList
;
...
@@ -56,10 +57,27 @@ public class ServerUtil {
...
@@ -56,10 +57,27 @@ public class ServerUtil {
* 比对服务器的先行卡版本号与本地先行卡版本号,
* 比对服务器的先行卡版本号与本地先行卡版本号,
* 更新全局变量exCardVersion(如删除先行卡、重新安装先行卡等)
* 更新全局变量exCardVersion(如删除先行卡、重新安装先行卡等)
*/
*/
public
static
void
initExCardState
()
{
public
static
void
initExCardState
(
Context
context
)
{
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
);
OkhttpUtil
.
get
(
URL_YGO233_DATAVER
,
new
Callback
()
{
String
language
=
context
.
getResources
().
getConfiguration
().
locale
.
getLanguage
();
String
id
=
""
;
String
URL_DATAVER
=
URL_CN_DATAVER
;
if
(!
language
.
isEmpty
())
{
if
(
AppsSettings
.
get
().
getDataLanguage
()
==
-
1
)
{
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
English
.
name
))
id
=
"EN"
;
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
Korean
.
name
))
id
=
"KR"
;
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
Spanish
.
name
))
id
=
"ES"
;
if
(
language
.
equals
(
AppsSettings
.
languageEnum
.
Japanese
))
id
=
"JP"
;
}
else
{
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_DATAVER
=
(
AppsSettings
.
get
().
getDataLanguage
()
==
AppsSettings
.
languageEnum
.
Chinese
.
code
)
?
URL_CN_DATAVER
:
"https://github.com/DaruKani/TransSuperpre/blob/main/"
+
id
+
"/version.txt"
;
}
OkhttpUtil
.
get
(
URL_DATAVER
,
new
Callback
()
{
@Override
@Override
public
void
onFailure
(
Call
call
,
IOException
e
)
{
public
void
onFailure
(
Call
call
,
IOException
e
)
{
exCardState
=
ExCardState
.
ERROR
;
exCardState
=
ExCardState
.
ERROR
;
...
@@ -69,7 +87,7 @@ public class ServerUtil {
...
@@ -69,7 +87,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
();
initExCardState
(
context
);
}
}
}
}
...
@@ -161,7 +179,7 @@ public class ServerUtil {
...
@@ -161,7 +179,7 @@ public class ServerUtil {
if
(
serverName
!=
null
&&
(
isHost
(
serverHost
)
||
isValidIP
(
serverHost
))
&&
isNumeric
(
serverPort
))
{
if
(
serverName
!=
null
&&
(
isHost
(
serverHost
)
||
isValidIP
(
serverHost
))
&&
isNumeric
(
serverPort
))
{
AddServer
(
context
,
serverName
,
serverDesc
,
serverHost
,
Integer
.
valueOf
(
serverPort
),
Constants
.
PlayerName
);
AddServer
(
context
,
serverName
,
serverDesc
,
serverHost
,
Integer
.
valueOf
(
serverPort
),
Constants
.
PlayerName
);
}
else
{
}
else
{
Log
.
w
(
TAG
,
"can't parse ex-server properly"
);
Log
.
w
(
TAG
,
"can't parse ex-server properly"
);
}
}
}
}
}
}
...
@@ -210,7 +228,7 @@ public class ServerUtil {
...
@@ -210,7 +228,7 @@ public class ServerUtil {
if
(
fileList
==
null
)
{
if
(
fileList
==
null
)
{
return
;
return
;
}
}
for
(
int
i
=
0
;
i
<
assetList
.
getServerInfoList
().
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
assetList
.
getServerInfoList
().
size
();
i
++)
{
String
assetName
=
assetList
.
getServerInfoList
().
get
(
i
).
getName
();
String
assetName
=
assetList
.
getServerInfoList
().
get
(
i
).
getName
();
String
assetDesc
=
assetList
.
getServerInfoList
().
get
(
i
).
getDesc
();
String
assetDesc
=
assetList
.
getServerInfoList
().
get
(
i
).
getDesc
();
...
@@ -218,7 +236,7 @@ public class ServerUtil {
...
@@ -218,7 +236,7 @@ public class ServerUtil {
int
assetPort
=
assetList
.
getServerInfoList
().
get
(
i
).
getPort
();
int
assetPort
=
assetList
.
getServerInfoList
().
get
(
i
).
getPort
();
/*考虑到fileList的serverinfo其他信息被用户修改过,专门只比较域名地址和端口来视为相同的server来补充备注*/
/*考虑到fileList的serverinfo其他信息被用户修改过,专门只比较域名地址和端口来视为相同的server来补充备注*/
for
(
int
j
=
0
;
j
<
fileList
.
getServerInfoList
().
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
fileList
.
getServerInfoList
().
size
();
j
++)
{
String
fileAddr
=
fileList
.
getServerInfoList
().
get
(
j
).
getServerAddr
();
String
fileAddr
=
fileList
.
getServerInfoList
().
get
(
j
).
getServerAddr
();
int
filePort
=
fileList
.
getServerInfoList
().
get
(
j
).
getPort
();
int
filePort
=
fileList
.
getServerInfoList
().
get
(
j
).
getPort
();
String
fileDesc
=
fileList
.
getServerInfoList
().
get
(
j
).
getDesc
();
String
fileDesc
=
fileList
.
getServerInfoList
().
get
(
j
).
getDesc
();
...
@@ -236,8 +254,9 @@ public class ServerUtil {
...
@@ -236,8 +254,9 @@ public class ServerUtil {
}
}
}
}
saveItems
(
context
,
xmlFile
,
fileList
.
getServerInfoList
());
saveItems
(
context
,
xmlFile
,
fileList
.
getServerInfoList
());
}
}
/**
/**
* 从资源文件serverlist.xml(或本地文件server_list.xml)解析服务器列表,并将新添加的服务器信息(name,addr,port)合并到服务器列表中。
* 从资源文件serverlist.xml(或本地文件server_list.xml)解析服务器列表,并将新添加的服务器信息(name,addr,port)合并到服务器列表中。
*
*
...
...
mobile/src/main/res/values-zh/strings.xml
View file @
52392bce
...
@@ -227,7 +227,7 @@
...
@@ -227,7 +227,7 @@
<string
name=
"failed_reason"
>
登录失败,原因是
</string>
<string
name=
"failed_reason"
>
登录失败,原因是
</string>
<string
name=
"notice_verify_email"
>
请验证账号邮箱后重登方可进入聊天室
</string>
<string
name=
"notice_verify_email"
>
请验证账号邮箱后重登方可进入聊天室
</string>
<string
name=
"send"
>
发送
</string>
<string
name=
"send"
>
发送
</string>
<string
name=
"mc_home"
>
大厅
</string>
<string
name=
"mc_home"
>
直连
大厅
</string>
<string
name=
"bbs"
>
社区
</string>
<string
name=
"bbs"
>
社区
</string>
<string
name=
"McNews"
>
公告
</string>
<string
name=
"McNews"
>
公告
</string>
<string
name=
"settings_pref_settings_only_game"
>
直接启动游戏
</string>
<string
name=
"settings_pref_settings_only_game"
>
直接启动游戏
</string>
...
...
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