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

<meta-data
<meta-data
android:name="android.app.lib_name"
android:value="@string/lib_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" />
<!-- Handles http and https URLs for status.app -->
<data android:scheme="http" android:host="status.app" />
<data android:scheme="https" android:host="status.app" />
<!-- Community paths -->
<data android:pathPattern="/c/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/c/.*" android:host="status.app" android:scheme="https" />
<!-- Community channel paths -->
<data android:pathPattern="/cc/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/cc/.*" android:host="status.app" android:scheme="https" />
<!-- User paths -->
<data android:pathPattern="/u/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/u/.*" android:host="status.app" android:scheme="https" />
<!-- Private chat paths -->
<data android:pathPattern="/p/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/p/.*" android:host="status.app" android:scheme="https" />
<!-- Community request paths -->
<data android:pathPattern="/cr/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/cr/.*" android:host="status.app" android:scheme="https" />
<!-- Group chat paths -->
<data android:pathPattern="/g/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/g/.*" android:host="status.app" android:scheme="https" />
<!-- Wallet paths -->
<data android:pathPattern="/wallet/.*" android:host="status.app" android:scheme="http" />
<data android:pathPattern="/wallet/.*" android:host="status.app" android:scheme="https" />
</intent-filter>
<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
37 changes: 36 additions & 1 deletion mobile/android/qt6/src/app/status/mobile/StatusQtActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,18 @@
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);

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 @@ -19,6 +27,8 @@ public void onCreate(Bundle savedInstanceState) {
}
// Set up shake detection (used for share-on-shake)
ShakeDetector.start(this);

handleDeepLink(getIntent());
}

@Override
Expand All @@ -33,13 +43,38 @@ protected void onPause() {
super.onPause();
}

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

@Override
protected void onDestroy() {
super.onDestroy();
}

// Called from Qt via JNI when main window is visible
public static void hideSplashScreen() {
public static void mainWindowReady() {
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
4 changes: 2 additions & 2 deletions ui/StatusQ/include/StatusQ/systemutilsinternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class SystemUtilsInternal : public QObject

// Set Android status bar icon color (true = light/white icons, false = dark/black icons)
Q_INVOKABLE void setAndroidStatusBarIconColor(bool lightIcons);
// Notify Android splash screen to hide (for custom activity)
Q_INVOKABLE void setAndroidSplashScreenReady();
// Notify Android that main window is ready (for custom activity) (hides the splash screen)
Q_INVOKABLE void setMainWindowReady();

// Get Android keyboard state (uses WindowInsets API, works Android 11-16+)
Q_INVOKABLE int androidKeyboardHeight() const;
Expand Down
4 changes: 2 additions & 2 deletions ui/StatusQ/src/systemutilsinternal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ void SystemUtilsInternal::setAndroidStatusBarIconColor(bool lightIcons)
#endif
}

void SystemUtilsInternal::setAndroidSplashScreenReady()
void SystemUtilsInternal::setMainWindowReady()
{
#ifdef Q_OS_ANDROID
QJniObject::callStaticMethod<void>(
"app/status/mobile/StatusQtActivity",
"hideSplashScreen",
"mainWindowReady",
"()V"
);
#endif
Expand Down
2 changes: 1 addition & 1 deletion ui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Window {

function contentLoaded() {
if (SQUtils.Utils.isAndroid) {
SystemUtils.setAndroidSplashScreenReady()
SystemUtils.setMainWindowReady()
}
}

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