Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
<!-- <meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
/> -->
Comment on lines +27 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Unintended change: NormalTheme meta-data commented out.

This appears unrelated to the app shortcuts feature. The NormalTheme meta-data ensures a smooth visual transition from the launch splash to the Flutter UI. Commenting it out can cause a jarring flash or flicker during app startup.

If this was intentional, please clarify the reasoning; otherwise, restore it.

Suggested fix
-            <!-- <meta-data
+            <meta-data
               android:name="io.flutter.embedding.android.NormalTheme"
               android:resource="@style/NormalTheme"
-              /> -->
+              />
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<!-- <meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
/> -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
πŸ€– Prompt for AI Agents
In `@android/app/src/main/AndroidManifest.xml` around lines 27 - 30, Restore the
commented-out NormalTheme meta-data in AndroidManifest by re-adding the
<meta-data> element that sets
android:name="io.flutter.embedding.android.NormalTheme" and
android:resource="@style/NormalTheme" so the launch-to-Flutter transition uses
the NormalTheme; this is unrelated to the app shortcuts change so remove the
comment markers around the NormalTheme meta-data (the block containing
NormalTheme) to prevent startup flicker.

<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts"/>

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand All @@ -44,6 +48,8 @@
</activity>
<!-- 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" />
Expand Down
83 changes: 82 additions & 1 deletion android/app/src/main/kotlin/org/aossie/ell_ena/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,86 @@
package org.aossie.ell_ena

import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel

class MainActivity : FlutterActivity()
class MainActivity : FlutterActivity() {
private val CHANNEL = "app_shortcuts"
private var pendingRoute: String? = null
private var methodChannel: MethodChannel? = null

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
handleIntent(intent)
}

override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
handleIntent(intent)
setIntent(intent) // Important: update the current intent

// βœ… Send route to Flutter immediately when app is resumed
sendRouteToFlutter()
}

override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)

methodChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)

// Setup method call handler
methodChannel?.setMethodCallHandler { call, result ->
when (call.method) {
"getInitialRoute" -> {
result.success(pendingRoute)
pendingRoute = null // Clear after sending
}
else -> result.notImplemented()
}
}

// Try to send initial route immediately if Flutter is ready
sendRouteToFlutter()
}

private fun handleIntent(intent: Intent?) {
// Method 1: Try to get route from deep link (app://shortcut/chat)
val uri: Uri? = intent?.data

if (uri != null && uri.scheme == "app" && uri.host == "shortcut") {
val route = uri.path?.removePrefix("/") // Remove leading "/"
pendingRoute = route
return
}

// Method 2: Try to get screen index from extras (fallback)
val screenIndex = intent?.getIntExtra("screen", -1)
if (screenIndex != -1) {
pendingRoute = when (screenIndex) {
0 -> "dashboard"
1 -> "calendar"
2 -> "workspace"
3 -> "chat"
4 -> "profile"
else -> null
}
}
}

private fun sendRouteToFlutter() {
if (pendingRoute != null && methodChannel != null) {
try {
methodChannel?.invokeMethod("navigate", pendingRoute)
pendingRoute = null
} catch (e: Exception) {
// βœ… Added logging for observability
Log.w("MainActivity", "Failed to send pendingRoute to Flutter: ${e.message}")
// Flutter might not be ready yet, route will be sent when getInitialRoute is called
}
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Ell-ena</string>

<!-- App Shortcuts Labels -->
<string name="shortcut_dashboard_short">Dashboard</string>
<string name="shortcut_dashboard_long">Dashboard</string>

<string name="shortcut_calendar_short">Calendar</string>
<string name="shortcut_calendar_long">Calendar</string>

<string name="shortcut_workspace_short">Workspace</string>
<string name="shortcut_workspace_long">Workspace</string>

<string name="shortcut_chat_short">Chat</string>
<string name="shortcut_chat_long">Chat</string>

<string name="shortcut_profile_short">Profile</string>
<string name="shortcut_profile_long">Profile</string>
</resources>
14 changes: 5 additions & 9 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->

<!-- Native splash screen theme -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.

This Theme is only used starting with V2 of Flutter's Android embedding. -->
<!-- Flutter UI theme (NO flutter logo, NO flash) -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>

</resources>
89 changes: 89 additions & 0 deletions android/app/src/main/res/xml/shortcuts.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">

<!-- Dashboard -->
<shortcut
android:shortcutId="dashboard"
android:enabled="true"
android:icon="@drawable/ic_dashboard"
android:shortcutShortLabel="@string/shortcut_dashboard_short"
android:shortcutLongLabel="@string/shortcut_dashboard_long">

<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.aossie.ell_ena"
android:targetClass="org.aossie.ell_ena.MainActivity">
<data android:scheme="app" android:host="shortcut" android:path="/dashboard" />
<extra android:name="screen" android:value="0" />
</intent>
</shortcut>

<!-- Calendar -->
<shortcut
android:shortcutId="calendar"
android:enabled="true"
android:icon="@drawable/ic_calendar"
android:shortcutShortLabel="@string/shortcut_calendar_short"
android:shortcutLongLabel="@string/shortcut_calendar_long">

<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.aossie.ell_ena"
android:targetClass="org.aossie.ell_ena.MainActivity">
<data android:scheme="app" android:host="shortcut" android:path="/calendar" />
<extra android:name="screen" android:value="1" />
</intent>
</shortcut>

<!-- Workspace -->
<shortcut
android:shortcutId="workspace"
android:enabled="true"
android:icon="@drawable/ic_workspace"
android:shortcutShortLabel="@string/shortcut_workspace_short"
android:shortcutLongLabel="@string/shortcut_workspace_long">

<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.aossie.ell_ena"
android:targetClass="org.aossie.ell_ena.MainActivity">
<data android:scheme="app" android:host="shortcut" android:path="/workspace" />
<extra android:name="screen" android:value="2" />
</intent>
</shortcut>

<!-- Chat -->
<shortcut
android:shortcutId="chat"
android:enabled="true"
android:icon="@drawable/ic_chat"
android:shortcutShortLabel="@string/shortcut_chat_short"
android:shortcutLongLabel="@string/shortcut_chat_long">

<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.aossie.ell_ena"
android:targetClass="org.aossie.ell_ena.MainActivity">
<data android:scheme="app" android:host="shortcut" android:path="/chat" />
<extra android:name="screen" android:value="3" />
</intent>
</shortcut>

<!-- Profile -->
<shortcut
android:shortcutId="profile"
android:enabled="true"
android:icon="@drawable/ic_profile"
android:shortcutShortLabel="@string/shortcut_profile_short"
android:shortcutLongLabel="@string/shortcut_profile_long">

<intent
android:action="android.intent.action.VIEW"
android:targetPackage="org.aossie.ell_ena"
android:targetClass="org.aossie.ell_ena.MainActivity">
<data android:scheme="app" android:host="shortcut" android:path="/profile" />
<extra android:name="screen" android:value="4" />
</intent>
</shortcut>

</shortcuts>
Loading