Trigger URL fixes
This commit is contained in:
@@ -115,8 +115,7 @@ public class Actions
|
||||
public static void closeNotification(Action action)
|
||||
{
|
||||
NotificationManager nm = (NotificationManager) Miscellaneous.getAnyContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
// for(StatusBarNotification n : nm.getActiveNotifications())
|
||||
// {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
|
||||
{
|
||||
String[] params = action.getParameter2().split(Action.actionParameter2Split, -1);
|
||||
@@ -193,7 +192,6 @@ public class Actions
|
||||
Miscellaneous.logEvent("i", "NotificationCloseCheck", "NotificationListener instance is null. Can\'t close notification.", 3);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
public static void sendBroadcast(Context context, String action)
|
||||
|
||||
@@ -96,7 +96,6 @@ import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
@@ -127,6 +126,8 @@ import eu.chainfire.libsuperuser.Shell;
|
||||
public class Miscellaneous extends Service
|
||||
{
|
||||
protected static String writeableFolderStringCache = null;
|
||||
protected final static String http_error_string = "HTTP_ERROR";
|
||||
protected final static String last_trigger_url_result_string = "last_trigger_url_result";
|
||||
public static Context startupContext;
|
||||
|
||||
public static final String lineSeparator = System.getProperty("line.separator");
|
||||
@@ -199,7 +200,7 @@ public class Miscellaneous extends Service
|
||||
// immediate deallocation of all system resources
|
||||
httpclient.getConnectionManager().shutdown();
|
||||
if(errorFound)
|
||||
return "httpError";
|
||||
return http_error_string;
|
||||
else
|
||||
return responseBody.toString();
|
||||
}
|
||||
@@ -275,7 +276,7 @@ public class Miscellaneous extends Service
|
||||
catch(Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("e", "HTTP error", Log.getStackTraceString(e), 3);
|
||||
return "httpError";
|
||||
return http_error_string;
|
||||
}
|
||||
// finally
|
||||
// {
|
||||
@@ -853,15 +854,15 @@ public class Miscellaneous extends Service
|
||||
}
|
||||
}
|
||||
|
||||
if(source.contains("[last_trigger_url_result]"))
|
||||
if(source.contains("[" + last_trigger_url_result_string + "]"))
|
||||
{
|
||||
try
|
||||
{
|
||||
source = source.replace("[last_trigger_url_result]", AutomationService.getInstance().getVariableMap().get("last_trigger_url_result"));
|
||||
source = source.replace("[" + last_trigger_url_result_string + "]", AutomationService.getInstance().getVariableMap().get(last_trigger_url_result_string));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Miscellaneous.logEvent("w", "Variable replacement", "Error replacing variable last_trigger_url_result.", 3);
|
||||
Miscellaneous.logEvent("w", "Variable replacement", "Error replacing variable " + last_trigger_url_result_string + ".", 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,18 +36,8 @@ public class NfcReceiver
|
||||
public static NfcAdapter getNfcAdapter(Context context)
|
||||
{
|
||||
if(nfcAdapter == null)
|
||||
{
|
||||
if(Build.VERSION.SDK_INT <= 10)
|
||||
{
|
||||
// NFC not supported until after Gingerbread.
|
||||
Miscellaneous.logEvent("w", "NFC", context.getResources().getString(R.string.nfcNotSupportedInThisAndroidVersionYet), 3);
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
nfcAdapter = NfcAdapter.getDefaultAdapter(context);
|
||||
}
|
||||
}
|
||||
nfcAdapter = NfcAdapter.getDefaultAdapter(context);
|
||||
|
||||
return nfcAdapter;
|
||||
}
|
||||
|
||||
@@ -91,28 +81,6 @@ public class NfcReceiver
|
||||
new NdefReaderTask().execute(tag);
|
||||
}
|
||||
}
|
||||
// else if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action))
|
||||
// {
|
||||
//
|
||||
// // In case we would still use the Tech Discovered Intent
|
||||
// Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
|
||||
// String[] techList = tag.getTechList();
|
||||
// String searchedTech = Ndef.class.getName();
|
||||
//
|
||||
// for (String tech : techList)
|
||||
// {
|
||||
// if (searchedTech.equals(tech))
|
||||
// {
|
||||
// new NdefReaderTask().execute(tag);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // No NFC NDEF intent
|
||||
// Miscellaneous.logEvent("w", "NFC", context.getResources().getString(R.string.nfcNoNdefIntentBut) + " " + action + ".", 5);
|
||||
// }
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@@ -334,15 +302,7 @@ public class NfcReceiver
|
||||
|
||||
return false;
|
||||
}
|
||||
else if(Build.VERSION.SDK_INT <= 10)
|
||||
{
|
||||
// NFC not supported until after Gingerbread.
|
||||
if(showErrorMessage)
|
||||
Toast.makeText(context, context.getResources().getString(R.string.nfcNotSupportedInThisAndroidVersionYet), Toast.LENGTH_LONG).show();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user