-
Notifications
You must be signed in to change notification settings - Fork 6
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
Stories library part 9.1 - added errorNotification Delete pendingIntent loader and base error notification ID setter #361
Merged
jd-alexander
merged 5 commits into
feature/wp-stories-part9-clean-todo-toast
from
feature/wp-stories-part92-notif-delete-intent
Jun 21, 2020
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6d98963
added interface to let the host app set the notification_error_base_i…
mzorz 75a177a
removed unused import
mzorz b24e66e
added errorNotfication pendingIntent loader to IntentLoaderr interface
mzorz a9c45e9
moved method to correct interface
mzorz 982f524
changed sequence of method call in NotificatinoINtenttLoader interfac…
mzorz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,7 @@ import android.Manifest | |||||
import android.animation.LayoutTransition | ||||||
import android.annotation.SuppressLint | ||||||
import android.app.Activity | ||||||
import android.app.PendingIntent | ||||||
import android.content.ComponentName | ||||||
import android.content.Context | ||||||
import android.content.Intent | ||||||
|
@@ -69,6 +70,7 @@ import com.wordpress.stories.compose.emoji.EmojiPickerFragment | |||||
import com.wordpress.stories.compose.emoji.EmojiPickerFragment.EmojiListener | ||||||
import com.wordpress.stories.compose.frame.FrameIndex | ||||||
import com.wordpress.stories.compose.frame.FrameSaveManager | ||||||
import com.wordpress.stories.compose.frame.FrameSaveNotifier | ||||||
import com.wordpress.stories.compose.frame.FrameSaveService | ||||||
import com.wordpress.stories.compose.frame.StorySaveEvents | ||||||
import com.wordpress.stories.compose.frame.StorySaveEvents.SaveResultReason.SaveError | ||||||
|
@@ -133,6 +135,8 @@ interface MediaPickerProvider { | |||||
|
||||||
interface NotificationIntentLoader { | ||||||
fun loadIntentForErrorNotification(): Intent | ||||||
fun loadPendingIntentForErrorNotificationDeletion(notificationId: Int): PendingIntent? | ||||||
fun setupErrorNotificationBaseId(): Int | ||||||
} | ||||||
|
||||||
interface AuthenticationHeadersProvider { | ||||||
|
@@ -199,7 +203,23 @@ abstract class ComposeLoopFrameActivity : AppCompatActivity(), OnStoryFrameSelec | |||||
} | ||||||
// Setup notification intent for notifications triggered from the FrameSaveService.FrameSaveNotifier class | ||||||
notificationIntentLoader?.let { | ||||||
// set the base notification Error Id. This is given on purpose so the host app can give a unique | ||||||
// set of notific ations ID to base our error notifications from, and avoid collision with other | ||||||
// notifications the host app may have | ||||||
// IMPORTANT: this needs to be the first call in the methods linedup for NotificationIntentLoader | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
frameSaveService.setNotificationErrorBaseId( | ||||||
it.setupErrorNotificationBaseId() | ||||||
) | ||||||
|
||||||
frameSaveService.setNotificationIntent(it.loadIntentForErrorNotification()) | ||||||
val notificationId = FrameSaveNotifier.getNotificationIdForError( | ||||||
frameSaveService.getNotificationErrorBaseId(), | ||||||
storyIndex | ||||||
) | ||||||
|
||||||
frameSaveService.setDeleteNotificationPendingIntent( | ||||||
it.loadPendingIntentForErrorNotificationDeletion(notificationId) | ||||||
) | ||||||
} | ||||||
|
||||||
metadataProvider?.let { | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