Open NghiaTranUIT opened 1 year ago
To count the number of Android Emulators, we can use this alternative approach:
exec()
from NodeJS: https://stackabuse.com/executing-shell-commands-with-node-js/adb devices | grep emulator
Ref: https://github.com/ProxymanApp/Proxyman/issues/1389#issuecomment-1276922896
Ref: https://github.com/ProxymanApp/Proxyman/issues/1389#issuecomment-1277185534
export default function Example() {
return (
<div className="bg-white shadow sm:rounded-lg">
<div className="px-4 py-5 sm:p-6">
<h3 className="text-lg font-medium leading-6 text-gray-900">Manage subscription</h3>
<div className="mt-2 sm:flex sm:items-start sm:justify-between">
<div className="max-w-xl text-sm text-gray-500">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Recusandae voluptatibus corrupti atque
repudiandae nam.
</p>
</div>
<div className="mt-5 sm:mt-0 sm:ml-6 sm:flex sm:flex-shrink-0 sm:items-center">
<button
type="button"
className="inline-flex items-center rounded-md border border-transparent bg-indigo-600 px-4 py-2 font-medium text-white shadow-sm hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 sm:text-sm"
>
Change plan
</button>
</div>
</div>
</div>
</div>
)
}
Description
It's time to support Android Emulator.
Acceptance Criteria
Override Emulator
adb
command is existed -> If not, show the Error Toast (Title = "Android Debug Bridge (adb) not found!", Message = "Proxyman requires \"adb\" command to perform tasks.\n\nIf you have not installed, please consider to install it.\n\nOr Skip if you've had.", First Button = "How to Install", Second Button = "Skip"). Click on "How to Install" will open the website:https://docs.proxyman.io/debug-devices/android-device/automatic-script-for-android-emulator#4.-how-does-it-work
How to check if
adb
command is exist/usr/local/bin/adb --help
(Useexec()
) -> If error -> return false/opt/homebrew/bin/adb --help
stderr
) -> Return TrueNote:
adb
command can be installed in two different places.Revert Emulator
Detect the number of Emulator
As soon as Windows is active -> Check the number of emulator devices
If the user opens the Android Studio -> open new Emulator -> Back to Proxyman -> Should re-run the script
0 Device![Screen_Shot_2022-09-23_at_08_59_14](https://user-images.githubusercontent.com/5878421/191881026-1ab05f06-a4a9-45ac-a9b1-796a073272cf.jpg)
1 Device![Screen_Shot_2022-09-23_at_09_02_06](https://user-images.githubusercontent.com/5878421/191881071-f2c53508-9a4b-42f1-ac66-275b173ca60d.jpg)
How to check
qemu-system
process, check the path if it containsAndroid/sdk/emulator
=> If it's 0 =? Show error toast => Else -> Display the number of devices -> Run the Override Emulator Script
Only Override HTTP Proxy
Override Emulator Script
Revert Emulator Script
How to Test
Override Emulator
Revert Emulator