Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
Dong committed Oct 12, 2023
1 parent 68e5671 commit d5059a2
Show file tree
Hide file tree
Showing 47 changed files with 1,581 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// swift-tools-version:5.6
import PackageDescription

let package = Package(
name: "iRate",
defaultLocalization: "en",
platforms: [.iOS(.v13)],
products: [
.library(
name: "iRate",
targets: ["iRate"]),
],
targets: [
.target(
name: "iRate",
path: "Sources/iRate")
]
)
26 changes: 26 additions & 0 deletions Sources/iRate/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/bs.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Ocijeni %@";
"iRateAppMessage" = "Ako uživate koristeći %@, želite li odvojiti trenutak da date ocjenu? To vam neće uzeti više od minute. Hvala na vašoj podršci!";
"iRateGameMessage" = "Ako uživate igrati %@, želite li odvojiti trenutak da date ocjenu? To vam neće uzeti više od minute. Hvala na vašoj podršci";
"iRateCancelButton" = "Ne, hvala";
"iRateRateButton" = "Ocijeni sada";
"iRateRemindButton" = "Podsjeti me kasnije";
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/cs.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Ohodnotit %@";
"iRateAppMessage" = "Pokud se vám líbí %@, našli byste si chvilku na ohodnocení aplikace? Nebude to trvat víc než minutu.\nDěkujeme za vaši podporu!";
"iRateGameMessage" = "Pokud se vám %@ líbí, našli byste si chvilku na ohodnocení hry? Nebude to trvat víc než minutu. Děkujeme za vaši podporu!";
"iRateCancelButton" = "Ne, děkuji";
"iRateRateButton" = "Ohodnotit nyní";
"iRateRemindButton" = "Připomenout později";
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/da.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Vurdér %@";
"iRateAppMessage" = "Hvis du kan lide at bruge %@, vil du så ikke bruge et øjeblik på at give en vurdering? Det tager ikke mere end et minut. Mange tak for hjælpen!";
"iRateGameMessage" = "Hvis du kan lide at spille %@, vil du så ikke bruge et øjeblik på at vurdere det? Det tager ikke mere end et minut. Mange tak for hjælpen!";
"iRateCancelButton" = "Nej tak";
"iRateRateButton" = "Vurdér nu";
"iRateRemindButton" = "Påmind mig senere";
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/de-AT.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Bewerte %@";
"iRateAppMessage" = "Wenn dir %@ gefällt, würdest Du es bitte bewerten? Dies wird nicht länger als eine Minute dauern.\nDanke für die Unterstützung!";
"iRateGameMessage" = "Wenn dir %@ gefällt, würdest Du es bitte bewerten? Dies wird nicht länger als eine Minute dauern. Danke für die Unterstützung!";
"iRateCancelButton" = "Nein, danke";
"iRateRateButton" = "Jetzt bewerten";
"iRateRemindButton" = "Später erinnern";
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/fa.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "امتیاز دهی به %@";
"iRateAppMessage" = "اگر شما از برنامه‌ی %@ لذت بردین، عالی میشه اگه با این برنامه در اپ‌استور امتیاز دهید! این کار بیشتر از ۱ دقیقه طول نمی‌کشد. با تشکر از حمایت شما!";
"iRateGameMessage" ="اگر شما از بازی %@ لذت بردین، عالی میشه اگه با این برنامه در اپ‌استور امتیاز دهید! این کار بیشتر از ۱ دقیقه طول نمی‌کشد. با تشکر از حمایت شما!";
"iRateCancelButton" = "نه، با تشکر";
"iRateRateButton" = "می‌خوام امتیاز بدم";
"iRateRemindButton" = "بعدا یادم بنداز";
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Notez %@";
"iRateAppMessage" = "Si vous aimez utiliser %@, n'oubliez pas de donner votre avis sur l'App Store. Cela ne prend qu'une minute. Merci d'avance pour votre soutien !";
"iRateGameMessage" = "Si vous aimez jouer à %@, n'oubliez pas de donner votre avis sur l'App Store. Cela ne prend qu'une minute. Merci d'avance pour votre soutien !";
"iRateCancelButton" = "Non, merci";
"iRateRateButton" = "Noter maintenant";
"iRateRemindButton" = "Me le rappeler ultérieurement";
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/hr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Ocijeni %@";
"iRateAppMessage" = "Ako uživate koristeći %@, želite li odvojiti trenutak da date ocjenu? To vam neće uzeti više od minute. Hvala na vašoj podršci!";
"iRateGameMessage" = "Ako uživate igrati %@, želite li odvojiti trenutak da date ocjenu? To vam neće uzeti više od minute. Hvala na vašoj podršci";
"iRateCancelButton" = "Ne, hvala";
"iRateRateButton" = "Ocijeni sada";
"iRateRemindButton" = "Podsjeti me kasnije";
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/nl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Beoordeel %@";
"iRateAppMessage" = "Als het gebruik van %@ je bevalt, wil je dan een moment nemen om het te beoordelen? Het duurt nog geen minuut. Bedankt voor je steun!";
"iRateGameMessage" = "Als het spelen van %@ je bevalt, wil je dan een moment nemen om het te beoordelen? Het duurt nog geen minuut. Bedankt voor je steun!";
"iRateCancelButton" = "Nee, bedankt";
"iRateRateButton" = "Beoordeel nu";
"iRateRemindButton" = "Herinner me er later aan";
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/sk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Ohodnotiť %@";
"iRateAppMessage" = "Ak sa vám páči %@, našli by ste si chvíľku na ohodnotenie aplikácie? Nebude to trvať viac ako minútu.\nĎakujeme za vašu podporu!";
"iRateGameMessage" = "Ak sa vám hra %@ páči, našli by ste si chvíľku na ohodnotenie aplikácie? Nebude to trvať viac ako minútu. Ďakujeme za vašu podporu!";
"iRateCancelButton" = "Nie, Ďakujem";
"iRateRateButton" = "Ohodnotiť teraz";
"iRateRemindButton" = "Pripomenúť neskôr";
Binary file not shown.
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/sv.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Betygsätt %@";
"iRateAppMessage" = "Gillar du %@ och kan tänka dig att betygsätta den? Det tar inte mer än en minut. Tack för ditt stöd!";
"iRateGameMessage" = "Gillar du att spela %@ och kan tänka dig att betygsätta det? Det tar inte mer än en minut. Tack för ditt stöd!";
"iRateCancelButton" = "Nej tack";
"iRateRateButton" = "Betygsätt nu!";
"iRateRemindButton" = "Påminn mig senare";
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 7 additions & 0 deletions Sources/iRate/iRate.bundle/ur-IN.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"iRateMessageTitle" = "کو ریٹ کیجیے %@";
"iRateAppMessage" = "اگر آپ نے %@ کو مفید پایا ہے تو کیا آپ اپنے قیمتی وقت میں سے چند لمحے نکال کر اس کو ریٹ کریں گے؟ اس میں ایک منٹ سے زیادہ نہیں لگے گا، آپ کے تعاون کا شکریہ!";
"iRateGameMessage" = "اگر آپ %@ کھیل کر محظوظ ہوئے ہیں تو کیا آپ اپنے قیمتی وقت میں سے چند لمحے نکال کر اس کو ریٹ کریں گے؟ اس میں ایک منٹ سے زیادہ نہیں لگے گا، آپ کے تعاون کا شکریہ!";
"iRateCancelButton" = "نہیں، شکریہ";
"iRateRateButton" = "ابھی ریٹ کیجیے";
"iRateRemindButton" = "مجھے بعد میں یاد دلائیں";
"iRateOkay" = "ٹھیک ہے";
7 changes: 7 additions & 0 deletions Sources/iRate/iRate.bundle/ur-PK.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"iRateMessageTitle" = "کو ریٹ کیجیے %@";
"iRateAppMessage" = "اگر آپ نے %@ کو مفید پایا ہے تو کیا آپ اپنے قیمتی وقت میں سے چند لمحے نکال کر اس کو ریٹ کریں گے؟ اس میں ایک منٹ سے زیادہ نہیں لگے گا، آپ کے تعاون کا شکریہ!";
"iRateGameMessage" = "اگر آپ %@ کھیل کر محظوظ ہوئے ہیں تو کیا آپ اپنے قیمتی وقت میں سے چند لمحے نکال کر اس کو ریٹ کریں گے؟ اس میں ایک منٹ سے زیادہ نہیں لگے گا، آپ کے تعاون کا شکریہ!";
"iRateCancelButton" = "نہیں، شکریہ";
"iRateRateButton" = "ابھی ریٹ کیجیے";
"iRateRemindButton" = "مجھے بعد میں یاد دلائیں";
"iRateOkay" = "ٹھیک ہے";
7 changes: 7 additions & 0 deletions Sources/iRate/iRate.bundle/ur.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"iRateMessageTitle" = "کو ریٹ کیجیے %@";
"iRateAppMessage" = "اگر آپ نے %@ کو مفید پایا ہے تو کیا آپ اپنے قیمتی وقت میں سے چند لمحے نکال کر اس کو ریٹ کریں گے؟ اس میں ایک منٹ سے زیادہ نہیں لگے گا، آپ کے تعاون کا شکریہ!";
"iRateGameMessage" = "اگر آپ %@ کھیل کر محظوظ ہوئے ہیں تو کیا آپ اپنے قیمتی وقت میں سے چند لمحے نکال کر اس کو ریٹ کریں گے؟ اس میں ایک منٹ سے زیادہ نہیں لگے گا، آپ کے تعاون کا شکریہ!";
"iRateCancelButton" = "نہیں، شکریہ";
"iRateRateButton" = "ابھی ریٹ کیجیے";
"iRateRemindButton" = "مجھے بعد میں یاد دلائیں";
"iRateOkay" = "ٹھیک ہے";
6 changes: 6 additions & 0 deletions Sources/iRate/iRate.bundle/vi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"iRateMessageTitle" = "Đánh giá %@";
"iRateAppMessage" = "Nếu thích sử dụng %@, bạn có muốn giành một chút thời gian để đánh giá nó? Sẽ không lâu hơn một phút. Cảm ơn sự hỗ trợ của bạn!";
"iRateGameMessage" = "Nếu thích chơi %@, bạn có muốn giành một chút thời gian để đánh giá nó? Sẽ không lâu hơn một phút. Cảm ơn sự hỗ trợ của bạn!";
"iRateCancelButton" = "Không, Cảm ơn";
"iRateRateButton" = "Đánh Giá Ngay";
"iRateRemindButton" = "Nhắc Tôi Sau";
Binary file not shown.
Binary file not shown.
Binary file not shown.
177 changes: 177 additions & 0 deletions Sources/iRate/iRate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
//
// iRate.h
//
// Version 1.12.2
//
// Created by Nick Lockwood on 26/01/2011.
// Copyright 2011 Charcoal Design
//
// Distributed under the permissive zlib license
// Get the latest version from here:
//
// https://github.com/nicklockwood/iRate
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wobjc-missing-property-synthesis"


