<commit_before>#!/bin/bash
echo ">> Capturing Module App Screenshot '$@'...";

if [[ "$#" -ne 3 ]]; then
    echo "> Wrong $# parameters '$@'!";
    echo "- Ex: 'app-android: ../commons-android/pub/module-app-screenshot.sh en-US phone 1'";
    echo "- Ex: 'app-android: ../commons-android/pub/module-app-screenshot.sh fr-FR phone 2'";
    exit 1;
fi

LANG=$1;
TYPE=$2;
NUMBER=$3;

DEBUG=false;
# DEBUG=true; # DEBUG

DEVICE_REBOOT_ALLOWED=false;
# DEVICE_REBOOT_ALLOWED=true; # use to switch time format (12/24), time-zone...

if [[ -z "${LANG}" ]]; then
    echo "> No lang provided '$LANG'!";
    exit 1;
fi
if [[ -z "${TYPE}" ]]; then
    echo "> No device type provided '$TYPE'!";
    exit 1;
fi
if [[ -z "${NUMBER}" ]]; then
    echo "> No screenshot number provided '$NUMBER'!";
    exit 1;
fi
echo " - lang: '$LANG'";
echo " - type: '$TYPE'";
echo " - number: '$NUMBER'";

if [[ "${LANG}" != "en-US" && "${LANG}" != "fr-FR" ]]; then
    echo "> Invalid lang provided '$LANG'!";
    exit 1;
fi

if [[ "${TYPE}" != "phone" ]]; then
    echo "> Invalid type provided '$TYPE'!";
    exit 1;
fi

DEST_DIR="src/main/play/listings/$LANG/graphics/$TYPE-screenshots";

if [ ! -d $DEST_DIR ]; then
    echo "> Destination directory does NOT exist '$DEST_DIR'!";
    exit 1;
fi
DEST_PATH="$DEST_DIR/$FILE_NAME";
echo " - destination: '$DEST_PATH'";

MAIN_PKG="org.mtransit.android";
if [ "$DEBUG" = true ] ; then
    MAIN_PKG="$MAIN_PKG.debug"; #DEBUG
fi
SPLASH_SCREEN_ACTIVITY="org.mtransit.android.ui.SplashScreenActivity";

MAIN_DIR=src/main;
DEBUG_DIR=src/debug;
RES_DIR=$MAIN_DIR/res;
DEBUG_RES_DIR=$DEBUG_DIR/res;

ANDROID_MANIFEST_FILE=$MAIN_DIR/AndroidManifest.xml;
if [ "$DEBUG" = true ] ; then
    ANDROID_MANIFEST_FILE=$DEBUG_DIR/AndroidManifest.xml;
fi
MODULE_PKG="";
if [ -f $ANDROID_MANIFEST_FILE ]; then
    echo " - android manifest: '$ANDROID_MANIFEST_FILE'.";
    MODULE_PKG=$(grep -E "package=\"(.*)+\"$" $ANDROID_MANIFEST_FILE | cut -d "\"" -f2 | cut -d "\"" -f1);
    # echo "MODULE_PKG: $MODULE_PKG.";
else
    echo " > No android manifest file! (file:$ANDROID_MANIFEST_FILE)";
    exit -1;
fi
if [[ -z "${MODULE_PKG}" ]]; then
    echo "> No module APK found '$MODULE_PKG'!";
    exit 1;
fi

AGENCY_RTS_FILE=$RES_DIR/values/gtfs_rts_values_gen.xml;
AGENCY_BIKE_FILE=$RES_DIR/values/bike_station_values.xml;
AGENCY_TIME_ZONE="";
if [ -f $AGENCY_RTS_FILE ]; then
    echo " - agency file: '$AGENCY_BIKE_FILE'.";
    AGENCY_TIME_ZONE=$(grep -E "<string name=\"gtfs_rts_timezone\">(.*)+</string>$" $AGENCY_RTS_FILE | cut -d ">" -f2 | cut -d "<" -f1);
    AGENCY_RTS_FILE=$RES_DIR/values/gtfs_rts_values.xml;
    if [ "$DEBUG" = true ] ; then
        AGENCY_RTS_FILE=$DEBUG_RES_DIR/values/gtfs_rts_values.xml;
    fi
    FILTER_AGENCY_AUTHORIY=$(grep -E "<string name=\"gtfs_rts_authority\">(.*)+</string>$" $AGENCY_RTS_FILE | cut -d ">" -f2 | cut -d "<" -f1);
