Refactoring

pull/187/head
M66B 4 years ago
parent 475814dad8
commit 297c09c129

@ -396,7 +396,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
super.startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException ex) {
Log.w(ex);
if (Helper.isTnef(intent.getType()))
if (Helper.isTnef(intent.getType(), null))
Helper.viewFAQ(this, 155);
else
ToastEx.makeText(this, getString(R.string.title_no_viewer, intent), Toast.LENGTH_LONG).show();

@ -517,7 +517,7 @@ public class Helper {
// Check if viewer available
if (ris == null || ris.size() == 0) {
if (isTnef(type))
if (isTnef(type, null))
viewFAQ(context, 155);
else {
String message = context.getString(R.string.title_no_viewer,
@ -530,10 +530,17 @@ public class Helper {
context.startActivity(intent);
}
static boolean isTnef(String type) {
static boolean isTnef(String type, String name) {
// https://en.wikipedia.org/wiki/Transport_Neutral_Encapsulation_Format
return ("application/ms-tnef".equals(type) ||
"application/vnd.ms-tnef".equals(type));
if ("application/ms-tnef".equals(type) ||
"application/vnd.ms-tnef".equals(type))
return true;
if ("application/octet-stream".equals(type) &&
"winmail.dat".equals(name))
return true;
return false;
}
static void view(Context context, Intent intent) {

@ -1941,8 +1941,7 @@ public class MessageHelper {
downloadAttachment(context, index, local);
if (Helper.isTnef(local.type) ||
("application/octet-stream".equals(local.type) && "winmail.dat".equals(local.name)))
if (Helper.isTnef(local.type, local.name))
decodeTNEF(context, local);
}

Loading…
Cancel
Save