Revert "Refactoring"

This reverts commit e2ac96de45.
pull/206/head
M66B 3 years ago
parent e2ac96de45
commit 20a5550fa6

@ -145,6 +145,16 @@
<action android:name="${applicationId}.REFRESH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
<activity
@ -188,19 +198,9 @@
<activity
android:name=".ActivityView"
android:exported="true"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySearch"

@ -144,6 +144,16 @@
<action android:name="${applicationId}.REFRESH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
<activity
@ -187,19 +197,9 @@
<activity
android:name=".ActivityView"
android:exported="true"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySearch"

@ -144,6 +144,16 @@
<action android:name="${applicationId}.REFRESH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
<activity
@ -187,19 +197,9 @@
<activity
android:name=".ActivityView"
android:exported="true"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySearch"

@ -144,6 +144,16 @@
<action android:name="${applicationId}.REFRESH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
<activity
@ -187,19 +197,9 @@
<activity
android:name=".ActivityView"
android:exported="true"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySearch"

@ -51,6 +51,61 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
return;
}
Intent intent = getIntent();
Uri data = (intent == null ? null : intent.getData());
if (data != null &&
"message".equals(data.getScheme()) &&
BuildConfig.APPLICATION_ID.equals(data.getHost())) {
super.onCreate(savedInstanceState);
Bundle args = new Bundle();
args.putParcelable("data", data);
new SimpleTask<EntityMessage>() {
@Override
protected EntityMessage onExecute(Context context, Bundle args) {
Uri data = args.getParcelable("data");
String path = data.getPath();
if (path == null)
return null;
String[] parts = path.split("/");
if (parts.length < 1)
return null;
long id = Long.parseLong(parts[1]);
DB db = DB.getInstance(context);
return db.message().getMessage(id);
}
@Override
protected void onExecuted(Bundle args, EntityMessage message) {
finish();
if (message == null)
return;
Intent thread = new Intent(ActivityMain.this, ActivityView.class);
thread.setAction("thread:" + message.id);
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
thread.putExtra("account", message.account);
thread.putExtra("folder", message.folder);
thread.putExtra("thread", message.thread);
thread.putExtra("filter_archive", true);
thread.putExtra("pinned", true);
thread.putExtra("msgid", message.msgid);
startActivity(thread);
}
@Override
protected void onException(Bundle args, Throwable ex) {
// Ignored
}
}.execute(this, args, "message:linked");
return;
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean eula = prefs.getBoolean("eula", false);
boolean sync_on_launch = prefs.getBoolean("sync_on_launch", false);

@ -1455,54 +1455,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
ServiceUI.sync(this, null);
}
Uri data = intent.getData();
if (data != null &&
"message".equals(data.getScheme()) &&
BuildConfig.APPLICATION_ID.equals(data.getHost())) {
Bundle args = new Bundle();
args.putParcelable("data", data);
new SimpleTask<EntityMessage>() {
@Override
protected EntityMessage onExecute(Context context, Bundle args) {
Uri data = args.getParcelable("data");
String path = data.getPath();
if (path == null)
return null;
String[] parts = path.split("/");
if (parts.length < 1)
return null;
long id = Long.parseLong(parts[1]);
DB db = DB.getInstance(context);
return db.message().getMessage(id);
}
@Override
protected void onExecuted(Bundle args, EntityMessage message) {
if (message == null)
return;
Intent thread = new Intent();
thread.setAction("thread:" + message.id);
thread.putExtra("account", message.account);
thread.putExtra("folder", message.folder);
thread.putExtra("thread", message.thread);
thread.putExtra("filter_archive", true);
thread.putExtra("pinned", true);
thread.putExtra("msgid", message.msgid);
onViewThread(intent);
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(this, args, "message:linked");
return;
}
String action = intent.getAction();
if (action != null) {
if (action.startsWith("unified")) {

@ -145,6 +145,16 @@
<action android:name="${applicationId}.REFRESH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
<activity
@ -188,19 +198,9 @@
<activity
android:name=".ActivityView"
android:exported="true"
android:exported="false"
android:launchMode="singleTask"
android:parentActivityName=".ActivityMain">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="message" />
<data android:host="${applicationId}" />
</intent-filter>
</activity>
android:parentActivityName=".ActivityMain" />
<activity
android:name=".ActivitySearch"

Loading…
Cancel
Save