elif [ -f $AGENCY_BIKE_FILE ]; then<commit_msg>"package¨ removed from AndroidManifest.xml > fix module app screenshot script<commit_after>#!/bin/bash
echo ">> Capturing Module App Screenshot '$@'...";

if [[ "$#" -ne 3 ]]; then
    echo "> Wrong $# parameters '$@'!";
    echo "- Ex: 'app-android: ../commons-android/pub/module-app-screenshot.sh en-US phone 1'";
    echo "- Ex: 'app-android: ../commons-android/pub/module-app-screenshot.sh fr-FR phone 2'";
    exit 1;
fi

LANG=$1;
TYPE=$2;
NUMBER=$3;

DEBUG=false;
# DEBUG=true; # DEBUG

DEVICE_REBOOT_ALLOWED=false;
# DEVICE_REBOOT_ALLOWED=true; # use to switch time format (12/24), time-zone...

if [[ -z "${LANG}" ]]; then
    echo "> No lang provided '$LANG'!";
    exit 1;
fi
if [[ -z "${TYPE}" ]]; then
    echo "> No device type provided '$TYPE'!";
    exit 1;
fi
if [[ -z "${NUMBER}" ]]; then
    echo "> No screenshot number provided '$NUMBER'!";
    exit 1;
fi
echo " - lang: '$LANG'";
echo " - type: '$TYPE'";
echo " - number: '$NUMBER'";

if [[ "${LANG}" != "en-US" && "${LANG}" != "fr-FR" ]]; then
    echo "> Invalid lang provided '$LANG'!";
    exit 1;
fi

if [[ "${TYPE}" != "phone" ]]; then
    echo "> Invalid type provided '$TYPE'!";
    exit 1;
fi

DEST_DIR="src/main/play/listings/$LANG/graphics/$TYPE-screenshots";

if [ ! -d $DEST_DIR ]; then
    echo "> Destination directory does NOT exist '$DEST_DIR'!";
    exit 1;
fi
DEST_PATH="$DEST_DIR/$FILE_NAME";
echo " - destination: '$DEST_PATH'";

MAIN_PKG="org.mtransit.android";
if [ "$DEBUG" = true ] ; then
    MAIN_PKG="$MAIN_PKG.debug"; #DEBUG
fi
SPLASH_SCREEN_ACTIVITY="org.mtransit.android.ui.SplashScreenActivity";

MAIN_DIR=src/main;
DEBUG_DIR=src/debug;
RES_DIR=$MAIN_DIR/res;
DEBUG_RES_DIR=$DEBUG_DIR/res;
CONFIG_DIR=config;

CONFIG_PKG_FILE=$CONFIG_DIR/pkg;
MODULE_PKG="";
if [ -f $CONFIG_PKG_FILE ]; then
    echo " - PKG config: '$CONFIG_PKG_FILE'.";
    MODULE_PKG=$(cat $CONFIG_PKG_FILE);
else
    echo " > No PKG config file! (file:$CONFIG_PKG_FILE)";
    exit -1;
fi
if [[ -z "${MODULE_PKG}" ]]; then
    echo "> No module APK found '$MODULE_PKG'!";
    exit 1;
fi

AGENCY_RTS_FILE=$RES_DIR/values/gtfs_rts_values_gen.xml;
AGENCY_BIKE_FILE=$RES_DIR/values/bike_station_values.xml;
AGENCY_TIME_ZONE="";
if [ -f $AGENCY_RTS_FILE ]; then
    echo " - agency file: '$AGENCY_BIKE_FILE'.";
    AGENCY_TIME_ZONE=$(grep -E "<string name=\"gtfs_rts_timezone\">(.*)+</string>$" $AGENCY_RTS_FILE | cut -d ">" -f2 | cut -d "<" -f1);
    AGENCY_RTS_FILE=$RES_DIR/values/gtfs_rts_values.xml;
    if [ "$DEBUG" = true ] ; then
        AGENCY_RTS_FILE=$DEBUG_RES_DIR/values/gtfs_rts_values.xml;
    fi
    FILTER_AGENCY_AUTHORIY=$(grep -E "<string name=\"gtfs_rts_authority\">(.*)+</string>$" $AGENCY_RTS_FILE | cut -d ">" -f2 | cut -d "<" -f1);
elif [ -f $AGENCY_BIKE_FILE ]; then
{'fraction_non_alphanumeric': 0.1936619718309859, 'fraction_numerical': 0.008450704225352112, 'mean_word_length': 3.94, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 38, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 11}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '942317', 'n_tokens_mistral': 2327, 'n_tokens_neox': 2259, 'n_words': 483}