Skip to content

Repository files navigation

KickIt - iOS SDK

This project was created to integrate Apple apps with the KickIt service.

Here's an example of how the SDK can be used:

// ...
@StateprivatevarshowingAlert=false@StateprivatevaralertMessage=""@StateprivatevarshouldCloseApp=Optional(false)
// ...
func checkAppDeprecation(){varkickItResponse:KickItResponse?do{letsdk=tryKickItSdk.init(bundle:.main, processInfo:.processInfo, parameters:["dummy":"app"], urlSession:.shared)
sdk.checkApplicationDeprecation{ result in
kickItResponse =try! result.get()
logger.log("Checking app deprecation")
logger.log("Response \(kickItResponse.debugDescription)")
showingAlert = kickItResponse!.matched
alertMessage = kickItResponse!.message
shouldCloseApp = kickItResponse?.hardDeprecation
logger.log("Executed app deprecation check")}}catch{
logger.log("Error")}}
// ...
func alert()->Alert{if shouldCloseApp !=nil && shouldCloseApp! {returnAlert(title:Text("Heads up!"), message:Text(alertMessage), dismissButton:.default(Text("Close"), action:{DispatchQueue.main.asyncAfter(deadline:.now()){UIApplication.shared.perform(#selector(NSXPCConnection.suspend))}}))}else{returnAlert(title:Text("Heads up!"), message:Text(alertMessage), dismissButton:.default(Text("Ok")))}}
// ...
.onAppear(perform: checkAppDeprecation)
// ...
.onReceive(NotificationCenter.default.publisher(for:UIApplication.willEnterForegroundNotification)){ _ incheckAppDeprecation()self.alert(isPresented: $showingAlert){alert()}}

With the code above the app will close always for forced upgrades blocking the user from using the app. And for soft upgrades it will only display a message and allow the user to continue.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages