catch security exception when passing on share intent that didn’t give us permission
This commit is contained in:
parent
c83caad3f5
commit
ecad9cbe3c
|
@ -5,6 +5,7 @@ import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -78,7 +79,12 @@ public class ChooseAccountForProfilePictureActivity extends XmppActivity {
|
||||||
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toString());
|
intent.putExtra(EXTRA_ACCOUNT, account.getJid().asBareJid().toString());
|
||||||
intent.setData(uri);
|
intent.setData(uri);
|
||||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||||
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,12 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, share.text);
|
intent.putExtra(Intent.EXTRA_TEXT, share.text);
|
||||||
intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote);
|
intent.putExtra(ConversationsActivity.EXTRA_AS_QUOTE, share.asQuote);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
Toast.makeText(this, R.string.sharing_application_not_grant_permission, Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -878,4 +878,5 @@
|
||||||
<string name="please_enter_password">Please enter the password for this account</string>
|
<string name="please_enter_password">Please enter the password for this account</string>
|
||||||
<string name="unable_to_perform_this_action">Unable to perform this action</string>
|
<string name="unable_to_perform_this_action">Unable to perform this action</string>
|
||||||
<string name="open_join_dialog">Join public channel…</string>
|
<string name="open_join_dialog">Join public channel…</string>
|
||||||
|
<string name="sharing_application_not_grant_permission">The sharing application did not grant permission to access this file.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue