guardianproject / orbot-apple

Orbot VPN app for iOS
MIT License
205 stars 34 forks source link

Archive fails for want of `Config.screenshotMode` #56

Closed johnhess closed 1 year ago

johnhess commented 1 year ago

I get the following error trying to Archive the app.

.../Orbot/BridgesViewController.swift:107:64: error: type 'Config' has no member 'screenshotMode'

I see this both in Bitrise and in XCode. Removing the || Config.screenshotMode portion of the two offending lines results in a successful build.

I think Shared/Config.swift defines that var within the #if DEBUG block. Is it simply undefined otherwise? If so, does it just want to be false in an #else?

johnhess commented 1 year ago

FWIW, my archive succeeds when I add an #else block

#if DEBUG
    /**
     Simulates a running Network Extension to get nice screenshots.

     NEVER EVER remove the `#if DEBUG` condition around this and any code using this.

     Should positively never end up in production code!
     */
    class var screenshotMode: Bool {
        UserDefaults.standard.bool(forKey: "FASTLANE_SNAPSHOT")
    }

    /**
     Show the Snowflake Proxy experimental button.
     */
    class var snowflakeProxyExperiment: Bool {
        !screenshotMode && true
    }

    /**
     Show VPN Log, Leaf Log, Leaf Configuration and Webserver log segments in log view for debugging.
     */
    class var extendedLogging: Bool {
        !screenshotMode && true
    }
#else 
    class var screenshotMode: Bool {
        false
    }
#endif
tladesignz commented 1 year ago

Oh, thanks for catching this!

It's only defined on DEBUG on purpose. Belts and suspenders, so I don't accidentally use code in production, which absolutely shouldn't be there. Somehow, I forgot about it in my latest additions. 😆🤷

I'll fix it!