Skip to content

Commit 9fc0458

Browse files
authored
Merge pull request #207 from IntergalacticPenguin/version/1.1.0
Version 1.1.0 - irecord, aemulator start fix
2 parents b3cbb8a + f7206ab commit 9fc0458

File tree

5 files changed

+100
-19
lines changed

5 files changed

+100
-19
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
🤔 **Check all before merging!**
2-
- [ ] 📈[Project board](https://github.com/IntergalacticPenguin/mobile-toolkit/projects/1) up to date
1+
🚨 **Check all before merging!**
32
- [ ] 🏗 Everything implemented thoroughly
43
- [ ] 🔨 All changes tested
54
- [ ] Change #1

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ _Note: This repository is mainly focused on macOS compatibility, but majority of
200200
* Reboot the device
201201

202202
### 📱 aemulator
203+
**Required**: Make terminal use Android Studio Java
204+
* **Edit .bash_profile** (or .zshrc if you have zsh shell) `open -e ~/.bash_profile` or `open -e ~/.zshrc`
205+
* **Add the following line at the end of the file** `export JAVA_HOME='/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home'`
206+
203207
* Android emulator supports all listed scripts by default + extra actions listed below
204208
* `aeimulator <option>` Handle various Android emulator activites
205209
* `start` - choose and launch installed emulator
@@ -220,8 +224,11 @@ _Note: This repository is mainly focused on macOS compatibility, but majority of
220224
* `iscreenshot -a` Take screenshot on all connected devices
221225

222226
### 🎥 irecord
223-
* Run QuickTime and open video source picker (so you can choose a device right away)
224-
* You may have to allow some system permission, so the script can access the picker
227+
**Required**: Install [videosnap](https://github.com/matthutchinson/videosnap/releases "videosnap") -> download and run `videosnap-0.0.6.pkg`
228+
229+
1. `irecord` Record screen
230+
2. End recording using `ctrl + c`
231+
3. Save screen video footage to ~/Desktop
225232

226233
### 🖼 igif
227234
**Required**: Install [ffmpeg](https://www.ffmpeg.org/ "ffmpeg") `brew install ffmpeg`

android/aemulator

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ help(){
2121
echo -e "Use one of the following options:\\n start - choose and launch installed emulator\\n gprs | edge | 3g - set network latency\\n call <number> - receive fake call\\n sms <number> <text> - recieve fake sms\\n gps <lat> <long> - set manual gps location\\n battery <0-100> - set manual battery level\\n telnet <command> - call telnet command (see README.md)"
2222
}
2323

24+
check_java_dependency(){
25+
if ! java -version &> /dev/null; then
26+
echo "❌ Java not available, edit your .bash_profile or .zshrc to use Android Studio version"
27+
echo "📝 Add the following line: export JAVA_HOME='/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home'"
28+
echo "🔌 Restart terminal afterwards"
29+
exit 1
30+
fi
31+
}
32+
2433
check_running_emulator(){
2534
if ! adb devices | grep emulator &> /dev/null; then
2635
echo "❌ No running emulators"
@@ -64,7 +73,7 @@ launch_emulator(){
6473
launch_emulator
6574
else
6675
echo "🚀 Launching emulator..."
67-
nohup "$ANDROID_HOME"/tools/emulator -avd "$EMULATOR_NAME" -no-snapshot &> /dev/null &
76+
nohup "$ANDROID_HOME"/emulator/emulator -avd "$EMULATOR_NAME" -no-snapshot &> /dev/null &
6877
rm "$LOCAL_EMULATOR_LIST"
6978
fi
7079
}
@@ -163,6 +172,7 @@ disable_network_delay(){
163172
}
164173

165174
check_for_update
175+
check_java_dependency
166176

167177
case $1 in
168178
'start')

changelog.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
🩹 fix iOS device pairing
2-
🩹 fix Android emulator telnet authentication
1+
✨ irecord now works using terminal only!
2+
👏 special thanks to matthutchinson for his videosnap project
3+
👀 see https://github.com/matthutchinson/videosnap
4+
🩹 fix aemulator start for API 29+
5+
🩹 check Java dependency while using aemulator

ios/irecord

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,76 @@
11
#!/bin/bash
2-
echo "📹 Opening QuickTime..."
3-
4-
osascript <<EOD
5-
tell application "QuickTime Player"
6-
activate
7-
set newMovieRecording to new movie recording
8-
end tell
9-
10-
tell application "System Events" to tell process "QuickTime Player"
11-
click button 3 of window 1
12-
end tell
13-
return
2+
LOCATION=$(dirname "$0")
3+
source "$LOCATION"/../common_tools
4+
IOS_DEVICES_LIST=$LOCATION/../data/toolkit_recordable_ios_devices.txt
5+
trap 'ctrlc $@' 1 2 3 6 15
6+
7+
RECORDING=false
8+
cd ~/Desktop || exit
9+
10+
ctrlc(){
11+
if $RECORDING ; then
12+
echo "✅ Saved into ~/Desktop/$FILENAME"
13+
fi
14+
osascript -e 'quit app "QuickTime Player"'
15+
exit
16+
}
17+
18+
check_videosnap_dependency(){ #TODO refactor when videosnap available via Homberew
19+
if ! [ -x "$(command -v "videosnap")" ]; then
20+
echo "💥 \"videosnap\" command required!"
21+
should_proceed "🛒 Install via GitHub? (download and run \"videosnap-0.0.6.pkg\")"
22+
open "https://github.com/matthutchinson/videosnap/releases"
23+
exit 1
24+
fi
25+
}
26+
27+
start_quicktime(){
28+
echo "💡 Starting QuickTime to enable recording (webcam light might turn on)..."
29+
osascript <<EOD
30+
tell application "QuickTime Player"
31+
set newMovieRecording to new movie recording
32+
set miniaturized of window 1 to true
33+
end tell
1434
EOD
35+
}
36+
37+
pick_recording_device(){
38+
echo "⏳ Detecting iOS devices..."
39+
rm -f "$IOS_DEVICES_LIST"
40+
videosnap -l >> "$IOS_DEVICES_LIST"
41+
grep -E -v "Found|FaceTime" "$IOS_DEVICES_LIST" > "$IOS_DEVICES_LIST.tmp" #remove info line and webcam
42+
mv "$IOS_DEVICES_LIST.tmp" "$IOS_DEVICES_LIST"
43+
sed 's/^* //g' "$IOS_DEVICES_LIST" > "$IOS_DEVICES_LIST.tmp" #remove "* " line prefixes
44+
mv "$IOS_DEVICES_LIST.tmp" "$IOS_DEVICES_LIST"
45+
46+
if [ "$(nl "$IOS_DEVICES_LIST")" == "" ]; then
47+
echo "❌ iOS device not detected, reconnect it and try again"
48+
ctrlc
49+
fi
50+
51+
if [ "$(wc -l "$IOS_DEVICES_LIST" | awk '{print $1}')" == "1" ]; then
52+
DEVICE_NAME="$(cat "$IOS_DEVICES_LIST")"
53+
else
54+
echo "📱 Available:"
55+
nl "$IOS_DEVICES_LIST"
56+
read -r -p "📝 Choose: " DEVICE_INDEX
57+
58+
DEVICE_NAME=$(sed "$DEVICE_INDEX"!d "$IOS_DEVICES_LIST")
59+
if [[ $DEVICE_INDEX == "" || $DEVICE_NAME == "" ]]; then
60+
delete_lastline
61+
pick_recording_device
62+
fi
63+
fi
64+
}
65+
66+
start_recording(){
67+
RECORDING=true
68+
FILENAME="$DEVICE_NAME-$(date +%Y-%m-%d-%H-%M-%S).mp4"
69+
echo "📹 Recording screen on $DEVICE_NAME, stop it with ctrl^c"
70+
videosnap -w 0 -p High -d "$DEVICE_NAME" "$FILENAME" &> /dev/null
71+
}
72+
73+
check_videosnap_dependency
74+
start_quicktime
75+
pick_recording_device
76+
start_recording

0 commit comments

Comments
 (0)