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

SDK unusable because of required updater calls #14

Open
ir-fuel opened this issue Jun 26, 2022 · 1 comment
Open

SDK unusable because of required updater calls #14

ir-fuel opened this issue Jun 26, 2022 · 1 comment

Comments

@ir-fuel
Copy link

ir-fuel commented Jun 26, 2022

It seems we need to instantiate the SDK using:

public static func shared(token: String? = nil,
                              onUpdateStartCallback: StartClosureSignature? = nil,
                              onUpdateAvailableCallback: UpdateAvailableClosureSignature? = nil,
                              onUpdateProgressCallback: ProgressClosureSignature? = nil,
                              onUpdateSuccessCallback: SuccessClosureSignature? = nil,
                              onUpdateFailureCallback: FailureClosureSignature? = nil) throws -> ActiveLookSDK

Which for normal development purposes is useless, as we can leave the entire update responsibility to the ActiveLook app.

Because a normal developer does not have the token nor the possibility to download firmware updates, the only solution is to pass bogus parameters and return false in onUpdateAvailableCallback. This however stops the SDK from functioning returning:

                        discoveredGlasses.connectionErrorCallback?(ActiveLookError.sdkUpdateFailed)
                        self.updateParameters.notify(.updateFailed)

The error originates in:

            guard httpResponse.statusCode != 403 else {
                self.failed(with: GlassesUpdateError.invalidToken)
                return
            }

which makes sense since we don't have the right token to check for updates.

I forked the repo and I fixed it by putting this in the code:

                glasses.fixInDeviceCmdStack {
                    glasses.cfgSet(name: "ALooK")
//                    parent.updateInitializedGlasses(glasses) --> this is not needed for 3rd party devs!
                    discoveredGlasses.connectionCallback?(glasses)
                }

@hesselbom
Copy link

According to https://github.com/ActiveLook/demo-app?tab=readme-ov-file#sdk-token the token field should be blank. I tried setting it to an empty string (like ActiveLookSDK.shared(token: "", [...]) and I don't get the error you mention so seems to be the correct way forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants