fix(android): fix android blob upload (#13435)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved WebView configuration to allow loading mixed content (HTTP
and HTTPS) in the Android app.
* Enhanced robustness when retrieving upload timestamps, preventing
potential errors if data is missing or undefined.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
EYHN
2025-08-07 11:43:30 +08:00
committed by GitHub
parent bc3b41378d
commit 747b11b128
3 changed files with 5 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import android.content.res.ColorStateList
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.webkit.WebSettings
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
@@ -90,6 +91,7 @@ class MainActivity : BridgeActivity(), AIButtonPlugin.Callback, AFFiNEThemePlugi
override fun load() {
super.load()
AuthInitializer.initialize(bridge)
bridge.webView.settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
}
override fun present() {

View File

@@ -556,7 +556,7 @@ class NbStorePlugin : Plugin() {
val id = call.getStringEnsure("id")
val peer = call.getStringEnsure("peer")
val blobId = call.getStringEnsure("blobId")
val uploadedAt = call.getLongEnsure("uploadedAt")
val uploadedAt = call.getLong("uploadedAt")
docStoragePool.setBlobUploadedAt(
universalId = id,
peer = peer,
@@ -582,4 +582,4 @@ class NbStorePlugin : Plugin() {
}
}
}
}
}

View File

@@ -321,7 +321,7 @@ export const NbStoreNativeDBApis: NativeDBApis = {
peer,
blobId,
});
return result.uploadedAt ? new Date(result.uploadedAt) : null;
return result?.uploadedAt ? new Date(result.uploadedAt) : null;
},
setBlobUploadedAt: async function (
id: string,