2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-10-31 09:20:23 +00:00

turn nanodroid_play into an array for better code

This commit is contained in:
Christopher Roy Bratusek 2018-11-27 19:48:00 +01:00
parent 3e0db08a73
commit 6d5686ee88
3 changed files with 63 additions and 58 deletions

View File

@ -810,64 +810,50 @@ install_apps () {
}
install_store () {
NANODROID_APP_STORE=""
NANODROID_REM_STORE=""
STORE_APPNAME=""
STORE_CHOICE=${nanodroid_play[0]}
FAKE_STORE=${nanodroid_play[1]}
[ "${FAKE_STORE}" -eq 1 ] && STORE_CONFLICT="Phonesky" || STORE_CONFLICT=""
# install Yalp Store or Play Store whichever requested
case "${nanodroid_play}" in
0 )
ui_print " << without App Store"
;;
case "${STORE_CHOICE}" in
1 )
ui_print " << with Play Store"
NANODROID_APP_STORE="Phonesky"
NANODROID_REM_STORE="FakeStore"
STORE_APPNAME="Phonesky"
# force unselect Fake Store when user has choosen Play Store
STORE_CONFLICT="FakeStore"
FAKE_STORE=0
nanodroid_install_file etc/default-permissions/phonesky-permissions.xml
;;
2 )
ui_print " << with Yalp Store"
NANODROID_APP_STORE="YalpStore"
NANODROID_REM_STORE=""
STORE_APPNAME="YalpStore"
;;
3 )
ui_print " << with Aurora Store"
NANODROID_APP_STORE="AuroraStore"
NANODROID_REM_STORE=""
;;
4 )
ui_print " << with Fake Store"
NANODROID_APP_STORE="FakeStore"
NANODROID_REM_STORE="Phonesky"
;;
5 )
ui_print " << with Yalp Store and Fake Store"
NANODROID_APP_STORE="YalpStore FakeStore"
NANODROID_REM_STORE="Phonesky"
;;
6 )
ui_print " << with Aurora Store and Fake Store"
NANODROID_APP_STORE="AuroraStore FakeStore"
NANODROID_REM_STORE="Phonesky"
STORE_APPNAME="AuroraStore"
;;
esac
if [ ! -z "${NANODROID_APP_STORE}" ]; then
for app in ${NANODROID_APP_STORE}; do
nanodroid_install_apk ${app}
done
if [ ! -z "${STORE_APPNAME}" ]; then
ui_print " << with ${STORE_APPNAME}"
nanodroid_install_apk "${STORE_APPNAME}"
else
ui_print " << without App Store"
fi
if [ ! -z "${NANODROID_REM_STORE}" ]; then
for app in ${NANODROID_REM_STORE}; do
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}
done
if [ "${FAKE_STORE}" -eq 1 ]; then
ui_print " << with Fake Store"
nanodroid_install_apk FakeStore
else ui_print " << without Fake Store"
fi
if [ ! -z "${STORE_CONFLICT}" ]; then
${NANODROID_BINDIR}/nanodroid-overlay --add ${STORE_CONFLICT}
if [ "${NANODROID_UPGRADE}" -eq 0 ]; then
rm -rf /data/data/com.android.vending
@ -1363,7 +1349,23 @@ check_cfg_setup () {
[ -z "${nanodroid_microg}" ] && set_prop nanodroid_microg 1
[ -z "${nanodroid_gmscore}" ] && set_prop nanodroid_gmscore 0
[ -z "${nanodroid_apps}" ] && set_prop nanodroid_apps 1
[ -z "${nanodroid_play}" ] && set_prop nanodroid_play 1
[ -z "${nanodroid_play}" ] && set_prop nanodroid_play "(1 0)"
# in NanoDroid <= 20.2 nanodroid_play is an integer
# starting with 20.3 it's an array, migrate the value
if [ "${#nanodroid_play[@]}" -eq 1 ]; then
case "${nanodroid_play}" in
0 ) tmp_prop="(0 0)"
1 ) tmp_prop="(1 0)"
2 ) tmp_prop="(2 0)"
3 ) tmp_prop="(0 1)"
4 ) tmp_prop="(2 1)"
esac
sed -e '/^nanodroid_nlpbackend/d' -i "${cfg_setup}"
set_prop nanodroid_nlpbackend "${tmp_prop}"
fi
if [ "${MODID}" = "NanoDroid" ]; then
[ -z "${nanodroid_overlay}" ] && set_prop nanodroid_overlay 1
@ -1381,7 +1383,7 @@ check_cfg_setup () {
# in NanoDroid <= 20.2 nanodroid_nlpbackend is an integer
# starting with 20.3 it's an array, migrate the value
if [ "${#nanodroid_nlpbackend[0]}" -eq 1 ]; then
if [ "${#nanodroid_nlpbackend[@]}" -eq 1 ]; then
case "${nanodroid_nlpbackend}" in
0 ) tmp_prop="(0 0 0)"
1 ) tmp_prop="(1 0 0)"

