Commit b195892f by Lee Munkyeong

認証問題対応

parent 60772113
...@@ -18,6 +18,7 @@ import android.net.ConnectivityManager; ...@@ -18,6 +18,7 @@ import android.net.ConnectivityManager;
import android.net.Network; import android.net.Network;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.Uri; import android.net.Uri;
import android.net.http.SslError;
import android.net.wifi.WifiManager; import android.net.wifi.WifiManager;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build; import android.os.Build;
...@@ -32,6 +33,7 @@ import android.webkit.DownloadListener; ...@@ -32,6 +33,7 @@ import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
import android.webkit.JsResult; import android.webkit.JsResult;
import android.webkit.PermissionRequest; import android.webkit.PermissionRequest;
import android.webkit.SslErrorHandler;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import android.webkit.WebChromeClient; import android.webkit.WebChromeClient;
import android.webkit.WebSettings; import android.webkit.WebSettings;
...@@ -363,7 +365,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -363,7 +365,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
}); });
myAlertDialog = dialog; myAlertDialog = dialog;
if (!isFinishing()) { if (!isFinishing() && !message.equals("false")) {
dialog.show(); dialog.show();
} }
result.confirm(); result.confirm();
...@@ -383,7 +385,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -383,7 +385,7 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
} else if (message.equals("error_already_exist_same_user")) { } else if (message.equals("error_already_exist_same_user")) {
message = getString(R.string.msg_error_already_exist_same_room); message = getString(R.string.msg_error_already_exist_same_room);
} else { } else {
message = "Confirm ?"; message = message;
} }
ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name); ABookAlertDialog confirmAlert = AlertDialogUtil.createAlertDialog(ChatWebviewActivity.this, R.string.app_name);
...@@ -522,28 +524,33 @@ public class ChatWebviewActivity extends ParentWebViewActivity { ...@@ -522,28 +524,33 @@ public class ChatWebviewActivity extends ParentWebViewActivity {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
Logger.d("url", "url : " + url); Logger.d("url", "url : " + url);
Uri uri = Uri.parse(url); Uri uri = Uri.parse(url);
String fileName = new File(Objects.requireNonNull(uri.getPath())).getName(); String fileName = new File(Objects.requireNonNull(uri.getPath())).getName();
// イメージをダウンロードする(png, jpg, jpeg, mp4, mov) // イメージをダウンロードする(png, jpg, jpeg, mp4, mov)
if (url.toLowerCase().endsWith(".png") || url.toLowerCase().endsWith(".jpg") || url.toLowerCase().endsWith(".jpeg") if (url.toLowerCase().endsWith(".png") || url.toLowerCase().endsWith(".jpg") || url.toLowerCase().endsWith(".jpeg")
|| url.toLowerCase().endsWith(".mov") || url.toLowerCase().endsWith(".mp4")) { || url.toLowerCase().endsWith(".mov") || url.toLowerCase().endsWith(".mp4")) {
view.loadUrl("javascript:CHAT_UI.showLoadingIndicator()"); view.loadUrl("javascript:CHAT_UI.showLoadingIndicator()");
DownloadManager mdDownloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager mdDownloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
DownloadManager.Request request = new DownloadManager.Request( DownloadManager.Request request = new DownloadManager.Request(
Uri.parse(url)); Uri.parse(url));
File destinationFile = new File(Environment.getExternalStorageDirectory(), fileName); File destinationFile = new File(Environment.getExternalStorageDirectory(), fileName);
request.setDescription("Downloading ..."); request.setDescription("Downloading ...");
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
request.setDestinationUri(Uri.fromFile(destinationFile)); request.setDestinationUri(Uri.fromFile(destinationFile));
assert mdDownloadManager != null; assert mdDownloadManager != null;
mdDownloadManager.enqueue(request); mdDownloadManager.enqueue(request);
} else { // その他のファイルはurlのみ確認 } else { // その他のファイルはurlのみ確認
Logger.d("download ", "download URL :" + url); Logger.d("download ", "download URL :" + url);
}
return false;
} }
return false;
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
} }
}); });
} }
......
...@@ -40,14 +40,14 @@ app_versioncode=1 ...@@ -40,14 +40,14 @@ app_versioncode=1
#cms server #cms server
#acms_address=http://10.0.2.2:8081/acms #acms_address=http://10.0.2.2:8081/acms
#download_server_address=http://10.0.2.2:8081/acms #download_server_address=http://10.0.2.2:8081/acms
acms_address=https://chatdev2.agentec.jp/acms acms_address=https://checkdev1.agentec.jp/acms
download_server_address=https://chatdev2.agentec.jp/acms download_server_address=https://checkdev1.agentec.jp/acms
#acms_address=https://check.abookcloud.com/acms #acms_address=https://check.abookcloud.com/acms
#download_server_address=https://check.abookcloud.com/acms #download_server_address=https://check.abookcloud.com/acms
#syncview server #syncview server
websocket_server_http_url=https://chatdev2.agentec.jp/v1 websocket_server_http_url=https://checkdev1.agentec.jp/v1
websocket_server_ws_url=wss://chatdev2.agentec.jp/v1 websocket_server_ws_url=wss://checkdev1.agentec.jp/v1
#WebSocket debug�o�� #WebSocket debug�o��
websocket_debug=false websocket_debug=false
......
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