mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-01 04:17:21 +01:00
bug fix
Signed-off-by: nuclearfog <hatespirit666@gmail.com>
This commit is contained in:
parent
e8618cfdf8
commit
2dbdd8844f
@ -8,7 +8,6 @@ import org.nuclearfog.twidda.backend.engine.TwitterEngine;
|
||||
import org.nuclearfog.twidda.backend.model.Relation;
|
||||
import org.nuclearfog.twidda.backend.model.User;
|
||||
import org.nuclearfog.twidda.database.AppDatabase;
|
||||
import org.nuclearfog.twidda.database.ExcludeDatabase;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@ -61,7 +60,6 @@ public class UserAction extends AsyncTask<UserAction.Action, User, Relation> {
|
||||
private EngineException twException;
|
||||
private WeakReference<UserProfile> callback;
|
||||
private TwitterEngine mTwitter;
|
||||
private ExcludeDatabase excludeDb;
|
||||
private AppDatabase db;
|
||||
private long userId;
|
||||
|
||||
@ -73,7 +71,6 @@ public class UserAction extends AsyncTask<UserAction.Action, User, Relation> {
|
||||
super();
|
||||
this.callback = new WeakReference<>(callback);
|
||||
mTwitter = TwitterEngine.getInstance(callback);
|
||||
excludeDb = ExcludeDatabase.getInstance(callback);
|
||||
db = new AppDatabase(callback);
|
||||
this.userId = userId;
|
||||
}
|
||||
@ -120,28 +117,24 @@ public class UserAction extends AsyncTask<UserAction.Action, User, Relation> {
|
||||
user = mTwitter.blockUser(userId);
|
||||
publishProgress(user);
|
||||
db.muteUser(userId, true);
|
||||
excludeDb.addUser(userId);
|
||||
break;
|
||||
|
||||
case ACTION_UNBLOCK:
|
||||
user = mTwitter.unblockUser(userId);
|
||||
publishProgress(user);
|
||||
db.muteUser(userId, false);
|
||||
excludeDb.removeUser(userId);
|
||||
break;
|
||||
|
||||
case ACTION_MUTE:
|
||||
user = mTwitter.muteUser(userId);
|
||||
publishProgress(user);
|
||||
db.muteUser(userId, true);
|
||||
excludeDb.addUser(userId);
|
||||
break;
|
||||
|
||||
case ACTION_UNMUTE:
|
||||
user = mTwitter.unmuteUser(userId);
|
||||
publishProgress(user);
|
||||
db.muteUser(userId, false);
|
||||
excludeDb.removeUser(userId);
|
||||
break;
|
||||
}
|
||||
return mTwitter.getConnection(userId);
|
||||
|
@ -498,7 +498,8 @@ public class TwitterEngine {
|
||||
try {
|
||||
if (!name.startsWith("@"))
|
||||
name = '@' + name;
|
||||
twitter.createBlock(name);
|
||||
twitter4j.User user = twitter.createBlock(name);
|
||||
excludeDB.addUser(user.getId());
|
||||
} catch (Exception err) {
|
||||
throw new EngineException(err);
|
||||
}
|
||||
@ -513,7 +514,9 @@ public class TwitterEngine {
|
||||
*/
|
||||
public User blockUser(long UserID) throws EngineException {
|
||||
try {
|
||||
return new User(twitter.createBlock(UserID), twitter.getId());
|
||||
twitter4j.User user = twitter.createBlock(UserID);
|
||||
excludeDB.addUser(UserID);
|
||||
return new User(user, twitter.getId());
|
||||
} catch (Exception err) {
|
||||
throw new EngineException(err);
|
||||
}
|
||||
@ -528,7 +531,9 @@ public class TwitterEngine {
|
||||
*/
|
||||
public User unblockUser(long UserID) throws EngineException {
|
||||
try {
|
||||
return new User(twitter.destroyBlock(UserID), twitter.getId());
|
||||
twitter4j.User user = twitter.destroyBlock(UserID);
|
||||
excludeDB.removeUser(UserID);
|
||||
return new User(user, twitter.getId());
|
||||
} catch (Exception err) {
|
||||
throw new EngineException(err);
|
||||
}
|
||||
@ -544,7 +549,8 @@ public class TwitterEngine {
|
||||
try {
|
||||
if (!name.startsWith("@"))
|
||||
name = '@' + name;
|
||||
twitter.createMute(name);
|
||||
twitter4j.User user = twitter.createMute(name);
|
||||
excludeDB.addUser(user.getId());
|
||||
} catch (Exception err) {
|
||||
throw new EngineException(err);
|
||||
}
|
||||
@ -559,7 +565,9 @@ public class TwitterEngine {
|
||||
*/
|
||||
public User muteUser(long UserID) throws EngineException {
|
||||
try {
|
||||
return new User(twitter.createMute(UserID), twitter.getId());
|
||||
twitter4j.User user = twitter.createMute(UserID);
|
||||
excludeDB.addUser(user.getId());
|
||||
return new User(user, twitter.getId());
|
||||
} catch (Exception err) {
|
||||
throw new EngineException(err);
|
||||
}
|
||||
@ -574,7 +582,9 @@ public class TwitterEngine {
|
||||
*/
|
||||
public User unmuteUser(long UserID) throws EngineException {
|
||||
try {
|
||||
return new User(twitter.destroyMute(UserID), twitter.getId());
|
||||
twitter4j.User user = twitter.destroyMute(UserID);
|
||||
excludeDB.removeUser(user.getId());
|
||||
return new User(user, twitter.getId());
|
||||
} catch (Exception err) {
|
||||
throw new EngineException(err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user