How BlackBerry went from defining smartphones to losing the market