From c3c0150f9288d9f9be6612fe15067ba5eaa40279 Mon Sep 17 00:00:00 2001 From: James Swan <122404367+swan-amazon@users.noreply.github.com> Date: Thu, 29 Aug 2024 19:29:28 +0000 Subject: [PATCH] reorder --- .../DefaultTermsAndConditionsProvider.cpp | 24 +++++++++---------- .../DefaultTermsAndConditionsProvider.h | 10 ++++---- src/app/server/TermsAndConditionsProvider.h | 20 ++++++++-------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/app/server/DefaultTermsAndConditionsProvider.cpp b/src/app/server/DefaultTermsAndConditionsProvider.cpp index 4640bb662255fd..db82433e03c3e5 100644 --- a/src/app/server/DefaultTermsAndConditionsProvider.cpp +++ b/src/app/server/DefaultTermsAndConditionsProvider.cpp @@ -97,12 +97,6 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::CheckAcceptance(const O return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(const Optional & inTermsAndConditions) -{ - mTemporalAcceptance.SetValue(inTermsAndConditions.Value()); - return CHIP_NO_ERROR; -} - CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::CommitAcceptance() { if (!mTemporalAcceptance.HasValue()) @@ -114,9 +108,15 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::CommitAcceptance() return StoreAcceptance(mLatchedAcceptance); } -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::RevertAcceptance() +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(Optional & outTermsAndConditions) const { - mTemporalAcceptance = mLatchedAcceptance; + outTermsAndConditions = mTemporalAcceptance; + return CHIP_NO_ERROR; +} + +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetRequirements(Optional & outTermsAndConditions) const +{ + outTermsAndConditions = mRequiredAcknowledgements; return CHIP_NO_ERROR; } @@ -133,15 +133,15 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::ResetAcceptance() return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(Optional & outTermsAndConditions) const +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::RevertAcceptance() { - outTermsAndConditions = mTemporalAcceptance; + mTemporalAcceptance = mLatchedAcceptance; return CHIP_NO_ERROR; } -CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetRequirements(Optional & outTermsAndConditions) const +CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(const Optional & inTermsAndConditions) { - outTermsAndConditions = mRequiredAcknowledgements; + mTemporalAcceptance.SetValue(inTermsAndConditions.Value()); return CHIP_NO_ERROR; } diff --git a/src/app/server/DefaultTermsAndConditionsProvider.h b/src/app/server/DefaultTermsAndConditionsProvider.h index b841d3ea49e7a9..1fbde5a7e51418 100644 --- a/src/app/server/DefaultTermsAndConditionsProvider.h +++ b/src/app/server/DefaultTermsAndConditionsProvider.h @@ -42,17 +42,17 @@ class DefaultTermsAndConditionsProvider : public TermsAndConditionsProvider CHIP_ERROR CheckAcceptance(const Optional & inTermsAndConditions, TermsAndConditionsState & outState) const override; - CHIP_ERROR SetAcceptance(const Optional & inTermsAndConditions) override; - CHIP_ERROR CommitAcceptance() override; - CHIP_ERROR RevertAcceptance() override; + CHIP_ERROR GetAcceptance(Optional & outTermsAndConditions) const override; + + CHIP_ERROR GetRequirements(Optional & outTermsAndConditions) const override; CHIP_ERROR ResetAcceptance() override; - CHIP_ERROR GetAcceptance(Optional & outTermsAndConditions) const override; + CHIP_ERROR RevertAcceptance() override; - CHIP_ERROR GetRequirements(Optional & outTermsAndConditions) const override; + CHIP_ERROR SetAcceptance(const Optional & inTermsAndConditions) override; private: CHIP_ERROR LoadAcceptance(Optional & outTermsAndConditions); diff --git a/src/app/server/TermsAndConditionsProvider.h b/src/app/server/TermsAndConditionsProvider.h index 2e55436566e1dc..95b73d70229583 100644 --- a/src/app/server/TermsAndConditionsProvider.h +++ b/src/app/server/TermsAndConditionsProvider.h @@ -55,19 +55,19 @@ class TermsAndConditionsProvider TermsAndConditionsState & outState) const = 0; /** - * @brief Sets the acceptance status of the required terms and conditions. + * @brief Commit the persistent acceptance status of the required terms and conditions. */ - virtual CHIP_ERROR SetAcceptance(const Optional & inTermsAndConditions) = 0; + virtual CHIP_ERROR CommitAcceptance() = 0; /** - * @brief Commit the persistent acceptance status of the required terms and conditions. + * @brief Retrieves the latest acceptance status of the required terms and conditions. */ - virtual CHIP_ERROR CommitAcceptance() = 0; + virtual CHIP_ERROR GetAcceptance(Optional & outTermsAndConditions) const = 0; /** - * @brief Clear the temporary acceptance status of the required terms and conditions. + * @brief Retrieves the requirements of the terms and conditions. */ - virtual CHIP_ERROR RevertAcceptance() = 0; + virtual CHIP_ERROR GetRequirements(Optional & outTermsAndConditions) const = 0; /** * @brief Reset the persisted acceptance status of the required terms and conditions. @@ -75,14 +75,14 @@ class TermsAndConditionsProvider virtual CHIP_ERROR ResetAcceptance() = 0; /** - * @brief Retrieves the latest acceptance status of the required terms and conditions. + * @brief Clear the temporary acceptance status of the required terms and conditions. */ - virtual CHIP_ERROR GetAcceptance(Optional & outTermsAndConditions) const = 0; + virtual CHIP_ERROR RevertAcceptance() = 0; /** - * @brief Retrieves the requirements of the terms and conditions. + * @brief Sets the acceptance status of the required terms and conditions. */ - virtual CHIP_ERROR GetRequirements(Optional & outTermsAndConditions) const = 0; + virtual CHIP_ERROR SetAcceptance(const Optional & inTermsAndConditions) = 0; }; } // namespace app