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

feat: App navigational flow for deep links/push notifications #329

Merged
merged 26 commits into from
Mar 15, 2024

Conversation

eyatsenkoperpetio
Copy link
Contributor

[iOS] App navigational flow for deep links/push notifications #248

We need to implement the internal paths in the app for implementing deep links and push notifications. The Following wiki explains the implementation required.

Push Notifications And Deep Linking On Mobile

APNS Files:
edx apns.zip

How to use?
https://github.com/openedx/openedx-app-ios/assets/76485998/3e91c934-26ab-4a5f-b513-d4b8cfc38968

rnr
rnr previously approved these changes Mar 7, 2024
Copy link
Contributor

@rnr rnr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
just minor code-style fixes requested

)
case .viewDeepLink:
configure(
primaryButtonTitle: "View",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String should be localised

@@ -213,6 +218,8 @@ public struct AlertView: View {
}
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove extra vertical spaces


public func showThread(thread: UserThread, postStateSubject: CurrentValueSubject<PostState?, Never>, animated: Bool) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix line length warning

DiscussionRouter {

DiscussionRouter
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix opening brace spacing violation

Podfile.lock Outdated
@@ -56,4 +56,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 881176d00eabfe8f78d6022c56c277cf61aad22b

COCOAPODS: 1.15.2
COCOAPODS: 1.15.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to downgrade cocoapod version

@@ -1,4 +1,4 @@
config_directory: './default_config'
config_directory: '../edx-mobile-config'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't push changes in default config values

}
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove extra vertical space

rnr
rnr previously approved these changes Mar 11, 2024
@rnr
Copy link
Contributor

rnr commented Mar 11, 2024

@eyatsenkoperpetio please fix merge conflicts

# Conflicts:
#	Core/Core/View/Base/AlertView.swift
#	OpenEdX/View/MainScreenView.swift
Copy link
Contributor

@saeedbashir saeedbashir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about going to user edit profile for user profile instead of opening read only user info? Thoughts?

CoreAssets.warning.swiftUIImage.renderingMode(.template)
.foregroundColor(Theme.Colors.textPrimary)
switch type {
case .deleteVideo:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about merging this case with deleteVideo because both are using the same icon?

@@ -26,9 +31,31 @@ public protocol DeepLinkService {
public class DeepLinkManager {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to disabled warning, Type Body Length Violation: Type body should span 300 lines or less excluding comments and whitespace: currently spans 308 lines (type_body_length)

Comment on lines 109 to 111
Task {
await navigateToScreen(with: link.type, link: link)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about moving this into else of if UIApplication.shared.applicationState == .active {

@@ -14,12 +14,13 @@ public enum AlertViewType: Equatable {
case logOut
case leaveProfile
case deleteVideo
case viewDeepLink
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be simply deepLink.

@@ -52,6 +52,7 @@
"ALERT.LEAVE" = "Leave";
"ALERT.KEEP_EDITING" = "Keep editing";
"ALERT.DELETE" = "DELETE";
"ALERT.WAITING" = "Waiting...";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've discussed this with @moiz994 and he's saying lets only show full screen loader without text waiting...

DispatchQueue.main.asyncAfter(deadline: .now() + (isCourseOpened ? 0 : 1)) {
switch link.type {
case .courseDashboard:
self.hostCourseContainerView?.rootView.viewModel.selection = CourseTab.course.rawValue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if you can use weak reference of self in block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need use weak self in this case, we don't have retain cycle

Comment on lines +35 to +37
func getNavigationController() -> UINavigationController {
navigationController
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing the access modifier of navigationController to public instead of defining a method. It's a read-only property so its not possible to change it from outside. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need have public navigationController, I use only for deep link

let alert = aps?[DataKeys.alert] as? [String: Any]
title = alert?[DataKeys.title] as? String
body = alert?[DataKeys.body] as? String
let aps = dictionary[DataKeys.aps.rawValue] as? [String: Any]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of Anyhashable RawStringExtractable is not useable so please remove it from DataKeys.

@eyatsenkoperpetio eyatsenkoperpetio linked an issue Mar 14, 2024 that may be closed by this pull request
Copy link
Contributor

@volodymyr-chekyrta volodymyr-chekyrta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍
Please address @saeedbashir's feedback

@volodymyr-chekyrta volodymyr-chekyrta merged commit 016cf09 into openedx:develop Mar 15, 2024
3 checks passed
@rnr rnr deleted the feat/deep-link-routing branch March 19, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants