Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: race conditions #187

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2a35f88
Crash fix
Jul 12, 2022
f2fe530
Provided fix for the track event race condition.
1abhishekpandey Jul 14, 2022
1cced01
Provided fix for String issue occurred in RSMessage class
1abhishekpandey Jul 14, 2022
48aa5b2
Fix for Alias Identify and userId plugins.
1abhishekpandey Jul 14, 2022
4dcfda8
Optimised the thread synchronisation codes.
1abhishekpandey Jul 14, 2022
8c1bc57
Race conditions removed
Jul 15, 2022
610cd82
Code modification
Jul 15, 2022
bdbf981
Code improved
Jul 16, 2022
79327e7
Optimised code
1abhishekpandey Jul 18, 2022
73a609c
Commenting out the code.
1abhishekpandey Jul 20, 2022
9d4cde9
Code improved
Jul 22, 2022
0890243
Updated Phone Vendor
1abhishekpandey Jul 22, 2022
48cc458
Added new API's in Client class.
1abhishekpandey Jul 22, 2022
300be3d
Improved Locale
1abhishekpandey Jul 22, 2022
4bc7ade
Some bugs fixed
Jul 22, 2022
e07fb53
Enhanced option and reset feature
1abhishekpandey Jul 27, 2022
6d84fc5
Addressing comments: Added watchOs and iPadOS
1abhishekpandey Jul 29, 2022
be03e73
Optimised reset: Now token and advertising will persist on reset call.
1abhishekpandey Aug 1, 2022
fa9b27f
GDPR fix
Aug 2, 2022
2988cec
comply swiftlint rules
pallabmaiti Mar 29, 2023
183509f
remove anonymous plugin
pallabmaiti May 10, 2023
90f117e
pulled latest & merged conflicts
pallabmaiti Nov 22, 2023
36b7e45
test cases fixed
pallabmaiti Nov 24, 2023
0aca21e
test cases removed, will be brought back
pallabmaiti Nov 24, 2023
c079746
test cases fixing in progress
pallabmaiti Nov 27, 2023
88e0eba
test deployment changed
pallabmaiti Nov 27, 2023
ac011cf
test case fixing in progress
pallabmaiti Nov 28, 2023
5971389
stopped test for tvOS and watchOS
pallabmaiti Nov 28, 2023
b4025c7
uncommented test for tvOS and watchOS
pallabmaiti Nov 28, 2023
886b1ba
uncommented test for tvOS and watchOS
pallabmaiti Nov 28, 2023
c2d8fb6
added test cases
pallabmaiti Nov 28, 2023
4ce96dd
added test cases for life cycle events
pallabmaiti Nov 28, 2023
94c0fba
code smell expedited
pallabmaiti Nov 28, 2023
09dcb77
more code smell expedited
pallabmaiti Nov 28, 2023
62280aa
fixing according to v1
pallabmaiti Dec 5, 2023
20f2971
RSContext fixed
pallabmaiti Dec 8, 2023
65b6eab
fix build error
pallabmaiti Dec 8, 2023
2986a15
fixed issues
pallabmaiti Dec 11, 2023
224aa74
fixed test case
pallabmaiti Dec 12, 2023
e6e10a3
fixed queue of events
pallabmaiti Dec 14, 2023
0f9890a
Merge branch 'develop-v2' of https://github.com/rudderlabs/rudder-sdk…
pallabmaiti Dec 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/build-and-quality-checks-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,33 @@ on:
jobs:
build:
name: Code Quality Checks(v2)
runs-on: macOS-latest
runs-on: macos-latest

steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install xcpretty
run: gem install xcpretty

- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'
# - name: Select Xcode version
# run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'

- name: Build SDK(iOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 13' | xcpretty
xcodebuild build -scheme Rudder-iOS -workspace Rudder.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 14' | xcpretty

- name: Build SDK(watchOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 - 45mm' | xcpretty
xcodebuild build -scheme Rudder-watchOS -workspace Rudder.xcworkspace -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' | xcpretty

- name: Build SDK(tvOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty
xcodebuild build -scheme Rudder-tvOS -workspace Rudder.xcworkspace -destination 'platform=tvOS Simulator,name=Apple TV' | xcpretty

- name: Build SDK(macOS)
run: |
xcodebuild build -scheme RudderSDK-iOS -workspace Rudder.xcworkspace -destination 'platform=macOS,variant=Mac Catalyst' | xcpretty
# - name: Build SDK(macOS)
# run: |
# xcodebuild build -scheme Rudder-macOS -workspace Rudder.xcworkspace -destination 'platform=macOS,variant=Mac Catalyst' | xcpretty

- name: Install Cocoapods
run: gem install cocoapods
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-title-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check PR title
uses: rudderlabs/[email protected]
8 changes: 4 additions & 4 deletions .github/workflows/deploy-cocoapods-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
jobs:
build:
name: Deploy to Cocoapods
runs-on: macOS-latest
runs-on: macos-latest
steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'
# - name: Select Xcode version
# run: sudo xcode-select -s '/Applications/Xcode_13.2.1.app/Contents/Developer'

- name: Install Cocoapods
run: gem install cocoapods
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/draft-new-beta-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Draft new Beta release

on:
workflow_dispatch:
inputs:
beta_version:
description: "Beta version(Only single digit, example: 1)"
required: true

jobs:
draft-new-beta-release:
name: Draft a new Beta release
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/fix/') || startsWith(github.ref, 'refs/heads/feat/')
steps:
- name: Checkout source branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Node 16
uses: actions/setup-node@v3
with:
node-version: 16

# In order to make a commit, we need to initialize a user.
# You may choose to write something less generic here if you want, it doesn't matter functionality wise.
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email [email protected]

# Calculate the next release version based on conventional semantic release
- name: Create release branch
id: create-release
env:
HUSKY: 0
run: |
source_branch_name=${GITHUB_REF##*/}
release_type=beta-release
git fetch origin master-v2
git fetch --tags origin
git merge origin/master-v2
current_version=$(jq -r .version package.json)

npx standard-version --skip.commit --skip.tag --skip.changelog
new_version="$(jq -r .version package.json).beta.${{ github.event.inputs.beta_version }}"
git reset --hard

branch_name="${release_type}/${new_version}"

echo "Source branch for new release is $source_branch_name"
echo "Current version is $current_version"
echo "Release type is $release_type"
echo "New version is $new_version"
echo "New release branch name is $branch_name"
git checkout -b "$branch_name"
git push --set-upstream origin "$branch_name"

echo "source_branch_name=$source_branch_name" >> $GITHUB_OUTPUT
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
echo "new_version=$new_version" >> $GITHUB_OUTPUT
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
echo "NEW_VERSION_VALUE=$new_version" >> $GITHUB_ENV

- name: Bump version
id: finish-release
env:
HUSKY: 0
run: |
echo "Current version: $CURRENT_VERSION_VALUE"
echo "New version: $NEW_VERSION_VALUE"
npx replace $CURRENT_VERSION_VALUE $NEW_VERSION_VALUE package.json
git add package.json
echo ${{ steps.create-release.outputs.new_version }}
echo "commit_summary=$SUMMARY" >> $GITHUB_OUTPUT
git commit -m "chore(beta-relase): $NEW_VERSION_VALUE"
git tag -a "v$NEW_VERSION_VALUE" -m "chore: release v$NEW_VERSION_VALUE"
git push origin "v$NEW_VERSION_VALUE"

- name: Push new version in release branch & tag
run: |
git push

- name: Checkout
uses: actions/checkout@v4
with:
ref: '${{ steps.create-release.outputs.branch_name }}'

- name: Install Cocoapods
run: gem install cocoapods

- name: 'Convert podspec to podspec.json'
run: |
pod ipc spec Rudder.podspec > Rudder.podspec.json

- name: Add Private Spec Repo to CocoaPods installation
run: |
pod repo add rudderlabs https://${{secrets.PAT_USERNAME}}:${{secrets.PAT}}@github.com/rudderlabs/Specs.git

- name: Add Podspec to repo
run: |
pod repo push rudderlabs Rudder.podspec.json
2 changes: 1 addition & 1 deletion .github/workflows/draft-new-release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
if: startsWith(github.ref, 'refs/heads/develop-v2') || startsWith(github.ref, 'refs/heads/hotfix-v2/')
steps:
- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-new-release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
echo "release_version=$VERSION" >> $GITHUB_OUTPUT

- name: Checkout source branch
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
50 changes: 28 additions & 22 deletions .github/workflows/test-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,42 @@ on:
jobs:
build:
name: 'Tests & Coverage(v2)'
runs-on: macOS-latest

runs-on: macos-latest
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2

- name: Install xcpretty
run: gem install xcpretty

# - name: Run tests(suite)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' | xcpretty

# - name: Run tests(1)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -only-testing "Tests/Tests" | xcpretty

# - name: Run tests(2)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -only-testing "Tests/Tests2" | xcpretty

# - name: Run tests(3)
# run: |
# xcodebuild -scheme RudderSDK-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13' -only-testing "Tests/Tests3" | xcpretty

- name: Install SonarCloud
run: npm install -g sonarqube-scanner

- name: Run tests(iOS)
run: |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-iOS test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -enableCodeCoverage YES -derivedDataPath build | xcpretty

- name: Run tests(tvOS)
run: |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-tvOS test -sdk appletvsimulator -destination 'platform=tvOS Simulator,name=Apple TV' -enableCodeCoverage YES -derivedDataPath build | xcpretty

- name: Run tests(watchOS)
run: |
xcodebuild -workspace Rudder.xcworkspace -scheme RudderTests-watchOS test -sdk watchsimulator -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (45mm)' -enableCodeCoverage YES -derivedDataPath build | xcpretty

- name: Collect coverage into one XML report
run: |
bash xccov-to-generic.sh build/Logs/Test/*.xcresult/ > generic-coverage.xml

- name: SonarCloud Scan
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner -Dsonar.host.url=https://sonarcloud.io

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
Configuration.json
.DS_Store
.scannerwork
.scannerwork

# Sonar
relative_or_absolute_path_to_cache_location
compile_commands.json
GoogleService-Info.plist
RudderConfig.plist
configuration.json
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Examples

- RudderTests
analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
- explicit_self

Expand Down
30 changes: 30 additions & 0 deletions Examples/RudderConfig/RudderConfig.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// RudderConfig.swift
// RudderOneTrust
//
// Created by Pallab Maiti on 26/01/23.
//

import Foundation

@objc
class RudderConfig: NSObject, Codable {
@objc let WRITE_KEY: String
@objc let PROD_DATA_PLANE_URL: String
@objc let PROD_CONTROL_PLANE_URL: String
@objc let LOCAL_DATA_PLANE_URL: String
@objc let LOCAL_CONTROL_PLANE_URL: String
@objc let DEV_DATA_PLANE_URL: String
@objc let DEV_CONTROL_PLANE_URL: String
@objc let STORAGE_LOCATION: String
@objc let DOMAIN_IDENTIFIER: String

@objc
class func create(from url: URL) -> RudderConfig? {
if let data = try? Data(contentsOf: url),
let rudderConfig = try? PropertyListDecoder().decode(RudderConfig.self, from: data) {
return rudderConfig
}
return nil
}
}
24 changes: 24 additions & 0 deletions Examples/RudderConfig/SampleRudderConfig.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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>WRITE_KEY</key>
<string></string>
<key>PROD_DATA_PLANE_URL</key>
<string></string>
<key>PROD_CONTROL_PLANE_URL</key>
<string></string>
<key>LOCAL_DATA_PLANE_URL</key>
<string></string>
<key>LOCAL_CONTROL_PLANE_URL</key>
<string></string>
<key>DEV_DATA_PLANE_URL</key>
<string></string>
<key>DEV_CONTROL_PLANE_URL</key>
<string></string>
<key>STORAGE_LOCATION</key>
<string></string>
<key>DOMAIN_IDENTIFIER</key>
<string></string>
</dict>
</plist>
1 change: 1 addition & 0 deletions Examples/SampleObjC-tvOS/SampleObjC-tvOS/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[config dataPlaneURL:DATA_PLANE_URL];
[config trackLifecycleEvents:YES];
[config recordScreenViews:YES];
[config loglevel:RSLogLevelDebug];
client = [RSClient sharedInstance];
[client configureWith:config];
[client track:@"track 1"];
Expand Down
Loading
Loading