mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-11 06:33:29 +00:00
Refactoring
This commit is contained in:
parent
475814dad8
commit
297c09c129
3 changed files with 13 additions and 7 deletions
|
@ -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…
Add table
Reference in a new issue