Add mobile favorites UX and Android deep link support

This commit is contained in:
Dwindi Ramadhana
2026-02-22 23:32:48 +07:00
parent d5d925d534
commit 32e9282349
10 changed files with 594 additions and 41 deletions

View File

@@ -22,6 +22,20 @@
<category android:name="android.intent.category.LAUNCHER" />
</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="https" android:host="dewemoji.com" />
</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="https" android:host="www.dewemoji.com" />
</intent-filter>
</activity>
<provider

View File

@@ -9,6 +9,7 @@ import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.webkit.WebView;
import android.widget.Toast;
import androidx.core.view.WindowCompat;
@@ -47,6 +48,38 @@ public class MainActivity extends BridgeActivity {
}
}
@Override
public void onBackPressed() {
WebView webView = getBridge() != null ? getBridge().getWebView() : null;
if (webView == null) {
super.onBackPressed();
return;
}
try {
webView.evaluateJavascript(
"(function(){try{return (window.dewemojiHandleAndroidBack && window.dewemojiHandleAndroidBack()) ? '1' : '0';}catch(e){return '0';}})();",
value -> {
boolean handled = value != null && value.contains("1");
if (handled) {
return;
}
if (webView.canGoBack()) {
webView.goBack();
return;
}
MainActivity.super.onBackPressed();
}
);
} catch (Exception ex) {
if (webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
}
private void hideSystemBars() {
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
WindowInsetsControllerCompat controller =