Skip to content

Commit 2463b1e

Browse files
Merge pull request #181 from Ayush0Chaudhary/long-press
🚀 Panda can now be triggered from the power button and UX overhual
2 parents d94345f + c2aed29 commit 2463b1e

15 files changed

+880
-63
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 30 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,97 +2,76 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools">
44

5+
<!-- All Permissions from your app -->
56
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
67
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
78
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
8-
<!-- <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />-->
99
<uses-permission android:name="android.permission.INTERNET"/>
1010
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
11-
<uses-permission android:name="android.permission.RECOGNIZE_SPEECH"/>
12-
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
11+
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
12+
tools:ignore="QueryAllPackagesPermission" />
1313
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
1414
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE"/>
15-
1615
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
1716

18-
1917
<application
20-
android:allowBackup="true"
2118
android:name=".MyApplication"
19+
android:allowBackup="true"
2220
android:dataExtractionRules="@xml/data_extraction_rules"
2321
android:fullBackupContent="@xml/backup_rules"
24-
2522
android:icon="@drawable/panda_logo_v1_512"
26-
android:roundIcon="@drawable/panda_logo_v1_512"
27-
2823
android:label="@string/app_name"
2924
android:networkSecurityConfig="@xml/network_security_config"
25+
android:roundIcon="@drawable/panda_logo_v1_512"
3026
android:supportsRtl="true"
3127
android:theme="@style/Theme.Blurr"
3228
tools:targetApi="31">
3329

30+
<!-- Your Activities -->
3431
<activity
3532
android:name=".MainActivity"
3633
android:exported="true"
3734
android:label="@string/app_name"
3835
android:theme="@style/Theme.Blurr">
3936
<intent-filter>
4037
<action android:name="android.intent.action.MAIN" />
41-
4238
<category android:name="android.intent.category.LAUNCHER" />
4339
</intent-filter>
4440

4541
<meta-data
4642
android:name="android.app.shortcuts"
4743
android:resource="@xml/shortcuts" />
4844
</activity>
49-
<activity
50-
android:name=".LoginActivity"
51-
android:exported="false"
52-
android:label="Login_activity"
53-
android:theme="@style/Theme.Blurr" />
54-
<activity
55-
android:name=".ChatActivity"
56-
android:exported="true"
57-
android:label="@string/app_name"
58-
android:theme="@style/Theme.Blurr">
59-
</activity>
60-
<activity
61-
android:name=".DialogueActivity"
62-
android:exported="false"
63-
android:label="@string/app_name"
64-
android:theme="@style/Theme.Blurr"
65-
android:windowSoftInputMode="adjustResize">
66-
</activity>
67-
<activity
68-
android:name=".SettingsActivity"
69-
android:exported="false"
70-
android:label="@string/settings"
71-
android:theme="@style/Theme.Blurr">
72-
</activity>
73-
7445

46+
<activity android:name=".LoginActivity" android:exported="false" android:label="Login_activity" android:theme="@style/Theme.Blurr" />
47+
<activity android:name=".ChatActivity" android:exported="true" android:label="@string/app_name" android:theme="@style/Theme.Blurr" />
48+
<activity android:name=".DialogueActivity" android:exported="false" android:label="@string/app_name" android:theme="@style/Theme.Blurr" android:windowSoftInputMode="adjustResize" />
49+
<activity android:name=".SettingsActivity" android:exported="false" android:label="@string/settings" android:theme="@style/Theme.Blurr" />
50+
<activity android:name=".OnboardingPermissionsActivity" android:exported="false" android:label="onboarding" android:theme="@style/Theme.Blurr" />
51+
<activity android:name=".PermissionsActivity" android:exported="false" android:label="@string/permissions_explained_title" android:theme="@style/Theme.Blurr" />
52+
<activity android:name=".MemoriesActivity" android:exported="false" android:label="My Memories" android:theme="@style/Theme.Blurr" />
53+
<activity android:name=".PrivacyActivity" android:exported="false" android:label="How Panda Remembers" android:theme="@style/Theme.Blurr" />
7554
<activity
76-
android:name=".PermissionsActivity"
55+
android:name=".RoleRequestActivity"
7756
android:exported="false"
78-
android:label="@string/permissions_explained_title"
79-
android:theme="@style/Theme.Blurr">
80-
</activity>
57+
android:launchMode="singleTop"
58+
android:excludeFromRecents="true"
59+
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar" />
8160

8261
<activity
83-
android:name=".MemoriesActivity"
84-
android:exported="false"
85-
android:label="My Memories"
86-
android:theme="@style/Theme.Blurr">
62+
android:name=".AssistEntryActivity"
63+
android:exported="true"
64+
android:launchMode="singleTop"
65+
android:taskAffinity=""
66+
android:excludeFromRecents="true">
67+
<intent-filter>
68+
<action android:name="android.intent.action.ASSIST" />
69+
<category android:name="android.intent.category.DEFAULT" />
70+
</intent-filter>
8771
</activity>
8872