#import <Availability.h>
#undef weak_delegate
#if __has_feature(objc_arc_weak) && \
(TARGET_OS_IPHONE || __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_8)
#define weak_delegate weak
#else
#define weak_delegate unsafe_unretained
#endif


#import <TargetConditionals.h>
#if TARGET_OS_IPHONE
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
#define IRATE_EXTERN UIKIT_EXTERN
#else
#import <Cocoa/Cocoa.h>
#define IRATE_EXTERN APPKIT_EXTERN
#endif

//! Project version number for iRate.
FOUNDATION_EXPORT double iRateVersionNumber;

//! Project version string for iRate.
FOUNDATION_EXPORT const unsigned char iRateVersionString[];

IRATE_EXTERN NSUInteger const iRateAppStoreGameGenreID;
IRATE_EXTERN NSString *const iRateErrorDomain;

//localisation string keys
IRATE_EXTERN NSString *const iRateMessageTitleKey; //iRateMessageTitle
IRATE_EXTERN NSString *const iRateAppMessageKey; //iRateAppMessage
IRATE_EXTERN NSString *const iRateGameMessageKey; //iRateGameMessage
IRATE_EXTERN NSString *const iRateUpdateMessageKey; //iRateUpdateMessage
IRATE_EXTERN NSString *const iRateCancelButtonKey; //iRateCancelButton
IRATE_EXTERN NSString *const iRateRemindButtonKey; //iRateRemindButton
IRATE_EXTERN NSString *const iRateRateButtonKey; //iRateRateButton

//notification keys
IRATE_EXTERN NSString *const iRateCouldNotConnectToAppStore;
IRATE_EXTERN NSString *const iRateDidDetectAppUpdate;
IRATE_EXTERN NSString *const iRateDidPromptForRating;
IRATE_EXTERN NSString *const iRateUserDidAttemptToRateApp;
IRATE_EXTERN NSString *const iRateUserDidDeclineToRateApp;
IRATE_EXTERN NSString *const iRateUserDidRequestReminderToRateApp;
IRATE_EXTERN NSString *const iRateDidOpenAppStore;


typedef NS_ENUM(NSUInteger, iRateErrorCode)
{
iRateErrorBundleIdDoesNotMatchAppStore = 1,
iRateErrorApplicationNotFoundOnAppStore,
iRateErrorApplicationIsNotLatestVersion,
iRateErrorCouldNotOpenRatingPageURL
};


@protocol iRateDelegate <NSObject>
@optional

- (void)iRateCouldNotConnectToAppStore:(NSError *)error;
- (void)iRateDidDetectAppUpdate;
- (BOOL)iRateShouldPromptForRating;
- (void)iRateDidPromptForRating;
- (void)iRateUserDidAttemptToRateApp;
- (void)iRateUserDidDeclineToRateApp;
- (void)iRateUserDidRequestReminderToRateApp;
- (BOOL)iRateShouldOpenAppStore;
- (void)iRateDidOpenAppStore;

