Commit ce86c42e by Lee Munkyeong

Merge branch 'features/#29_2/add_src_file' into…

Merge branch 'features/#29_2/add_src_file' into 'features/#29_2/Modify-error-page-on-not-connected-network'

Features/#29 2/add src file

See merge request !79
parents 622a870f 72a92316
<!doctype html>
<html lang="en" style="background: #DBDBDB;">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=0">
<title>Prototype</title>
<link href="./fontawesome/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="./css/bootstrap.min.css">
<link rel="stylesheet" href="./css/lightbox.min.css">
<link rel="stylesheet" href="./css/chat.css">
<script>
const PLATFORM = 'android';
const IS_MOBILE = true;
</script>
</script>
</head>
<body>
<nav class="navbar navbar-expand navbar-dark bg-primary fixed-top flex-md-nowrap p-2 shadow">
<ul class="navbar-nav col-3" id="navbarLeft">
<button class="btn btn-primary" type="button" id="homeButton">
<i class="fa fa-home" style="font-size: 1.6rem;"></i>
</button>
</ul>
<a class="navbar-brand col-6 mr-0 text-truncate titleRoomName text-center" href="#">Error</a>
</nav>
<div class="error-aria">
<img id="errorImg" src="./icon/error_top_icon.svg">
<div id="errorTitle">
<a>ネットワークエラー</a>
</div>
<div id="errorMsg">
ネットワークに接続できませんでした。電波が良いところでもう一度接続してください。
</div>
<button class="bg-primary reload-button" id="reloadButton">更新</button>
<img id="errorEnd" src="./icon/error_footer_img.svg">
</div>
</div>
<script src="./js/libs/jquery-3.3.1.min.js"></script>
<script src="./js/libs/popper.min.js"></script>
<script src="./js/libs/moment.js"></script>
<script src="./js/libs/locale/ko.js" charset="UTF-8"></script>
<script src="./js/libs/locale/ja.js" charset="UTF-8"></script>
<script src="./js/libs/mustache.min.js"></script>
<script src="./js/libs/deparam.js"></script>
<script src="./js/libs/bootstrap.min.js"></script>
<script src="./js/libs/jquery.mark.min.js"></script>
<script src="./js/libs/lightbox.js"></script>
<script src="./js/language.js"></script>
<script src="./js/language_ko.js" charset="UTF-8"></script>
<script src="./js/language_ja.js" charset="UTF-8"></script>
<script src="./js/language_en.js" charset="UTF-8"></script>
<script src="./js/chat-util.js"></script>
<script src="./js/chat-error.js"></script>
</body>
</html>
\ No newline at end of file
jQuery('#homeButton').on('click', function() {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要。
} else if (CHAT_UTIL.isAndroid()) {
android.goHome();
}
});
jQuery('#reloadButton').on('click', function() {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要。
} else if (CHAT_UTIL.isAndroid()) {
android.reload();
}
});
\ No newline at end of file
...@@ -148,7 +148,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -148,7 +148,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
int TYPE_SHOW_TOAST = 1; int TYPE_SHOW_TOAST = 1;
int TYPE_SHOW_ALERT = 2; int TYPE_SHOW_ALERT = 2;
} }
public interface ContentCheckResultType { public interface ContentCheckResultType {
int NETWORK_ERROR = -2; int NETWORK_ERROR = -2;
int ERROR = -1; int ERROR = -1;
...@@ -161,19 +161,19 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -161,19 +161,19 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
sendRegistrationIdToCMS(); sendRegistrationIdToCMS();
activityHandlingHelper = ActivityHandlingHelper.getInstance(); activityHandlingHelper = ActivityHandlingHelper.getInstance();
activityHandlingHelper.setCurrentActivity(this); activityHandlingHelper.setCurrentActivity(this);
} }
private void sendRegistrationIdToCMS() { private void sendRegistrationIdToCMS() {
// Tokenが更新されたか確認 // Tokenが更新されたか確認
if (!PreferenceUtil.getUserPref(this, UserPrefKey.NEED_SEND_TOKEN, false)){ if (!PreferenceUtil.getUserPref(this, UserPrefKey.NEED_SEND_TOKEN, false)){
// 更新されてない // 更新されてない
return; return;
} }
String fcmToken = FirebaseInstanceId.getInstance().getToken(); String fcmToken = FirebaseInstanceId.getInstance().getToken();
boolean isSendSuccess = false; boolean isSendSuccess = false;
// CMSに送信 // CMSに送信
if (getRInteger(R.integer.push_message) == 1 && fcmToken != null) { if (getRInteger(R.integer.push_message) == 1 && fcmToken != null) {
try { try {
...@@ -185,7 +185,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -185,7 +185,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} else { } else {
AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByMacAdress(fcmToken); AbstractLogic.getLogic(UserAuthenticateLogic.class).updateDeviceTokenByMacAdress(fcmToken);
} }
isSendSuccess = true; isSendSuccess = true;
} catch (NetworkDisconnectedException e) { } catch (NetworkDisconnectedException e) {
Logger.w(TAG, "[sendRegistrationIdToCMS] NetworkDisconnectedException"); Logger.w(TAG, "[sendRegistrationIdToCMS] NetworkDisconnectedException");
} catch (Exception e) { } catch (Exception e) {
...@@ -193,7 +193,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -193,7 +193,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
} }
// CMSへ更新した結果をセットする // CMSへ更新した結果をセットする
PreferenceUtil.putUserPref(this, UserPrefKey.NEED_SEND_TOKEN, !isSendSuccess); PreferenceUtil.putUserPref(this, UserPrefKey.NEED_SEND_TOKEN, !isSendSuccess);
} }
...@@ -211,7 +211,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -211,7 +211,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
Initializer.getInstance().init(getABVApplication()); Initializer.getInstance().init(getABVApplication());
} }
validateLoginStatus(); validateLoginStatus();
if (ABVEnvironment.getInstance().acmsAddress == null) { if (ABVEnvironment.getInstance().acmsAddress == null) {
loadAddressIfSaasGeneral(); loadAddressIfSaasGeneral();
} }
...@@ -289,14 +289,14 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -289,14 +289,14 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
* Viewを開始します。 * Viewを開始します。
*/ */
public void startContentViewActivity(Intent intent, long contentId) { public void startContentViewActivity(Intent intent, long contentId) {
// 該当コンテンツが360コンテンツ&直前にある場合、startActivityで移動せず、履歴で残っているActivityをそのまま表示する。 // 該当コンテンツが360コンテンツ&直前にある場合、startActivityで移動せず、履歴で残っているActivityをそのまま表示する。
if (checkPanoContent(contentId) && ActivityHandlingHelper.getInstance().hasPreviousPanoContentId(contentId)) { if (checkPanoContent(contentId) && ActivityHandlingHelper.getInstance().hasPreviousPanoContentId(contentId)) {
finish(); finish();
return; return;
} }
// 直前のActivityにはないが、同じ360コンテンツが存在している場合、それをfinishさせる。 // 直前のActivityにはないが、同じ360コンテンツが存在している場合、それをfinishさせる。
ActivityHandlingHelper.getInstance().deleteExistPanoContentId(contentId); ActivityHandlingHelper.getInstance().deleteExistPanoContentId(contentId);
// コンテンツアラートのサービスオプションがYの時はアラートを表示 // コンテンツアラートのサービスオプションがYの時はアラートを表示
if (AbstractLogic.getLogic(ContractLogic.class).getContentAlert()) { if (AbstractLogic.getLogic(ContractLogic.class).getContentAlert()) {
...@@ -306,17 +306,17 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -306,17 +306,17 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
} }
/** /**
* 360コンテンツ使用可能かのチェック * 360コンテンツ使用可能かのチェック
* バーチャルツアー:OS4.4以上 * バーチャルツアー:OS4.4以上
* 360動画:OS5.0以上 * 360動画:OS5.0以上
* @param contentId * @param contentId
* @return * @return
*/ */
private boolean checkPanoContent(long contentId) { private boolean checkPanoContent(long contentId) {
int ret = ContentViewHelper.getInstance().check360Content(contentId); int ret = ContentViewHelper.getInstance().check360Content(contentId);
return ret == 0 ? false : true; return ret == 0 ? false : true;
} }
private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) { private void contentViewActivityMoveWithContentAlert(final Intent intent, final long contentId, final NaviConsts ABVNavi) {
ContentDto contentDto = contentDao.getContent(contentId); ContentDto contentDto = contentDao.getContent(contentId);
...@@ -510,10 +510,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -510,10 +510,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
configureKeepScreen(); configureKeepScreen();
} }
if (e != null) { if (e != null) {
//新着更新時にログアウトすることで、SIDが取得できなく、例外が発生したときにはトースト非表示 //新着更新時にログアウトすることで、SIDが取得できなく、例外が発生したときにはトースト非表示
if (ABVDataCache.getInstance().getMemberInfo() != null) { if (ABVDataCache.getInstance().getMemberInfo() != null) {
handleError(e); handleError(e);
} }
} }
} }
}); });
...@@ -541,9 +541,9 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -541,9 +541,9 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
try { try {
ContentDto dto = contentDao.getContent(contentId); ContentDto dto = contentDao.getContent(contentId);
if (dto == null) { if (dto == null) {
return ContentCheckResultType.ERROR; return ContentCheckResultType.ERROR;
} }
ContractLogic contractLogic = AbstractLogic.getLogic(ContractLogic.class); ContractLogic contractLogic = AbstractLogic.getLogic(ContractLogic.class);
checkStatus = contentLogic.getContentCheckDeliverable(contentId, dto.resourceVersion); checkStatus = contentLogic.getContentCheckDeliverable(contentId, dto.resourceVersion);
if (checkStatus == ContentCheckResultType.NO_AUTH_DELETE) { if (checkStatus == ContentCheckResultType.NO_AUTH_DELETE) {
...@@ -678,7 +678,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -678,7 +678,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
public void showWifiDisconnectAlert(final int messageId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException { public void showWifiDisconnectAlert(final int messageId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException {
showWifiDisconnectAlert(messageId, R.string.download, positive, negative); showWifiDisconnectAlert(messageId, R.string.download, positive, negative);
} }
public void showWifiDisconnectAlert(final int messageId, final int titleId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException { public void showWifiDisconnectAlert(final int messageId, final int titleId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException {
if(ABVEnvironment.getInstance().networkAdapter.getActiveNetworkType() == ConnectivityManager.TYPE_MOBILE && PreferenceUtil.get(this, DefPrefKey.WIFI_ALERT_ENABLE, true)){ if(ABVEnvironment.getInstance().networkAdapter.getActiveNetworkType() == ConnectivityManager.TYPE_MOBILE && PreferenceUtil.get(this, DefPrefKey.WIFI_ALERT_ENABLE, true)){
handler.post(new Runnable() { handler.post(new Runnable() {
...@@ -737,7 +737,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -737,7 +737,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
protected void setDisplaySize() { protected void setDisplaySize() {
mDisplaySize = DisplayUtil.getDisplaySize2(getApplicationContext()); mDisplaySize = DisplayUtil.getDisplaySize2(getApplicationContext());
Logger.v(TAG, "[Size] display width=%s, height=%s", mDisplaySize.width, mDisplaySize.height); Logger.v(TAG, "[Size] display width=%s, height=%s", mDisplaySize.width, mDisplaySize.height);
} }
...@@ -864,14 +864,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -864,14 +864,8 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
ll_menuItem_chat.setOnClickListener(new View.OnClickListener() { ll_menuItem_chat.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
// チャット利用のはネットワークが繋がる時のみ ActivityHandlingHelper.getInstance().startChatWebviewActivity();
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) { mCommunicationMenuDialog.dismiss();
ActivityHandlingHelper.getInstance().startChatWebviewActivity();
mCommunicationMenuDialog.dismiss();
} else {
ABVToastUtil.showMakeText(getABVApplication().getBaseContext(), R.string.request_network_connection, Toast.LENGTH_SHORT);
return;
}
} }
}); });
} else { } else {
......
...@@ -75,14 +75,18 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -75,14 +75,18 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
if (isNormalSize()) { if (isNormalSize()) {
setPortraitIfNormal(); setPortraitIfNormal();
} }
setContentView(R.layout.chat_webview); setContentView(R.layout.chat_webview);
Intent intent = getIntent(); Intent intent = getIntent();
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl");
//ネットワークがない場合専用のページを表示。
if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
chatWebviewUrl = intent.getStringExtra("chatWebviewUrl");
} else {
chatWebviewUrl = "file:///android_asset/chat/public/index.html";
}
sid = intent.getStringExtra("sid"); sid = intent.getStringExtra("sid");
roomId = intent.getLongExtra("roomId", 0); roomId = intent.getLongExtra("roomId", 0);
roomName = intent.getStringExtra("roomName"); roomName = intent.getStringExtra("roomName");
...@@ -584,6 +588,27 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -584,6 +588,27 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}); });
} }
@JavascriptInterface
public void goHome() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
backToHome();
}
});
}
@JavascriptInterface
public void reload() {
mChatWebView.post(new Runnable() {
@Override
public void run() {
ActivityHandlingHelper.getInstance().startChatWebviewActivity();
}
});
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment