forcedotcom / SalesforceMobileSDK-Android

Android SDK for Salesforce
Other
339 stars 384 forks source link

@W-15547113: [MSDK Android] Crash When Returning To Login View From Server Picker View #2551

Closed JohnsonEricAtSalesforce closed 2 months ago

JohnsonEricAtSalesforce commented 2 months ago

🎸 Ready For Review 🥁

This resolves what looks like an easy-to-fix crash when returning to login from the server picker. The crash is due to startActivity being called on a Context reference that isn't always an Activity instance. Since the method is already ServerPickerActivity, calling startActivity on this seems like it'd do just what the exception is asking for.

@brandonpage - Does this align with the comment in this method?

brandonpage commented 2 months ago

I must have been asleep that day since I just copied over the startActivity code from BiometricAuthenticationManager, which isn't an Activity but uses Intent.FLAG_ACTIVITY_NEW_TASK to avoid this crash. I removed the new task flag because this is an activity... but forgot to use it's own context 🤦.