Skip to content

Commit

Permalink
reorder
Browse files Browse the repository at this point in the history
  • Loading branch information
swan-amazon committed Aug 29, 2024
1 parent b64b992 commit c3c0150
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
24 changes: 12 additions & 12 deletions src/app/server/DefaultTermsAndConditionsProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::CheckAcceptance(const O
return CHIP_NO_ERROR;
}

CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(const Optional<TermsAndConditions> & inTermsAndConditions)
{
mTemporalAcceptance.SetValue(inTermsAndConditions.Value());
return CHIP_NO_ERROR;
}

CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::CommitAcceptance()
{
if (!mTemporalAcceptance.HasValue())
Expand All @@ -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<TermsAndConditions> & outTermsAndConditions) const
{
mTemporalAcceptance = mLatchedAcceptance;
outTermsAndConditions = mTemporalAcceptance;
return CHIP_NO_ERROR;
}

CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetRequirements(Optional<TermsAndConditions> & outTermsAndConditions) const
{
outTermsAndConditions = mRequiredAcknowledgements;
return CHIP_NO_ERROR;
}

Expand All @@ -133,15 +133,15 @@ CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::ResetAcceptance()
return CHIP_NO_ERROR;
}

CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetAcceptance(Optional<TermsAndConditions> & outTermsAndConditions) const
CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::RevertAcceptance()
{
outTermsAndConditions = mTemporalAcceptance;
mTemporalAcceptance = mLatchedAcceptance;
return CHIP_NO_ERROR;
}

CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::GetRequirements(Optional<TermsAndConditions> & outTermsAndConditions) const
CHIP_ERROR chip::app::DefaultTermsAndConditionsProvider::SetAcceptance(const Optional<TermsAndConditions> & inTermsAndConditions)
{
outTermsAndConditions = mRequiredAcknowledgements;
mTemporalAcceptance.SetValue(inTermsAndConditions.Value());
return CHIP_NO_ERROR;
}

Expand Down
10 changes: 5 additions & 5 deletions src/app/server/DefaultTermsAndConditionsProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ class DefaultTermsAndConditionsProvider : public TermsAndConditionsProvider
CHIP_ERROR CheckAcceptance(const Optional<TermsAndConditions> & inTermsAndConditions,
TermsAndConditionsState & outState) const override;

CHIP_ERROR SetAcceptance(const Optional<TermsAndConditions> & inTermsAndConditions) override;

CHIP_ERROR CommitAcceptance() override;

CHIP_ERROR RevertAcceptance() override;
CHIP_ERROR GetAcceptance(Optional<TermsAndConditions> & outTermsAndConditions) const override;

CHIP_ERROR GetRequirements(Optional<TermsAndConditions> & outTermsAndConditions) const override;

CHIP_ERROR ResetAcceptance() override;

CHIP_ERROR GetAcceptance(Optional<TermsAndConditions> & outTermsAndConditions) const override;
CHIP_ERROR RevertAcceptance() override;

CHIP_ERROR GetRequirements(Optional<TermsAndConditions> & outTermsAndConditions) const override;
CHIP_ERROR SetAcceptance(const Optional<TermsAndConditions> & inTermsAndConditions) override;

private:
CHIP_ERROR LoadAcceptance(Optional<TermsAndConditions> & outTermsAndConditions);
Expand Down
20 changes: 10 additions & 10 deletions src/app/server/TermsAndConditionsProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,34 @@ 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<TermsAndConditions> & 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<TermsAndConditions> & 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<TermsAndConditions> & outTermsAndConditions) const = 0;

/**
* @brief Reset the persisted acceptance status of the required terms and conditions.
*/
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<TermsAndConditions> & 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<TermsAndConditions> & outTermsAndConditions) const = 0;
virtual CHIP_ERROR SetAcceptance(const Optional<TermsAndConditions> & inTermsAndConditions) = 0;
};

} // namespace app
Expand Down

0 comments on commit c3c0150

Please sign in to comment.