#!/bin/bash

#remove old droidbuddy app from user gazlene that used to be installed by this app
sudo rm -rf /opt/droidbuddy /usr/share/applications/androidbuddy.desktop

install_packages adb gvfs-backends rustc cargo || exit 1

"${DIRECTORY}/manage" install-if-not-installed Scrcpy || exit 1
#Remove scrcpy menu button
sudo rm -f /usr/share/applications/scrcpy.desktop

#download to home folder so androidbuddy can auto-update going forward
cd ~/.local/share
git_clone https://github.com/Botspot/androidbuddy || exit 1
cd

status -n "Running androidbuddy install script... "
~/.local/share/androidbuddy/main.sh install || error "AndroidBuddy install script failed, please refer to errors above."
status_green Done
