diff --git a/mobile/AndroidManifest.xml b/mobile/AndroidManifest.xml index 4b6d73ce..57c7693b 100644 --- a/mobile/AndroidManifest.xml +++ b/mobile/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="40" + android:versionName="0.5.6"> { +public class CheckHttpResponse extends AsyncTask { private IITC_JSInterface mJsInterface; + private Context mContext; - public CheckHttpResponse(IITC_JSInterface jsInterface) { + public CheckHttpResponse(IITC_JSInterface jsInterface, Context c) { + mContext = c; mJsInterface = jsInterface; }; @Override - protected Void doInBackground(String... urls) { + protected Boolean doInBackground(String... urls) { // check http responses and disable splash screen on error HttpGet httpRequest = new HttpGet(urls[0]); HttpClient httpclient = new DefaultHttpClient(); @@ -38,11 +45,52 @@ public class CheckHttpResponse extends AsyncTask { if (code != HttpStatus.SC_OK) { Log.d("iitcm", "received error code: " + code); mJsInterface.removeSplashScreen(); + // TODO: remove when google login issue is fixed + if (urls[0].contains("uberauth=WILL_NOT_SIGN_IN")) { + return true; + } } } catch (IOException e) { e.printStackTrace(); } - return null; + return false; } + /* + * TEMPORARY WORKAROUND for Google login fail + */ + @Override + protected void onPostExecute(Boolean aBoolean) { + if (aBoolean) { + Log.d("iitcm", "google auth error, redirecting to work-around page"); + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(mContext); + + // set title + alertDialogBuilder.setTitle("LOGIN FAILED!"); + + // set dialog message + alertDialogBuilder + .setMessage("This is caused by Google and hopefully fixed soon. " + + "To workaround this issue:\n" + + "• Choose 'Cancel' when asked to choose an account " + + "and manually enter your email address and password into the web page\n" + + "• If you don't see the account chooser, delete apps cache/data " + + "to force a new login session and handle it as described above") + .setCancelable(true) + .setNeutralButton("Reload now", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.cancel(); + IITC_Mobile iitc_mobile = (IITC_Mobile) mContext; + iitc_mobile.reloadIITC(); + } + }); + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + // show it + alertDialog.show(); + } + } }