Skip to content

Commit 58b24d2

Browse files
authored
feat: new user agents (#25)
1 parent 110512b commit 58b24d2

File tree

5 files changed

+61
-3
lines changed

5 files changed

+61
-3
lines changed

CompassSDK/Communications/ApiRouter.swift

+9
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@ extension ApiCall {
3232
}
3333

3434
request.addValue(type.rawValue, forHTTPHeaderField: "Content-Type")
35+
request.addValue(userAgent, forHTTPHeaderField: "User-Agent")
36+
3537
return request
3638
}
39+
40+
private var userAgent: String {
41+
let codeVersion = Bundle.compassSDK?.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "unknown"
42+
let deviceType = UIDevice.current.userInterfaceIdiom == .pad ? "tablet" : "mobile"
43+
44+
return "Marfeel-iOS-SDK/\(codeVersion) (\(UIDevice.current.model)) \(deviceType)"
45+
}
3746
}
3847

3948
protocol ApiRouting: AnyObject {

CompassSDK/Extensions/Bundle.swift

+4
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@ extension Bundle {
1818

1919
var pageTechnology: Int? { object(forInfoDictionaryKey: "COMPASS_PAGE_TYPE") as? Int }
2020

21+
static var compassSDK: Bundle? {
22+
return Bundle(for: CompassTracker.self)
23+
}
24+
2125
}

CompassSDK/Info.plist

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>$(MARKETING_VERSION)</string>
18+
<string>2.13.0</string>
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
</dict>

MarfeelSDK-iOS.podspec

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ Pod::Spec.new do |spec|
1616
#
1717

1818
spec.name = "MarfeelSDK-iOS"
19-
spec.version = "2.12.1"
19+
spec.version = "2.13.0"
2020
spec.summary = "iOS version of MarfeelSDK."
2121

22-
# This description is used to generate tags and improve search results.
22+
23+
# This description is used to generate tags and improve searc h results.
2324
# * Think: What does it do? Why did you write it? What is the focus?
2425
# * Try to keep it short, snappy and to the point.
2526
# * Write the description between the DESC delimiters below.

bump-version.sh

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
# Check if version argument is provided
4+
if [ -z "$1" ]; then
5+
echo "Usage: ./bump_version.sh <new_version>"
6+
exit 1
7+
fi
8+
9+
NEW_VERSION="$1"
10+
11+
# Define paths for podspec and Info.plist
12+
PODSPEC_FILE="MarfeelSDK-iOS.podspec"
13+
PLIST_PATH="CompassSDK/Info.plist"
14+
15+
# Check if the podspec file exists
16+
if [ ! -f "$PODSPEC_FILE" ]; then
17+
echo "Podspec file not found at $PODSPEC_FILE"
18+
exit 1
19+
fi
20+
21+
# Check if the Info.plist file exists
22+
if [ ! -f "$PLIST_PATH" ]; then
23+
echo "Info.plist file not found at $PLIST_PATH"
24+
exit 1
25+
fi
26+
27+
# Update the version in the .podspec file
28+
echo "Updating podspec version..."
29+
sed -i '' "s/spec.version = \".*\"/spec.version = \"$NEW_VERSION\"/" "$PODSPEC_FILE"
30+
31+
# Update the version in the Info.plist file
32+
echo "Updating Info.plist version..."
33+
plutil -replace CFBundleShortVersionString -string "$NEW_VERSION" "$PLIST_PATH"
34+
35+
# Check if the changes were successful
36+
if [ $? -eq 0 ]; then
37+
echo "Version updated successfully in both podspec and Info.plist"
38+
else
39+
echo "Failed to update version in podspec or Info.plist"
40+
exit 1
41+
fi
42+
43+
44+
echo "Version bump complete"

0 commit comments

Comments
 (0)