Skip to content

Commit

Permalink
Driving detection & motion data (#313)
Browse files Browse the repository at this point in the history
* track isDriving

* track location metadata

* Update RadarAPIClient.m

* Update RadarAPIClient.m

* motionData -> locationMetadata

* Put behind a feature setting

* fix feature settings

* request location on activity change

Put the locationMetadata on the user obj client side

Revert "Put the locationMetadata on the user obj client side"

This reverts commit e41a500.

simplify location metadata

declare newActivityType

bug fixes

didUpdateLocation

didUpdateLocation #2

location metadata

update example

fix example

'Update Radar SDK version to 3.10.2-beta.1

* Updates

* change get to request

* more

* fix delegate def

* Add to gitignore

* Improve typing

* Move activity updates to updateTracking

* don't change version

* simplify queues

* Add flag for isUpdatingActivity

* immediately stop updates

* Add to xcode

* properly include activity manager

* move init of activity manager

* remove beta tag for now

* update info.plist

* commenting out sensitive api calls

* lowercase the type'

* change activity manager and podspec

* add spm dependency of radarSDMMotion

* change optional dep version

* remove the optional dependency

* removing dead code

* change header search path

* typo

* move to conditional inclusion of files

* change package.swift

* remove motion for test

* add back excluded motion

* change package.swift

* change package swift for test

* change header search path

* shift things for the time being

* change file

* revert back experiemnts with optional dependency and macros

* fix chatty listerners and also ensure that it starts with init

* cleanup

* bump beta version

* refactor

* Kenny/patch start tracking on init (#374)

* add start tracking if needed

* not check on first call to listenr

* revert example changes

* bump beta

* bump down beta version just for a build

* Kenny decouple motion permission (#377)

* implement radarMotion prototype

* why is it not impoting the protocol header file?'

* save for project rename

* got it working on local example

* update package.swift

* update swift package

* add other possible path?

* forward declare protocol

* change to package.swift

* change to any type

* add pods

* bump version

* change podspecs

* bump beta

* temp bumping down version for some verification, pls revert later

* add back beta version

* bump beta and also change release workflow to support new scheme

* changes to release yml

* cleanup

* try and load the class at runtime

* bump beta version

* also release pod

* tidy up

* bump beta and tidy up

* add back release yml stuff

* address review comments

* version bump

* change to right version bump

* clean up

* bump to minor version and also expire older readings

* remove sensors

* change to just call track once

---------

Co-authored-by: Liam Meier <[email protected]>
Co-authored-by: Kenny Hu <[email protected]>
Co-authored-by: KennyHuRadar <[email protected]>
  • Loading branch information
4 people authored Aug 16, 2024
1 parent 63c92df commit 4367407
Show file tree
Hide file tree
Showing 36 changed files with 1,149 additions and 22 deletions.
48 changes: 37 additions & 11 deletions .github/workflows/release-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,51 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Build, test, and analyze
- name: Build, test, and analyze (RadarSDK)
run: xcodebuild clean build analyze test -workspace Example/Example.xcodeproj/project.xcworkspace -scheme RadarSDK -destination "platform=iOS Simulator,name=iPhone 15 Pro" | xcpretty

- name: Build archive for iPhone simulator
- name: Build archive for iPhone simulator (RadarSDK)
run: xcodebuild archive -scheme RadarSDK -archivePath "RadarSDK-iphonesimulator.xcarchive" -sdk iphonesimulator SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO

- name: Build archive for iPhone device
- name: Build archive for iPhone device (RadarSDK)
run: xcodebuild archive -scheme RadarSDK -archivePath "RadarSDK-iphoneos.xcarchive" -sdk iphoneos SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO

- name: Build XCFramework
- name: Build archive for iPhone simulator (RadarSDKMotion)
run: cd RadarSDKMotion && xcodebuild archive -scheme RadarSDKMotion -archivePath "../RadarSDKMotion-iphonesimulator.xcarchive" -sdk iphonesimulator SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO

- name: Build archive for iPhone device (RadarSDKMotion)
run: cd RadarSDKMotion && xcodebuild archive -scheme RadarSDKMotion -archivePath "../RadarSDKMotion-iphoneos.xcarchive" -sdk iphoneos SKIP_INSTALL=NO CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO

- name: Build XCFramework (RadarSDK)
run: xcodebuild -create-xcframework -framework RadarSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/RadarSDK.framework -framework RadarSDK-iphoneos.xcarchive/Products/Library/Frameworks/RadarSDK.framework -output RadarSDK.xcframework

- name: Zip XCFramework
- name: Build XCFramework (RadarSDKMotion)
run: xcodebuild -create-xcframework -framework RadarSDKMotion-iphonesimulator.xcarchive/Products/Library/Frameworks/RadarSDKMotion.framework -framework RadarSDKMotion-iphoneos.xcarchive/Products/Library/Frameworks/RadarSDKMotion.framework -output RadarSDKMotion.xcframework

- name: Zip XCFramework (RadarSDK)
run: zip -r RadarSDK.xcframework.zip RadarSDK.xcframework -x ".*" -x "__MACOSX" -D

- name: Upload XCFramework to release
- name: Zip XCFramework (RadarSDKMotion)
run: zip -r RadarSDKMotion.xcframework.zip RadarSDKMotion.xcframework -x ".*" -x "__MACOSX" -D

- name: Upload XCFramework to release (RadarSDK)
uses: svenstaro/upload-release-action@v2
with:
file: RadarSDK.xcframework.zip

- name: Upload XCFramework to release (RadarSDKMotion)
uses: svenstaro/upload-release-action@v2
with:
file: RadarSDKMotion.xcframework.zip

# get sha256 checksum of the XCFramework
- name: Get SHA256 checksum
id: checksum
- name: Get SHA256 checksum (RadarSDK)
id: checksum_radarsdk
run: echo "::set-output name=checksum::$(shasum -a 256 RadarSDK.xcframework.zip | cut -d ' ' -f 1)"

- name: Get SHA256 checksum (RadarSDKMotion)
id: checksum_radarsdkmotion
run: echo "::set-output name=checksum::$(shasum -a 256 RadarSDKMotion.xcframework.zip | cut -d ' ' -f 1)"

- name: Repository Dispatch
if: ${{ !github.event.release.prerelease }}
Expand All @@ -51,9 +72,14 @@ jobs:
token: ${{ secrets.SPM_REPO_KEY }}
repository: radarlabs/radar-sdk-ios-spm
event-type: update-xcframework
client-payload: '{"release": "${{ github.event.release.tag_name }}", "checksum": "${{ steps.checksum.outputs.checksum }}", "url": "${{ github.event.release.html_url }}"}'
client-payload: '{"release": "${{ github.event.release.tag_name }}", "checksum": "${{ steps.checksum_radarsdk.outputs.checksum }}", "url": "${{ github.event.release.html_url }}", "checksum_motion": "${{ steps.checksum_radarsdkmotion.outputs.checksum }}"}'

# Lint and deploy the spec to the CocoaPods trunk
- uses: michaelhenry/[email protected]
- name: Deploy to Cocoapods
run: |
set -eo pipefail
pod lib lint --allow-warnings RadarSDK.podspec
pod trunk push --allow-warnings RadarSDK.podspec
pod lib lint --allow-warnings RadarSDKMotion.podspec
pod trunk push --allow-warnings RadarSDKMotion.podspec
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
xcuserdata/
.idea/
.vscode/
Carthage/Checkouts/
Carthage/Build/
sonar-reports/
Expand Down
53 changes: 52 additions & 1 deletion Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
objects = {

/* Begin PBXBuildFile section */
013D7AF226D327C400574AD5 /* RadarSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0107AA77262200DA008AB52F /* RadarSDK.framework */; };
013D7AF226D327C400574AD5 /* RadarSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0107AA77262200DA008AB52F /* RadarSDK.framework */; settings = {ATTRIBUTES = (Required, ); }; };
013D7AF326D327C400574AD5 /* RadarSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0107AA77262200DA008AB52F /* RadarSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
DD236D27230A006700EB88F9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD236D26230A006700EB88F9 /* AppDelegate.swift */; };
DD236D30230A006900EB88F9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DD236D2F230A006900EB88F9 /* Assets.xcassets */; };
DD291169230D0AF900049D3A /* Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD291168230D0AF900049D3A /* Utils.swift */; };
DDB861D32385FC3E00770661 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = DDB861D22385FC3E00770661 /* [email protected] */; };
E698B7492C626B0600084371 /* RadarSDKMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E698B7412C626AE600084371 /* RadarSDKMotion.framework */; };
E698B7502C627A1600084371 /* RadarSDKMotion.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = E698B7412C626AE600084371 /* RadarSDKMotion.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F625D7F92C3337650024D1E7 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F625D7F82C3337650024D1E7 /* Launch Screen.storyboard */; };
/* End PBXBuildFile section */

