Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
058b4364
Commit
058b4364
authored
Apr 14, 2022
by
onuma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#46980 ABookCheck, eXFrame 各アプリ規約同意
parent
af412954
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
41 deletions
+40
-41
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/TermsOfUseJson.java
+23
-0
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/ContractLogic.java
+15
-31
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/LoginActivity.java
+2
-10
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/TermsOfUseJson.java
0 → 100644
View file @
058b4364
package
jp
.
agentec
.
abook
.
abv
.
bl
.
acms
.
client
.
json
;
import
org.json.adf.JSONException
;
import
org.json.adf.JSONObject
;
import
jp.agentec.abook.abv.bl.common.exception.AcmsException
;
import
jp.agentec.abook.abv.bl.common.exception.JSONValidationException
;
/**
* 利用規約に同意するで取得するテキストを格納するJSON
*/
public
class
TermsOfUseJson
extends
AcmsCommonJSON
{
public
String
message
;
public
TermsOfUseJson
(
String
jsonString
)
throws
AcmsException
{
super
(
jsonString
);
}
@Override
protected
void
parse
(
JSONObject
json
)
throws
JSONValidationException
,
JSONException
{
super
.
parse
(
json
);
message
=
getString
(
json
,
"message"
,
null
);
}
}
ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/ContractLogic.java
View file @
058b4364
package
jp
.
agentec
.
abook
.
abv
.
bl
.
logic
;
import
org.json.adf.JSONObject
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -7,8 +9,10 @@ import java.io.InputStreamReader;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.List
;
import
java.util.Locale
;
import
jp.agentec.abook.abv.bl.acms.client.AcmsClient
;
import
jp.agentec.abook.abv.bl.acms.client.json.TermsOfUseJson
;
import
jp.agentec.abook.abv.bl.acms.client.parameters.AcmsParameters
;
import
jp.agentec.abook.abv.bl.acms.type.SecurityPolicyType
;
import
jp.agentec.abook.abv.bl.acms.type.ServiceOption.ServiceOptionId
;
...
...
@@ -368,38 +372,18 @@ public class ContractLogic extends AbstractLogic {
* @param url 取得しに行くURL
* @return 取得した文字列(失敗したらnullが返る)
*/
public
String
getTermsOfServiceText
(
String
url
,
String
laungage
)
{
HttpResponse
response
=
new
HttpResponse
();
HttpURLConnection
conn
=
null
;
public
String
getTermsOfServiceText
(
String
url
)
{
String
requestUrl
=
url
+
"?language="
+
Locale
.
getDefault
().
getLanguage
();
try
{
URL
requestUrl
=
new
URL
(
url
+
"?language="
+
laungage
);
conn
=
HttpRequestSender
.
openConnection
(
"GET"
,
requestUrl
,
"UTF-8"
,
null
,
null
,
5000
);
Logger
.
i
(
TAG
,
"responseCode : "
+
conn
.
getResponseCode
());
response
.
httpResponseCode
=
conn
.
getResponseCode
();
if
(
response
.
httpResponseCode
!=
200
)
{
return
null
;
}
response
.
httpResponseMessage
=
conn
.
getResponseMessage
();
response
.
contentLength
=
NumericUtil
.
parseLong
(
conn
.
getHeaderField
(
"Content-Length"
),
0
);
InputStream
inputStream
=
conn
.
getInputStream
();
BufferedReader
bufferReader
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
(),
"UTF-8"
));
String
resultJson
=
new
String
();
String
str
;
while
(
null
!=
(
str
=
bufferReader
.
readLine
()
)
)
{
resultJson
=
resultJson
+
str
;
}
bufferReader
.
close
();
Logger
.
d
(
TAG
,
"response JSON : "
+
resultJson
);
return
resultJson
;
}
catch
(
IOException
e
)
{
Logger
.
e
(
e
.
getMessage
());
}
catch
(
NumberFormatException
e
)
{
Logger
.
e
(
e
.
getMessage
());
}
finally
{
if
(
conn
!=
null
)
{
conn
.
disconnect
();
}
HttpResponse
response
=
AcmsClient
.
getInstance
(
ABVEnvironment
.
getInstance
().
networkAdapter
).
send
(
requestUrl
,
""
,
null
);
TermsOfUseJson
resultJson
=
new
TermsOfUseJson
(
response
.
httpResponseBody
);
return
resultJson
.
message
;
}
catch
(
NetworkDisconnectedException
e
)
{
Logger
.
e
(
TAG
,
""
+
e
);
}
catch
(
AcmsException
e
)
{
Logger
.
e
(
TAG
,
""
+
e
);
}
catch
(
Exception
e
)
{
Logger
.
e
(
TAG
,
""
+
e
);
}
return
null
;
}
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/LoginActivity.java
View file @
058b4364
...
...
@@ -280,21 +280,13 @@ public class LoginActivity extends ABVLoginActivity {
// CMSより文言を取得し、ダイアログで表示する。
ContractLogic
logic
=
AbstractLogic
.
getLogic
(
ContractLogic
.
class
);
String
language
=
Locale
.
getDefault
().
getLanguage
();
termsOfUseText
=
logic
.
getTermsOfServiceText
(
termsOfUseUrl
,
language
);
termsOfUseText
=
logic
.
getTermsOfServiceText
(
termsOfUseUrl
);
runOnUiThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
String
messageText
=
getString
(
R
.
string
.
err_gert_term_of_use_text
);
if
(
termsOfUseText
!=
null
)
{
JSONObject
detail_json
=
new
JSONObject
(
termsOfUseText
);
Locale
locale
=
Locale
.
getDefault
();
if
(
locale
.
getLanguage
().
equals
(
"ja"
))
{
messageText
=
detail_json
.
getString
(
"ja"
);
}
else
if
(
locale
.
getLanguage
().
equals
(
"ko"
))
{
messageText
=
detail_json
.
getString
(
"ko"
);
}
else
{
messageText
=
detail_json
.
getString
(
"en"
);
}
messageText
=
termsOfUseText
;
}
AlertDialogUtil
.
showAlertDialog
(
LoginActivity
.
this
,
getString
(
R
.
string
.
error
),
messageText
,
true
,
new
DialogInterface
.
OnClickListener
()
{
@Override
...
...
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