@purchasely/cordova-plugin-purchasely 5.7.3 → 6.0.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +12 -8
  2. package/__tests__/Purchasely.test.js +307 -92
  3. package/example/config.xml +1 -11
  4. package/example/e2e/README.md +44 -0
  5. package/example/e2e/helpers/driver.js +70 -0
  6. package/example/e2e/package.json +19 -0
  7. package/example/e2e/specs/bridge.e2e.js +51 -0
  8. package/example/e2e/specs/dismiss.e2e.js +37 -0
  9. package/example/e2e/tools/ci_run_e2e.sh +49 -0
  10. package/example/e2e/tools/ci_run_e2e_ios.sh +46 -0
  11. package/example/e2e/wdio.android.conf.js +21 -0
  12. package/example/e2e/wdio.ios.conf.js +19 -0
  13. package/example/e2e/wdio.shared.conf.js +28 -0
  14. package/example/package-lock.json +59 -205
  15. package/example/package.json +7 -6
  16. package/example/www/index.html +1 -7
  17. package/example/www/js/index.js +113 -92
  18. package/package.json +1 -1
  19. package/plugin.xml +4 -22
  20. package/src/android/PurchaselyPlugin.kt +529 -440
  21. package/src/ios/CDVPurchasely+Events.h +1 -1
  22. package/src/ios/CDVPurchasely+UserAttributes.h +1 -1
  23. package/src/ios/CDVPurchasely+UserAttributes.m +2 -0
  24. package/src/ios/CDVPurchasely.h +21 -16
  25. package/src/ios/CDVPurchasely.m +497 -261
  26. package/www/Purchasely.js +208 -40
  27. package/src/android/PLYProductActivity.kt +0 -168
  28. package/src/android/PLYSubscriptionsActivity.java +0 -37
  29. package/src/android/activity_ply_product_activity.xml +0 -6
  30. package/src/android/activity_ply_subscriptions_activity.xml +0 -6
  31. package/src/android/theme_purchasely_fullscreen.xml +0 -6
  32. package/src/android/theme_purchasely_fullscreen_v23.xml +0 -6
  33. package/src/android/theme_purchasely_fullscreen_v23_light_status_bar.xml +0 -7
@@ -8,7 +8,7 @@
8
8
  #import <Cordova/CDVPlugin.h>
9
9
  #import "CDVPurchasely.h"
10
10
 
11
- @interface CDVPurchasely (Events) {
11
+ @interface CDVPurchasely (Events) <PLYEventDelegate> {
12
12
 
13
13
  }
14
14
 
@@ -8,7 +8,7 @@
8
8
  #import <Cordova/CDVPlugin.h>
9
9
  #import "CDVPurchasely.h"
10
10
 
11
- @interface CDVPurchasely (UserAttributes) {
11
+ @interface CDVPurchasely (UserAttributes) <PLYUserAttributeDelegate> {
12
12
 
13
13
  }
14
14
 
@@ -16,6 +16,7 @@
16
16
  type:(enum PLYUserAttributeType)type
17
17
  value:(id _Nullable)value
18
18
  source:(enum PLYUserAttributeSource)source {
19
+ if (self.attributeCommand == nil) { return; }
19
20
  NSDictionary *attributeDic = [self dictionaryFromUserAttributeWithKey:key type:type value:value source:source];
20
21
 
21
22
  CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:attributeDic];
@@ -26,6 +27,7 @@
26
27
 
27
28
  - (void)onUserAttributeRemovedWithKey:(NSString * _Nonnull)key
28
29
  source:(enum PLYUserAttributeSource)source {
30
+ if (self.attributeCommand == nil) { return; }
29
31
  NSString *sourceString = [PLYUserAttributeSourceHelper stringFromUserAttributeSource:source];
30
32
 
31
33
  NSMutableDictionary<NSString *, id> *attributeDic = [@{
@@ -8,22 +8,29 @@
8
8
  #import <Cordova/CDVPlugin.h>
9
9
  #import <Purchasely/Purchasely-Swift.h>
10
10
 
11
- @interface CDVPurchasely<PLYEventDelegate, PLYUserAttributeDelegate> : CDVPlugin {
11
+ // Protocol conformance (PLYEventDelegate / PLYUserAttributeDelegate) is declared on the
12
+ // CDVPurchasely (Events) and (UserAttributes) categories, which implement the delegate methods.
13
+ @interface CDVPurchasely : CDVPlugin {
12
14
  }
13
15
 
14
- @property (nonatomic, retain) UIViewController* presentedPresentationViewController;
16
+ // The presentation currently displayed (v6 uses id<PLYPresentation> for close()/back()).
17
+ @property (nonatomic, strong) id<PLYPresentation> currentPresentation;
15
18
 
16
19
  @property CDVInvokedUrlCommand* purchasedCommand;
17
20
  @property CDVInvokedUrlCommand* eventCommand;
18
21
  @property CDVInvokedUrlCommand* attributeCommand;
19
22
 
20
- @property (nonatomic) NSMutableArray<PLYPresentation *> *presentationsLoaded;
21
- @property (nonatomic, assign) Boolean shouldReopenPaywall;
23
+ @property (nonatomic) NSMutableArray<id<PLYPresentation>> *presentationsLoaded;
22
24
 
23
25
  @property (nonatomic) CDVInvokedUrlCommand* purchaseResolve;
24
26
 
25
- @property CDVInvokedUrlCommand* paywallActionInterceptorCommand;
26
- @property void (^onProcessActionHandler)(BOOL proceed);
27
+ // v6 per-action interceptor state. Each registered action kind keeps its own
28
+ // Cordova callbackId (to emit intercept events); each intercepted invocation
29
+ // stashes its PLYInterceptResult completion under a unique id so concurrent
30
+ // intercepts resolve independently (was a single stashed completion before).
31
+ @property (nonatomic, strong) NSMutableDictionary<NSString *, NSString *> *actionInterceptorCallbackIds;
32
+ @property (nonatomic, strong) NSMutableDictionary<NSString *, void (^)(enum PLYInterceptResult)> *pendingInterceptCompletions;
33
+ @property (nonatomic) NSUInteger interceptorInvocationCounter;
27
34
 
28
35
  - (void)start:(CDVInvokedUrlCommand*)command;
29
36
  - (void)setLogLevel:(CDVInvokedUrlCommand*)command;
@@ -31,13 +38,12 @@
31
38
  - (void)userLogout:(CDVInvokedUrlCommand*)command;
32
39
  - (void)setAttribute:(CDVInvokedUrlCommand*)command;
33
40
  - (void)getAnonymousUserId:(CDVInvokedUrlCommand*)command;
34
- - (void)readyToOpenDeeplink:(CDVInvokedUrlCommand*)command;
35
- - (void)setDefaultPresentationResultHandler:(CDVInvokedUrlCommand*)command;
41
+ - (void)allowDeeplink:(CDVInvokedUrlCommand*)command;
42
+ - (void)allowCampaigns:(CDVInvokedUrlCommand*)command;
43
+ - (void)handleDeeplink:(CDVInvokedUrlCommand*)command;
44
+ - (void)setDefaultPresentationDismissHandler:(CDVInvokedUrlCommand*)command;
36
45
  - (void)presentPresentationWithIdentifier:(CDVInvokedUrlCommand*)command;
37
46
  - (void)presentPresentationForPlacement:(CDVInvokedUrlCommand*)command;
38
- - (void)presentPlanWithIdentifier:(CDVInvokedUrlCommand*)command;
39
- - (void)presentProductWithIdentifier:(CDVInvokedUrlCommand*)command;
40
- - (void)presentSubscriptions:(CDVInvokedUrlCommand*)command;
41
47
  - (void)purchaseWithPlanVendorId:(CDVInvokedUrlCommand*)command;
42
48
  - (void)restoreAllProducts:(CDVInvokedUrlCommand*)command;
43
49
  - (void)silentRestoreAllProducts:(CDVInvokedUrlCommand*)command;
@@ -50,12 +56,11 @@
50
56
  - (void)userSubscriptionsHistory:(CDVInvokedUrlCommand*)command;
51
57
  - (void)addEventsListener:(CDVInvokedUrlCommand*)command;
52
58
  - (void)removeEventsListener:(CDVInvokedUrlCommand*)command;
53
- - (void)isDeeplinkHandled:(CDVInvokedUrlCommand*)command;
54
- - (void)setPaywallActionInterceptor:(CDVInvokedUrlCommand*)command;
55
- - (void)onProcessAction:(CDVInvokedUrlCommand*)command;
59
+ - (void)registerActionInterceptor:(CDVInvokedUrlCommand*)command;
60
+ - (void)unregisterActionInterceptor:(CDVInvokedUrlCommand*)command;
61
+ - (void)completeActionInterceptor:(CDVInvokedUrlCommand*)command;
56
62
  - (void)closePresentation:(CDVInvokedUrlCommand*)command;
57
- - (void)hidePresentation:(CDVInvokedUrlCommand*)command;
58
- - (void)showPresentation:(CDVInvokedUrlCommand*)command;
63
+ - (void)backPresentation:(CDVInvokedUrlCommand*)command;
59
64
  - (void)userDidConsumeSubscriptionContent:(CDVInvokedUrlCommand*)command;
60
65
  - (void)setUserAttributeWithStringArray:(CDVInvokedUrlCommand*)command;
61
66
  - (void)setUserAttributeWithIntArray:(CDVInvokedUrlCommand*)command;