Sharing Screen

Referral Campaign Sharing Screen

The sharing screen appears once the user logins into the REFERRAL campaign. The screen enables him to refer the brand with his friends or acquaintances so that he could earn points and rewards for referring. Here is a detailed guide to know how to launch the sharing screen in InviteReferrals.

Steps :

LAUNCH REFERRAL CAMPAIGN SCREEN

Add the following line in your custom button click. Replace CampaignID with the id of the referral campaign. Default campaignID will be applied if the campaignID is specified as 0 (Zero).This will launch the login screen of InviteReferrals.

InviteReferrals.launch("CampaignID", email: nil, mobile: nil, name: nil, subscriptionID: nil)
[InviteReferrals launch: @”CampaignID" Email: nil mobile: nil name: nil SubscriptionID: nil];

If you want to auto login by clicking the above custom button, pass the value of emailID / mobile no. as a string value to their respective parameter (based on the user Identifier set in your InviteReferrals Dashboard Account settings) to launch the share screen directly. Example for the use cases as given below

If the email / mobile number (based on user identifier set in account setting in InviteReferrals Dashboard) is nil or empty string then on the Launch() method call IR Login Screen will be open.

And if email / mobile number (based on user identifier set in account setting in IR Dashboard) is passed then Sharing screen will be open on the Launch() method with an animated circular Loader and hit the setupUserID() and on user-details API response loader will stop and Sharing Screen UI will be created.

Refer to the below use cases :

A. For Login Screen

For Login Screen:
InviteReferrals.launch("68XXX", email: nil, mobile: nil, name: nil, subscriptionID: nil)
[InviteReferrals launch: @"68XXX" Email: nil mobile: nil name: nil SubscriptionID: nil];

Parameters :

ParametersDescriptionValue
Email (string)customer's email id[email protected]
Mobile (string)customer's mobile number9717XXXXXX
Name (string)Name of the customerMike
Subscription Id (string)

B. For Auto Login (Share Screen)

InviteReferrals.launch("68XXX",email:"[email protected]",mobile:"9818XXXXXX",name:"Tom", subscriptionID: nil)
[InviteReferrals launch: @"68XXX" Email: @"[email protected]" mobile: @"9818XXXXXX" name: @"Tom" SubscriptionID: nil];

C. For Auto Login (Share Screen) Using Default CampaignID

InviteReferrals.launch("0", email: "[email protected]", mobile: "9818XXXXXX", name: "Tom", subscriptionID: nil)
[InviteReferrals launch: @"0" Email: @"[email protected]" mobile: @"9818XXXXXX" name: @"Tom" SubscriptionID: nil];

📘

Note: In above example Dummy CampaignID shown. Kindly use your own CampaignID configured in your panel or simply use the default campaign by passing campaignID 0 (Zero).

PASS USER DETAILS FOR AUTO LOGIN (Single Sign In)

setupUserID() Method can be used for autologin users in the background state. Suppose if the client has its own login screen then on app's login or signup client can autologin user to IR using this method in background state and then when Launch() method called User-details API will not trigger again and Sharing details UI will be created in less time.

📘

Note: there is a parameter name flag in this method if user pass a string value "launch" then on user-details API response launch() method will be called internally from SDK which will redirect the user to the Share screen again (but the difference is user-details API triggering task performed in the background)

InviteReferrals.setupUserID("EmailID", mobile: "MobileNo", name: "Name", gender: "Male/Female", shareLink: nil, shareTitle: nil, shareDesc: nil, shareImg: nil, customValue: nil, campaignID: "CampaignID", flag: nil, subscriptionID: nil)

Example:

InviteReferrals.setupUserID("[email protected]", mobile: "9818XXXXXX", name: "[email protected]", gender: nil, shareLink: nil, shareTitle: nil, shareDesc: nil, shareImg: nil, customValue: nil, campaignID: "0", flag: "launch", subscriptionID: nil)
[InviteReferrals setupUserID: @"EmailID" mobile: @"Mobile Number" name: @"Name" gender: @"Gender" shareLink: nil shareTitle: nil shareDesc: nil shareImg: nil customValue: nil campaignID: @"CampaignID" flag: nil SubscriptionID: nil];

Example:

[InviteReferrals setupUserID: @"[email protected]" mobile: @"9818XXXXXX" name: @"Tom" gender: @"Male" shareLink: nil shareTitle: nil shareDesc: nil shareImg: nil customValue: nil campaignID: @"0" flag: @"launch" SubscriptionID: nil];

📘

Note: Kindly make sure in the above method the value of EmailID or mobile number in its respective parameter is mandatory based on the user Identifier set in your InviteReferrals Dashboard Account settings. Also note that the SDK will logout the user on every new app launch (due to session expiration) so you need to pass the user details at least once in every new app launch (session) before using the launch method to redirect to the share screen.

LOGOUT (From InviteReferral Campaign)

Although the SDK will logout users from the campaign on every new app launch (due to session expire) and you need to pass user details on every new app launch (session expire) to login again, Suppose if you want to logout user from the campaign in the same session to meet your requirement or referral flow then you can logout user from the logged in campaign by using the following method.

InviteReferrals.logout()
[InviteReferrals logout];

Suppose, if you want to log out the user from the campaign in the same session to meet your requirement (or referral flow )then you can log out the user from the logged-in campaign by using the following method.

SHOW REFER A FRIEND POPUP

Just add the following line in the ViewController in which you want to show the referral program popup.

InviteReferrals.showSharePopup("Event_Rule", email: nil, mobile: nil, name: nil, subscriptionID: nil)
[InviteReferrals showSharePopup: @"Event_Rule" Email: nil mobile: nil name: nil SubscriptionID: nil];

If you want to auto login from the show refer friend popup, pass the value of emailID / mobile no. as a string value to their respective parameter (based on the user Identifier set in your InviteReferrals Dashboard Account settings) to launch the share screen directly.

Read the below use cases :

A. For login screen

InviteReferrals.showSharePopup("home", email: nil, mobile: nil, name: nil, subscriptionID: nil)
[InviteReferrals showSharePopup: @"home" Email: nil mobile: nil name: nil SubscriptionID: nil];

B. For Auto Login (Share Screen)

InviteReferrals.showSharePopup("home", email: "[email protected]", mobile: "9818XXXXXX", name: "Tom", subscriptionID: nil)
[InviteReferrals showSharePopup: @"home" Email: @"[email protected]" mobile: @"9818XXXXXX" name: @"Tom" SubscriptionID: nil];

📘

Note: In the above example the Dummy Event_Rule is shown. Kindly configure your Mobile APP rule first in your InviteReferrals Panel inside the “Integration” tab of your Campaign to use this feature.

SHARING DETAILS (to get Content in a Dictionary Format)

You can get the Sharing Screen Content in the form of JSON Dictionary by using the following method.

InviteReferrals.getShareData(withCampaignID: "CampaignID", email: "Email Address", mobile: "Mobile Number", name: "Full Name", subscriptionID: "SubscriptionID (optional/nil)", showErrorAlerts: false/true, showActivityIndicatorViewWhileLoading: true/false) { (irSharingContent: NSMutableDictionary?) in
print("SharingContent = \(irSharingContent!)")
}
Example:

InviteReferrals.getShareData(withCampaignID: "0", email: "[email protected]", mobile: "9818XXXXXX", name: "Tom", subscriptionID: "nil", showErrorAlerts: false, showActivityIndicatorViewWhileLoading: true) { (irSharingContent: NSMutableDictionary?) in
print("SharingContent = \(irSharingContent!)")
}
[InviteReferrals GetShareDataWithCampaignID: @"CampaignID" Email: @"Email Address" mobile: @"Mobile Number" name: @"Full Name" SubscriptionID: @"SubscriptionID (optional / nil)" ShowErrorAlerts: NO/YES ShowActivityIndicatorViewWhileLoading: YES/NO SharingDetails:^(NSMutableDictionary * irSharingContent) {
NSLog(@"SharingContent = %@", irSharingContent);
}];
Example:

[InviteReferrals GetShareDataWithCampaignID: @"0" Email: @"[email protected]" mobile: @"9818XXXXXX" name: @"Tom" SubscriptionID: nil ShowErrorAlerts: NO ShowActivityIndicatorViewWhileLoading: YES SharingDetails:^(NSMutableDictionary * irSharingContent) {
NSLog(@"SharingContent = %@", irSharingContent);
}];

Response Sample :

{
    "sms_shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "twitter_shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "email_shareText": "<table>\r\n    <tr>\r\n        <td>Hi,</td>\r\n    </tr>\r\n    <tr>\r\n        <td></td>\r\n    </tr>\r\n    <tr>\r\n        <td>Your friend Tom, has invited you to try InviteReferrals through his referral link</td>\r\n    </tr>\r\n    <tr>\r\n        <td></td>\r\n    </tr>\r\n    <tr>\r\n        <td>Accept the invitation by clicking the link mentioned below.</td>\r\n    </tr>\r\n    <tr>\r\n        <td>https://notifyvisitors.ref-r.com/c/i/29812/61236843</td>\r\n    </tr>\r\n</table>",
    "campaignID": "29812",
    "pinterest_shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "shareSubject": "Explore InviteReferrals Referral Contest",
    "loginScreenData": "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\"><style>body{background: transparent;}</style><div class=\"text-center\">\n    <h3><br />Heading</h3>\n    <p class=\"lead\">\n        The description of your referral campaign \n        <br>\n        comes here\n    </p>\n</div>",
    "popup_shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "Authentication": "success",
    "tracking_period": 30,
    "Email": "[email protected]",
    "linkedin__shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "CustomerName": "Tom",
    "referral_link": "https://notifyvisitors.ref-r.com/c/i/29812/61236843",
    "shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "referral_code": "NEERYSC3",
    "shareScreenData": "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css\"><style>body{background: transparent;}</style><div class=\"text-center\">\n    <h3><br />Heading</h3>\n    <p class=\"lead\">\n        The description of your referral campaign\n        <br>\n        comes here\n    </p>\n</div>",
    "fb_shareText": {
        "fbImage": "https://s3.ap-south-1.amazonaws.com/tagnpin-mumbai/images/fb_10209_29812.jpg",
        "fb_shareText": "Refer and win #Referral #Contests #inviteReferrals",
        "fbReferral_link": "https://notifyvisitors.ref-r.com/c/i/29812/61236843?r=fb"
    },
    "whatsapp_shareText": "Refer and win #Referral #Contests #inviteReferrals",
    "unique_code": null
}

CLOSE BUTTON LISTENER FOR THE REFERRAL SCREEN

This delegate will be triggered whenever the referral screen of the SDK is closed using the Done / Close button in the navigation bar of the referral screen. You can achieve this by using InviteReferralsDelegate in your app if you want to do so. Suppose you want to use this delegate in your ViewController, then add the delegate in your ViewController file.

class ViewController: UIViewController, InviteReferralsDelegate {
}
#import <UIKit/UIKit.h>
#import <InviteReferrals/InviteReferrals.h>

@interface ViewController : UIViewController <InviteReferralsDelegate>
@end

Now inside viewDidLoad() of your ViewController.swift file, call the following method to set the delegate.

override func viewDidLoad() {
      super.viewDidLoad()
  InviteReferrals.sharedInstance()?.delegate = self
}
- (void)viewDidLoad {
  [super viewDidLoad];
  [InviteReferrals sharedInstance].delegate = self;
}

Now you can implement the following function and here you can perform your required task with the Done / Close button action.

func handleDoneButtonAction(withUserInfo userInfo: NSMutableDictionary?) {
// Do Your stuff here ………….. 
}
-(void)HandleDoneButtonActionWithUserInfo:(NSMutableDictionary *)userInfo {
// Do Your stuff here ………….. 
}