Implement media sessions notification

This commit is contained in:
2026-04-22 22:51:10 +02:00
parent 6635266fc8
commit a0b43ae009
25 changed files with 173 additions and 219 deletions
@@ -94,6 +94,15 @@ namespace margelo::nitro::omni {
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JSource> /* source */)>("setSource");
method(_javaPart, JSource::fromCpp(source));
}
std::optional<bool> JHybridOmniPlayerSpec::getShowNotification() {
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getShowNotification");
auto __result = method(_javaPart);
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
}
void JHybridOmniPlayerSpec::setShowNotification(std::optional<bool> showNotification) {
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* showNotification */)>("setShowNotification");
method(_javaPart, showNotification.has_value() ? jni::JBoolean::valueOf(showNotification.value()) : nullptr);
}
bool JHybridOmniPlayerSpec::getHasPrev() {
static const auto method = _javaPart->javaClassStatic()->getMethod<jboolean()>("getHasPrev");
auto __result = method(_javaPart);
@@ -53,6 +53,8 @@ namespace margelo::nitro::omni {
std::shared_ptr<HybridOmniEventMapSpec> getEventMap() override;
Source getSource() override;
void setSource(const Source& source) override;
std::optional<bool> getShowNotification() override;
void setShowNotification(std::optional<bool> showNotification) override;
bool getHasPrev() override;
bool getHasNext() override;
std::vector<Track> getVideos() override;
-9
View File
@@ -63,15 +63,6 @@ namespace margelo::nitro::omni {
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* autoplay */)>("setAutoplay");
method(_javaPart, autoplay.has_value() ? jni::JBoolean::valueOf(autoplay.value()) : nullptr);
}
std::optional<bool> JHybridOmniViewSpec::getShowNotification() {
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getShowNotification");
auto __result = method(_javaPart);
return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
}
void JHybridOmniViewSpec::setShowNotification(std::optional<bool> showNotification) {
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* showNotification */)>("setShowNotification");
method(_javaPart, showNotification.has_value() ? jni::JBoolean::valueOf(showNotification.value()) : nullptr);
}
std::optional<bool> JHybridOmniViewSpec::getAutoPip() {
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getAutoPip");
auto __result = method(_javaPart);
-2
View File
@@ -54,8 +54,6 @@ namespace margelo::nitro::omni {
void setPlayer(const std::shared_ptr<HybridOmniPlayerSpec>& player) override;
std::optional<bool> getAutoplay() override;
void setAutoplay(std::optional<bool> autoplay) override;
std::optional<bool> getShowNotification() override;
void setShowNotification(std::optional<bool> showNotification) override;
std::optional<bool> getAutoPip() override;
void setAutoPip(std::optional<bool> autoPip) override;
@@ -45,10 +45,6 @@ void JHybridOmniViewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /*
hybridView->setAutoplay(props->autoplay.value);
props->autoplay.isDirty = false;
}
if (props->showNotification.isDirty) {
hybridView->setShowNotification(props->showNotification.value);
props->showNotification.isDirty = false;
}
if (props->autoPip.isDirty) {
hybridView->setAutoPip(props->autoPip.value);
props->autoPip.isDirty = false;
@@ -35,6 +35,12 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
@set:Keep
abstract var source: Source
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@set:Keep
abstract var showNotification: Boolean?
@get:DoNotStrip
@get:Keep
abstract val hasPrev: Boolean
@@ -38,12 +38,6 @@ abstract class HybridOmniViewSpec: HybridView() {
@set:Keep
abstract var autoplay: Boolean?
@get:DoNotStrip
@get:Keep
@set:DoNotStrip
@set:Keep
abstract var showNotification: Boolean?
@get:DoNotStrip
@get:Keep
@set:DoNotStrip