mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 08:38:34 +00:00
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:
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user