Last active
September 18, 2024 19:23
-
-
Save matthamil/4c490d4834dee1fb7db3d7baa141b0da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MOBILE_PROJECT_DIR=~/path/to/project/dir | |
function adbreverse { | |
adb reverse tcp:8081 tcp:8081 | |
} | |
# android only | |
function darkmodeoff { | |
adb shell "cmd uimode night no" | |
} | |
# android only | |
function darkmodeon { | |
adb shell "cmd uimode night yes" | |
} | |
function deeplinkandroid { | |
adb shell am start -a android.intent.action.VIEW -d "$1" | |
} | |
function deeplinkios { | |
xcrun simctl openurl booted "$1" | |
} | |
## | |
# Correct simulator device time. A simulator's device time may become | |
# out of sync when loading from a frozen state instead of a fresh start. | |
function unfucktime { | |
adb -e shell su root date `date +"%m%d%H%M%y"` | |
} | |
function androidstagingdebug { | |
nc -z localhost 8081 && \ | |
adb reverse tcp:8081 tcp:8081 && \ | |
$MOBILE_PROJECT_DIR/android/gradlew buildStagingDebug && \ | |
$MOBILE_PROJECT_DIR/android/gradlew installStagingDebug | |
} | |
function androidstagingrelease { | |
nc -z localhost 8081 && \ | |
adb reverse tcp:8081 tcp:8081 && \ | |
$MOBILE_PROJECT_DIR/android/gradlew buildStagingRelease && \ | |
$MOBILE_PROJECT_DIR/android/gradlew installStagingRelease | |
} | |
## | |
# Opens Android Studio with args | |
# @example open the current directory in Android Studio | |
# studio . | |
# @see https://www.jetbrains.com/help/idea/working-with-the-ide-features-from-command-line.html#standalone | |
function studio { | |
open -na /Applications/Android\ Studio.app/ --args "$@" | |
} | |
# shakes connected Android simulator or device | |
function shake { | |
adb shell input keyevent 82 | |
} | |
# android only | |
function showtouches { | |
adb shell settings put system show_touches 1 | |
} | |
# android only | |
function hidetouches { | |
adb shell settings put system show_touches 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment