Skip to content

Commit

Permalink
demo update
Browse files Browse the repository at this point in the history
  • Loading branch information
sonerdm committed Jun 17, 2022
1 parent c2a025c commit b10d16e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 28 deletions.
22 changes: 11 additions & 11 deletions InsiderDemo/InsiderDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
UNUserNotificationCenter.current().delegate = self

Insider.initWithLaunchOptions(launchOptions, partnerName: INSIDER_PARTNER_NAME, appGroup: APP_GROUP)
Insider.setActiveForegroundPushView()
Insider.register(withQuietPermission: false)
Insider.registerCallback(with: #selector(insiderCallbackHandler(info:)), sender: self)
Insider.enableIDFACollection(false);
Expand All @@ -43,29 +44,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
return true
}

func showAlertAction(title: String, message: String){
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.default, handler: nil))
self.window?.rootViewController?.present(alert, animated: true, completion: nil)
}

@objc func insiderCallbackHandler(info: [String : AnyObject]){
let type = info["type"]?.intValue ?? -1
switch type {
case InsiderCallbackType.notificationOpen.rawValue:
print(info)
break
case InsiderCallbackType.inappButtonClick.rawValue:
print(info)
break
case InsiderCallbackType.tempStorePurchase.rawValue:
print(info)
break
case InsiderCallbackType.tempStoreAddedToCart.rawValue:
print(info)
let callback = String(describing: info)
showAlertAction(title: "InsiderCallbackTypeNotificationOpen", message: callback)
break
case InsiderCallbackType.tempStoreCustomAction.rawValue:
print(info)
let callback = String(describing: info)
showAlertAction(title: "InsiderCallbackTypeTempStoreCustomAction", message: callback)
break
default:
print(info)
break
}
}

}

8 changes: 0 additions & 8 deletions InsiderDemo/InsiderDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@
<string>insideryour_partner_name</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>insiderqaautomation1</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
Expand Down
4 changes: 1 addition & 3 deletions InsiderDemo/InsiderDemo/InsiderDemo.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<key>aps-environment</key>
<string>development</string>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.useinsider.InsiderDemo</string>
</array>
<array/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.useinsider.InsiderDemo</string>
</array>
<array/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
<plist version="1.0">
<dict>
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.useinsider.InsiderDemo</string>
</array>
<array/>
</dict>
</plist>

0 comments on commit b10d16e

Please sign in to comment.