Skip to content

Commit

Permalink
Merge branch 'oppia:develop' into console-logger-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
manas-yu authored Oct 30, 2024
2 parents 75960a1 + 2ba2cbc commit 38212b7
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 22 deletions.
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/splash_image.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/component_color_splash_activity_background_color" />
<item android:drawable="@drawable/splash_page" android:gravity="center"/>
</layer-list>
6 changes: 0 additions & 6 deletions app/src/main/res/drawable/splash_page.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@
android:height="640dp"
android:viewportWidth="360"
android:viewportHeight="640">
<group>
<clip-path android:pathData="M0,0h360v640h-360z M 0,0"/>
<path
android:pathData="M0,0h360v640h-360z"
android:fillColor="#019489"/>
</group>
<path
android:pathData="M80,258c0,-6.78 1.62,-12.35 5.16,-17.27A23.25,23.25 0,0 1,100.65 231a30.08,30.08 0,0 1,14.68 0.94,22.51 22.51,0 0,1 12.72,10.43 26.89,26.89 0,0 1,3.37 10,36.05 36.05,0 0,1 0.14,9.68c-1.08,8.47 -4.93,15.28 -12.15,20a23.15,23.15 0,0 1,-11.91 3.88,26.84 26.84,0 0,1 -13,-2.4 23.73,23.73 0,0 1,-9.82 -8.77,28.77 28.77,0 0,1 -4.38,-12.28C80.17,260.72 80.07,259 80,258ZM105,275.24h0a6.62,6.62 0,0 1,0.17 -0.71,22.8 22.8,0 0,1 2.23,-6.07 11.78,11.78 0,0 1,3.24 -3.81c0.23,-0.2 0.23,-0.31 0.13,-0.54a3.9,3.9 0,0 1,2 -5.16,1.24 1.24,0 0,1 0.23,-0.11 4,4 0,0 1,5.17 2.3,4.22 4.22,0 0,1 0.23,2 4,4 0,0 1,-5.9 2.87c-0.34,-0.2 -0.64,-0.47 -1,-0.74 -3.78,3.1 -5,7.46 -5.74,12a1.14,1.14 0,0 0,0.31 0,15.8 15.8,0 0,0 7.35,-1.69 17.6,17.6 0,0 0,5.81 -4.49,20.44 20.44,0 0,0 2.87,-4.55 20.89,20.89 0,0 0,1.68 -8,27.87 27.87,0 0,0 -0.37,-5.06 17.58,17.58 0,0 0,-4.32 -9.11,14.66 14.66,0 0,0 -5.36,-3.81 18.8,18.8 0,0 0,-6.95 -1.42c-0.81,0 -1.66,0 -2.47,0.07a16.25,16.25 0,0 0,-11.87 5.94A17.1,17.1 0,0 0,89.58 250a20.29,20.29 0,0 0,-1.48 8.6,21.78 21.78,0 0,0 2.33,9.48 16.34,16.34 0,0 0,10.62 8.68c0.65,0.16 1.29,0.27 2,0.4a3.52,3.52 0,0 0,0 -0.61,41.92 41.92,0 0,0 -1.35,-8A18.49,18.49 0,0 0,99 262.64a0.5,0.5 0,0 0,-0.67 -0.24,4 4,0 0,1 -5,-2.59 4.61,4.61 0,0 1,-0.17 -1.18,4 4,0 0,1 3.91,-4 3.9,3.9 0,0 1,2.57 0.91,3.83 3.83,0 0,1 1.35,4 4.07,4.07 0,0 1,-1.42 2.23c0.27,0.44 0.57,0.81 0.81,1.25a27.63,27.63 0,0 1,3.21 10.42c0.06,0.58 0.16,1.15 0.23,1.76L104,275.2v-4.52a71.54,71.54 0,0 1,0.47 -8.54,30.53 30.53,0 0,1 1.85,-7.89 0.31,0.31 0,0 0,-0.1 -0.34,4 4,0 1,1 5.54,-1.15 3.92,3.92 0,0 1,-4 1.72c-0.31,0 -0.37,0 -0.47,0.24 -0.24,0.64 -0.51,1.28 -0.71,1.92a32.28,32.28 0,0 0,-1.15 5.94c-0.14,1.55 -0.3,3.1 -0.37,4.66s-0.07,2.9 -0.1,4.35a34.72,34.72 0,0 1,0.13 3.64Z"
android:fillColor="#fff"/>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@
</style>

<style name="SplashScreenTheme" parent="OppiaThemeWithoutActionBar">
<item name="android:windowBackground">@drawable/splash_page</item>
<item name="android:windowBackground">@drawable/splash_image</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:windowAnimationStyle">@style/FadeTransitionAnimation.Activity</item>
</style>
<!-- PREVIOUS BUTTON STYLE -->
Expand Down
8 changes: 5 additions & 3 deletions scripts/buf_lint_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

source scripts/formatting.sh

jar_file_path=$?
config_file_path=$?
os_type=$?
Expand All @@ -15,11 +17,11 @@ lint_protobuf_files() {
status=$?

if [ "$status" = 0 ] ; then
echo "Protobuf lint check completed successfully"
echo_success "Protobuf lint check completed successfully"
exit 0
else
echo "********************************"
echo "Protobuf lint check issues found. Please fix them before pushing your code."
echo_error "Protobuf lint check issues found. Please fix them before pushing your code."
echo "********************************"
exit 1
fi
Expand Down Expand Up @@ -57,7 +59,7 @@ check_os_type() {
elif [[ "$OSTYPE" == "darwin"* ]]; then
os_type="Darwin"
else
echo "Protobuf lint check not available on $OSTYPE"
echo_error "Protobuf lint check not available on $OSTYPE"
exit 0
fi
}
Expand Down
6 changes: 4 additions & 2 deletions scripts/buildifier_lint_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

source scripts/formatting.sh

echo "********************************"
echo "Checking Bazel file formatting"
echo "********************************"
Expand All @@ -19,12 +21,12 @@ $buildifier_file_path --lint=warn --mode=check --warnings=-native-android,+out-o
status=$?

if [ "$status" = 0 ] ; then
echo "Buildifier lint check completed successfully"
echo_success "Buildifier lint check completed successfully"
exit 0
else
# Assume any lint output or non-zero exit code is a failure.
echo "********************************"
echo "Buildifier issue found."
echo_error "Buildifier issue found."
echo "Please fix the above issues."
echo "********************************"
exit 1
Expand Down
6 changes: 4 additions & 2 deletions scripts/checkstyle_lint_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

source scripts/formatting.sh

echo "********************************"
echo "Checking Java file formatting"
echo "********************************"
Expand All @@ -23,11 +25,11 @@ echo $lint_results
if [ "$lint_command_result" -ne 0 ] || [ -z "$lint_results" ] || [[ ${lint_results} == *"[WARN]"* ]]; then
# Assume any lint output or non-zero exit code is a failure.
echo "********************************"
echo "Checkstyle issue found."
echo_error "Checkstyle issue found."
echo "Please fix the above issues."
echo "********************************"
exit 1
else
echo "Checkstyle lint check completed successfully"
echo_success "Checkstyle lint check completed successfully"
exit 0
fi
10 changes: 6 additions & 4 deletions scripts/feature_flags_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

source scripts/formatting.sh

echo "********************************"
echo "Running feature flag checks"
echo "********************************"
Expand Down Expand Up @@ -120,24 +122,24 @@ function perform_checks_on_feature_flags() {
in_array=$(item_in_array "$element" "${imported_classes[@]}")
if [[ $in_array -ne 1 ]]; then
failed_checks=$((failed_checks + 1))
echo "$element is not imported in the constructor argument in $file_path at line $imports_line_number"
echo_error "$element is not imported in the constructor argument in $file_path at line $imports_line_number"
fi
done

for element in "${feature_flags[@]}"; do
in_array=$(item_in_array "$element" "${flags_added_to_map[@]}")
if [[ $in_array -ne 1 ]]; then
failed_checks=$((failed_checks + 1))
echo "$element is not added to the logging map in $file_path at line $flags_map_line_number"
echo_error "$element is not added to the logging map in $file_path at line $flags_map_line_number"
fi
done

if [[ $failed_checks -eq 0 ]]; then
echo "Feature flag checks completed successfully"
echo_success "Feature flag checks completed successfully"
exit 0
else
echo "********************************"
echo "Feature flag issues found."
echo_error "Feature flag issues found."
echo "Please fix the above issues."
echo "********************************"
exit 1
Expand Down
30 changes: 30 additions & 0 deletions scripts/formatting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

#Defines color codes for output formatting

# Red color for error messages
RED='\033[0;31m'

# Green color for success messages
GREEN='\033[0;32m'

# Yellow color for warnings messages
YELLOW='\033[0;33m'

# No color, used to reset the color after each message
NC='\033[0m'

# Function to print an error message in red
function echo_error() {
echo -e "${RED}$1${NC}"
}

# Function to print a success message in green
function echo_success() {
echo -e "${GREEN}$1${NC}"
}

# Function to print a warning message in yellow
function echo_warning() {
echo -e "${YELLOW}$1${NC}"
}
8 changes: 5 additions & 3 deletions scripts/ktlint_lint_check.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

source scripts/formatting.sh

echo "********************************"
echo "Checking code formatting"
echo "********************************"
Expand All @@ -19,15 +21,15 @@ java -jar $jar_file_path --android app/src/**/*.kt data/src/**/*.kt domain/src/*
status=$?

if [ "$status" = 0 ] ; then
echo "Lint completed successfully."
echo_success "Lint completed successfully."
exit 0
else
echo "********************************"
echo "Ktlint issue found."
echo_error "Ktlint issue found."
echo "Please fix the above issues.
You can also use the java -jar $jar_file_path -F --android domain/src/**/*.kt utility/src/**/*.kt data/src/**/*.kt app/src/**/*.kt testing/src/**/*.kt scripts/src/**/*.kt instrumentation/src/**/*.kt
command to fix the most common issues."
echo "Please note, there might be a possibility where the above command will not fix the issue.
echo_warning "Please note, there might be a possibility where the above command will not fix the issue.
In that case, you will have to fix it yourself."
echo "********************************"
exit 1
Expand Down
4 changes: 3 additions & 1 deletion scripts/pre-push.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/bash

source scripts/formatting.sh

# This script will run the pre-push checks in the given order
# - ktlint
# - checkstyle
# - buf
# - (others in the future)

if bash scripts/ktlint_lint_check.sh && bash scripts/checkstyle_lint_check.sh && bash scripts/buf_lint_check.sh ; then
echo "All checks passed successfully"
echo_success "All checks passed successfully"
exit 0
else
exit 1
Expand Down

0 comments on commit 38212b7

Please sign in to comment.