I’m building a product using Two Legged Auth. I’ve got it all working with our server and the Android app with the ParticleDeviceSetupLibrary v0.5.3 and I’m setting the user’s access token on the ParticleCloudSDK library.
My issue is that the device setup activities have a ‘Log Out’ button which, if pressed, brings the user to a login screen that means nothing to them because they don’t actually have a particle login. Thus, I want to remove/hide this button.
I can’t get to the button because it’s buried in the library and I can’t extend the ParticleDeviceSetupLibrary class due to its restrictions. The only other thing I can think of at the moment is to fork the whole (daunting) repo to edit the activities, which seems like a lot of extra work for a relatively small gain as I’m fairly new to Android development and am still confused about DI stuff.
Does anyone have any suggestions on how to do this?
You don’t need to extend or fork the whole repo. You can bypass login/logout by using ParticleDeviceSetupLibrary.initWithSetupOnly instead of ParticleDeviceSetupLibrary.init (the recommended way) or create activity_discover_device.xml layout inside your project, there you can copy and modify our layout used inside setup library.
I was using initWithSetupOnly wrong, and I didn’t quite realise that overriding the layout in my project would work like that. Good to know for other things!
Changing the width and height to 0dp almost works…
@Raimis is there a good way to do this on iOS? I tried setting the initWithSetupOnly option by calling:
if let setupController = ParticleSetupMainController.init(setupOnly: true)
{
setupController.delegate = self //as! UIViewController & ParticleSetupMainControllerDelegate
self.present(setupController, animated: true, completion: nil)
}
Unfortunately, this still has the log out button showing on the device setup process. I’m new to swift programming… so it’s very possible I’m doing something wrong as well.