force reauthentication to be able to send global cursor data
This commit is contained in:
parent
084cc90321
commit
2d1293389f
3 changed files with 41 additions and 6 deletions
|
@ -60,11 +60,11 @@
|
||||||
accessToken = [[AccessToken alloc] init];
|
accessToken = [[AccessToken alloc] init];
|
||||||
|
|
||||||
BOOL forceLogin = NO;
|
BOOL forceLogin = NO;
|
||||||
if (![accessToken stringForKey:@"version-0.5.2-new-login"]) {
|
if (![accessToken stringForKey:@"version-0.6.0-new-login"]) {
|
||||||
[self logout:self];
|
[self logout:self];
|
||||||
forceLogin = YES;
|
forceLogin = YES;
|
||||||
[accessToken setString:nil forKey:@"entity"];
|
[accessToken setString:nil forKey:@"entity"];
|
||||||
[accessToken setString:@"yes" forKey:@"version-0.5.2-new-login"];
|
[accessToken setString:@"yes" forKey:@"version-0.6.0-new-login"];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) {
|
if (forceLogin || ![accessToken stringForKey:@"user_access_token"] || ![accessToken secret]) {
|
||||||
|
@ -479,7 +479,8 @@
|
||||||
{
|
{
|
||||||
if ([notification object] == mentionsViewWindow)
|
if ([notification object] == mentionsViewWindow)
|
||||||
{
|
{
|
||||||
[self unreadMentions:0];
|
//[self unreadMentions:0];
|
||||||
|
[mentionsView stringByEvaluatingJavaScriptFromString:@"tentia_instance.setAllMentionsRead();"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
define([
|
define([
|
||||||
"helper/HostApp",
|
"helper/HostApp",
|
||||||
"controller/Timeline"
|
"controller/Timeline",
|
||||||
|
"lib/URI",
|
||||||
|
"helper/Paths"
|
||||||
],
|
],
|
||||||
|
|
||||||
function(HostApp, Timeline) {
|
function(HostApp, Timeline, URI, Paths) {
|
||||||
|
|
||||||
|
|
||||||
function Mentions() {
|
function Mentions() {
|
||||||
|
@ -63,6 +65,37 @@ function(HostApp, Timeline) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mentions.prototype.setAllMentionsRead = function() {
|
||||||
|
this.unread_mentions = 0;
|
||||||
|
HostApp.unreadMentions(this.unread_mentions);
|
||||||
|
this.updateLatestMentionRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
Mentions.prototype.updateLatestMentionRead = function() {
|
||||||
|
var status = this.body.firstChild.status;
|
||||||
|
|
||||||
|
if (status && status.type == "https://tent.io/types/post/status/v0.1.0") {
|
||||||
|
|
||||||
|
var url = URI(Paths.mkApiRootPath("/profile/" + encodeURIComponent("https://tent.io/types/info/cursor/v0.1.0")));
|
||||||
|
var body = {
|
||||||
|
"https://tent.io/types/info/cursor/v0.1.0": {
|
||||||
|
"mentions": {
|
||||||
|
"https://tent.io/types/post/status/v0.1.0": {
|
||||||
|
"post_id": status.id,
|
||||||
|
"post_entity": status.entity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var callback = function(resp) {
|
||||||
|
//debug(resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
Paths.getURL(url.toString(), "PUT", callback, JSON.stringify(body));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return Mentions;
|
return Mentions;
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,8 @@ function(HostApp, Paths, Hmac) {
|
||||||
+ "&redirect_uri=" + this.app_info["redirect_uris"][0]
|
+ "&redirect_uri=" + this.app_info["redirect_uris"][0]
|
||||||
+ "&scope=" + Object.keys(this.app_info["scopes"]).join(",")
|
+ "&scope=" + Object.keys(this.app_info["scopes"]).join(",")
|
||||||
+ "&state=" + this.state
|
+ "&state=" + this.state
|
||||||
+ "&tent_post_types=all";
|
+ "&tent_post_types=all"
|
||||||
|
+ "&tent_profile_info_types=all";
|
||||||
|
|
||||||
HostApp.openAuthorizationURL(this.apiRoot() + auth);
|
HostApp.openAuthorizationURL(this.apiRoot() + auth);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue