Skip to content

Commit fd47190

Browse files
alrikaiAnka
andauthored
Release 2.0.0
* Release 2.0.0 * update umbrella import * update example project code & switch release version to branch while we re-work the release process * add background uploading capability and streamline some of the Example app code * update readme, as we no longer should need any netrc stuff for using the SDK --------- Co-authored-by: Anka <[email protected]>
1 parent 99605c4 commit fd47190

39 files changed

+619
-490
lines changed

Example/Example.xcodeproj/project.pbxproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/* End PBXBuildFile section */
1717

1818
/* Begin PBXFileReference section */
19+
0A878E652CD4A4E4008FAE00 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
1920
B4C6AE8F2AF546B200A68766 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
2021
B4C6AE922AF546B200A68766 /* ExampleApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleApp.swift; sourceTree = "<group>"; };
2122
B4C6AE942AF546B200A68766 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
@@ -57,6 +58,7 @@
5758
B4C6AE912AF546B200A68766 /* Example */ = {
5859
isa = PBXGroup;
5960
children = (
61+
0A878E652CD4A4E4008FAE00 /* Info.plist */,
6062
B4C6AE922AF546B200A68766 /* ExampleApp.swift */,
6163
B4C6AE942AF546B200A68766 /* ContentView.swift */,
6264
B4C6AE962AF546B300A68766 /* Assets.xcassets */,
@@ -293,6 +295,7 @@
293295
ENABLE_HARDENED_RUNTIME = YES;
294296
ENABLE_PREVIEWS = YES;
295297
GENERATE_INFOPLIST_FILE = YES;
298+
INFOPLIST_FILE = Example/Info.plist;
296299
INFOPLIST_KEY_NSCameraUsageDescription = "To capture photos of your property";
297300
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
298301
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
@@ -332,6 +335,7 @@
332335
ENABLE_HARDENED_RUNTIME = YES;
333336
ENABLE_PREVIEWS = YES;
334337
GENERATE_INFOPLIST_FILE = YES;
338+
INFOPLIST_FILE = Example/Info.plist;
335339
INFOPLIST_KEY_NSCameraUsageDescription = "To capture photos of your property";
336340
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
337341
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
@@ -386,8 +390,8 @@
386390
isa = XCRemoteSwiftPackageReference;
387391
repositoryURL = "https://github.com/hoverinc/hover-capture-ios.git";
388392
requirement = {
389-
kind = upToNextMajorVersion;
390-
minimumVersion = 0.1.1;
393+
branch = release/2.0.0;
394+
kind = branch;
391395
};
392396
};
393397
/* End XCRemoteSwiftPackageReference section */

Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/Example/ContentView.swift

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,28 @@ struct ContentView: View {
1313
VStack {
1414
Button("Start Flow") {
1515
Task {
16-
try await HVCameraExterior.sharedInstance.startCaptureSession(
17-
settings: HVCameraSettings(),
18-
info: CaptureJobInformation(
19-
firstTimeUser: true,
20-
jobID: 12345,
21-
clientIdentifier: "DEADBEEF_DEAD_BEEF_DEAD_BEEFDEADBEEF",
22-
uploadSecret: "DEADBEEF_DEAD_BEEF_DEAD_BEEFDEADBEEF"
23-
)
24-
)
16+
let jobInfo = CaptureJobInformation(
17+
firstTimeUser: true,
18+
identifier: JobIdentifier(
19+
jobID: 123
20+
),
21+
uploadSecret: "DEADBEEF_DEAD_BEEF_DEAD_BEEFDEADBEEF")
22+
let sessionSettings = HVCameraSettings()
23+
24+
do {
25+
_ = try await HVPartnerSDK.sharedInstance.startCaptureSession(
26+
settings: sessionSettings,
27+
info: jobInfo)
28+
try await HVPartnerSDK.sharedInstance.startCaptureFlow()
29+
} catch let error as HVSessionError {
30+
print("Known capture flow error: \(error.localizedDescription)")
31+
} catch {
32+
print("Unknown Capture Flow Error: \(error.localizedDescription)")
33+
34+
}
2535
}
2636
}
27-
}
28-
.padding()
29-
.onAppear {
30-
HVCameraExterior.sharedInstance.initialize()
37+
.padding()
3138
}
3239
}
3340
}

