We need to have loaders showing during the API calls. Use the same approach as in mytello, with blocking user actions on the screen during the loader showing.
We need to have loaders showing during the API calls. Use the same approach as in mytello, with blocking user actions on the screen during the loader showing.
There should be 3 methods for devices:
getAllDevices(): we already have this. It should fetch all the devices from the API.
addDevice(): This method should add a new device to API. It should not deal with anything but adding a device.
getDevice(): This should be the method called from the LoginActivity. It should:
1. Check if there is an existing device in shared prefs, then just return it.
2. If there is no device, then make the getAllDevices call, and then the addDevice call, with the logic that we already have.
So the Login activity and it’s ViewModel shouldn’t be aware if the device was created or it already existed.
There should be 3 methods for devices:
getAllDevices(): we already have this. It should fetch all the devices from the API.
addDevice(): This method should add a new device to API. It should not deal with anything but adding a device.
getDevice(): This should be the method called from the LoginActivity. It should:
1. Check if there is an existing device in shared prefs, then just return it.
2. If there is no device, then make the getAllDevices call, and then the addDevice call, with the logic that we already have.
So the Login activity and it's ViewModel shouldn't be aware if the device was created or it already existed.
No need to open the MainActivity yet. Most probably we will still need to get the VPN.conf before going to the main activity.
We need to have loaders showing during the API calls. Use the same approach as in mytello, with blocking user actions on the screen during the loader showing.
Remove this line.
Change the name of this property to reflect which exact header it is.
Rename, tp reflect the method correctly.
There should be 3 methods for devices:
getAllDevices(): we already have this. It should fetch all the devices from the API.
addDevice(): This method should add a new device to API. It should not deal with anything but adding a device.
getDevice(): This should be the method called from the LoginActivity. It should:
1. Check if there is an existing device in shared prefs, then just return it.
2. If there is no device, then make the getAllDevices call, and then the addDevice call, with the logic that we already have.
So the Login activity and it’s ViewModel shouldn’t be aware if the device was created or it already existed.
login() -> isDeviceLoggedIn() -> getAllDevices ->
-> getVPNConf()
-> addDevice() -> getVPNConf()
-> createTunnel() -> SUCCESS -> LoginActivity -> MainActivity
Do we need to have the BaseActivity in Manifest?
Why is the LoginActivity.LOADING_TAG used here?
Put all the hardcoded strings in constants: " “, " : "
Rename the boolean
Check only the IMEI ( Android ID ) with equals
Change magic numbers to constants
Do we need LIveData here?
Rename the flag boolean
Rename isHaveDevice to hasDevice
Rename disposable2 and disposable properties accordingly
Revisores
7dd33ca862
.