Expand All @@ -31,6 +33,20 @@
remoteGlobalIDString = DD236C7E2308797B00EB88F9;
remoteInfo = RadarSDKTests;
};
E698B7402C626AE600084371 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E698B7382C626AE600084371 /* RadarSDKMotion.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = E698B6672C6167A800084371;
remoteInfo = RadarSDKMotion;
};
E698B7422C626AE600084371 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = E698B7382C626AE600084371 /* RadarSDKMotion.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = E698B6712C6167A800084371;
remoteInfo = RadarSDKMotionTests;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -41,6 +57,7 @@
dstSubfolderSpec = 10;
files = (
013D7AF326D327C400574AD5 /* RadarSDK.framework in Embed Frameworks */,
E698B7502C627A1600084371 /* RadarSDKMotion.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -56,6 +73,7 @@
DD86FCF9239185F4003225F6 /* RadarSDK.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RadarSDK.xcodeproj; path = ../RadarSDK.xcodeproj; sourceTree = SOURCE_ROOT; };
DD86FD0B23918B3C003225F6 /* Example-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example-Bridging-Header.h"; sourceTree = "<group>"; };
DDB861D22385FC3E00770661 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
E698B7382C626AE600084371 /* RadarSDKMotion.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RadarSDKMotion.xcodeproj; path = ../../RadarSDKMotion/RadarSDKMotion.xcodeproj; sourceTree = "<group>"; };
F625D7F82C3337650024D1E7 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand All @@ -65,6 +83,7 @@
buildActionMask = 2147483647;
files = (
013D7AF226D327C400574AD5 /* RadarSDK.framework in Frameworks */,
E698B7492C626B0600084371 /* RadarSDKMotion.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -98,6 +117,7 @@
DD291168230D0AF900049D3A /* Utils.swift */,
DD236D2F230A006900EB88F9 /* Assets.xcassets */,
DD86FCF9239185F4003225F6 /* RadarSDK.xcodeproj */,
E698B7382C626AE600084371 /* RadarSDKMotion.xcodeproj */,
F625D7F82C3337650024D1E7 /* Launch Screen.storyboard */,
);
path = Example;
Expand All @@ -119,6 +139,15 @@
name = Frameworks;
sourceTree = "<group>";
};
E698B7392C626AE600084371 /* Products */ = {
isa = PBXGroup;
children = (
E698B7412C626AE600084371 /* RadarSDKMotion.framework */,
E698B7432C626AE600084371 /* RadarSDKMotionTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand All @@ -136,6 +165,8 @@
dependencies = (
);
name = Example;
packageProductDependencies = (
);
productName = Example;
productReference = DD236D23230A006700EB88F9 /* Example.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -164,13 +195,19 @@
Base,
);
mainGroup = DD236D1A230A006700EB88F9;
packageReferences = (
);
productRefGroup = DD236D24230A006700EB88F9 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = DD55C3B62395D25600C34B40 /* Products */;
ProjectRef = DD86FCF9239185F4003225F6 /* RadarSDK.xcodeproj */;
},
{
ProductGroup = E698B7392C626AE600084371 /* Products */;
ProjectRef = E698B7382C626AE600084371 /* RadarSDKMotion.xcodeproj */;
},
);
projectRoot = "";
targets = (
Expand All @@ -194,6 +231,20 @@
remoteRef = DD55C3BB2395D25600C34B40 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
E698B7412C626AE600084371 /* RadarSDKMotion.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = RadarSDKMotion.framework;
remoteRef = E698B7402C626AE600084371 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
E698B7432C626AE600084371 /* RadarSDKMotionTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = RadarSDKMotionTests.xctest;
remoteRef = E698B7422C626AE600084371 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */

/* Begin PBXResourcesBuildPhase section */
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UIWindowSceneDelegate, UN
Radar.setMetadata([ "foo": "bar" ])
Radar.setDelegate(self)
Radar.setVerifiedDelegate(self)

return true
}

Expand Down Expand Up @@ -83,6 +83,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UIWindowSceneDelegate, UN
print("Track once: status = \(Radar.stringForStatus(status)); location = \(String(describing: location)); events = \(String(describing: events)); user = \(String(describing: user))")
}
}

demoButton(text: "trackOnce") {
Radar.trackOnce()
}


demoButton(text: "startTracking") {
let options = RadarTrackingOptions.presetContinuous
Expand Down
1 change: 1 addition & 0 deletions Example/Example/Example-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
//

#import <RadarSDK/RadarSDK.h>
#import <RadarMotion/RadarSDKMotion.h>
2 changes: 2 additions & 0 deletions Example/Example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
<string>Your background location usage description goes here.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your foreground location usage description goes here.</string>
<key>NSMotionUsageDescription</key>
<string>Your motion usage description goes here.</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
13 changes: 13 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ let package = Package(
.library(
name: "RadarSDK",
targets: ["RadarSDK"]
),
.library(
name: "RadarSDKMotion",
targets: ["RadarSDKMotion"]
)
],
dependencies: [],
Expand All @@ -23,6 +27,15 @@ let package = Package(
cSettings: [
.headerSearchPath(".")
]
),
.target(
name: "RadarSDKMotion",
dependencies: ["RadarSDK"],
path: "RadarSDKMotion/RadarSDKMotion",
publicHeadersPath: "Include",
cSettings: [
.headerSearchPath(".")
]
)
]
)
2 changes: 1 addition & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDK'
s.version = '3.16.1'
s.version = '3.17.0'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => '[email protected]' }
Expand Down
Loading

0 comments on commit 4367407

Please sign in to comment.