View File

@ -20,7 +20,7 @@ nanodroid_microg=1
nanodroid_gmscore=0
nanodroid_fdroid=1
nanodroid_apps=1
nanodroid_play=1
nanodroid_play=(1 0)
nanodroid_overlay=1
nanodroid_zelda=1
nanodroid_mapsv1=1
@ -40,7 +40,7 @@ the **microG** package supports the following options (nanodroid_microg is alway
```
nanodroid_gmscore=0
nanodroid_play=1
nanodroid_play=(1 0)
nanodroid_overlay=0
nanodroid_mapsv1=1
nanodroid_gsync=0
@ -93,14 +93,17 @@ whether to override an already existing app.
`0` means that a ROM app is preferred against a NanoDroid app, where `1` means the NanoDroid app is prefered. This applies to included applications [> Details](doc/Applications.md)
`nanodroid_play=[0|1|2|3|4]`
`nanodroid_play=([0|1|2|3] [0|1])`
what app store to use:
* `0` will not provide any app store
* `1` will provide **Play Store**
* `2` will provide **Yalp Store**
* `3` will provide **Fake Store**
* `4` will provide **Yalp Store** and **Fake Store**
* 1st item
* 0 = No App Store
* 1 = Play Store
* 2 = Yalp Store
* 3 = Aurora Store
* 2nd item
* 0 = without Fake Store
* 1 = with Fake Store
`nanodroid_overlay=[0|1]`

View File

@ -101,25 +101,25 @@ setup_add 14 nanodroid_override
if grep -q "selected.1=1" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [None]"
echo "nanodroid_play=0" >> "${nanodroid_setup}"
echo "nanodroid_play=(0 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=2" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Play Store]"
echo "nanodroid_play=1" >> "${nanodroid_setup}"
echo "nanodroid_play=(1 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=3" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Yalp Store]"
echo "nanodroid_play=2" >> "${nanodroid_setup}"
echo "nanodroid_play=(2 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=4" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Aurora Store]"
echo "nanodroid_play=3" >> "${nanodroid_setup}"
echo "nanodroid_play=(3 0)" >> "${nanodroid_setup}"
elif grep -q "selected.1=5" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Fake Store]"
echo "nanodroid_play=4" >> "${nanodroid_setup}"
echo "nanodroid_play=(0 1)" >> "${nanodroid_setup}"
elif grep -q "selected.1=6" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Yalp + Fake Store]"
echo "nanodroid_play=5" >> "${nanodroid_setup}"
echo "nanodroid_play=(2 1)" >> "${nanodroid_setup}"
elif grep -q "selected.1=7" "${store_prop}"; then
ui_print " <>> setting property: nanodroid_play [Aurora + Fake Store]"
echo "nanodroid_play=6" >> "${nanodroid_setup}"
echo "nanodroid_play=(3 1)" >> "${nanodroid_setup}"
fi
if grep -q "item.1.1=1" "${nlp_prop}"; then