89-
<activity
90-
android:name=".PrivacyActivity"
91-
android:exported="false"
92-
android:label="How Panda Remembers"
93-
android:theme="@style/Theme.Blurr">
94-
</activity>
9573

74+
<!-- Your Other Services -->
9675
<service
9776
android:name=".ScreenInteractionService"
9877
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
@@ -137,18 +116,18 @@
137116
android:enabled="true"
138117
android:exported="false" />
139118

119+
<!-- Your Widget Provider -->
140120
<receiver
141121
android:name=".PandaWidgetProvider"
142122
android:exported="false">
143123
<intent-filter>
144124
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
145125
</intent-filter>
146-
147126
<meta-data
148127
android:name="android.appwidget.provider"
149128
android:resource="@xml/panda_widget_info" />
150129
</receiver>
151130

152131
</application>
153132

154-
</manifest>
133+
</manifest>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.blurr.voice
2+
3+
import android.app.Activity
4+
import android.content.Intent
5+
import android.os.Bundle
6+
import android.util.Log
7+
import androidx.core.content.ContextCompat
8+
9+
class AssistEntryActivity : Activity() {
10+
11+
override fun onCreate(savedInstanceState: Bundle?) {
12+
super.onCreate(savedInstanceState)
13+
handleAssistLaunch(intent)
14+
// No UI — finish immediately
15+
finish()
16+
}
17+
18+
override fun onNewIntent(intent: Intent?) {
19+
super.onNewIntent(intent)
20+
handleAssistLaunch(intent)
21+
finish()
22+
}
23+
24+
private fun handleAssistLaunch(intent: Intent?) {
25+
Log.d("AssistEntryActivity", "Assistant invoked via ACTION_ASSIST, intent=$intent")
26+
27+
// If agent already running, you can signal it to focus/show UI instead of starting again
28+
if (!ConversationalAgentService.isRunning) {
29+
val serviceIntent = Intent(this, ConversationalAgentService::class.java).apply {
30+
action = "com.blurr.voice.ACTION_START_FROM_ASSIST"
31+
putExtra("source", "assist_gesture") // optional metadata
32+
}
33+
ContextCompat.startForegroundService(this, serviceIntent)
34+
} else {
35+
// e.g., tell the service to bring its overlay/mic UI to front
36+
sendBroadcast(Intent("com.blurr.voice.ACTION_SHOW_OVERLAY"))
37+
}
38+
}
39+
}

app/src/main/java/com/blurr/voice/LoginActivity.kt.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import androidx.activity.result.contract.ActivityResultContracts
1313
import androidx.appcompat.app.AppCompatActivity
1414
import androidx.lifecycle.lifecycleScope
1515
import com.blurr.voice.utilities.FreemiumManager
16+
import com.blurr.voice.utilities.OnboardingManager
1617
import com.blurr.voice.utilities.UserProfileManager
1718
import com.google.android.gms.auth.api.identity.BeginSignInRequest
1819
import com.google.android.gms.auth.api.identity.Identity
@@ -112,7 +113,6 @@ class LoginActivity : AppCompatActivity() {
112113
}
113114
}
114115

115-
// 5. Update this function to accept the ID Token string directly
116116
private fun firebaseAuthWithGoogle(idToken: String) {
117117
val credential = GoogleAuthProvider.getCredential(idToken, null)
118118
firebaseAuth.signInWithCredential(credential)
@@ -138,24 +138,30 @@ class LoginActivity : AppCompatActivity() {
138138
profileManager.saveProfile("Unknown", "unknown")
139139
Log.w("LoginActivity", "User name or email was null, profile not saved.")
140140
}
141+
141142
lifecycleScope.launch {
143+
val onboardingManager = OnboardingManager(this@LoginActivity)
144+
142145
if (isNewUser) {
143146
Log.d("LoginActivity", "New user detected. Provisioning freemium account.")
144147
val freemiumManager = FreemiumManager()
145148
freemiumManager.provisionUserIfNeeded()
149+
}
150+
151+
// CHECK THE LOCAL FLAG INSTEAD OF isNewUser
152+
if (onboardingManager.isOnboardingCompleted()) {
153+
Log.d("LoginActivity", "Onboarding already completed on this device. Launching main activity.")
154+
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
146155
} else {
147-
Log.d("LoginActivity", "Returning user detected. Skipping provisioning.")
156+
Log.d("LoginActivity", "Onboarding not completed. Launching permissions stepper.")
157+
startActivity(Intent(this@LoginActivity, OnboardingPermissionsActivity::class.java))
148158
}
149-
// Proceed to the next activity only after provisioning is attempted
150-
Toast.makeText(this@LoginActivity, "Welcome, ${user?.displayName}", Toast.LENGTH_SHORT).show()
151-
startActivity(Intent(this@LoginActivity, MainActivity::class.java))
152159
finish()
153160
}
154161
} else {
155162
Log.w("LoginActivity", "signInWithCredential:failure", task.exception)
156163
Toast.makeText(this, "Authentication Failed.", Toast.LENGTH_SHORT).show()
157164
}
158-
// The progress bar is already handled by the launcher's result
159165
}
160166
}
161167
}

0 commit comments

Comments
 (0)