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

fixed oauth flow on iOS #17

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fixed oauth flow on iOS
  • Loading branch information
thbonk committed Nov 12, 2022
commit 3cff94e5b3090bd33574e94f183bb8c6f74b2f7e
32 changes: 0 additions & 32 deletions Leviathan.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
E91CC3C22915D82E00FC0BA0 /* Status+createdAt.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91CC3C12915D82E00FC0BA0 /* Status+createdAt.swift */; };
E91CC3CC29166D0B00FC0BA0 /* AsynchronousUpdate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91CC3CB29166D0B00FC0BA0 /* AsynchronousUpdate.swift */; };
E91CC3D0291681F600FC0BA0 /* Status+actions.swift in Sources */ = {isa = PBXBuildFile; fileRef = E91CC3CF291681F600FC0BA0 /* Status+actions.swift */; };
E94A9019291EA783008F2B71 /* AppDelegate+iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A9018291EA783008F2B71 /* AppDelegate+iOS.swift */; };
E94A901B291EA89C008F2B71 /* AppDelegate+macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A901A291EA7CA008F2B71 /* AppDelegate+macOS.swift */; };
E94A901D291EAB08008F2B71 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A901C291EAB08008F2B71 /* ContentView.swift */; };
E94A901F291EAC2C008F2B71 /* LogonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A901E291EAC2C008F2B71 /* LogonView.swift */; };
E94A9021291F0C24008F2B71 /* SessionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94A9020291F0C24008F2B71 /* SessionModel.swift */; };
Expand Down Expand Up @@ -68,8 +66,6 @@
E91CC3C12915D82E00FC0BA0 /* Status+createdAt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Status+createdAt.swift"; sourceTree = "<group>"; };
E91CC3CB29166D0B00FC0BA0 /* AsynchronousUpdate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AsynchronousUpdate.swift; sourceTree = "<group>"; };
E91CC3CF291681F600FC0BA0 /* Status+actions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Status+actions.swift"; sourceTree = "<group>"; };
E94A9018291EA783008F2B71 /* AppDelegate+iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+iOS.swift"; sourceTree = "<group>"; };
E94A901A291EA7CA008F2B71 /* AppDelegate+macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AppDelegate+macOS.swift"; sourceTree = "<group>"; };
E94A901C291EAB08008F2B71 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
E94A901E291EAC2C008F2B71 /* LogonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogonView.swift; sourceTree = "<group>"; };
E94A9020291F0C24008F2B71 /* SessionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -164,7 +160,6 @@
E981008629117DAA001F4133 /* Extensions */,
E981006C29105332001F4133 /* Model */,
E98598252917BED0003C5187 /* Persistence */,
E94A9015291EA739008F2B71 /* Platform */,
E9EA0592291C022B008F55AF /* Utils */,
E90B5944290FCBC400324E6B /* Views */,
E985981F2917BDCE003C5187 /* Generated */,
Expand Down Expand Up @@ -222,31 +217,6 @@
path = Entities;
sourceTree = "<group>";
};
E94A9015291EA739008F2B71 /* Platform */ = {
isa = PBXGroup;
children = (
E94A9016291EA74E008F2B71 /* iOS */,
E94A9017291EA756008F2B71 /* macOS */,
);
path = Platform;
sourceTree = "<group>";
};
E94A9016291EA74E008F2B71 /* iOS */ = {
isa = PBXGroup;
children = (
E94A9018291EA783008F2B71 /* AppDelegate+iOS.swift */,
);
path = iOS;
sourceTree = "<group>";
};
E94A9017291EA756008F2B71 /* macOS */ = {
isa = PBXGroup;
children = (
E94A901A291EA7CA008F2B71 /* AppDelegate+macOS.swift */,
);
path = macOS;
sourceTree = "<group>";
};
E94A9022291F0EAC008F2B71 /* Session */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -484,7 +454,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E94A901B291EA89C008F2B71 /* AppDelegate+macOS.swift in Sources */,
E9810074291053D4001F4133 /* NotificationsModel.swift in Sources */,
E98597F0291688DF003C5187 /* StatusOperationProvider.swift in Sources */,
E98598162917B1E8003C5187 /* Leviathan.xcdatamodeld in Sources */,
Expand Down Expand Up @@ -519,7 +488,6 @@
E981006E29105347001F4133 /* TimelineModel.swift in Sources */,
E9699A43291C261F004781F9 /* View+onRendered.swift in Sources */,
E9810078291055C1001F4133 /* NotificationsView.swift in Sources */,
E94A9019291EA783008F2B71 /* AppDelegate+iOS.swift in Sources */,
E91CC3BC29156A8D00FC0BA0 /* String+HTML.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
19 changes: 16 additions & 3 deletions Leviathan/Sources/Application/LeviathanApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
// limitations under the License.
//

import MastodonSwift
import SwiftUI

@main
struct LeviathanApp: SwiftUI.App {

Expand All @@ -33,13 +35,24 @@ struct LeviathanApp: SwiftUI.App {
.environmentObject(FederatedTimelineModel())
.environmentObject(NotificationsModel())
.environmentObject(SessionModel.shared)
.onOpenURL(perform: handleUrl)
}
}

// MARK: - Private Properties

@ApplicationDelegateAdaptor(AppDelegate.self)
private var appDelegate

private let persistenceController = PersistenceController.shared


// MARK: - Private Methods

private func handleUrl(_ url: URL) {
if url.scheme == "leviathan" {
handleOauthCallback(url)
}
}

private func handleOauthCallback(_ url: URL) {
MastodonClient.handleOAuthResponse(url: url)
}
}
40 changes: 0 additions & 40 deletions Leviathan/Sources/Platform/iOS/AppDelegate+iOS.swift

This file was deleted.

45 changes: 0 additions & 45 deletions Leviathan/Sources/Platform/macOS/AppDelegate+macOS.swift

This file was deleted.

8 changes: 4 additions & 4 deletions Leviathan/Sources/Views/AccountManagement/LogonView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ struct LogonView: View {
.multilineTextAlignment(.center)
.padding(.bottom, 10)

Form {
//Form {
TextField("Server Name:", text: $serverName, prompt: Text("Server Name"))
.fixedSize()
//.fixedSize()
.onChange(of: serverName, perform: loadInstanceInformation(server:))
}
.padding(.bottom, 10)
//}
//.padding(.bottom, 10)

instanceInformation()

Expand Down