ReviewPrompter

1.0.1

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.
ChristianFox/ReviewPrompter

What's New

v1.0.1

2023-04-28T23:23:19Z
  • Updated Readme, no code changes

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.

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 21:50:53 GMT-0900 (Hawaii-Aleutian Daylight Time)