Skip to content

Commit

Permalink
refactor: merging state into core lib
Browse files Browse the repository at this point in the history
BREAKING CHANGE: @segment/sovran-react-native is now deprecated. Remove from your dependencies. All functionality is now rolled in the core package.

Required changes:

- Remove `@segment/sovran-react-native` from your dependencies.

- iOS: If you are using `trackDeeplinks` or `setAnonymousId` from native you'll need to update the imports to

```diff
- #import <segment_analytics_react_native-Swift.h>
+ #import "SegmentAnalyticsReactNative-Swift.h"
```

fix: remove test logs

fix: remove sovran as dependency on all plugins

fix: pr fixes

fix: remove buildjson
  • Loading branch information
oscb committed Apr 2, 2024
1 parent 7160d3d commit ca8fb86
Show file tree
Hide file tree
Showing 97 changed files with 898 additions and 2,066 deletions.
247 changes: 119 additions & 128 deletions README.md

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions examples/AnalyticsReactNativeExample/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,10 @@ PODS:
- RNScreens (3.27.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- segment-analytics-react-native (2.18.0):
- segment-analytics-react-native (2.19.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- sovran-react-native
- SocketRocket (0.6.1)
- sovran-react-native (1.1.0):
- React-Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -579,7 +577,6 @@ DEPENDENCIES:
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNScreens (from `../node_modules/react-native-screens`)
- segment-analytics-react-native (from `../../../packages/core`)
- sovran-react-native (from `../../../packages/sovran`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -690,8 +687,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-screens"
segment-analytics-react-native:
:path: "../../../packages/core"
sovran-react-native:
:path: "../../../packages/sovran"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -752,9 +747,8 @@ SPEC CHECKSUMS:
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741
RNScreens: 3c2d122f5e08c192e254c510b212306da97d2581
segment-analytics-react-native: abcd50e51633527c8b116a8b14780e8e4e5ad9d1
segment-analytics-react-native: c6102b6df97957348561bb5b624872bd188e49ef
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
sovran-react-native: 26dc5e42e618e311bb93d6e825e80af1934b8887
Yoga: eddf2bbe4a896454c248a8f23b4355891eb720a6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

Expand Down
2 changes: 1 addition & 1 deletion examples/AnalyticsReactNativeExample/workspace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { getLinkedData } = require('../linkHelper')

module.exports = {
...getLinkedData(['core', 'sovran'])
...getLinkedData(['core'])
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.analyticsreactnativee2e73

import android.app.Application
import android.util.Log
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
Expand All @@ -11,6 +12,7 @@ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.flipper.ReactNativeFlipper
import com.facebook.soloader.SoLoader
import com.segmentanalyticsreactnative.AnalyticsReactNativePackage

class MainApplication : Application(), ReactApplication {

Expand Down Expand Up @@ -40,6 +42,13 @@ class MainApplication : Application(), ReactApplication {
// If you opted-in for the New Architecture, we load the native entry point for this app.
load()
}
val analyticsPackage = reactNativeHost.reactInstanceManager
.packages
.find { it is AnalyticsReactNativePackage }
as? AnalyticsReactNativePackage

analyticsPackage?.setAnonymousId("Native AnonymousID")

ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
}
}
3 changes: 3 additions & 0 deletions examples/E2E-73/ios/AnalyticsReactNative-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
7699B88040F8A987B510C191 /* libPods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 19F6CBCC0A4E27FBF8BF4A61 /* libPods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
D44395D62B87E17A00B881B1 /* File.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44395D52B87E17A00B881B1 /* File.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -43,6 +44,9 @@
5DCACB8F33CDC322A6C60F78 /* libPods-AnalyticsReactNativeE2E73.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AnalyticsReactNativeE2E73.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AnalyticsReactNativeE2E73/LaunchScreen.storyboard; sourceTree = "<group>"; };
89C6BE57DB24E9ADA2F236DE /* Pods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.release.xcconfig"; path = "Target Support Files/Pods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests/Pods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.release.xcconfig"; sourceTree = "<group>"; };
D44395D42B87E17A00B881B1 /* AnalyticsReactNativeE2E73-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AnalyticsReactNativeE2E73-Bridging-Header.h"; sourceTree = "<group>"; };
D44395D52B87E17A00B881B1 /* File.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = File.swift; sourceTree = "<group>"; };
D44395D72B881AC800B881B1 /* libReact-Core.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-Core.a"; sourceTree = BUILT_PRODUCTS_DIR; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -99,6 +103,7 @@
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
D44395D72B881AC800B881B1 /* libReact-Core.a */,
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
5DCACB8F33CDC322A6C60F78 /* libPods-AnalyticsReactNativeE2E73.a */,
19F6CBCC0A4E27FBF8BF4A61 /* libPods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.a */,
Expand All @@ -116,12 +121,14 @@
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
D44395D52B87E17A00B881B1 /* File.swift */,
13B07FAE1A68108700A75B9A /* AnalyticsReactNativeE2E73 */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* AnalyticsReactNativeE2E73Tests */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
BBD78D7AC51CEA395F1C20DB /* Pods */,
D44395D42B87E17A00B881B1 /* AnalyticsReactNativeE2E73-Bridging-Header.h */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand Down Expand Up @@ -206,7 +213,7 @@
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1120;
LastSwiftMigration = 1520;
};
};
};
Expand Down Expand Up @@ -393,6 +400,7 @@
buildActionMask = 2147483647;
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
D44395D62B87E17A00B881B1 /* File.swift in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -412,6 +420,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 5B7EB9410499542E8C5724F5 /* Pods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -439,6 +448,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 89C6BE57DB24E9ADA2F236DE /* Pods-AnalyticsReactNativeE2E73-AnalyticsReactNativeE2E73Tests.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = AnalyticsReactNativeE2E73Tests/Info.plist;
Expand Down Expand Up @@ -480,6 +490,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = AnalyticsReactNativeE2E73;
SWIFT_OBJC_BRIDGING_HEADER = "AnalyticsReactNativeE2E73-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
Expand All @@ -506,6 +517,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = AnalyticsReactNativeE2E73;
SWIFT_OBJC_BRIDGING_HEADER = "AnalyticsReactNativeE2E73-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 3 additions & 1 deletion examples/E2E-73/ios/AnalyticsReactNativeE2E73/AppDelegate.mm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import "SegmentAnalyticsReactNative-Swift.h"

@implementation AppDelegate

Expand All @@ -10,6 +10,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};

[AnalyticsReactNative setAnonymousId: @"Native AnonymousID"];

return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
Expand Down
8 changes: 8 additions & 0 deletions examples/E2E-73/ios/File.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//
// File.swift
// AnalyticsReactNativeE2E73
//
// Created by Oscar Bazaldua on 2/22/24.
//

import Foundation
15 changes: 5 additions & 10 deletions examples/E2E-73/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1127,12 +1127,11 @@ PODS:
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- segment-analytics-react-native (2.16.1):
- segment-analytics-react-native (2.19.0):
- glog
- RCT-Folly (= 2022.05.16.00)
- React-Core
- sovran-react-native
- SocketRocket (0.6.1)
- sovran-react-native (1.0.4):
- React-Core
- Yoga (1.14.0)

DEPENDENCIES:
Expand Down Expand Up @@ -1215,7 +1214,6 @@ DEPENDENCIES:
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNScreens (from `../node_modules/react-native-screens`)
- segment-analytics-react-native (from `../../../packages/core`)
- sovran-react-native (from `../../../packages/sovran`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -1344,8 +1342,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-screens"
segment-analytics-react-native:
:path: "../../../packages/core"
sovran-react-native:
:path: "../../../packages/sovran"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -1415,10 +1411,9 @@ SPEC CHECKSUMS:
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNGestureHandler: 61bfdfc05db9b79dd61f894dcd29d3dcc6db3c02
RNScreens: b582cb834dc4133307562e930e8fa914b8c04ef2
segment-analytics-react-native: 13d4ba325add2b2ed796ee58531e3b4cacfe692f
segment-analytics-react-native: 8829610e19044ceb74cbc689b34d88ff188d4a65
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
sovran-react-native: 791f2f726b4d57ece59676eda58d6da9dc95ad4e
Yoga: 20d6a900dcc8d61d5e3b799bbf627cc34474a8c4
Yoga: 44003f970aa541b79dfdd59cf236fda41bd5890f

PODFILE CHECKSUM: a8b42a411ee5d548930e6e63e39d1b743067421d

Expand Down
1 change: 1 addition & 0 deletions examples/E2E-73/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"express": "^4.17.1",
"jest": "^29.7.0",
"jest-circus": "^29.3.1",
"pod-install": "^0.1.39",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"rimraf": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/E2E-73/workspace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { getLinkedData } = require('../linkHelper')

module.exports = {
...getLinkedData(['core', 'sovran'])
...getLinkedData(['core'])
}
10 changes: 10 additions & 0 deletions examples/E2E-73/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3091,6 +3091,7 @@ __metadata:
express: "npm:^4.17.1"
jest: "npm:^29.7.0"
jest-circus: "npm:^29.3.1"
pod-install: "npm:^0.1.39"
prettier: "npm:2.8.8"
react: "npm:18.2.0"
react-native: "npm:0.73.0"
Expand Down Expand Up @@ -8577,6 +8578,15 @@ __metadata:
languageName: node
linkType: hard

"pod-install@npm:^0.1.39":
version: 0.1.39
resolution: "pod-install@npm:0.1.39"
bin:
pod-install: build/index.js
checksum: 10c0/fc5d88a13b6bd58cb9c6336ae0d068f5b7c54d8449f649dd080672583caf701f48bce49a878705ef166b879aaa0068f0a1782061f4cb85c67fff7008dd4ae5fd
languageName: node
linkType: hard

"prelude-ls@npm:^1.2.1":
version: 1.2.1
resolution: "prelude-ls@npm:1.2.1"
Expand Down
12 changes: 3 additions & 9 deletions examples/E2E/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -499,12 +499,10 @@ PODS:
- RNScreens (3.27.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- segment-analytics-react-native (2.18.0):
- segment-analytics-react-native (2.19.0):
- RCT-Folly (= 2021.07.22.00)
- React-Core
- sovran-react-native
- SocketRocket (0.6.1)
- sovran-react-native (1.1.0):
- React-Core
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -579,7 +577,6 @@ DEPENDENCIES:
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- RNScreens (from `../node_modules/react-native-screens`)
- segment-analytics-react-native (from `../../../packages/core`)
- sovran-react-native (from `../../../packages/sovran`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
Expand Down Expand Up @@ -690,8 +687,6 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-screens"
segment-analytics-react-native:
:path: "../../../packages/core"
sovran-react-native:
:path: "../../../packages/sovran"
Yoga:
:path: "../node_modules/react-native/ReactCommon/yoga"

Expand Down Expand Up @@ -752,9 +747,8 @@ SPEC CHECKSUMS:
RNCMaskedView: 0e1bc4bfa8365eba5fbbb71e07fbdc0555249489
RNGestureHandler: 32a01c29ecc9bb0b5bf7bc0a33547f61b4dc2741
RNScreens: 3c2d122f5e08c192e254c510b212306da97d2581
segment-analytics-react-native: abcd50e51633527c8b116a8b14780e8e4e5ad9d1
segment-analytics-react-native: c6102b6df97957348561bb5b624872bd188e49ef
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
sovran-react-native: 26dc5e42e618e311bb93d6e825e80af1934b8887
Yoga: eddf2bbe4a896454c248a8f23b4355891eb720a6
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

Expand Down
2 changes: 1 addition & 1 deletion examples/E2E/workspace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { getLinkedData } = require('../linkHelper')

module.exports = {
...getLinkedData(['core', 'sovran'])
...getLinkedData(['core'])
}
Loading

0 comments on commit ca8fb86

Please sign in to comment.