Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
amit-kremer93 committed Jan 25, 2022
1 parent 0a43555 commit e743ef6
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 0 deletions.
11 changes: 11 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,15 @@
<natures>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1643112709182</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
1 change: 1 addition & 0 deletions app.plugin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./expo/withAppsFlyer');
5 changes: 5 additions & 0 deletions expo-module.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"ios": {
"appDelegateSubscribers": ["AppLifecycleDelegate"]
}
}
5 changes: 5 additions & 0 deletions expo/withAppsFlyer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const withAppsFlyerIos = require('react-native-appsflyer/expo/withAppsFlyerIos.js');
module.exports = function withAppsFlyer(config, { shouldUseStrictMode = false }) {
config = withAppsFlyerIos(config, shouldUseStrictMode);
return config;
};
33 changes: 33 additions & 0 deletions expo/withAppsFlyerIos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const pkg = require('react-native-appsflyer/package.json');
const { withDangerousMod } = require('@expo/config-plugins');
const { mergeContents } = require('@expo/config-plugins/build/utils/generateCode');
const fs = require('fs');
const path = require('path');

module.exports = function withAppsFlyerIos(config, shouldUseStrictMode) {
return withDangerousMod(config, [
'ios',
async (config) => {
const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile');
const contents = fs.readFileSync(filePath, 'utf-8');

const configureStrictMode = mergeContents({
tag: 'AppsFlyer Strict Mode',
src: contents,
newSrc: ` $RNAppsFlyerStrictMode == ${shouldUseStrictMode}`,
anchor: "target 'expoAppsFlyerTest' do",
offset: 0,
comment: '#',
});

if (!configureStrictMode.didMerge) {
console.log("ERROR: Cannot add AppsFlyer strict mode to the project's ios/Podfile because it's malformed. Please report this with a copy of your project Podfile.");
return config;
}

fs.writeFileSync(filePath, configureStrictMode.contents);

return config;
},
]);
};
16 changes: 16 additions & 0 deletions ios/RNAFSDKAppLifecycleDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// RNAFSDKAppLifecycleDelegate.swift
// RNAppsFlyer
//
// Created by Amit Kremer on 25/01/2022.
// Copyright © 2022 Facebook. All rights reserved.
//

import Foundation
import ExpoModulesCore

public class RNAFSDKAppLifecycleDelegate: ExpoAppDelegateSubscriber {
public func applicationDidBecomeActive(_ application: UIApplication) {
print("EXPOOO didbecomeactive")
}
}
13 changes: 13 additions & 0 deletions ios/RNAppsFlyer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
B3E7B58A1CC2AC0600A0062D /* RNAppsFlyer.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNAppsFlyer.m */; };
EDF5D8F327A022D40094F2AB /* RNAFSDKAppLifecycleDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EDF5D8F227A022D40094F2AB /* RNAFSDKAppLifecycleDelegate.swift */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -30,6 +31,7 @@
943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppsFlyerCrossPromotionHelper.h; sourceTree = "<group>"; };
B3E7B5881CC2AC0600A0062D /* RNAppsFlyer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNAppsFlyer.h; sourceTree = "<group>"; };
B3E7B5891CC2AC0600A0062D /* RNAppsFlyer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNAppsFlyer.m; sourceTree = "<group>"; };
EDF5D8F227A022D40094F2AB /* RNAFSDKAppLifecycleDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNAFSDKAppLifecycleDelegate.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -54,6 +56,7 @@
58B511D21A9E6C8500147676 = {
isa = PBXGroup;
children = (
EDF5D8F227A022D40094F2AB /* RNAFSDKAppLifecycleDelegate.swift */,
943704C9209F6735005B3A22 /* AppsFlyerCrossPromotionHelper.h */,
943704C7209F6734005B3A22 /* AppsFlyerLinkGenerator.h */,
943704C6209F6734005B3A22 /* AppsFlyerShareInviteHelper.h */,
Expand Down Expand Up @@ -95,6 +98,7 @@
TargetAttributes = {
58B511DA1A9E6C8500147676 = {
CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 1320;
};
};
};
Expand All @@ -103,6 +107,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 58B511D21A9E6C8500147676;
Expand All @@ -121,6 +126,7 @@
buildActionMask = 2147483647;
files = (
B3E7B58A1CC2AC0600A0062D /* RNAppsFlyer.m in Sources */,
EDF5D8F327A022D40094F2AB /* RNAFSDKAppLifecycleDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -204,32 +210,39 @@
58B511F01A9E6C8500147676 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNAppsFlyer;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
58B511F11A9E6C8500147676 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../../../React/**",
"$(SRCROOT)/../../react-native/React/**",
);
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = RNAppsFlyer;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@
"setupFiles": [
"<rootDir>/__tests__/setup.js"
]
},
"peerDependencies": {
"expo": "*"
}
}
1 change: 1 addition & 0 deletions react-native-appsflyer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Pod::Spec.new do |s|
s.platform = :ios, "9.0"
s.static_framework = true
s.dependency 'React'
s.dependency 'ExpoModulesCore'

# AppsFlyerFramework
if defined?($RNAppsFlyerStrictMode) && ($RNAppsFlyerStrictMode == true)
Expand Down

0 comments on commit e743ef6

Please sign in to comment.