[ADD] Bookmarks per user account (#738)

This commit is contained in:
Rizwan Mohamed Ibrahim
2017-10-27 20:25:22 +05:30
committed by Ryan Nystrom
parent 908463a31a
commit 199ce48047
6 changed files with 98 additions and 54 deletions

View File

@@ -112,7 +112,17 @@ NewIssueTableViewControllerDelegate {
owner: repo.owner,
hasIssueEnabled: repo.hasIssuesEnabled
)
return AlertAction.bookmark(bookmarkModel)
let store = BookmarksStore(client.userSession?.token)
let isNewBookmark = !store.contains(bookmark: bookmarkModel)
return AlertAction.toggleBookmark(isNewBookmark) { _ in
if isNewBookmark {
store.add(bookmark: bookmarkModel)
}
else {
store.remove(bookmark: bookmarkModel)
}
Haptic.triggerNotification(.success)
}
}
@objc