Example/Example/ExampleApp.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,60 @@
66
//
77

88
import SwiftUI
9+
import HVCaptureSDK
10+
import BackgroundTasks
911

1012
@main
1113
struct ExampleApp: App {
14+
15+
let uploadTaskIdentifier = "to.hover.uploads"
16+
17+
init() {
18+
// NOTE: to allow the SDK to handle its own background uploads, uncomment this line
19+
// and comment out the `registerBackgroundTask` line.
20+
//HVPartnerSDK.sharedInstance.registerForBackgroundJobs()
21+
HVPartnerSDK.sharedInstance.initialize()
22+
23+
registerBackgroundTask()
24+
}
25+
1226
var body: some Scene {
1327
WindowGroup {
1428
ContentView()
1529
}
1630
}
1731
}
32+
33+
extension ExampleApp {
34+
/// Example of how we can manually trigger the SDK to perform background uploads
35+
func registerBackgroundTask() {
36+
// set up background tasks for scheduling HVCaptureSDK uploads, if applicable
37+
BGTaskScheduler.shared.register(forTaskWithIdentifier: uploadTaskIdentifier, using: nil) { task in
38+
self.uploadCaptureDataInBackground(task: task as! BGProcessingTask)
39+
}
40+
41+
// schedule the background task to be executed
42+
let request = BGProcessingTaskRequest(identifier: uploadTaskIdentifier)
43+
request.requiresNetworkConnectivity = true
44+
request.requiresExternalPower = false
45+
try? BGTaskScheduler.shared.submit(request)
46+
}
47+
48+
func uploadCaptureDataInBackground(task: BGProcessingTask) {
49+
let processingTask = Task {
50+
do {
51+
// set up HVPartnerSDK for background uploading (on wifi only)
52+
// NOTE: can configure whether to upload on wifi only (`true`) vs. wifi + cellular (`false`)
53+
try await HVPartnerSDK.sharedInstance.initializeForBackground(parameters: .init(
54+
uploadOnWiFiOnly: true))
55+
task.setTaskCompleted(success: true)
56+
} catch {
57+
task.setTaskCompleted(success: false)
58+
}
59+
}
60+
61+
task.expirationHandler = {
62+
processingTask.cancel()
63+
}
64+
}
65+
}

