Skip to content

Commit

Permalink
fix: Add default implementation for hook methods (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
keelerm84 authored May 20, 2024
1 parent fbb2645 commit 4461043
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/actions/ci/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ runs:
with:
xcode-version: ${{ inputs.xcode-version }}

- name: Install mint and swiftlint
- name: Install mint
shell: bash
run: |
brew tap mint-lang/mint-lang
brew install mint-lang swiftlint libressl
brew install mint-lang libressl
- name: Install cocoapods
shell: bash
Expand Down
14 changes: 14 additions & 0 deletions LaunchDarkly/LaunchDarkly/Models/Hooks/Hook.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@ public protocol Hook {
/// determined. The method is executed synchronously.
func afterEvaluation(seriesContext: EvaluationSeriesContext, seriesData: EvaluationSeriesData, evaluationDetail: LDEvaluationDetail<LDValue>) -> EvaluationSeriesData
}

public extension Hook {
func metadata() -> Metadata {
return Metadata(name: "UNDEFINED")
}

func beforeEvaluation(seriesContext: EvaluationSeriesContext, seriesData: EvaluationSeriesData) -> EvaluationSeriesData {
return seriesData
}

func afterEvaluation(seriesContext: EvaluationSeriesContext, seriesData: EvaluationSeriesData, evaluationDetail: LDEvaluationDetail<LDValue>) -> EvaluationSeriesData {
return seriesData
}
}

0 comments on commit 4461043

Please sign in to comment.