Antom, leading provider of tailored payment solutionsAntom, leading provider of tailored payment solutions

Customize the user authorization view

When the Merchants' mini program calls some APIs, such as contact, photo album, geographical location, and other related APIs, it is important to obtain consent from users to protect their privacy. Users have the right to reject the mini program calling these sensitive APIs.

Griver AppContainer has implemented the default authorization view. Customize the authorization view by GRVAuthDelegate.

copy
@protocol GRVAuthDelegate <NSObject>

@required

/** Show authorization view

 Show authorization  view , the view ususally has two buttons for 'Allow' and 'Don't allow'

 @param param GRVAuthParam
 @param currentViewController  current view controller for presenting the authorization view controller.
 @param positiveAction when user click the 'Allow' button, you should call the positiveAction for calling back.
 @param cancelAction when user click the 'Don't allow', you should cancel showing the authorization view and call the cancelAction for calling back.
 */
- (void)showAuthWithParam:(GRVAuthParam *)param
currentViewController:(UIViewController*)currentViewController
      positiveAction:(GRVAuthActionBlock _Nullable)positiveAction
        cancelAction:(GRVAuthActionBlock _Nullable)cancelAction;

@end

The GRVAuthParam contains the following properties.

copy
@interface GRVAuthParam : NSObject

/**
 scopes of authorization.
 */
@property(nonatomic, copy)NSArray<NSString *> *scopes;

/**
 content for showing authorization.
 */
@property(nonatomic, copy)NSString *content;

/**
 title for showing authorization.
 */
@property(nonatomic, copy)NSString *title;

/**
 icon for showing authorization.
 */
@property(nonatomic, strong)UIImage *authIcon;

/**
 logo of mini program.
 */
@property(nonatomic, strong)UIImage *miniProgramLogo;

/**
 mini program name.
 */
@property(nonatomic, copy)NSString *miniProgramName;

@end

Implement the GRVAuthDelegate and your own extension, then configure to Griver AppContainer as follows. You can see your customized authorization view in the mini program.

copy
// GRVExtensionDelegate
  extensionDelegate.uiProvider.authDelegate = DemoGRVAuthDelegateImpl();