Files
SideStore/AltStore/Operations/AuthenticationOperation.swift
naturecodevoid 3a7cd29b22 Merge SwiftUI (#221) + SwiftUI improvements (#265)
commit 22f1ff7cd7d4d4750eeda2067d23846900239b83
Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
Date:   Sat May 20 11:29:01 2023 -0700

    fix: actually disable LocalConsole's character limit

commit 4b51915da7bc0637ccf819ac45c7d727d450ae12
Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
Date:   Sat May 20 11:27:12 2023 -0700

    Merge SwiftUI improvements (#265)

    commit 7f73f2adef
    Merge: 72f34dd2 38a1c7ee
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sat May 20 11:23:07 2023 -0700

        Merge remote-tracking branch 'origin/fabianthdev/feature/SwiftUI' into naturecodevoid/swiftui-improvements

    commit 72f34dd286
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Apr 12 18:21:49 2023 -0700

        feat: default to Storm icon for PR builds

        Signed-off-by: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>

    commit 060c37c423
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 19:40:53 2023 -0700

        fix(icons): sky appears correctly in light mode

    commit 8c2968aeb3
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 14:29:03 2023 -0700

        fix: build errors

    commit 4f512b6318
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:54:01 2023 -0700

        project(minimuxer): fix actions build error

    commit 5b752cf26e
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:51:54 2023 -0700

        fix: remove duplicate isSideStore checks with a StoreApp extension

    commit 62a478277e
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:41:58 2023 -0700

        fix(AsyncFallibleButton): try to use failureReason and then fallback to localizedDescription

    commit 994b2318a9
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:38:44 2023 -0700

        feat(dev mode): add AFC file explorer and dump profiles

    commit 423ac28ba3
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:35:14 2023 -0700

        project(AltStore): xcode wants to move these around I guess

    commit af2cdd48d6
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:34:57 2023 -0700

        feat: add debug logging toggle

    commit 44fe0c5686
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:33:11 2023 -0700

        project(minimuxer): Add libminimuxer as an input file for build step

    commit 3d46a3069a
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:32:22 2023 -0700

        fix: handle source conflict in merge policy

    commit 82e8fb7389
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Apr 9 13:31:39 2023 -0700

        docs: include info on Developer Mode

    commit 1dd0cd7d90
    Merge: 92a9650c 566841a9
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Apr 6 21:07:33 2023 -0700

        Merge branch 'fabianthdev/feature/SwiftUI' into naturecodevoid/swiftui-improvements

    commit 566841a9a6
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Apr 6 21:06:07 2023 -0700

        Fix not being able to open the project

    commit 92a9650c0c
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Apr 6 20:49:49 2023 -0700

        Apply DevModeView suggestion

    commit df94e79472
    Merge: d3cfc4ba cd2c5ad7
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Apr 6 20:48:52 2023 -0700

        Merge branch 'fabianthdev/feature/SwiftUI' into naturecodevoid/swiftui-improvements

    commit cd2c5ad7b4
    Merge: 3466870d 6146f1bd
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Apr 6 20:43:10 2023 -0700

        Merge remote-tracking branch 'origin/develop' into fabianthdev/feature/SwiftUI

    commit d3cfc4bab9
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 22 13:05:11 2023 -0800

        FileExplorer: Replace file when inserting

    commit df62461d4a
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 22 13:04:52 2023 -0800

        Settings: Add Export Logs and commit xcodeproj changes

    commit 817d2de5e0
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 22 12:19:07 2023 -0800

        Rename View+SideStore

    commit 3ea478ad05
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 22 12:18:42 2023 -0800

        DevMode: Add password

    commit 13f9a9d1bf
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 22 11:43:13 2023 -0800

        AdvancedSettingsView: improve anisette URL by using a label instead of a placeholder

    commit 3821a6034d
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Tue Feb 21 17:34:56 2023 -0800

        project: attempt to fix crashing on launch

    commit 3e8d7da0c3
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 13:49:22 2023 -0800

        AdvancedSettingsView: Remove autocomplete from anisette URL text field

    commit a42c1a705f
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 13:25:59 2023 -0800

        SettingsView: Adjust ordering a little bit and remove accent color

    commit 30efc6f210
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 13:19:26 2023 -0800

        LaunchViewController: Revert changes

    commit 60412721ee
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 13:04:42 2023 -0800

        Fix build errors

        hopefully this doesn't have any unintended side effects

    commit cba00a3b9d
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 12:03:22 2023 -0800

        Add Advanced Settings in-app

    commit 2aa880d10e
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 10:56:01 2023 -0800

        Fix build errors after merge

    commit 47848ddd18
    Merge: deac960e 3466870d
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 09:56:21 2023 -0800

        Merge branch 'fabianthdev/feature/SwiftUI' into naturecodevoid/swiftui-improvements

        Signed-off-by: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>

    commit deac960e10
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 09:54:56 2023 -0800

        Revert OutputCapturer changes since Fabian already added the fix

    commit 9f05123e42
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 09:16:49 2023 -0800

        AppIconView: Make isSideStore required

    commit d9a4b07095
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 09:16:07 2023 -0800

        Fix changing SideStore app icon not displaying My Apps

    commit 839699ee03
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 09:00:19 2023 -0800

        Icons: add Vista by Swifticul

    commit 81409227d6
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 08:06:33 2023 -0800

        Add developer mode

    commit 49b9be160f
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sun Feb 19 07:57:29 2023 -0800

        AppRowView: Disable ratings if there aren't any ratings

    commit 3466870d8f
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Feb 19 14:31:01 2023 +0100

        [ADD] UI for writing an app review and submit an app rating

    commit ffe8a92a4e
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Feb 19 14:30:21 2023 +0100

        [CHANGE] UI fixes and SwiftUI previews for easier development

    commit bc2cae46a8
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Feb 19 14:25:13 2023 +0100

        [ADD] Refresh all apps functionality in MyAppsView

    commit a95d8a502c
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Feb 19 11:40:26 2023 +0100

        [FIX] STDOUT output not visible in Xcode console

    commit 19e66112dd
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sat Feb 18 20:27:06 2023 -0800

        SourcesView: Fix 1 trusted source causing an error making all trusted sources fail to load

    commit 0d3cb843ea
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sat Feb 18 20:26:32 2023 -0800

        SourcesViewController: Fix 1 trusted source causing an error making all trusted sources fail to load

    commit df1a662acc
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sat Feb 18 20:25:58 2023 -0800

        FetchTrustedSourcesOperation: Remove redundant if statement

    commit 684c9e08eb
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Sat Feb 18 10:48:05 2023 -0800

        Fix HMR

    commit c585c57965
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Fri Feb 17 18:51:06 2023 -0800

        Revert fixes since it didn't actually fix the problem

    commit 3605ca6422
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Fri Feb 17 18:20:56 2023 -0800

        Fix HMR again

    commit 40f4c94f4d
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Fri Feb 17 18:11:25 2023 -0800

        Fix HMR crashing the app

    commit 986465d8f4
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Fri Feb 17 17:44:56 2023 -0800

        Project: Add HMR

        https://github.com/krzysztofzablocki/Inject#individual-developer-setup-once-per-machine

    commit 09db1ba9fc
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Feb 16 18:13:32 2023 -0800

        SettingsView: Move App Icon to a new, general settings section

    commit 8874480b8c
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Feb 16 17:57:51 2023 -0800

        Icons: invert Sky

    commit f0cc4613da
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Thu Feb 16 17:57:19 2023 -0800

        AppIconsView: Add artists

    commit bec78322a4
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 15 21:00:28 2023 -0800

        actions: Add build step that changes default icon

    commit 03777fd2e7
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 15 20:49:07 2023 -0800

        Icons: add Sky, Honeydew, Midnight

    commit 96ae60a9f2
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 15 19:36:10 2023 -0800

        AppIconsView: improve the way primary icons are handled

    commit c7ad6b10a1
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 15 19:35:57 2023 -0800

        Icons: reduce image sizes

    commit 8b8e471c97
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Wed Feb 15 18:52:42 2023 -0800

        Add App Icon changer

    commit 38c0a8a9a3
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Tue Feb 14 08:24:49 2023 -0800

        Fix ConnectAppleIDView being shoved into a sidebar on iPad

    commit e7ff6496c1
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Tue Feb 14 08:20:16 2023 -0800

        AuthenticationOperation: fix 2FA code not being displayed

        Bandaid fix, it would be better to have the alert in ConnectAppleIDView

    commit c2e89b09ea
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Mon Feb 13 21:44:48 2023 -0800

        RootView: Fix UI being shoved into sidebar on iPad (closes #264, thanks @Swifticul!)

    commit ec4dbb6679
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Mon Feb 13 21:06:59 2023 -0800

        OutputCapturer: fix logging disappearing from Xcode/idevicedebug run

    commit d80c9ba2a8
    Author: naturecodevoid <44983869+naturecodevoid@users.noreply.github.com>
    Date:   Mon Feb 13 21:06:17 2023 -0800

        remove unused apps.json files

    commit b2f81bf7c6
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Feb 13 18:56:34 2023 +0100

        [ADD] LocalConsole showing STDOUT and STDERR

    commit 2fffa6e122
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sat Feb 4 14:35:58 2023 +0100

        [FIX] App compatibility info

    commit 723c8e9539
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sat Feb 4 14:29:02 2023 +0100

        [ADD] Debug entries for refresh attempts, sending feedback, advanced settings, and resetting the pairing file

    commit 07159b0ea6
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sat Feb 4 13:07:04 2023 +0100

        [ADD] Error log view

    commit e0bd54389c
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sat Feb 4 12:55:25 2023 +0100

        [FIX] Various UI issues

    commit 57213fbf0c
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sat Feb 4 12:46:43 2023 +0100

        [ADD] App report button and trusted source badge in app detail view

    commit 0239dfcd6d
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Feb 3 18:19:07 2023 +0100

        [FIX] AppIDsView and authentication workflow

    commit 5af6f825ee
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Feb 3 18:16:48 2023 +0100

        [FIX] Full screen app screenshot previews

    commit b4859512ab
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Feb 3 14:58:06 2023 +0100

        [FIX] Accent color

    commit 3d0f385af7
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Tue Jan 31 22:38:42 2023 +0100

        [CHANGE] Overhaul of the AppDetailView with version history, reviews & ratings, and app information

    commit f3e58e1485
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Tue Jan 31 22:37:37 2023 +0100

        [UPDATE] AppPillButton dimensions and expiration text

    commit d3e04c1db7
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Tue Jan 31 22:35:09 2023 +0100

        [FIX] Show App IDs button only if user is logged in with their Apple ID

    commit ed1970245a
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Tue Jan 31 22:32:11 2023 +0100

        [ADD] Load and show trusted sources with option to add them to the app

    commit 15dd885a1b
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Tue Jan 31 22:30:21 2023 +0100

        [ADD] Credits section in SettingsView

    commit 4663c01700
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Jan 16 21:23:16 2023 +0100

        [CHANGE] Extracted all strings into the Localizable.strings

    commit e733601c66
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Jan 16 19:03:33 2023 +0100

        [FIX] Text alignment in SettingsView

    commit fc974a8079
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Jan 16 19:02:58 2023 +0100

        [ADD] Hint for new users who don't have any sources

    commit 6aaadc79e5
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Jan 16 18:59:39 2023 +0100

        [ADD] AppScreenshot view with ImageProcessor to automatically rotate landscape screenshots

    commit b9177e89c6
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 13:37:38 2023 +0100

        [FIX] Issues introduced by changes to the AltSource specification.

    commit 1531c0a77f
    Author: Fabian Thies <github@fabian-thies.de>
    Date:   Fri Jan 13 12:48:27 2023 +0100

        [UPDATE] Translations (#7)

        This PR merges all the new translations made on the SideStore weblate instance (https://translate.sidestore.io/projects/sidestore/app).

        New translations:
        - French
        - Korean

        Updated translations:
        - Spanish

        Co-authored-by: bogotesr <bogotesr@gmail.com>
        Co-authored-by: GABO1423 <35014183+GABO1423@users.noreply.github.com>
        Co-authored-by: Joss Laymon <71040782+bogotesr@users.noreply.github.com>
        Co-authored-by: mindfreakdev <shost212@gmail.com>
        Co-authored-by: Python <rjp2030@proton.me>
        Co-authored-by: Testi Cules <ervd516@gmail.com>

    commit 1dde36face
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 12:25:50 2023 +0100

        [FIX] Changes made by Xcode 14 after building the app

    commit c3c3783ba4
    Author: Upal <shost212@gmail.com>
    Date:   Mon Dec 26 19:18:33 2022 +0530

        Added Hindi Language (#5)

        * Added Hindi Language

    commit 8400af3423
    Author: mindfreakdev <shost212@gmail.com>
    Date:   Sun Dec 25 16:52:01 2022 +0530

        Added Dutch Language

    commit 243c7efc09
    Author: mindfreakdev <shost212@gmail.com>
    Date:   Sun Dec 25 12:30:42 2022 +0530

        Added Ukrainian Language

    commit 0298a0235b
    Author: mindfreakdev <shost212@gmail.com>
    Date:   Sun Dec 25 12:28:00 2022 +0530

        Added Ukrainian Language

    commit e5b2496b09
    Author: Gabriel Morazán <35014183+GABO1423@users.noreply.github.com>
    Date:   Sun Dec 25 01:08:47 2022 -0400

        Screen Crunch sucks

        Signed-off-by: Gabriel Morazán <35014183+GABO1423@users.noreply.github.com>

    commit 75c52a3af2
    Author: GABO1423 <35014183+GABO1423@users.noreply.github.com>
    Date:   Sun Dec 25 00:58:22 2022 -0400

        Spanish Translation Tweaks

    commit 2c07009b04
    Author: bogotesr <bogotesr@gmail.com>
    Date:   Sat Dec 24 21:06:28 2022 -0700

        Add es-419 and finish adding support for the translations

        Added Latin American Spanish (probably not the best translation)

        Made everything reference the swiftgen stuff rather than having strings

    commit 6257fdcd61
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Thu Dec 22 10:29:57 2022 +0100

        [CHANGE] Extracted some example strings and replaced them by generated localized strings

    commit e23956d4ed
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Thu Dec 22 10:21:57 2022 +0100

        [ADD] SwiftGen configuration and generated files

    commit 1341de8315
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Thu Dec 22 10:10:58 2022 +0100

        [ADD] Empty Localizable.strings

    commit 77f5844e4d
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 12:04:10 2023 +0100

        [WIP] AppScreenshot view with ImageProcessor to automatically rotate landscape images. Possible through my fork of the AsyncImage framework.

    commit b3c4819e8d
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 12:02:56 2023 +0100

        [WIP] Fetch trusted sources in SourcesView

    commit a6ca73f8fc
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 12:02:06 2023 +0100

        [WIP] AppIDs view in My Apps section

    commit f17d00c0bc
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 12:00:00 2023 +0100

        [ADD] Badge in AppDetailView for apps from the official source and (WIP) trusted sources

    commit 875453533b
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 11:58:25 2023 +0100

        [ADD] Hint view in MyAppsView telling the user about where to find updates in the future if no updates are available

    commit 9a7a39a58e
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 11:54:44 2023 +0100

        [FIX] App permission icon color

    commit 65db392388
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Jan 13 11:51:06 2023 +0100

        [ADD] Show source name and external url domain in NewsItemView

    commit 6a6fc22995
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Dec 23 16:02:57 2022 +0100

        [ADD] Full-screen app screenshot preview

    commit 5697c4c063
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Dec 23 15:21:16 2022 +0100

        [CHANGE] Replace system image name strings with SFSymbols

    commit bcd54067d3
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Fri Dec 23 13:12:39 2022 +0100

        [ADD] Dependency: SFSafeSymbols

    commit c7ce32a562
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Wed Dec 21 17:49:49 2022 +0100

        [ADD] WIP: Promoted category cards and app list filter button in BrowseView

    commit 5a1496a3cd
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Wed Dec 21 17:48:45 2022 +0100

        [FIX] AccentColor in dark mode

    commit 497c048240
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Wed Dec 21 17:48:23 2022 +0100

        [ADD] Carousel for SideStore-specific announcements in NewsView

    commit 02e48a207f
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Wed Dec 21 17:45:44 2022 +0100

        [ADD] WIP: Add My Apps view with support for sideloading new apps, refreshing installed apps and much more

    commit a0eb30f98e
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Dec 12 19:20:54 2022 +0100

        [CHANGE] Fixed the AppRowView background blur effect

    commit 378631e976
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Dec 12 19:20:10 2022 +0100

        [ADD] Backported dismiss() environment variable to let views dismiss themselves

    commit 0e7083539d
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Dec 12 19:18:57 2022 +0100

        [ADD] Search bar for BrowseView on iOS 15

    commit 0c034b61d9
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Dec 12 19:16:36 2022 +0100

        [CHANGE] Fetch news when NewsView appears

    commit 89dea75b84
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Dec 12 19:15:16 2022 +0100

        Improved app detail view

    commit 81ea791b63
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Mon Dec 12 19:12:38 2022 +0100

        [ADD] Authentication view for connecting SideStore to an Apple ID

    commit c81f716427
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Nov 27 16:41:30 2022 +0100

        [WIP] Fixed the app permissions grid in AppDetailView

    commit eb151d74dd
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Nov 27 16:17:08 2022 +0100

        [ADD] Expandable app and version description texts

    commit 0dc7af5e51
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Sun Nov 27 00:26:15 2022 +0100

        [ADD] iOS 13 compatible AsyncImage implementation with cache

    commit d3e8473f45
    Author: Fabian Thies <git@fabian-thies.de>
    Date:   Wed Nov 23 22:34:02 2022 +0100

        [ADD] News, Browse and Settings views ported to SwiftUI

        This commit contains WIP SwiftUI versions of most of the views in SideStore.

commit 38a1c7eef6
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat May 20 20:05:36 2023 +0200

    Fix rebase issues

commit f6252c3a8b
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat May 20 19:10:51 2023 +0200

    Fix trusted sources being enabled in onboarding process regardless of user choice

commit 653d80b88e
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri May 19 13:14:15 2023 +0200

    Add onboarding screens for an easy setup of SideStore

commit 89609ad35c
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Feb 19 14:31:01 2023 +0100

    [ADD] UI for writing an app review and submit an app rating

commit 2211013e57
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Feb 19 14:30:21 2023 +0100

    [CHANGE] UI fixes and SwiftUI previews for easier development

commit f206ee1406
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Feb 19 14:25:13 2023 +0100

    [ADD] Refresh all apps functionality in MyAppsView

commit 00dc9b36af
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Feb 19 11:40:26 2023 +0100

    [FIX] STDOUT output not visible in Xcode console

commit 24146cef90
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Feb 13 18:56:34 2023 +0100

    [ADD] LocalConsole showing STDOUT and STDERR

commit c46a50ec58
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat Feb 4 14:35:58 2023 +0100

    [FIX] App compatibility info

commit de7e909c01
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat Feb 4 14:29:02 2023 +0100

    [ADD] Debug entries for refresh attempts, sending feedback, advanced settings, and resetting the pairing file

commit fbc754d8b7
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat Feb 4 13:07:04 2023 +0100

    [ADD] Error log view

commit 767d878051
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat Feb 4 12:55:25 2023 +0100

    [FIX] Various UI issues

commit 132b140af2
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sat Feb 4 12:46:43 2023 +0100

    [ADD] App report button and trusted source badge in app detail view

commit df7d8871ff
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Feb 3 18:19:07 2023 +0100

    [FIX] AppIDsView and authentication workflow

commit ca2398e4c7
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Feb 3 18:16:48 2023 +0100

    [FIX] Full screen app screenshot previews

commit b8f02d2152
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Feb 3 14:58:06 2023 +0100

    [FIX] Accent color

commit e85876cd24
Author: Fabian Thies <git@fabian-thies.de>
Date:   Tue Jan 31 22:38:42 2023 +0100

    [CHANGE] Overhaul of the AppDetailView with version history, reviews & ratings, and app information

commit 3f06a53058
Author: Fabian Thies <git@fabian-thies.de>
Date:   Tue Jan 31 22:37:37 2023 +0100

    [UPDATE] AppPillButton dimensions and expiration text

commit 4ee053a4f9
Author: Fabian Thies <git@fabian-thies.de>
Date:   Tue Jan 31 22:35:09 2023 +0100

    [FIX] Show App IDs button only if user is logged in with their Apple ID

commit e5369524ce
Author: Fabian Thies <git@fabian-thies.de>
Date:   Tue Jan 31 22:32:11 2023 +0100

    [ADD] Load and show trusted sources with option to add them to the app

commit 77465cebd0
Author: Fabian Thies <git@fabian-thies.de>
Date:   Tue Jan 31 22:30:21 2023 +0100

    [ADD] Credits section in SettingsView

commit f90bf3bfcf
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Jan 16 21:23:16 2023 +0100

    [CHANGE] Extracted all strings into the Localizable.strings

commit 0000610b9d
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Jan 16 19:03:33 2023 +0100

    [FIX] Text alignment in SettingsView

commit c7e095583d
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Jan 16 19:02:58 2023 +0100

    [ADD] Hint for new users who don't have any sources

commit a725f3e9cc
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Jan 16 18:59:39 2023 +0100

    [ADD] AppScreenshot view with ImageProcessor to automatically rotate landscape screenshots

commit b5dea18073
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 13:37:38 2023 +0100

    [FIX] Issues introduced by changes to the AltSource specification.

commit b9b309e603
Author: Fabian Thies <github@fabian-thies.de>
Date:   Fri Jan 13 12:48:27 2023 +0100

    [UPDATE] Translations (#7)

    This PR merges all the new translations made on the SideStore weblate instance (https://translate.sidestore.io/projects/sidestore/app).

    New translations:
    - French
    - Korean

    Updated translations:
    - Spanish

    Co-authored-by: bogotesr <bogotesr@gmail.com>
    Co-authored-by: GABO1423 <35014183+GABO1423@users.noreply.github.com>
    Co-authored-by: Joss Laymon <71040782+bogotesr@users.noreply.github.com>
    Co-authored-by: mindfreakdev <shost212@gmail.com>
    Co-authored-by: Python <rjp2030@proton.me>
    Co-authored-by: Testi Cules <ervd516@gmail.com>

commit 15f1be0aa8
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 12:25:50 2023 +0100

    [FIX] Changes made by Xcode 14 after building the app

commit ffd80ce0b4
Author: Upal <shost212@gmail.com>
Date:   Mon Dec 26 19:18:33 2022 +0530

    Added Hindi Language (#5)

    * Added Hindi Language

commit 350891ee2a
Author: mindfreakdev <shost212@gmail.com>
Date:   Sun Dec 25 16:52:01 2022 +0530

    Added Dutch Language

commit 5dec1cd561
Author: mindfreakdev <shost212@gmail.com>
Date:   Sun Dec 25 12:30:42 2022 +0530

    Added Ukrainian Language

commit c4d235d742
Author: mindfreakdev <shost212@gmail.com>
Date:   Sun Dec 25 12:28:00 2022 +0530

    Added Ukrainian Language

commit cdc6675dd5
Author: Gabriel Morazán <35014183+GABO1423@users.noreply.github.com>
Date:   Sun Dec 25 01:08:47 2022 -0400

    Screen Crunch sucks

    Signed-off-by: Gabriel Morazán <35014183+GABO1423@users.noreply.github.com>

commit 85635bb26e
Author: GABO1423 <35014183+GABO1423@users.noreply.github.com>
Date:   Sun Dec 25 00:58:22 2022 -0400

    Spanish Translation Tweaks

commit 3be0a4a89c
Author: bogotesr <bogotesr@gmail.com>
Date:   Sat Dec 24 21:06:28 2022 -0700

    Add es-419 and finish adding support for the translations

    Added Latin American Spanish (probably not the best translation)

    Made everything reference the swiftgen stuff rather than having strings

commit 47e47fb3cf
Author: Fabian Thies <git@fabian-thies.de>
Date:   Thu Dec 22 10:29:57 2022 +0100

    [CHANGE] Extracted some example strings and replaced them by generated localized strings

commit 48903034b6
Author: Fabian Thies <git@fabian-thies.de>
Date:   Thu Dec 22 10:21:57 2022 +0100

    [ADD] SwiftGen configuration and generated files

commit 6952218ee7
Author: Fabian Thies <git@fabian-thies.de>
Date:   Thu Dec 22 10:10:58 2022 +0100

    [ADD] Empty Localizable.strings

commit 80146c1e03
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 12:04:10 2023 +0100

    [WIP] AppScreenshot view with ImageProcessor to automatically rotate landscape images. Possible through my fork of the AsyncImage framework.

commit 642ae996c9
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 12:02:56 2023 +0100

    [WIP] Fetch trusted sources in SourcesView

commit 8040636aa5
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 12:02:06 2023 +0100

    [WIP] AppIDs view in My Apps section

commit 731fcfaca7
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 12:00:00 2023 +0100

    [ADD] Badge in AppDetailView for apps from the official source and (WIP) trusted sources

commit 708fb3fccd
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 11:58:25 2023 +0100

    [ADD] Hint view in MyAppsView telling the user about where to find updates in the future if no updates are available

commit 9f429fb068
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 11:54:44 2023 +0100

    [FIX] App permission icon color

commit 29fc693f4d
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Jan 13 11:51:06 2023 +0100

    [ADD] Show source name and external url domain in NewsItemView

commit 6f373ad305
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Dec 23 16:02:57 2022 +0100

    [ADD] Full-screen app screenshot preview

commit c069d779d9
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Dec 23 15:21:16 2022 +0100

    [CHANGE] Replace system image name strings with SFSymbols

commit cd88970a22
Author: Fabian Thies <git@fabian-thies.de>
Date:   Fri Dec 23 13:12:39 2022 +0100

    [ADD] Dependency: SFSafeSymbols

commit 6b6708e43c
Author: Fabian Thies <git@fabian-thies.de>
Date:   Wed Dec 21 17:49:49 2022 +0100

    [ADD] WIP: Promoted category cards and app list filter button in BrowseView

commit 9206eeb9e3
Author: Fabian Thies <git@fabian-thies.de>
Date:   Wed Dec 21 17:48:45 2022 +0100

    [FIX] AccentColor in dark mode

commit 080bbb3c51
Author: Fabian Thies <git@fabian-thies.de>
Date:   Wed Dec 21 17:48:23 2022 +0100

    [ADD] Carousel for SideStore-specific announcements in NewsView

commit ea2c862900
Author: Fabian Thies <git@fabian-thies.de>
Date:   Wed Dec 21 17:45:44 2022 +0100

    [ADD] WIP: Add My Apps view with support for sideloading new apps, refreshing installed apps and much more

commit 4fe72ea113
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Dec 12 19:20:54 2022 +0100

    [CHANGE] Fixed the AppRowView background blur effect

commit c486a62b50
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Dec 12 19:20:10 2022 +0100

    [ADD] Backported dismiss() environment variable to let views dismiss themselves

commit 3ce4451da4
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Dec 12 19:18:57 2022 +0100

    [ADD] Search bar for BrowseView on iOS 15

commit 294ba12391
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Dec 12 19:16:36 2022 +0100

    [CHANGE] Fetch news when NewsView appears

commit 4a3343fe61
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Dec 12 19:15:16 2022 +0100

    Improved app detail view

commit d1e6ddd435
Author: Fabian Thies <git@fabian-thies.de>
Date:   Mon Dec 12 19:12:38 2022 +0100

    [ADD] Authentication view for connecting SideStore to an Apple ID

commit 3e0379dc70
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Nov 27 16:41:30 2022 +0100

    [WIP] Fixed the app permissions grid in AppDetailView

commit d99674f8bd
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Nov 27 16:17:08 2022 +0100

    [ADD] Expandable app and version description texts

commit ca7acc17da
Author: Fabian Thies <git@fabian-thies.de>
Date:   Sun Nov 27 00:26:15 2022 +0100

    [ADD] iOS 13 compatible AsyncImage implementation with cache

commit 16a8bce102
Author: Fabian Thies <git@fabian-thies.de>
Date:   Wed Nov 23 22:34:02 2022 +0100

    [ADD] News, Browse and Settings views ported to SwiftUI

    This commit contains WIP SwiftUI versions of most of the views in SideStore.
2023-05-20 11:31:25 -07:00

712 lines
31 KiB
Swift

//
// AuthenticationOperation.swift
// AltStore
//
// Created by Riley Testut on 6/5/19.
// Copyright © 2019 Riley Testut. All rights reserved.
//
import Foundation
import SwiftUI
import Roxas
import Network
import AltStoreCore
import AltSign
enum AuthenticationError: LocalizedError
{
case noTeam
case noCertificate
case teamSelectorError
case missingPrivateKey
case missingCertificate
var errorDescription: String? {
switch self {
case .noTeam: return NSLocalizedString("Developer team could not be found.", comment: "")
case .teamSelectorError: return NSLocalizedString("Error presenting team selector view.", comment: "")
case .noCertificate: return NSLocalizedString("Developer certificate could not be found.", comment: "")
case .missingPrivateKey: return NSLocalizedString("The certificate's private key could not be found.", comment: "")
case .missingCertificate: return NSLocalizedString("The certificate could not be found.", comment: "")
}
}
}
@objc(AuthenticationOperation)
final class AuthenticationOperation: ResultOperation<(ALTTeam, ALTCertificate, ALTAppleAPISession)>
{
let context: AuthenticatedOperationContext
private weak var presentingViewController: UIViewController?
// private lazy var navigationController: UINavigationController = {
// let navigationController = self.storyboard.instantiateViewController(withIdentifier: "navigationController") as! UINavigationController
// if #available(iOS 13.0, *)
// {
// navigationController.isModalInPresentation = true
// }
// return navigationController
// }()
//
// private lazy var storyboard = UIStoryboard(name: "Authentication", bundle: nil)
private var appleIDEmailAddress: String?
private var appleIDPassword: String?
private var shouldShowInstructions = false
private let operationQueue = OperationQueue()
private var submitCodeAction: UIAlertAction?
init(context: AuthenticatedOperationContext, presentingViewController: UIViewController?)
{
self.context = context
self.presentingViewController = presentingViewController
super.init()
self.context.authenticationOperation = self
self.operationQueue.name = "com.altstore.AuthenticationOperation"
self.progress.totalUnitCount = 4
}
override func main()
{
super.main()
if let error = self.context.error
{
self.finish(.failure(error))
return
}
// Sign In
self.signIn() { (result) in
guard !self.isCancelled else { return self.finish(.failure(OperationError.cancelled)) }
switch result
{
case .failure(let error): self.finish(.failure(error))
case .success((let account, let session)):
self.context.session = session
self.progress.completedUnitCount += 1
// Fetch Team
self.fetchTeam(for: account, session: session) { (result) in
guard !self.isCancelled else { return self.finish(.failure(OperationError.cancelled)) }
switch result
{
case .failure(let error): self.finish(.failure(error))
case .success(let team):
self.context.team = team
self.progress.completedUnitCount += 1
// Fetch Certificate
self.fetchCertificate(for: team, session: session) { (result) in
guard !self.isCancelled else { return self.finish(.failure(OperationError.cancelled)) }
switch result
{
case .failure(let error): self.finish(.failure(error))
case .success(let certificate):
self.context.certificate = certificate
self.progress.completedUnitCount += 1
// Register Device
self.registerCurrentDevice(for: team, session: session) { (result) in
guard !self.isCancelled else { return self.finish(.failure(OperationError.cancelled)) }
switch result
{
case .failure(let error): self.finish(.failure(error))
case .success:
self.progress.completedUnitCount += 1
// Save account/team to disk.
self.save(team) { (result) in
guard !self.isCancelled else { return self.finish(.failure(OperationError.cancelled)) }
switch result
{
case .failure(let error): self.finish(.failure(error))
case .success:
// Must cache App IDs _after_ saving account/team to disk.
self.cacheAppIDs(team: team, session: session) { (result) in
let result = result.map { _ in (team, certificate, session) }
self.finish(result)
}
}
}
}
}
}
}
}
}
}
}
}
func save(_ altTeam: ALTTeam, completionHandler: @escaping (Result<Void, Error>) -> Void)
{
let context = DatabaseManager.shared.persistentContainer.newBackgroundContext()
context.performAndWait {
do
{
let account: Account
let team: Team
if let tempAccount = Account.first(satisfying: NSPredicate(format: "%K == %@", #keyPath(Account.identifier), altTeam.account.identifier), in: context)
{
account = tempAccount
}
else
{
account = Account(altTeam.account, context: context)
}
if let tempTeam = Team.first(satisfying: NSPredicate(format: "%K == %@", #keyPath(Team.identifier), altTeam.identifier), in: context)
{
team = tempTeam
}
else
{
team = Team(altTeam, account: account, context: context)
}
account.update(account: altTeam.account)
if let providedEmailAddress = self.appleIDEmailAddress
{
// Save the user's provided email address instead of the one associated with their account (which may be outdated).
account.appleID = providedEmailAddress
}
team.update(team: altTeam)
try context.save()
completionHandler(.success(()))
}
catch
{
completionHandler(.failure(error))
}
}
}
override func finish(_ result: Result<(ALTTeam, ALTCertificate, ALTAppleAPISession), Error>)
{
guard !self.isFinished else { return }
print("Finished authenticating with result:", result.error?.localizedDescription ?? "success")
let context = DatabaseManager.shared.persistentContainer.newBackgroundContext()
context.perform {
do
{
let (altTeam, altCertificate, session) = try result.get()
guard
let account = Account.first(satisfying: NSPredicate(format: "%K == %@", #keyPath(Account.identifier), altTeam.account.identifier), in: context),
let team = Team.first(satisfying: NSPredicate(format: "%K == %@", #keyPath(Team.identifier), altTeam.identifier), in: context)
else { throw AuthenticationError.noTeam }
// Account
account.isActiveAccount = true
let otherAccountsFetchRequest = Account.fetchRequest() as NSFetchRequest<Account>
otherAccountsFetchRequest.predicate = NSPredicate(format: "%K != %@", #keyPath(Account.identifier), account.identifier)
let otherAccounts = try context.fetch(otherAccountsFetchRequest)
for account in otherAccounts
{
account.isActiveAccount = false
}
// Team
team.isActiveTeam = true
let otherTeamsFetchRequest = Team.fetchRequest() as NSFetchRequest<Team>
otherTeamsFetchRequest.predicate = NSPredicate(format: "%K != %@", #keyPath(Team.identifier), team.identifier)
let otherTeams = try context.fetch(otherTeamsFetchRequest)
for team in otherTeams
{
team.isActiveTeam = false
}
let activeAppsMinimumVersion = OperatingSystemVersion(majorVersion: 13, minorVersion: 3, patchVersion: 1)
if team.type == .free, ProcessInfo.processInfo.isOperatingSystemAtLeast(activeAppsMinimumVersion)
{
UserDefaults.standard.activeAppsLimit = ALTActiveAppsLimit
}
else
{
UserDefaults.standard.activeAppsLimit = nil
}
// Save
try context.save()
// Update keychain
Keychain.shared.appleIDEmailAddress = self.appleIDEmailAddress ?? altTeam.account.appleID // Prefer the user's provided email address over the one associated with their account (which may be outdated).
Keychain.shared.appleIDPassword = self.appleIDPassword
Keychain.shared.signingCertificate = altCertificate.p12Data()
Keychain.shared.signingCertificatePassword = altCertificate.machineIdentifier
self.showInstructionsIfNecessary() { (didShowInstructions) in
let signer = ALTSigner(team: altTeam, certificate: altCertificate)
// Refresh screen must go last since a successful refresh will cause the app to quit.
self.showRefreshScreenIfNecessary(signer: signer, session: session) { (didShowRefreshAlert) in
super.finish(result)
DispatchQueue.main.async {
// self.navigationController.dismiss(animated: true, completion: nil)
self.dismiss()
}
}
}
}
catch
{
super.finish(result)
DispatchQueue.main.async {
// self.navigationController.dismiss(animated: true, completion: nil)
self.dismiss()
}
}
}
}
}
private extension AuthenticationOperation
{
func present(_ viewController: UIViewController) -> Bool
{
UIApplication.shared.keyWindow?.rootViewController?.present(viewController, animated: true)
// guard let presentingViewController = self.presentingViewController else { return false }
//
// self.navigationController.view.tintColor = .white
//
// if self.navigationController.viewControllers.isEmpty
// {
// guard presentingViewController.presentedViewController == nil else { return false }
//
// self.navigationController.setViewControllers([viewController], animated: false)
// presentingViewController.present(self.navigationController, animated: true, completion: nil)
// }
// else
// {
// viewController.navigationItem.leftBarButtonItem = nil
// self.navigationController.pushViewController(viewController, animated: true)
// }
return true
}
func dismiss() {
if let presentingViewController {
presentingViewController.dismiss(animated: true)
}
// UIApplication.shared.keyWindow?.rootViewController?.presentedViewController?.dismiss(animated: true)
}
}
private extension AuthenticationOperation
{
func signIn(completionHandler: @escaping (Result<(ALTAccount, ALTAppleAPISession), Swift.Error>) -> Void)
{
func authenticate()
{
DispatchQueue.main.async {
let viewController = UIHostingController(rootView: NavigationView {
ConnectAppleIDView { appleID, password, completionHandler in
self.authenticate(appleID: appleID, password: password) { (result) in
completionHandler(result)
}
} completionHandler: { result in
if let (account, session, password) = result
{
// We presented the Auth UI and the user signed in.
// In this case, we'll assume we should show the instructions again.
self.shouldShowInstructions = true
self.appleIDPassword = password
completionHandler(.success((account, session)))
}
else
{
completionHandler(.failure(OperationError.cancelled))
}
}
}.navigationViewStyle(StackNavigationViewStyle()))
if !self.present(viewController)
{
completionHandler(.failure(OperationError.notAuthenticated))
}
}
}
if let appleID = Keychain.shared.appleIDEmailAddress, let password = Keychain.shared.appleIDPassword
{
self.authenticate(appleID: appleID, password: password) { (result) in
switch result
{
case .success((let account, let session)):
self.appleIDPassword = password
completionHandler(.success((account, session)))
case .failure(ALTAppleAPIError.incorrectCredentials), .failure(ALTAppleAPIError.appSpecificPasswordRequired):
authenticate()
case .failure(let error):
completionHandler(.failure(error))
}
}
}
else
{
authenticate()
}
}
func authenticate(appleID: String, password: String, completionHandler: @escaping (Result<(ALTAccount, ALTAppleAPISession), Swift.Error>) -> Void)
{
self.appleIDEmailAddress = appleID
let fetchAnisetteDataOperation = FetchAnisetteDataOperation(context: self.context)
fetchAnisetteDataOperation.resultHandler = { (result) in
switch result
{
case .failure(let error): completionHandler(.failure(error))
case .success(let anisetteData):
let verificationHandler: ((@escaping (String?) -> Void) -> Void)?
// if let presentingViewController = self.presentingViewController
// {
verificationHandler = { (completionHandler) in
DispatchQueue.main.async {
let alertController = UIAlertController(title: NSLocalizedString("Please enter the 6-digit verification code that was sent to your Apple devices.", comment: ""), message: nil, preferredStyle: .alert)
alertController.addTextField { (textField) in
textField.autocorrectionType = .no
textField.autocapitalizationType = .none
textField.keyboardType = .numberPad
NotificationCenter.default.addObserver(self, selector: #selector(AuthenticationOperation.textFieldTextDidChange(_:)), name: UITextField.textDidChangeNotification, object: textField)
}
let submitAction = UIAlertAction(title: NSLocalizedString("Continue", comment: ""), style: .default) { (action) in
let textField = alertController.textFields?.first
let code = textField?.text ?? ""
completionHandler(code)
}
submitAction.isEnabled = false
alertController.addAction(submitAction)
self.submitCodeAction = submitAction
alertController.addAction(UIAlertAction(title: RSTSystemLocalizedString("Cancel"), style: .cancel) { (action) in
completionHandler(nil)
})
let keyWindow = UIApplication.shared.windows.filter { $0.isKeyWindow }.first
if var topController = keyWindow?.rootViewController {
while let presentedViewController = topController.presentedViewController {
topController = presentedViewController
}
topController.present(alertController, animated: true, completion: nil)
}
}
}
// }
// else
// {
// // No view controller to present security code alert, so don't provide verificationHandler.
// verificationHandler = nil
// }
ALTAppleAPI.shared.authenticate(appleID: appleID, password: password, anisetteData: anisetteData,
verificationHandler: verificationHandler) { (account, session, error) in
if let account = account, let session = session
{
completionHandler(.success((account, session)))
}
else
{
completionHandler(.failure(error ?? OperationError.unknown))
}
}
}
}
self.operationQueue.addOperation(fetchAnisetteDataOperation)
}
func fetchTeam(for account: ALTAccount, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTTeam, Swift.Error>) -> Void)
{
func selectTeam(from teams: [ALTTeam])
{
if teams.count <= 1 {
if let team = teams.first {
return completionHandler(.success(team))
} else {
return completionHandler(.failure(AuthenticationError.noTeam))
}
} else {
DispatchQueue.main.async {
// let selectTeamViewController = self.storyboard.instantiateViewController(withIdentifier: "selectTeamViewController") as! SelectTeamViewController
//
// selectTeamViewController.teams = teams
// selectTeamViewController.completionHandler = completionHandler
//
// if !self.present(selectTeamViewController)
// {
// return completionHandler(.failure(AuthenticationError.noTeam))
// }
}
}
}
ALTAppleAPI.shared.fetchTeams(for: account, session: session) { (teams, error) in
switch Result(teams, error)
{
case .failure(let error): completionHandler(.failure(error))
case .success(let teams):
DatabaseManager.shared.persistentContainer.performBackgroundTask { (context) in
if let activeTeam = DatabaseManager.shared.activeTeam(in: context), let altTeam = teams.first(where: { $0.identifier == activeTeam.identifier })
{
completionHandler(.success(altTeam))
}
else
{
selectTeam(from: teams)
}
}
}
}
}
func fetchCertificate(for team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTCertificate, Swift.Error>) -> Void)
{
func requestCertificate()
{
let machineName = "AltStore - " + UIDevice.current.name
ALTAppleAPI.shared.addCertificate(machineName: machineName, to: team, session: session) { (certificate, error) in
do
{
let certificate = try Result(certificate, error).get()
guard let privateKey = certificate.privateKey else { throw AuthenticationError.missingPrivateKey }
ALTAppleAPI.shared.fetchCertificates(for: team, session: session) { (certificates, error) in
do
{
let certificates = try Result(certificates, error).get()
guard let certificate = certificates.first(where: { $0.serialNumber == certificate.serialNumber }) else {
throw AuthenticationError.missingCertificate
}
certificate.privateKey = privateKey
completionHandler(.success(certificate))
}
catch
{
completionHandler(.failure(error))
}
}
}
catch
{
completionHandler(.failure(error))
}
}
}
func replaceCertificate(from certificates: [ALTCertificate])
{
guard let certificate = certificates.first(where: { $0.machineName?.starts(with: "AltStore") == true }) ?? certificates.first else { return completionHandler(.failure(AuthenticationError.noCertificate)) }
ALTAppleAPI.shared.revoke(certificate, for: team, session: session) { (success, error) in
if let error = error, !success
{
completionHandler(.failure(error))
}
else
{
requestCertificate()
}
}
}
ALTAppleAPI.shared.fetchCertificates(for: team, session: session) { (certificates, error) in
do
{
let certificates = try Result(certificates, error).get()
if
let data = Keychain.shared.signingCertificate,
let localCertificate = ALTCertificate(p12Data: data, password: nil),
let certificate = certificates.first(where: { $0.serialNumber == localCertificate.serialNumber })
{
// We have a certificate stored in the keychain and it hasn't been revoked.
localCertificate.machineIdentifier = certificate.machineIdentifier
completionHandler(.success(localCertificate))
}
else if
let serialNumber = Keychain.shared.signingCertificateSerialNumber,
let privateKey = Keychain.shared.signingCertificatePrivateKey,
let certificate = certificates.first(where: { $0.serialNumber == serialNumber })
{
// LEGACY
// We have the private key for one of the certificates, so add it to certificate and use it.
certificate.privateKey = privateKey
completionHandler(.success(certificate))
}
else if
let serialNumber = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.certificateID) as? String,
let certificate = certificates.first(where: { $0.serialNumber == serialNumber }),
let machineIdentifier = certificate.machineIdentifier,
FileManager.default.fileExists(atPath: Bundle.main.certificateURL.path),
let data = try? Data(contentsOf: Bundle.main.certificateURL),
let localCertificate = ALTCertificate(p12Data: data, password: machineIdentifier)
{
// We have an embedded certificate that hasn't been revoked.
localCertificate.machineIdentifier = machineIdentifier
completionHandler(.success(localCertificate))
}
else if certificates.isEmpty
{
// No certificates, so request a new one.
requestCertificate()
}
else
{
// We don't have private keys for any of the certificates,
// so we need to revoke one and create a new one.
replaceCertificate(from: certificates)
}
}
catch
{
completionHandler(.failure(error))
}
}
}
func registerCurrentDevice(for team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTDevice, Error>) -> Void)
{
guard let udid = Bundle.main.object(forInfoDictionaryKey: Bundle.Info.deviceID) as? String else {
return completionHandler(.failure(OperationError.unknownUDID))
}
ALTAppleAPI.shared.fetchDevices(for: team, types: [.iphone, .ipad], session: session) { (devices, error) in
do
{
let devices = try Result(devices, error).get()
if let device = devices.first(where: { $0.identifier == udid })
{
completionHandler(.success(device))
}
else
{
ALTAppleAPI.shared.registerDevice(name: UIDevice.current.name, identifier: udid, type: .iphone, team: team, session: session) { (device, error) in
completionHandler(Result(device, error))
}
}
}
catch
{
completionHandler(.failure(error))
}
}
}
func cacheAppIDs(team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<Void, Error>) -> Void)
{
let fetchAppIDsOperation = FetchAppIDsOperation(context: self.context)
fetchAppIDsOperation.resultHandler = { (result) in
do
{
let (_, context) = try result.get()
try context.save()
completionHandler(.success(()))
}
catch
{
completionHandler(.failure(error))
}
}
self.operationQueue.addOperation(fetchAppIDsOperation)
}
func showInstructionsIfNecessary(completionHandler: @escaping (Bool) -> Void)
{
return completionHandler(false)
// guard self.shouldShowInstructions else { return completionHandler(false) }
//
// DispatchQueue.main.async {
// let instructionsViewController = self.storyboard.instantiateViewController(withIdentifier: "instructionsViewController") as! InstructionsViewController
// instructionsViewController.showsBottomButton = true
// instructionsViewController.completionHandler = {
// completionHandler(true)
// }
//
// if !self.present(instructionsViewController)
// {
// completionHandler(false)
// }
// }
}
func showRefreshScreenIfNecessary(signer: ALTSigner, session: ALTAppleAPISession, completionHandler: @escaping (Bool) -> Void)
{
guard let application = ALTApplication(fileURL: Bundle.main.bundleURL), let provisioningProfile = application.provisioningProfile else { return completionHandler(false) }
// If we're not using the same certificate used to install AltStore, warn user that they need to refresh.
guard !provisioningProfile.certificates.contains(signer.certificate) else { return completionHandler(false) }
#if DEBUG
completionHandler(false)
#else
DispatchQueue.main.async {
let context = AuthenticatedOperationContext(context: self.context)
context.operations.removeAllObjects() // Prevent deadlock due to endless waiting on previous operations to finish.
let refreshViewController = self.storyboard.instantiateViewController(withIdentifier: "refreshAltStoreViewController") as! RefreshAltStoreViewController
refreshViewController.context = context
refreshViewController.completionHandler = { _ in
completionHandler(true)
}
if !self.present(refreshViewController)
{
completionHandler(false)
}
}
#endif
}
}
extension AuthenticationOperation
{
@objc func textFieldTextDidChange(_ notification: Notification)
{
guard let textField = notification.object as? UITextField else { return }
self.submitCodeAction?.isEnabled = (textField.text ?? "").count == 6
}
}