Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[auth] Add Android Quick Settings tile to launch the app

ExtendedGuru48831d71935fa043
diff --git a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml
index c8dcb3253f..3953727aea 100644
--- a/mobile/apps/auth/android/app/src/main/AndroidManifest.xml
+++ b/mobile/apps/auth/android/app/src/main/AndroidManifest.xml
@@ -43,6 +43,19 @@
</activity>
+ <service
+ android:name=".QuickTileService"
+ android:icon="@drawable/ic_qs_monochrome"
+ android:label="Ente Auth"
+ android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
+ android:exported="true"
+ tools:targetApi="24">
+
+ <intent-filter>
+ <action android:name="android.service.quicksettings.action.QS_TILE" />
+ </intent-filter>
+ </service>
+
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data android:name="flutterEmbedding" android:value="2"/>
diff --git a/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt
new file mode 100644
index 0000000000..5d652ed267
--- /dev/null
+++ b/mobile/apps/auth/android/app/src/main/kotlin/io/ente/authenticator/QuickTileService.kt
@@ -0,0 +1,31 @@
+package io.ente.auth
+
+import android.annotation.SuppressLint
+import android.app.PendingIntent
+import android.content.Intent
+import android.os.Build
+import android.service.quicksettings.TileService
+import androidx.annotation.RequiresApi
+
+@RequiresApi(Build.VERSION_CODES.N)
+class QuickTileService : TileService() {
+
+ @SuppressLint("StartActivityAndCollapseDeprecated")
+ override fun onClick() {
+ val intent = Intent(applicationContext, MainActivity::class.java).apply {
+ flags = Intent.FLAG_ACTIVITY_NEW_TASK
+ }
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
+ startActivityAndCollapse(
+ PendingIntent.getActivity(
+ this,
+ 0,
+ intent,
+ PendingIntent.FLAG_IMMUTABLE,
+ ),
+ )
+ } else {
+ startActivityAndCollapse(intent)
+ }
+ }
+}
diff --git a/mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml b/mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml
new file mode 100644
index 0000000000..1060979a1e
--- /dev/null
+++ b/mobile/apps/auth/android/app/src/main/res/drawable/ic_qs_monochrome.xml
@@ -0,0 +1,5 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="23.892136dp" android:viewportHeight="443" android:viewportWidth="445" android:width="24dp">
+
+ <path android:fillColor="#ffffff" android:pathData="M75,0C75.13,27.13 74.91,54.24 74.43,81.36 74.03,103.58 73.87,125.78 74,148L77,148C80.78,125.81 81.89,103.25 83.86,80.83 84.64,72.02 85.42,63.21 86.2,54.39 87.8,36.26 89.4,18.13 91,0 114.42,8.23 137.04,18.57 160,28 159.89,38.19 159.78,48.38 159.66,58.57 159.4,96.95 163.49,123.22 136.76,155.25 124.19,167.1 84.27,193.2 73.89,191.52 44.77,176.87 11.65,152.27 1,121 -1.19,109.29 3.38,41.25 6,22 23.05,16.33 40.08,10.64 57.11,4.91 63.02,3.04 68.87,1.17 75,0ZM358.42,288.55c-22.31,0.71 -44.64,0.63 -66.96,0.7 -35.9,0.19 -71.81,0.11 -107.71,0.36C161.91,287.93 162.4,313.46 201,329c85.04,31.22 128.65,-29.84 172,-20 33.05,12.62 59.9,66.54 -2,104 -37.71,23.12 -168.2,68.25 -271,-31 -71.25,-65.59 -59.73,-173.26 -56,-193 6.38,0.78 11.86,4.31 17.29,7.47 3.49,2.03 6.97,4.06 10.38,6.22C77.66,206.78 117.34,187.8 146,162 174.02,138.61 170.35,101.91 170.75,68.96 170.9,56.26 171.19,47.47 172,38 386.64,-54.82 556.88,282.51 358.42,288.55ZM167,182c1.34,3.55 2.48,4.69 5.74,6.61 6.62,2.68 14.04,1.76 21.05,1.79 10.33,0.04 0.13,-0.02 23.13,0 32.71,-0.03 65.43,-0 98.14,-0.03 3.53,-0.45 5.91,-1.54 8.94,-3.38 2.54,-3.82 2.79,-6.6 2,-11 -26.59,-72.58 -155.6,-51.22 -159,6z"/>
+
+</vector>