Refactoring the device module into iOS and android