Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
takecian committed Nov 5, 2024
1 parent 6541e66 commit f372c7c
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 47 deletions.
105 changes: 65 additions & 40 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,76 +1,101 @@
GIT
remote: https://github.com/CocoaPods/fourflusher
revision: 8235ee8fae34ccaf5c708987306228988cea2e43
revision: 4e5f1693d41748c2124e492b5f97b7331479840e
branch: master
specs:
fourflusher (2.2.0)
fourflusher (2.3.1)

GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.0)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.7.10)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.0.2)
cocoapods (1.6.1)
activesupport (>= 4.0.2, < 5)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.16.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.6.1)
cocoapods-deintegrate (>= 1.0.2, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-core (= 1.16.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.3.1, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.2.0, < 3.0)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.8.1, < 2.0)
cocoapods-core (1.6.1)
activesupport (>= 4.0.2, < 6)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.27.0, < 2.0)
cocoapods-core (1.16.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.3)
cocoapods-downloader (1.6.3)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.3.1)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
concurrent-ruby (1.3.4)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.17.0)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
httpclient (2.8.3)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
minitest (5.11.3)
molinillo (0.6.6)
nanaimo (0.2.6)
json (2.7.6)
minitest (5.25.1)
molinillo (0.8.0)
nanaimo (0.4.0)
nap (1.1.0)
netrc (0.11.0)
ruby-macho (1.4.0)
thread_safe (0.3.6)
tzinfo (1.2.10)
thread_safe (~> 0.1)
xcodeproj (1.8.1)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.3.9)
ruby-macho (2.5.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.27.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)
nanaimo (~> 0.4.0)
rexml (>= 3.3.6, < 4.0)
zeitwerk (2.6.18)

PLATFORMS
ruby
Expand All @@ -80,4 +105,4 @@ DEPENDENCIES
fourflusher!

BUNDLED WITH
1.16.1
1.17.2
28 changes: 21 additions & 7 deletions SwiftRater/SwiftRater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -323,21 +323,35 @@ import StoreKit

#if os(iOS)
@discardableResult
@objc public static func check(host: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) -> Bool {
@objc @MainActor public static func check(host: UIViewController? = nil) -> Bool {
guard UsageDataManager.shared.ratingConditionsHaveBeenMet else {
return false
}

SwiftRater.shared.showRatingAlert(host: host, force: false)

let viewController = host ?? topViewController()
SwiftRater.shared.showRatingAlert(host: viewController, force: false)
return true
}
@objc public static func rateApp(host: UIViewController? = UIApplication.shared.keyWindow?.rootViewController) {

@objc @MainActor public static func rateApp(host: UIViewController? = nil) {
NSLog("[SwiftRater] Trying to show review request dialog.")
SwiftRater.shared.showRatingAlert(host: host, force: true)

let viewController = host ?? topViewController()
SwiftRater.shared.showRatingAlert(host: viewController, force: true)

UsageDataManager.shared.isRateDone = true
}

// Helper method to get top view controller
@MainActor private static func topViewController() -> UIViewController? {
guard let windowScene = UIApplication.shared.connectedScenes
.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene else {
return nil
}

return windowScene.windows
.first(where: { $0.isKeyWindow })?
.rootViewController
}
#endif

#if os(macOS)
Expand Down

0 comments on commit f372c7c

Please sign in to comment.