@end


@interface iRate : NSObject

+ (instancetype)sharedInstance;

//app store ID - this is only needed if your
//bundle ID is not unique between iOS and Mac app stores
@property (nonatomic, assign) NSUInteger appStoreID;

//application details - these are set automatically
@property (nonatomic, assign) NSUInteger appStoreGenreID;
@property (nonatomic, copy) NSString *appStoreCountry;
@property (nonatomic, copy) NSString *applicationName;
@property (nonatomic, copy) NSString *applicationVersion;
@property (nonatomic, copy) NSString *applicationBundleID;

//usage settings - these have sensible defaults
@property (nonatomic, assign) NSUInteger usesUntilPrompt;
@property (nonatomic, assign) NSUInteger eventsUntilPrompt;
@property (nonatomic, assign) float daysUntilPrompt;
@property (nonatomic, assign) float usesPerWeekForPrompt;
@property (nonatomic, assign) float remindPeriod;

//message text, you may wish to customise these
@property (nonatomic, copy) NSString *messageTitle;
@property (nonatomic, copy) NSString *message;
@property (nonatomic, copy) NSString *updateMessage;
@property (nonatomic, copy) NSString *cancelButtonLabel;
@property (nonatomic, copy) NSString *remindButtonLabel;
@property (nonatomic, copy) NSString *rateButtonLabel;

//debugging and prompt overrides

@property (nonatomic, assign) BOOL useSKStoreReviewControllerIfAvailable;
@property (nonatomic, assign) BOOL useUIAlertControllerIfAvailable;
@property (nonatomic, assign) BOOL useAllAvailableLanguages;
@property (nonatomic, assign) BOOL promptForNewVersionIfUserRated;
@property (nonatomic, assign) BOOL onlyPromptIfLatestVersion;
@property (nonatomic, assign) BOOL onlyPromptIfMainWindowIsAvailable;
@property (nonatomic, assign) BOOL promptAtLaunch;
@property (nonatomic, assign) BOOL verboseLogging;
@property (nonatomic, assign) BOOL previewMode;

//advanced properties for implementing custom behaviour
@property (nonatomic, strong) NSURL *ratingsURL;
@property (nonatomic, strong) NSDate *firstUsed;
@property (nonatomic, strong) NSDate *lastReminded;
@property (nonatomic, assign) NSUInteger usesCount;
@property (nonatomic, assign) NSUInteger eventCount;
@property (nonatomic, readonly) float usesPerWeek;
@property (nonatomic, assign) BOOL declinedThisVersion;
@property (nonatomic, readonly) BOOL declinedAnyVersion;
@property (nonatomic, assign) BOOL ratedThisVersion;
@property (nonatomic, readonly) BOOL ratedAnyVersion;
@property (nonatomic, weak_delegate) id<iRateDelegate> delegate;

//manually control behaviour
- (BOOL)shouldPromptForRating;
- (void)promptForRating;
- (void)promptIfNetworkAvailable;
- (void)promptIfAllCriteriaMet;
- (void)openRatingsPageInAppStore;
- (void)logEvent:(BOOL)deferPrompt;
- (void)remindLater;

@end


#pragma clang diagnostic pop
Loading

0 comments on commit d5059a2

Please sign in to comment.