Skip to content

Commit

Permalink
Updates for stateful plugin protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
ps2 committed Sep 22, 2023
1 parent abf41c5 commit 6de0cbd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions MixpanelServiceKit/MixpanelService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ import LoopKit

public final class MixpanelService: Service {

public static let serviceIdentifier = "MixpanelService"
public static let pluginIdentifier = "MixpanelService"

public static let localizedTitle = LocalizedString("Mixpanel", comment: "The title of the Mixpanel service")

public weak var serviceDelegate: ServiceDelegate?

public weak var stateDelegate: StatefulPluggableDelegate?

public var token: String?

private var client: MixpanelInstance?
Expand Down Expand Up @@ -43,12 +45,12 @@ public final class MixpanelService: Service {
public func completeUpdate() {
try! KeychainManager().setMixpanelToken(token)
createClient()
serviceDelegate?.serviceDidUpdateState(self)
stateDelegate?.pluginDidUpdateState(self)
}

public func completeDelete() {
try! KeychainManager().setMixpanelToken()
serviceDelegate?.serviceWantsDeletion(self)
stateDelegate?.pluginWantsDeletion(self)
}

private func createClient() {
Expand Down

0 comments on commit 6de0cbd

Please sign in to comment.