GRVMPAppRatingDelegate
IAPMiniProgram SDK provides the ability to customize the star ratings model of the mini program, so that the Super App can use their own star ratings model to show the start ratings of the mini programs. This article describes how to customize the star ratingsl of the mini program by implementing the specific interface of IAPMiniProgram SDK.
Procedures
To customize the star ratings model of the mini program, follow these steps:
Step 1. Implement the GRVMPAppRatingDelegate
delegate
Implement the GRVMPAppRatingDelegate delegate and write code in the required methods according to your business logic.
Code sample as follows:
class DemoAppRatingDelegateImpl: NSObject, GRVMPAppRatingDelegate {
func getAppRating(withAppId appId: String) -> GRVMPMoreMenuRatingModel {
}
}
Step 2. Configure the GRVMPAppRatingDelegate
delegate
Refer to the following sample code. Configure the GRVExtensionDelegate interface to register the GRVMPAppRatingDelegate delegate after initializing the SDK.
let extensionDelegate = GRVExtensionDelegate()
extensionDelegate.uiProvider.appRatingDelegate = DemoAppRatingDelegateImpl()
Delegates
GRVMPAppRatingDelegate
delegate
The definition of this delegate is shown in the following codes:
@protocol GRVMPAppRatingDelegate <NSObject>
@required
- (GRVMPMoreMenuRatingModel *)getAppRatingWithAppId:(NSString *)appId;
@end
Methods
Based on the definition above, this interface provides the following method:
Method | Description |
Gets the star ratings of the mini program. The SDK needs to call this method to obtain the star ratings of the current mini program. |
getAppRatingWithAppId:
method
Parameters
Parameter | Data type | Required | Description |
appId | String | Yes | The mini program |
Return value
Parameter | Data type | Required | Description |
N/A | GRVMPMoreMenuRatingModel class | Yes | The star rating model of the current mini program. |
GRVMPMoreMenuRatingModel class
The definition of the this class is shown in the following codes:
typedef void (^GRVMPMoreMenuRatingActionBlock)(GRVMoreMenuContext *context);
@interface GRVMPMoreMenuRatingModel : NSObject
@property (nonatomic, copy) NSString *ratingScore;
@property (nonatomic, copy) NSString *ratingAppId;
@property (nonatomic, copy) GRVMPMoreMenuRatingActionBlock actionBlock;
@end
Parameter | Data type | Required | Description |
ratingScore | String | Yes | The star rating of the mini program. |
ratingAppId | String | Yes | The mini program |
actionBlock | Function | No | The listener for when clicking the star area in the options menu panel. |