Skip to content

Repository files navigation

ALVersionControl

CI StatusVersionLicensePlatform

ALVersionControl is an application update process controller. There are 3 types of update status which described below. AlVersionControl does not provide any api call. You have to make it in own way.

Version Control API structure

Request:

ALVersionControl has handy request model called ALVersionControlRequest which has only 2 variable. You may use it in your api call. You have to store latest versions on your server database for both iOS and Android.

publicstructALVersionControlRequest:Encodable{
/// OS Type (1:iOS - 2:Android)
letos:Int
/// App bundle version (e.g. 1.0.2)
letversion:Stringpublicinit(){self.os =1self.version =Bundle.main.infoDictionary?["CFBundleShortVersionString"]as?String??""}}

Json

{
"os": 1,
"version": "1.0.2"
}

Response

ALVersionControl has response model called ALVersionControlResponse which you have to use in order to us handle controlling process. You may use your own model, but you have to convert it to this model in "versionControllerAPIHandler" method to pass through completion.

publicenumALVersionControlStatus:Int,Codable{
/// All good. App is up to date
case upToDate =0
/// Optional update available
case optional =1
/// Force update available
case force =2}publicstructALVersionControlResponse:Decodable{
/// The info message which inform to user there is a new update.
letmessage:String?
/// The status of new update.
letstatus:ALVersionControlStatus?
/// The market url which lead the user to update the app
leturl:URL?publicinit(message:String?, status:ALVersionControlStatus?, url:URL?){self.message = message
self.status = status
self.url = url
}}

Json

{
"message": "Hey! You have a new update.",
"status": 1,
"url": "app market url"
}
  1. Up to date [0] : So there is no update. All is good.
  2. Optional Update [1] : To inform users there is a new update and user may update the app. Once user dismiss the alert, we will not bother again.
  3. Force Update [2] : User must update the application in order to keep using the app. Hopefully never use it.

Usage

Setup

ALVersionControl.shared.setup(delegate:self)

You have to handle applicationDidBecomeActive status. Just calling the appDidBecomeActive method is enough.

func applicationDidBecomeActive(_ application:UIApplication){ALVersionControl.shared.appDidBecomeActive()}

Language Support

Turkish, English, Arabic

Feel free to add more. Pull requests are welcome :)

Installation

Swift Package Manager

Once you have your Swift package set up, adding ALVersionControl as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies:[.package(url:"https://github.com/applogistdev/ALVersionControl.git", from:"0.2.0")]

CocoaPods

To integrate ALVersionControl into your Xcode project using CocoaPods, specify it in your Podfile

pod'ALVersionControl'

Author

sonifex, sonerguler93@gmail.com

License

ALVersionControl is available under the MIT license. See the LICENSE file for more info.

About

App Market Version Controller

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages