Skip to content

Commit

Permalink
Merge branch 'update-outdated-tidy-script-paths-droid-992'
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-mullvad committed Jun 12, 2024
2 parents e3dd3d0 + 596b605 commit 68a54bb
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 128 deletions.
7 changes: 2 additions & 5 deletions android/app/src/main/res/xml/provider_paths.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path
name="logs"
path="logs/" />
<cache-path name="logs"
path="logs/" />
</paths>


2 changes: 1 addition & 1 deletion android/lib/common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
</manifest>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/ic_remove.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="M200,520v-80h560v80L200,520Z"/>
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="#FF000000"
android:pathData="M200,520v-80h560v80L200,520Z" />
</vector>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/icon_add.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M440,520L200,520L200,440L440,440L440,200L520,200L520,440L760,440L760,520L520,520L520,760L440,760L440,520Z" />
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="@android:color/white"
android:pathData="M440,520L200,520L200,440L440,440L440,200L520,200L520,440L760,440L760,520L520,520L520,760L440,760L440,520Z" />
</vector>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/icon_delete.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M280,840Q247,840 223.5,816.5Q200,793 200,760L200,240L160,240L160,160L360,160L360,120L600,120L600,160L800,160L800,240L760,240L760,760Q760,793 736.5,816.5Q713,840 680,840L280,840ZM680,240L280,240L280,760Q280,760 280,760Q280,760 280,760L680,760Q680,760 680,760Q680,760 680,760L680,240ZM360,680L440,680L440,320L360,320L360,680ZM520,680L600,680L600,320L520,320L520,680ZM280,240L280,240L280,760Q280,760 280,760Q280,760 280,760L280,760Q280,760 280,760Q280,760 280,760L280,240Z" />
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="@android:color/white"
android:pathData="M280,840Q247,840 223.5,816.5Q200,793 200,760L200,240L160,240L160,160L360,160L360,120L600,120L600,160L800,160L800,240L760,240L760,760Q760,793 736.5,816.5Q713,840 680,840L280,840ZM680,240L280,240L280,760Q280,760 280,760Q280,760 280,760L680,760Q680,760 680,760Q680,760 680,760L680,240ZM360,680L440,680L440,320L360,320L360,680ZM520,680L600,680L600,320L520,320L520,680ZM280,240L280,240L280,760Q280,760 280,760Q280,760 280,760L280,760Q280,760 280,760Q280,760 280,760L280,240Z" />
</vector>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/icon_edit.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M200,760L257,760L648,369L591,312L200,703L200,760ZM120,840L120,670L648,143Q660,132 674.5,126Q689,120 705,120Q721,120 736,126Q751,132 762,144L817,200Q829,211 834.5,226Q840,241 840,256Q840,272 834.5,286.5Q829,301 817,313L290,840L120,840ZM760,256L760,256L704,200L704,200L760,256ZM619,341L591,312L591,312L648,369L648,369L619,341Z" />
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="@android:color/white"
android:pathData="M200,760L257,760L648,369L591,312L200,703L200,760ZM120,840L120,670L648,143Q660,132 674.5,126Q689,120 705,120Q721,120 736,126Q751,132 762,144L817,200Q829,211 834.5,226Q840,241 840,256Q840,272 834.5,286.5Q829,301 817,313L290,840L120,840ZM760,256L760,256L704,200L704,200L760,256ZM619,341L591,312L591,312L648,369L648,369L619,341Z" />
</vector>
18 changes: 8 additions & 10 deletions android/lib/resource/src/main/res/drawable/icon_fail.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<path
android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0"
android:fillColor="#fff"/>
<path
android:pathData="m25.147,22 l7.875,-7.872A2.225,2.225 0,0 0,29.875 10.982l-7.875,7.872L14.125,10.982A2.225,2.225 0,0 0,10.977 14.128l7.875,7.872 -7.875,7.871a2.225,2.225 0,0 0,3.147 3.146l7.875,-7.872 7.875,7.872a2.225,2.225 0,0 0,3.147 -3.146l-7.875,-7.872z"
android:fillColor="#e34039"/>
android:width="44dp"
android:height="44dp"
android:viewportWidth="44"
android:viewportHeight="44">
<path android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0"
android:fillColor="#fff" />
<path android:pathData="m25.147,22 l7.875,-7.872A2.225,2.225 0,0 0,29.875 10.982l-7.875,7.872L14.125,10.982A2.225,2.225 0,0 0,10.977 14.128l7.875,7.872 -7.875,7.871a2.225,2.225 0,0 0,3.147 3.146l7.875,-7.872 7.875,7.872a2.225,2.225 0,0 0,3.147 -3.146l-7.875,-7.872z"
android:fillColor="#e34039" />
</vector>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/icon_more_vert.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@android:color/white"
android:pathData="M480,800Q447,800 423.5,776.5Q400,753 400,720Q400,687 423.5,663.5Q447,640 480,640Q513,640 536.5,663.5Q560,687 560,720Q560,753 536.5,776.5Q513,800 480,800ZM480,560Q447,560 423.5,536.5Q400,513 400,480Q400,447 423.5,423.5Q447,400 480,400Q513,400 536.5,423.5Q560,447 560,480Q560,513 536.5,536.5Q513,560 480,560ZM480,320Q447,320 423.5,296.5Q400,273 400,240Q400,207 423.5,183.5Q447,160 480,160Q513,160 536.5,183.5Q560,207 560,240Q560,273 536.5,296.5Q513,320 480,320Z"/>
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="@android:color/white"
android:pathData="M480,800Q447,800 423.5,776.5Q400,753 400,720Q400,687 423.5,663.5Q447,640 480,640Q513,640 536.5,663.5Q560,687 560,720Q560,753 536.5,776.5Q513,800 480,800ZM480,560Q447,560 423.5,536.5Q400,513 400,480Q400,447 423.5,423.5Q447,400 480,400Q513,400 536.5,423.5Q560,447 560,480Q560,513 536.5,536.5Q513,560 480,560ZM480,320Q447,320 423.5,296.5Q400,273 400,240Q400,207 423.5,183.5Q447,160 480,160Q513,160 536.5,183.5Q560,207 560,240Q560,273 536.5,296.5Q513,320 480,320Z" />
</vector>
18 changes: 8 additions & 10 deletions android/lib/resource/src/main/res/drawable/icon_success.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="44dp"
android:height="44dp"
android:viewportWidth="44.0"
android:viewportHeight="44.0">
<path
android:fillColor="#fff"
android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0" />
<path
android:fillColor="#44AD4D"
android:pathData="M11.4142136,20.5857864 C10.633165,19.8047379 9.366835,19.8047379 8.5857864,20.5857864 C7.8047379,21.366835 7.8047379,22.633165 8.5857864,23.4142136 L16.5857864,31.4142136 C17.366835,32.1952621 18.633165,32.1952621 19.4142136,31.4142136 L35.4142136,15.4142136 C36.1952621,14.633165 36.1952621,13.366835 35.4142136,12.5857864 C34.633165,11.8047379 33.366835,11.8047379 32.5857864,12.5857864 L18,27.1715729 L11.4142136,20.5857864 Z" />
android:width="44dp"
android:height="44dp"
android:viewportWidth="44.0"
android:viewportHeight="44.0">
<path android:fillColor="#fff"
android:pathData="M22,22m-22,0a22,22 0,1 1,44 0a22,22 0,1 1,-44 0" />
<path android:fillColor="#44AD4D"
android:pathData="M11.4142136,20.5857864 C10.633165,19.8047379 9.366835,19.8047379 8.5857864,20.5857864 C7.8047379,21.366835 7.8047379,22.633165 8.5857864,23.4142136 L16.5857864,31.4142136 C17.366835,32.1952621 18.633165,32.1952621 19.4142136,31.4142136 L35.4142136,15.4142136 C36.1952621,14.633165 36.1952621,13.366835 35.4142136,12.5857864 C34.633165,11.8047379 33.366835,11.8047379 32.5857864,12.5857864 L18,27.1715729 L11.4142136,20.5857864 Z" />
</vector>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/icon_text_fields.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="M280,800v-520L80,280v-120h520v120L400,280v520L280,800ZM640,800v-320L520,480v-120h360v120L760,480v320L640,800Z"/>
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="#FF000000"
android:pathData="M280,800v-520L80,280v-120h520v120L400,280v520L280,800ZM640,800v-320L520,480v-120h360v120L760,480v320L640,800Z" />
</vector>
13 changes: 6 additions & 7 deletions android/lib/resource/src/main/res/drawable/icon_upload_file.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="#FF000000"
android:pathData="M440,760h80v-167l64,64 56,-57 -160,-160 -160,160 57,56 63,-63v167ZM240,880q-33,0 -56.5,-23.5T160,800v-640q0,-33 23.5,-56.5T240,80h320l240,240v480q0,33 -23.5,56.5T720,880L240,880ZM520,360v-200L240,160v640h480v-440L520,360ZM240,160v200,-200 640,-640Z"/>
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path android:fillColor="#FF000000"
android:pathData="M440,760h80v-167l64,64 56,-57 -160,-160 -160,160 57,56 63,-63v167ZM240,880q-33,0 -56.5,-23.5T160,800v-640q0,-33 23.5,-56.5T240,80h320l240,240v480q0,33 -23.5,56.5T720,880L240,880ZM520,360v-200L240,160v640h480v-440L520,360ZM240,160v200,-200 640,-640Z" />
</vector>
21 changes: 10 additions & 11 deletions android/lib/resource/src/main/res/drawable/icons_more_circle.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillAlpha="0.6"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"
android:pathData="M12,24A12,12 0,0 1,3.515 3.515a12,12 0,1 1,16.97 16.97A11.922,11.922 0,0 1,12 24zM10.445,16.044L10.445,17.6h3.111v-1.556zM7.333,12.155v1.556h9.333v-1.556zM5,8.267v1.556h14L19,8.267z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path android:fillAlpha="0.6"
android:fillColor="#FFFFFF"
android:fillType="evenOdd"
android:pathData="M12,24A12,12 0,0 1,3.515 3.515a12,12 0,1 1,16.97 16.97A11.922,11.922 0,0 1,12 24zM10.445,16.044L10.445,17.6h3.111v-1.556zM7.333,12.155v1.556h9.333v-1.556zM5,8.267v1.556h14L19,8.267z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/icon_background"/>
<foreground android:drawable="@drawable/icon_android"/>
<monochrome android:drawable="@drawable/icon_android_mono"/>
<background android:drawable="@color/icon_background" />
<foreground android:drawable="@drawable/icon_android" />
<monochrome android:drawable="@drawable/icon_android_mono" />
</adaptive-icon>
1 change: 0 additions & 1 deletion android/lib/resource/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@
<string name="obfuscation_on_udp_over_tcp">On (UDP-over-TCP)</string>
<string name="automatic">Automatic</string>
<string name="off">Off</string>

