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
31 changes: 19 additions & 12 deletions mobile/android/qt6/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,33 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<meta-data
<meta-data
android:name="android.app.lib_name"
android:value="@string/app_name" />

<meta-data
<meta-data
android:name="android.app.arguments"
android:value="" />

<!-- Required for Qt6 to properly detect and load native libraries -->
<meta-data
android:name="android.app.system_libs_prefix"
android:value="/system/lib64/" />
<!-- Required for Qt6 to properly detect and load native libraries -->
<meta-data
android:name="android.app.system_libs_prefix"
android:value="/system/lib64/" />

<meta-data
android:name="android.app.use_local_qt_libs"
android:value="1" />
<meta-data
android:name="android.app.use_local_qt_libs"
android:value="1" />

<meta-data
android:name="android.app.bundle_local_qt_libs"
android:value="1" />
<meta-data
android:name="android.app.bundle_local_qt_libs"
android:value="1" />

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="status-app" />
</intent-filter>
</activity>

<provider
Expand Down
35 changes: 35 additions & 0 deletions mobile/android/qt6/src/app/status/mobile/StatusQtActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import android.os.Bundle;
import androidx.core.splashscreen.SplashScreen;
import java.util.concurrent.atomic.AtomicBoolean;
import android.content.Intent;
import android.net.Uri;

public class StatusQtActivity extends QtActivity {
private static final AtomicBoolean splashShouldHide = new AtomicBoolean(false);
Expand All @@ -13,6 +15,12 @@ public class StatusQtActivity extends QtActivity {
// Remove this line when Qt 6.10+ fixes the issue, and delete Android16KeyboardWorkaround.java
private Android16KeyboardWorkaround mKeyboardWorkaround;

private static final AtomicBoolean userLoggedIn = new AtomicBoolean(false);
private static String savedDeepLink = null;

// JNI hook: implemented in native code to forward deep links to Qt
private static native void passDeepLinkToQt(String deepLink);

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -25,6 +33,15 @@ public void onCreate(Bundle savedInstanceState) {
// QTBUG-140897: Install Android 16 keyboard workaround
// Remove this line when Qt 6.10+ fixes the issue
mKeyboardWorkaround = Android16KeyboardWorkaround.install(this);

handleDeepLink(getIntent());
}

@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
handleDeepLink(intent);
}

@Override
Expand All @@ -42,5 +59,23 @@ protected void onDestroy() {
// Called from Qt via JNI when main window is visible
public static void hideSplashScreen() {
splashShouldHide.set(true);
userLoggedIn.set(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

If we need to track the logged in state it's probably not the best to do it here when the splash screen gets hidden, right? We could add a flag in the activity that's driven by qml/c++ to save the login state.

if (savedDeepLink != null) {
passDeepLinkToQt(savedDeepLink);
savedDeepLink = null;
}
}

private void handleDeepLink(Intent intent) {
if (intent == null) return;
String action = intent.getAction();
Uri data = intent.getData();
if (Intent.ACTION_VIEW.equals(action) && data != null) {
if (!userLoggedIn.get()) {
savedDeepLink = data.toString();
return;
}
passDeepLinkToQt(data.toString());
}
}
}
1 change: 1 addition & 0 deletions src/nim_status_client.nim
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ proc mainProc() =

let singleInstance = newSingleInstance(($keccak256.digest(DATADIR))[0..31], openUri)
let urlSchemeEvent = newStatusUrlSchemeEventObject()
urlSchemeEvent.setInstance()
# init url manager before app controller
statusFoundation.initUrlSchemeManager(urlSchemeEvent, singleInstance, openUri)

Expand Down
2 changes: 1 addition & 1 deletion vendor/nimqml