a quick fix for problems caused by getDefaultAccountId(), such as https://twitter.com/mariotaku can't be opened from a browser correctly.
This commit is contained in:
parent
fda00c8308
commit
d8bf7e391f
|
@ -133,12 +133,6 @@ 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());
|
||||
}
|
||||
|
|
|
@ -1700,7 +1700,9 @@ public final class Utils implements Constants, TwitterConstants {
|
|||
public static long getDefaultAccountId(final Context context) {
|
||||
if (context == null) return -1;
|
||||
final SharedPreferences prefs = context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||
return prefs.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
|
||||
long account_id = prefs.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
|
||||
if (account_id == -1) account_id = Utils.getAccountIds(context)[0]; /* TODO: this is just a quick fix */
|
||||
return account_id;
|
||||
}
|
||||
|
||||
public static String getDefaultAccountScreenName(final Context context) {
|
||||
|
|
Loading…
Reference in New Issue