<string name="udp_over_tcp_port_title">UDP-over-TCP port</string>
<string name="udp_over_tcp_port_info">Which TCP port the UDP-over-TCP obfuscation protocol should connect to on the VPN server.</string>
<string name="created_x">Created: %s</string>
Expand Down
3 changes: 2 additions & 1 deletion android/lib/resource/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<resources>
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<style name="AppTheme"
parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
Expand Down
54 changes: 30 additions & 24 deletions android/scripts/tidy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,43 @@ function main {

# Autoformats Android XML files
function format {
tidy -xml \
-m \
-i \
-w 100 \
-utf8 \
--quiet yes \
--indent-attributes yes \
--indent-spaces 4 \
--literal-attributes yes \
../**/src/*/AndroidManifest.xml \
../lib/resource/src/main/res/anim*/*.xml \
../lib/resource/src/main/res/drawable*/*.xml \
../app/src/main/res/layout*/*.xml
non_text_xml_paths=("$(find .. -wholename "*/src/*.xml" ! -name "strings*.xml" ! -name plurals.xml)")
for xml_path in "${non_text_xml_paths[@]}"; do
tidy -xml \
-m \
-i \
-w 100 \
-utf8 \
--quiet yes \
--indent-attributes yes \
--indent-spaces 4 \
--literal-attributes yes \
"$xml_path"
done

tidy -xml \
-m \
-i \
-w 0 \
-utf8 \
--quiet yes \
--indent-spaces 4 \
--literal-attributes yes \
--indent-cdata yes \
../lib/resource/src/main/res/values/*.xml
# We only format non-translated files since we don't want
# to introduce a mismatch between the xml files and source
# (.po) files.
non_translated_text_xml_paths=("$(find .. -wholename "*/values/strings*.xml" -o -wholename "*/values/plurals.xml")")
for xml_path in "${non_translated_text_xml_paths[@]}"; do
tidy -xml \
-m \
-i \
-w 0 \
-utf8 \
--quiet yes \
--indent-spaces 4 \
--literal-attributes yes \
--indent-cdata yes \
"$xml_path"
done

# FIXME - when tidy learns to not leave whitespace around, remove the line below - https://github.com/htacg/tidy-html5/issues/864
find .. -name '*.xml' -exec sed -i -e 's/[ \t]*$//' '{}' ';'
}

function checkDiff {
if git diff --exit-code -- ../**/AndroidManifest.xml ../**/src/main/res; then
if git diff --exit-code -- ../**/*.xml; then
echo "Android XML files are correctly formatted"
return 0
else
Expand Down
16 changes: 7 additions & 9 deletions android/test/e2e/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:remove="android:maxSdkVersion"
tools:ignore="ScopedStorage" />
tools:remove="android:maxSdkVersion"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:remove="android:maxSdkVersion"
tools:ignore="ScopedStorage" />
tools:remove="android:maxSdkVersion"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.INTERNET" />
<instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="net.mullvad.mullvadvpn" />
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="net.mullvad.mullvadvpn" />
</manifest>
6 changes: 2 additions & 4 deletions android/test/mockapi/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<instrumentation
android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="net.mullvad.mullvadvpn" />
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="net.mullvad.mullvadvpn" />
</manifest>

0 comments on commit 68a54bb

Please sign in to comment.