Package.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ let package = Package(
1919
name: "HVCaptureSDK",
2020
dependencies: [
2121
"ObjcExceptionBridging",
22+
"_HoverSDK",
2223
"_HVAVCamera",
23-
"_HVCameraExterior",
2424
"_HVCore",
2525
"_HVCVPixelBufferHelper",
2626
"_XCGLogger",
@@ -32,33 +32,33 @@ let package = Package(
3232

3333
.binaryTarget(
3434
name: "ObjcExceptionBridging",
35-
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/179081155.zip",
36-
checksum: "9a7b6d95fb1c5a2fcbe812dfec2dacdac564cc5eb035fed849994b7ae7798ebd"
35+
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/203311933.zip",
36+
checksum: "5fa8986aa63f860c681eefece027e919ccdf02e80f4da4a66e701a561cad4e73"
3737
),
3838
.binaryTarget(
39-
name: "_HVAVCamera",
40-
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/179081156.zip",
41-
checksum: "fcbcd6a0359bb95ce70ebd6ed151c7b9fef86bc115f68770d061c570d6ec26f9"
39+
name: "_HoverSDK",
40+
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/203311994.zip",
41+
checksum: "c4ae23a5ebb048c40b346f41d5757ba24b50980f017b8a1ff27f35902ef4ef40"
4242
),
4343
.binaryTarget(
44-
name: "_HVCameraExterior",
45-
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/179081164.zip",
46-
checksum: "391966af56f124238dd8aaab383f2ce286a3821ef264636cf37c9545c3d0c586"
44+
name: "_HVAVCamera",
45+
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/203311934.zip",
46+
checksum: "2355881d8b1b50a0cec6d7480f3a10db5994abaef5bca0a4c6a52bc56b586660"
4747
),
4848
.binaryTarget(
4949
name: "_HVCore",
50-
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/179081167.zip",
51-
checksum: "096e8fdb1a1ecf01c6fd0a2133a7bc5516043dc670bdc8a81af66e9e7a0855c3"
50+
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/203311990.zip",
51+
checksum: "44152baf504ab9872a357f298ef3e38f0c482de19d11a0effcfcf9f11ca96093"
5252
),
5353
.binaryTarget(
5454
name: "_HVCVPixelBufferHelper",
55-
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/179081161.zip",
56-
checksum: "59d089565ef612213ac325fd2ae7e0dad2a3a010be7613bba24a7a86ad435e7b"
55+
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/203311987.zip",
56+
checksum: "838cfb39bbd2bdc66e5298e1dfa6b624fb7275ce1d7c5fc94bb717cf35efab1b"
5757
),
5858
.binaryTarget(
5959
name: "_XCGLogger",
60-
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/179081168.zip",
61-
checksum: "95110df7e425f8a770cf5b7192605917b1ed352dee0c5166ba3df7f3406f9d72"
60+
url: "https://api.github.com/repos/hoverinc/hover-capture-ios/releases/assets/203311996.zip",
61+
checksum: "2b774d6d83aa1ee5205fd169a22d5fd6e5340b050e06c52227a503b3298e1a5f"
6262
),
6363
]
6464
)

README.md

Lines changed: 9 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,49 @@ The HOVER Capture iOS SDK provides a user flow for capturing and submitting 3D s
1717

1818
The HOVER Capture iOS SDK is distributed using Swift Package Manager. You may integrate it using Xcode or a `Package.swift` file.
1919

20-
> [!TIP]
21-
> Swift Package Manager requires a properly configured `.netrc` file to download binary assets from the private repository. Please see [Authenticating with .netrc](#authenticating-with-netrc) below for instructions on how to properly configure this.
22-
2320
<details>
2421
<summary>Xcode</summary>
25-
22+
2623
To integrate the SDK using Xcode, perform the following steps:
2724

2825
1. In the Xcode Project Navigator pane (on the left side), select your project.
2926
2. Select your project under the PROJECT heading on the left-side panel
3027
3. Select the Package Dependencies tab on the top
3128
4. Click the + button under the Packages list.
3229
5. In the "Search or Enter Package URL" search bar, enter the repository url (`https://github.com/hoverinc/hover-capture-ios.git`)
33-
- We recommend using https to mitigate some bumps with github authentication.
3430
6. Click "Add Package"
3531
7. Select a target to add the `HVCaptureSDK` library.
3632

3733
</details>
3834

3935
<details>
4036
<summary>Package.swift</summary>
41-
37+
4238
To integrate the SDK into a Swift package, add the following line to your `dependencies` array in your `Package.swift` manifest:
4339

4440
```swift
45-
.package(url: "https://github.com/hoverinc/hover-capture-ios.git", from: "0.1.1")
41+
.package(url: "https://github.com/hoverinc/hover-capture-ios.git", from: "2.0.0")
4642
```
4743

4844
</details>
4945

5046
## Usage
5147

52-
> [!CAUTION]
53-
> APIs are non-final and considered unstable.
48+
The `Example` app in the repository provides a minimal example of how to integrate the SDK into an application. Additionally, the [Getting Stated](https://hoverinc.github.io/hover-capture-ios/documentation/hvcapturesdk/gettingstarted) guide and [Tutorials](https://hoverinc.github.io/hover-capture-ios/tutorials/tutorials/) have more comprehensive and up-to-date documentation regartding SDK usage, customization and integration.
5449

5550
### Initializing the SDK
5651

5752
The SDK should be initialized as early as possible in the app lifecycle. This is because the SDK does some background work to set up required structures and upload any remaining captured data from past jobs that have yet to complete.
5853
As such, the SDK should (ideally) be initialized in host application’s `applicationDidFinishLaunching` method, so that the SDK can continue uploading any files that remain to be uploaded. This helps expedite 3D model generation, as we need all the captured images and metadata to begin the 3D reconstruction process.
5954

6055
```swift
61-
import HVCamera
56+
import HVCaptureSDK
6257
class AppDelegate: UIResponder, UIApplicationDelegate {
6358
// ...
6459

6560
@MainActor
6661
private func applicationDidFinishLaunching(_ notification: Notification) {
67-
HVCameraExterior.sharedInstance.initialize()
62+
HVPartnerSDK.sharedInstance.initialize()
6863
}
6964
}
7065
```
@@ -74,7 +69,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7469
The host app can launch the SDK in any way it sees fit, as long as there is an active ViewController somewhere in the app. Here is one example using SwiftUI of launching the SDK capture flow on a button click:
7570

7671
```swift
77-
import HVCamera
72+
import HVCaptureSDK
7873
import SwiftUI
7974

8075
struct FooView: View {
@@ -87,7 +82,7 @@ struct FooView: View {
8782
Button("Start Capture") {
8883
let captureTask = Task {
8984
do {
90-
try await HVCameraExterior.sharedInstance.startCaptureSession(settings: sessionSettings, info: jobInfo)
85+
try await HVPartnerSDK.sharedInstance.startCaptureSession(settings: sessionSettings, info: jobInfo)
9186
} catch let error as HVSessionError {
9287
// maybe handle our known errors here
9388
switch error.kind {
@@ -127,7 +122,7 @@ Since we execute asynchronously, within a Swift ``Task``, we also honor its canc
127122
```swift
128123
let captureTask = Task {
129124
do {
130-
try await HVCameraExterior.sharedInstance.startCaptureSession(settings: sessionSettings, info: jobInfo)
125+
try await HVPartnerSDK.sharedInstance.startCaptureSession(settings: sessionSettings, info: jobInfo)
131126
} catch let error as HVSessionError {
132127
switch error.kind {
133128
case .UserCancelled:
@@ -141,39 +136,3 @@ DispatchQueue.main.asyncAfter(deadline: .now() + 10, execute: {
141136
captureTask.cancel()
142137
})
143138
```
144-
145-
## Troubleshooting
146-
147-
### Authenticating with `.netrc`
148-
149-
The SDK wraps a number of sub-frameworks into one tidy package to simplify distribution and integration. However, to avoid checking these binaries into the repository, we host them as artifacts within the associated Github Release. To meet Swift Package Manager's security requirements, we must use Github's API to download these binary assets, and thus authenticate with the Github API using `netrc` to authorize the download.
150-
151-
Your `netrc` file should look something like this:
152-
153-
```
154-
machine api.github.com
155-
login schrismartin
156-
password ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
157-
```
158-
159-
- `machine` – This will be `api.github.com`, as SPM will attempt to download the binary frameworks via Github's API
160-
- `login` – This will be your Github username, omitting any `@domain.com` suffix.
161-
- `password` – This will be a [Github Personal Access Token](#github-personal-access-token)
162-
163-
After making any modifications to this file, you will want to restart Xcode for the changes to take effect. You may need to reset package caches if you continue to see errors.
164-
165-
> [!NOTE]
166-
> An incorrect configuration of this file will result in an `badResponseStatusCode(404)` error when attempting to download a framework binary. While a 404 typically indicates that a resources doesn't exist, in this case, it means it doesn't exist _for you_. If your `.netrc` file is correctly configured and you're still seeing this issue, please review the scopes for your configured Github PAT.
167-
168-
### Github Personal Access Tokens:
169-
170-
Both Xcode and the `.netrc` file will need access to Github in order to seamlessly download the requirements to build & run the SDK. The associated Github Personal Access Token (PAT) will need to be configured as below.
171-
172-
1. Make sure you’re signed into Github for the account that you need to authenticate
173-
2. Navigate to Settings → Developer Settings → Personal Access Tokens
174-
3. Click “Generate new token” → “Generate new token (classic)”
175-
4. Generate a new token that contains at least the following scopes
176-
- `admin:public_key`
177-
- `write:discussion`
178-
- `repo`
179-
- `user`

Sources/HVCaptureSDK/HVCaptureSDK.docc/CaptureSDK.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ``_HVCameraExterior``
1+
# ``_HoverSDK``
22

33
The HOVER capture experience
44

0 commit comments

Comments
 (0)