mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 03:33:06 +08: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.os.Bundle
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.webkit.WebSettings
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.graphics.drawable.DrawableCompat
|
import androidx.core.graphics.drawable.DrawableCompat
|
||||||
@@ -90,6 +91,7 @@ class MainActivity : BridgeActivity(), AIButtonPlugin.Callback, AFFiNEThemePlugi
|
|||||||
override fun load() {
|
override fun load() {
|
||||||
super.load()
|
super.load()
|
||||||
AuthInitializer.initialize(bridge)
|
AuthInitializer.initialize(bridge)
|
||||||
|
bridge.webView.settings.mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun present() {
|
override fun present() {
|
||||||
|
|||||||
+2
-2
@@ -556,7 +556,7 @@ class NbStorePlugin : Plugin() {
|
|||||||
val id = call.getStringEnsure("id")
|
val id = call.getStringEnsure("id")
|
||||||
val peer = call.getStringEnsure("peer")
|
val peer = call.getStringEnsure("peer")
|
||||||
val blobId = call.getStringEnsure("blobId")
|
val blobId = call.getStringEnsure("blobId")
|
||||||
val uploadedAt = call.getLongEnsure("uploadedAt")
|
val uploadedAt = call.getLong("uploadedAt")
|
||||||
docStoragePool.setBlobUploadedAt(
|
docStoragePool.setBlobUploadedAt(
|
||||||
universalId = id,
|
universalId = id,
|
||||||
peer = peer,
|
peer = peer,
|
||||||
@@ -582,4 +582,4 @@ class NbStorePlugin : Plugin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -321,7 +321,7 @@ export const NbStoreNativeDBApis: NativeDBApis = {
|
|||||||
peer,
|
peer,
|
||||||
blobId,
|
blobId,
|
||||||
});
|
});
|
||||||
return result.uploadedAt ? new Date(result.uploadedAt) : null;
|
return result?.uploadedAt ? new Date(result.uploadedAt) : null;
|
||||||
},
|
},
|
||||||
setBlobUploadedAt: async function (
|
setBlobUploadedAt: async function (
|
||||||
id: string,
|
id: string,
|
||||||
|
|||||||
Reference in New Issue
Block a user