Fixed twitter status link handler, tested with Chrome.

This commit is contained in:
Yixiao Li 2015-04-25 15:37:15 +09:00
parent c5278f9000
commit fda00c8308
2 changed files with 18 additions and 6 deletions

View File

@ -541,22 +541,28 @@
<intent-filter>
<data
android:host="twitter.com"
android:scheme="http"/>
android:scheme="http"
android:pathPrefix="/"/>
<data
android:host="twitter.com"
android:scheme="https"/>
android:scheme="https"
android:pathPrefix="/"/>
<data
android:host="www.twitter.com"
android:scheme="http"/>
android:scheme="http"
android:pathPrefix="/"/>
<data
android:host="www.twitter.com"
android:scheme="https"/>
android:scheme="https"
android:pathPrefix="/"/>
<data
android:host="mobile.twitter.com"
android:scheme="http"/>
android:scheme="http"
android:pathPrefix="/"/>
<data
android:host="mobile.twitter.com"
android:scheme="https"/>
android:scheme="https"
android:pathPrefix="/"/>
<action android:name="android.intent.action.VIEW"/>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>

View File

@ -133,6 +133,12 @@ public class TwitterLinkHandlerActivity extends Activity implements Constants {
final Uri.Builder builder = new Uri.Builder();
builder.scheme(SCHEME_TWIDERE);
builder.authority(AUTHORITY_STATUS);
// TODO: Must have an account_id but getDefaultAccountId() seems to return -1 always.
long default_account_id = getDefaultAccountId(this);
if (default_account_id == -1) {
default_account_id = Utils.getAccountIds(this)[0];
}
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_ID, String.valueOf(default_account_id));
builder.appendQueryParameter(QUERY_PARAM_STATUS_ID, pathSegments.get(2));
return new Intent(Intent.ACTION_VIEW, builder.build());
}