Skip to content

Commit

Permalink
UM-5572 and UM-5573 :: Mobile APK file upload issue fixed, which will…
Browse files Browse the repository at this point in the history
…… (#5442) (#79)

UM-5572 and UM-5573 :: Mobile APK file upload issue fixed, which will accept the all files to upload into the system  (#5441)

* apk generation

* dev env

* fix for the apk upload pdf

This reverts commit 3acffa7cfb5fc07b93dfa5a4fcde3c7b6bafeba3.

* Updated the urls and generated the APKS also fixed the file type as anything

* temp issue fix

* Update MainActivity.java
  • Loading branch information
jagankumar-egov authored Apr 22, 2023
1 parent de0977b commit 0fd131e
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 25 deletions.
25 changes: 12 additions & 13 deletions frontend/mono-ui/web/rainmaker-webview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:7.0.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down Expand Up @@ -67,16 +67,14 @@ android {
minSdkVersion 19
applicationId 'org.egovernment.mseva.citizen'
targetSdkVersion 26
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
versionCode 14
versionName '2.3.0'
resValue "string", "app_name", "mSeva-Punjab"
resValue "string", "app_name", "mSeva-Citizen-DEV"
resValue "string", "launcher_icon", "@mipmap/ic_launcher_citizen"
signingConfig signingConfigs.Citizen

// Production
buildConfigField 'String', 'url', '"https://mseva.lgpunjab.gov.in/citizen/user/register"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
buildConfigField 'String', 'url', '"https://dev.digit.org/citizen/user/register"'
buildConfigField 'String', 'gatewayHost', '"test.ccavenue.com"'
}
EmployeeProd {
minSdkVersion 19
Expand Down Expand Up @@ -104,8 +102,8 @@ android {
resValue "string", "launcher_icon", "@mipmap/ic_launcher_citizen"
signingConfig signingConfigs.Citizen

buildConfigField 'String', 'url', '"https://dev.digit.org/citizen/user/register"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
buildConfigField 'String', 'url', '"https://dev.digit.org/digit-ui/citizen"'
buildConfigField 'String', 'gatewayHost', '"test.ccavenue.com"'
}
EmployeeDEV {
minSdkVersion 19
Expand All @@ -118,7 +116,7 @@ android {
resValue "string", "launcher_icon", "@mipmap/ic_launcher_employee"
signingConfig signingConfigs.Employee

buildConfigField 'String', 'url', '"https://dev.digit.org/employee/user/login"'
buildConfigField 'String', 'url', '"https://dev.digit.org/digit-ui/employee"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
}
CitizenQA{
Expand All @@ -132,7 +130,7 @@ android {
resValue "string", "launcher_icon", "@mipmap/ic_launcher_citizen"
signingConfig signingConfigs.Citizen

buildConfigField 'String', 'url', '"https://qa.digit.org/citizen/user/register"'
buildConfigField 'String', 'url', '"https://qa.digit.org/digit-ui/citizen"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
}
EmployeeQA {
Expand All @@ -146,7 +144,7 @@ android {
resValue "string", "launcher_icon", "@mipmap/ic_launcher_employee"
signingConfig signingConfigs.Employee

buildConfigField 'String', 'url', '"https://qa.digit.org/employee/user/login"'
buildConfigField 'String', 'url', '"https://qa.digit.org/digit-ui/employee"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
}
CitizenUAT{
Expand All @@ -160,7 +158,7 @@ android {
resValue "string", "launcher_icon", "@mipmap/ic_launcher_citizen"
signingConfig signingConfigs.Citizen

buildConfigField 'String', 'url', '"https://uat.digit.org/citizen/user/register"'
buildConfigField 'String', 'url', '"https://uat.digit.org/digit-ui/citizen"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
}
EmployeeUAT {
Expand All @@ -174,7 +172,7 @@ android {
resValue "string", "launcher_icon", "@mipmap/ic_launcher_employee"
signingConfig signingConfigs.Employee

buildConfigField 'String', 'url', '"https://uat.digit.org/employee/user/login"'
buildConfigField 'String', 'url', '"https://uat.digit.org/digit-ui/employee"'
buildConfigField 'String', 'gatewayHost', '"migs.mastercard.co.in"'
}
CitizenSTAGING{
Expand Down Expand Up @@ -212,3 +210,4 @@ dependencies {
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-base:15.0.1'
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Sep 12 18:02:38 IST 2019
#Mon Jan 23 10:17:12 IST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
zipStoreBase=GRADLE_USER_HOME
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="staging.digit.org"
android:host="qa.digit.org"
android:pathPattern=".*"
android:pathPrefix="/" /> <!-- if you want only a specific directory from your website to be opened in the app through external links -->
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ public void downloadBase64File(String base64Data, String filename) throws IOExce
os = new FileOutputStream(dwldsPath, false);
os.write(pdfAsBytes);
}catch (Exception e){
Log.v("Error while creating temp report.");
}finally {
os.flush();
os.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.view.KeyEvent;
import android.view.View;
import android.view.WindowManager;
import android.webkit.ConsoleMessage;
import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.URLUtil;
Expand Down Expand Up @@ -78,7 +79,7 @@ public class MainActivity extends AppCompatActivity {

final private int REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS = 124;
private static String URL =BuildConfig.url;
private String FILE_TYPE = "image/*"; //to upload any file type using "*/*"; check file type references for more
private String FILE_TYPE = "*/*"; //to upload any file type using "*/*"; check file type references for more
public static String HOST = getHost(URL);

//Careful with these variable names if altering
Expand Down Expand Up @@ -168,9 +169,10 @@ protected void onCreate(Bundle savedInstanceState) {
//Move this to Javascript Proxy

webView = (WebView) findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(false);
webView.getSettings().setJavaScriptEnabled(true);
webView.addJavascriptInterface(proxy, "mSewaApp");


String versionName = "";
int versionCode = 0;
try {
Expand All @@ -185,7 +187,7 @@ protected void onCreate(Bundle savedInstanceState) {
WebSettings webSettings = webView.getSettings();

webSettings.setUserAgentString(webSettings.getUserAgentString() + " mSewa V." + versionName + "." + versionCode);
webSettings.setJavaScriptEnabled(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setGeolocationEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowFileAccessFromFileURLs(true);
Expand Down Expand Up @@ -270,7 +272,11 @@ public void onDownloadStart(String url, String userAgent,

webView.setWebChromeClient(new WebChromeClient() {
// handling geolocation

@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
android.util.Log.d("WebView", consoleMessage.message());
return true;
}
@Override
public void onGeolocationPermissionsShowPrompt(final String origin, final GeolocationPermissions.Callback callback) {

Expand Down Expand Up @@ -423,7 +429,7 @@ public boolean url_actions(WebView view, String url){
boolean returnValue = true;
//Show toast error if not connected to the network
if (!DetectConnection.isInternetAvailable(MainActivity.this)) {
Toast.makeText(getApplicationContext(), "Please check your Network Connection!", Toast.LENGTH_SHORT).show();
// Toast.makeText(getApplicationContext(), "Please check your Network Connection!", Toast.LENGTH_SHORT).show();

//Use this in a hyperlink to redirect back to default URL :: href="refresh:android"
} else if (url.startsWith("refresh:")) {
Expand Down Expand Up @@ -553,6 +559,7 @@ public boolean check_permission(int permission){
return false;
}


private void showFileDialog(){
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
Expand Down Expand Up @@ -594,8 +601,10 @@ private File create_image() throws IOException {
@SuppressLint("SimpleDateFormat")
String file_name = new SimpleDateFormat("yyyy_mm_ss").format(new Date());
String new_name = "file_"+file_name+"_";
File sd_directory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
return File.createTempFile(new_name, ".jpg", sd_directory);
final File root = new File(Environment.getExternalStorageDirectory() + File.separator + "MyDir" + File.separator);
root.mkdirs();
//File sd_directory = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
return File.createTempFile(new_name, ".jpg", root);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
<external-path name="external" path="."/>
<external-path name="Download" path="Download/"/>
</paths>

0 comments on commit 0fd131e

Please sign in to comment.