Changed share links

pull/206/head
M66B 3 years ago
parent 6effe41619
commit 1c4342db7e

@ -146,6 +146,7 @@
</intent-filter>
<intent-filter>
<!-- legacy -->
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
@ -154,6 +155,16 @@
<data android:scheme="message" />
<data android:host="${applicationId}" />
</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="email.faircode.eu" />
</intent-filter>
</activity>
<activity

@ -27,6 +27,7 @@ import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
@ -55,7 +56,8 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
Uri data = (intent == null ? null : intent.getData());
if (data != null &&
"message".equals(data.getScheme()) &&
BuildConfig.APPLICATION_ID.equals(data.getHost())) {
("email.faircode.eu".equals(data.getHost()) ||
BuildConfig.APPLICATION_ID.equals(data.getHost()))) {
super.onCreate(savedInstanceState);
Bundle args = new Bundle();
@ -65,13 +67,19 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
@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]);
long id;
String f = data.getFragment();
if ("email.faircode.eu".equals(data.getHost()))
id = Long.parseLong(data.getFragment());
else {
String path = data.getPath();
if (path == null)
return null;
String[] parts = path.split("/");
if (parts.length < 1)
return null;
id = Long.parseLong(parts[1]);
}
DB db = DB.getInstance(context);
return db.message().getMessage(id);

@ -5237,7 +5237,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (!TextUtils.isEmpty(message.subject))
result.put("subject", message.subject);
String link = "message://" + BuildConfig.APPLICATION_ID + "/" + message.id;
String link = "message://email.faircode.eu/link/#" + message.id;
Document document = JsoupEx.parse(file);
HtmlHelper.truncate(document, HtmlHelper.MAX_FULL_TEXT_SIZE / 2);

Loading…
Cancel
Save