Giter VIP home page Giter VIP logo

christianfox / reviewprompter Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 15 KB

ReviewPrompter is an open-source library for iOS applications written in Swift that helps you intelligently prompt users for app reviews. It tracks the occurrence of specific events within your app and requests a review prompt when the specified conditions are met.

License: MIT License

Swift 100.00%
events ios macos review storekit swift swift-package-manager tracker

reviewprompter's Introduction

Latest Version Swift Platforms

Swift Package Manager Cocoapods Cathage Manually

CodeCoverage License Contribution First Timers Friendly

Size Files

ReviewPrompter

ReviewPrompter is an open-source library for iOS applications written in Swift that helps you intelligently prompt users for app reviews. It tracks the occurrence of specific events within your app and requests a review prompt when the specified conditions are met. ReviewPrompter ensures that users are not prompted too frequently by implementing a minimum time interval between each prompt.

Dependencies

ReviewPrompter is a subclass of EventTracker and so depends on the EventTracker library.

Features

  • Tracks occurrences of named events in your app
  • Requests review prompts when the number of events matches the specified condition
  • Ensures a minimum time interval between each prompt
  • Allows for manual triggering of review prompts
  • Supports event count resetting
  • Provides an option to enable or disable logging

๐Ÿงช Tests

The library is basically fully tested with 98.5% code coverage

๐Ÿ’ป Installation

Swift Package Manager

To add ReviewPrompter to your project using Swift Package Manager, add the following dependency in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/ChristianFox/ReviewPrompter.git", from: "1.0.0")
]

Don't forget to add ReviewPrompter to your target dependencies:

targets: [
    .target(
        name: "YourTarget",
        dependencies: ["ReviewPrompter"]),
]

๐Ÿ› ๏ธ Usage

ReviewPrompter

Initialise an instance

let reviewPrompter = ReviewPrompter(minimumPromptInterval: 60 * 60 * 24 * 7) // 1 week

Increase the event count and request a review prompt if the condition is met. Callback is used to inform the caller if a review prompt has been requested.

do {
    try reviewPrompter.increaseEventCountWithReviewPrompt(forIdentifier: "event1") { didRequestReview in
        print("Review prompt requested: \(didRequestReview)")
    }
} catch {
    print("Error: \(error)")
}

Manually triggr a review prompt

let didRequest = reviewPrompter.requestReviewPrompt()
print("Review prompt requested: \(didRequest)")

If needed, you can delete the history of review prompt dates with the deleteHistoryOfReviewPromptDates() method:

reviewPrompter.deleteHistoryOfReviewPromptDates()

Inherited from EventTracker

Begin tracking an event

reviewPrompter.trackEvent(forIdentifier: "event1", withCondition: 3)

Stop tracking an event

reviewPrompter.stopTrackingEvent(forIdentifier: "event1")

Change the condition for an event

do {
    try reviewPrompter.changeCondition(5, forIdentifier: "event1")
} catch {
    print("Error updating event condition: \(error)")
}

Increase the event count

do {
    try reviewPrompter.increaseEventCount(forIdentifier: "event1")
} catch {
    print("Error increasing event count: \(error)")
}

Reset the event count

do {
    try reviewPrompter.resetEventCount(forIdentifier: "event1")
} catch {
    print("Error resetting event count: \(error)")
}

Check if an event's condition has been met

if reviewPrompter.hasEventMetCondition(forIdentifier: "event1") {
    print("Event met condition!")
}

Check an event is being tracked

if reviewPrompter.isTrackingEvent(forIdentifier: "event1") {
    print("Event is being tracked!")
}

Check the number of times an event has occured

let eventCount = reviewPrompter.eventCount(forIdentifier: "event1")
print("Event count: \(eventCount)")

Check the current condition of an event

let eventCondition = reviewPrompter.condition(forIdentifier: "event1")
print("Event condition: \(eventCondition)")

๐Ÿ•โ€๐Ÿฆบ Support

Please open an issue for support.

๐Ÿ‘ทโ€โ™‚๏ธ Contributing

Pull requests are welcome. I welcome developers of all skill levels to help improve the library, fix bugs, or add new features.

For major changes, please open an issue first to discuss what you would like to change.

Before submitting a pull request, please ensure that your code adheres to the existing code style and conventions, and that all tests pass. Additionally, if you're adding new functionality, please make sure to include unit tests to verify the behavior.

If you have any questions or need assistance, feel free to open an issue, and I'll do my best to help you out.

๐Ÿชช Licence

ReviewPrompter is released under the MIT Licence. See the LICENSE file for more information.

Buy Me A Coffee

reviewprompter's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.