🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

openinstall-react-native

Package Overview
Dependencies
Maintainers
3
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openinstall-react-native - npm Package Compare versions

Comparing version
1.8.1
to
1.8.2
+9
-15
documents/iOS.md

@@ -49,3 +49,3 @@ ### iOS 手动集成方式

- 在 iOS 工程中如果找不到头文件可能要在 TARGETS-> BUILD SETTINGS -> Search Paths -> Header Search Paths 添加如下如路径:
````
``` objc
$(SRCROOT)/../node_modules/openinstall-react-native/ios/RCTOpenInstall

@@ -58,3 +58,2 @@ ````

```
#import <RCTOpenInstall/RCTOpenInstall.h>
//通过cocoapod安装插件头文件路径不一样,如下

@@ -68,9 +67,5 @@ #import <openinstall-react-native/RCTOpenInstall.h>

插件版本1.3.0之前的初始化方案:
即在AppDelegate.m 的 `didFinishLaunchingWithOptions` 方法里面添加代码([OpenInstallSDK initWithDelegate:[RCTOpenInstall allocWithZone:nil]];),如果升级1.3.0,可删除该代码
(3)scheme相关代码
AppDelegate.m 里面添加如下代码:
**插件版本1.3.0开始,[OpenInstallSDK handLinkURL:url]方法改为[RCTOpenInstall handLinkURL:url],由插件内部完成后续工作**
```

@@ -80,11 +75,8 @@ //iOS9以上,会优先走这个方法

//openURL1
[RCTOpenInstall handLinkURL:url];
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
RCTBridge *mainBridge = delegate.bridge;
RCTOpenInstall *module = [mainBridge moduleForClass:[RCTOpenInstall class]];
[module handLinkURL:url];
return YES;
}
//适用目前所有iOS版本
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{
//openURL2
[RCTOpenInstall handLinkURL:url];
return YES;
}
```

@@ -94,9 +86,11 @@

AppDelegate.m 里面添加如下代码:
**插件版本1.3.0开始,[OpenInstallSDK continueUserActivity:userActivity]方法改为[RCTOpenInstall continueUserActivity:userActivity],由插件内部完成后续工作**
```
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler{
//univeral link
[RCTOpenInstall continueUserActivity:userActivity];
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
RCTBridge *mainBridge = delegate.bridge;
RCTOpenInstall *module = [mainBridge moduleForClass:[RCTOpenInstall class]];
[module continueUserActivity:userActivity];
return YES;
}
```

@@ -35,7 +35,7 @@ //

+ (id)shareInstance;
//+ (id)shareInstance;
+ (void)handLinkURL:(NSURL *)url;
- (void)handLinkURL:(NSURL *)url;
+ (void)continueUserActivity:(NSUserActivity *)userActivity;
- (void)continueUserActivity:(NSUserActivity *)userActivity;
@end

@@ -49,2 +49,3 @@ //

/*
static RCTOpenInstall *sharedInstance = nil;

@@ -61,11 +62,19 @@ + (id)shareInstance{

}
*/
- (instancetype)init{
self = [super init];
if (self) {
}
return self;
}
+ (void)initOpenInstall:(NSDictionary *)params{
[RCTOpenInstall shareInstance];
if (!sharedInstance.initStat) {
sharedInstance.initStat = YES;
- (void)initOpenInstall:(NSDictionary *)params{
//[RCTOpenInstall shareInstance];
if (!self.initStat) {
self.initStat = YES;
//iOS14.5苹果隐私政策正式启用
if (sharedInstance.adEnable) {
if (self.adEnable) {
if (@available(iOS 14, *)) {

@@ -87,3 +96,3 @@ [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {

+ (void)OpInit{
- (void)OpInit{
//ASA广告归因

@@ -94,6 +103,6 @@ NSMutableDictionary *config = [[NSMutableDictionary alloc]init];

NSString *token = [AAAttribution attributionTokenWithError:&error];
if (sharedInstance.ASAEnable || [sharedInstance.ASA isEqualToString:@"ASA"]) {
if (self.ASAEnable || [self.ASA isEqualToString:@"ASA"]) {
[config setValue:token forKey:OP_ASA_Token];
}
if (sharedInstance.ASADebug) {
if (self.ASADebug) {
[config setValue:@(YES) forKey:OP_ASA_isDev];

@@ -109,5 +118,5 @@ }else{

NSString *idfaStr;
if (sharedInstance.adEnable) {
if (sharedInstance.idfaStr.length > 0) {
idfaStr = sharedInstance.idfaStr;
if (self.adEnable) {
if (self.idfaStr.length > 0) {
idfaStr = self.idfaStr;
}else{

@@ -119,12 +128,12 @@ idfaStr = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];

//caid
if (sharedInstance.caid1.length > 0) {
[config setValue:sharedInstance.caid1 forKey:app_caid1];
if (self.caid1.length > 0) {
[config setValue:self.caid1 forKey:app_caid1];
}
if (sharedInstance.caid2.length > 0) {
[config setValue:sharedInstance.caid2 forKey:app_caid2];
if (self.caid2.length > 0) {
[config setValue:self.caid2 forKey:app_caid2];
}
}else{
//兼容老版本
if (sharedInstance.idfaStr.length > 0) {
idfaStr = sharedInstance.idfaStr;
if (self.idfaStr.length > 0) {
idfaStr = self.idfaStr;
[config setValue:idfaStr forKey:OP_Idfa_Id];

@@ -139,5 +148,5 @@ }

// }
[OpenInstallSDK initWithDelegate:sharedInstance adsAttribution:config];
[OpenInstallSDK initWithDelegate:self adsAttribution:config];
[RCTOpenInstall check];
[self check];

@@ -150,3 +159,3 @@ }

[RCTOpenInstall shareInstance];
// [RCTOpenInstall shareInstance];

@@ -166,5 +175,5 @@ @synchronized([RCTOpenInstall class]) {

{
RCTOpenInstall *shareInstance = [RCTOpenInstall shareInstance];
// RCTOpenInstall *shareInstance = [RCTOpenInstall shareInstance];
NSLog(@"OpenInstall Init params: %@", params);
NSLog(@"OpenInstall Init adEnabled = %d,\nASAEnabled = %d,\nASADebug = %d,\nidfaStr = %@,\ncaid1 = %@,\ncaid2 = %@,\nASA =%@,\nadid = %@",shareInstance.adEnable,shareInstance.ASAEnable,shareInstance.ASADebug,shareInstance.idfaStr,shareInstance.caid1,shareInstance.caid2,shareInstance.ASA,params[@"adid"]);
NSLog(@"OpenInstall Init adEnabled = %d,\nASAEnabled = %d,\nASADebug = %d,\nidfaStr = %@,\ncaid1 = %@,\ncaid2 = %@,\nASA =%@,\nadid = %@",self.adEnable,self.ASAEnable,self.ASADebug,self.idfaStr,self.caid1,self.caid2,self.ASA,params[@"adid"]);
@synchronized([RCTOpenInstall class]) {

@@ -189,3 +198,3 @@ if ([params.allKeys containsObject:@"idfaStr"] && params[@"idfaStr"]) {

[RCTOpenInstall initOpenInstall:params];
[self initOpenInstall:params];
}

@@ -287,13 +296,13 @@

+ (void)handLinkURL:(NSURL *)url{
[RCTOpenInstall wakeupParamStored:url];
- (void)handLinkURL:(NSURL *)url{
[self wakeupParamStored:url];
}
+ (void)continueUserActivity:(NSUserActivity *)userActivity{
[RCTOpenInstall wakeupParamStored:userActivity];
- (void)continueUserActivity:(NSUserActivity *)userActivity{
[self wakeupParamStored:userActivity];
}
+ (void)wakeupParamStored:(id)handle{
- (void)wakeupParamStored:(id)handle{
[RCTOpenInstall allocWithZone:nil];
if (sharedInstance.initStat) {
if (self.initStat) {
if ([handle isKindOfClass:[NSURL class]]) {

@@ -306,5 +315,5 @@ [OpenInstallSDK handLinkURL:(NSURL *)handle];

if ([handle isKindOfClass:[NSURL class]]) {
sharedInstance.handleURL = (NSURL *)handle;
self.handleURL = (NSURL *)handle;
}else{
sharedInstance.userActivity = (NSUserActivity *)handle;
self.userActivity = (NSUserActivity *)handle;
}

@@ -314,12 +323,12 @@ }

+ (void)check{
if (sharedInstance.handleURL) {
[OpenInstallSDK handLinkURL:sharedInstance.handleURL];
sharedInstance.handleURL = nil;
- (void)check{
if (self.handleURL) {
[OpenInstallSDK handLinkURL:self.handleURL];
self.handleURL = nil;
}
if (sharedInstance.userActivity) {
[OpenInstallSDK continueUserActivity:sharedInstance.userActivity];
sharedInstance.userActivity = nil;
if (self.userActivity) {
[OpenInstallSDK continueUserActivity:self.userActivity];
self.userActivity = nil;
}
}
@end

@@ -68,3 +68,2 @@

rf = rf.replace("[OpenInstallSDK handLinkURL:url];","\n");
console.log(path + "\n插件版本1.3.0开始,新方法[RCTOpenInstall handLinkURL:]将替代原先的[OpenInstallSDK handLinkURL:]方法\n");
}

@@ -75,24 +74,10 @@ var hasCoded = rf.match(/RCTOpenInstall handLinkURL/);

+ "\n\t\/\/openURL1"
+ "\n\t[RCTOpenInstall handLinkURL:url];");
+ "\n\tAppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;"
+ "\n\tRCTBridge *mainBridge = delegate.bridge;"
+ "\n\tRCTOpenInstall *module = [mainBridge moduleForClass:[RCTOpenInstall class]];"
+ "\n\t[module handLinkURL:url];");
}
}
var matchOpenURL2 = rf.match(/\n.*openURL.*sourceApplication.*\n?\{/);
if(matchOpenURL2 == null){
rf = rf.replace("@end","- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{"
+ "\n\t\/\/openURL2"
+ "\n\t[RCTOpenInstall handLinkURL:url];\n\treturn YES;\n}"
+ "\n@end");
}else{
var hasCodedTrash = rf.match(/OpenInstallSDK handLinkURL/);
if(hasCodedTrash != null){
rf = rf.replace("[OpenInstallSDK handLinkURL:url];","\n");
console.log(path + "\n插件版本1.3.0开始,新方法[RCTOpenInstall handLinkURL:]将替代原先的[OpenInstallSDK handLinkURL:]方法\n");
}
var hasCoded = rf.match(/openURL2\n.*RCTOpenInstall handLinkURL/);
if(hasCoded == null){
rf = rf.replace(matchOpenURL2[0], matchOpenURL2[0] + "\n\t\/\/openURL2" + "\n\t[RCTOpenInstall handLinkURL:url];");
}
}

@@ -109,7 +94,12 @@ var matchContinueUserActivity = rf.match(/\n.*continueUserActivity.*\n?\{/);

rf = rf.replace("[OpenInstallSDK continueUserActivity:userActivity];","\n");
console.log(path +"\n插件版本1.3.0开始,新方法[RCTOpenInstall continueUserActivity:]将替代原先的[OpenInstallSDK continueUserActivity:]方法\n");
console.log(path +"\n插件版本1.3.0开始,新方法将替代原先的[OpenInstallSDK continueUserActivity:]方法\n");
}
var hasCoded = rf.match(/RCTOpenInstall continueUserActivity/);
if(hasCoded == null){
rf = rf.replace(matchContinueUserActivity[0], matchContinueUserActivity[0] + "\n\t" + "[RCTOpenInstall continueUserActivity:userActivity];");
rf = rf.replace(matchContinueUserActivity[0], matchContinueUserActivity[0]
+ "\n\t"
+ "\n\tAppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;"
+ "\n\tRCTBridge *mainBridge = delegate.bridge;"
+ "\n\tRCTOpenInstall *module = [mainBridge moduleForClass:[RCTOpenInstall class]];"
+ "[module continueUserActivity:userActivity];");
}

@@ -116,0 +106,0 @@

{
"name": "openinstall-react-native",
"version": "1.8.1",
"version": "1.8.2",
"description": "openinstall sdk plugin for react-native",

@@ -21,3 +21,3 @@ "main": "index.js",

"一键拉起",
"广告效果监测",
"广告渠道统计",
"渠道归因"

@@ -24,0 +24,0 @@ ],

Sorry, the diff of this file is not supported yet