use of com.google.j2objc.annotations.ObjectiveCName in project actor-platform by actorapp.
the class GroupPermissions method setMembersCanInvite.
@ObjectiveCName("setMembersCanInvite:")
public void setMembersCanInvite(boolean membersCanInvite) {
SparseArray<Object> unmapped = settings.getUnmappedObjects();
settings = new ApiAdminSettings(settings.showAdminsToMembers(), membersCanInvite, settings.canMembersEditGroupInfo(), settings.canAdminsEditGroupInfo(), settings.showJoinLeaveMessages());
settings.setUnmappedObjects(unmapped);
}
use of com.google.j2objc.annotations.ObjectiveCName in project actor-platform by actorapp.
the class GroupPermissions method setMembersCanEditInfo.
@ObjectiveCName("setMembersCanEditInfo:")
public void setMembersCanEditInfo(boolean canEditInfo) {
SparseArray<Object> unmapped = settings.getUnmappedObjects();
settings = new ApiAdminSettings(settings.showAdminsToMembers(), settings.canMembersInvite(), canEditInfo, settings.canAdminsEditGroupInfo(), settings.showJoinLeaveMessages());
settings.setUnmappedObjects(unmapped);
}
use of com.google.j2objc.annotations.ObjectiveCName in project actor-platform by actorapp.
the class GroupPermissions method setShowAdminsToMembers.
@ObjectiveCName("showAdminsToMembers:")
public void setShowAdminsToMembers(boolean showAdminsToMembers) {
SparseArray<Object> unmapped = settings.getUnmappedObjects();
settings = new ApiAdminSettings(showAdminsToMembers, settings.canMembersInvite(), settings.canMembersEditGroupInfo(), settings.canAdminsEditGroupInfo(), settings.showJoinLeaveMessages());
settings.setUnmappedObjects(unmapped);
}
use of com.google.j2objc.annotations.ObjectiveCName in project actor-platform by actorapp.
the class I18nEngine method formatPresence.
//
// Presence
//
@ObjectiveCName("formatPresence:withSex:")
public String formatPresence(UserPresence value, Sex sex) {
if (value == null) {
return null;
}
String[] sexType = DEFAULT;
if (sex == Sex.MALE) {
sexType = MALE;
} else if (sex == Sex.FEMALE) {
sexType = FEMALE;
}
if (value.getState() == UserPresence.State.OFFLINE) {
long currentTime = im.actor.runtime.Runtime.getCurrentSyncedTime() / 1000L;
int delta = (int) (currentTime - value.getLastSeen());
if (delta < 60) {
return get("presence.now", sexType);
} else if (delta < 24 * 60 * 60) {
String time = formatTime(value.getLastSeen() * 1000L);
if (areSameDays(value.getLastSeen() * 1000L, new Date().getTime())) {
return get("presence.today", sexType).replace("{time}", time);
} else {
return get("presence.yesterday", sexType).replace("{time}", time);
}
} else if (delta < 14 * 24 * 60 * 60) {
String time = formatTime(value.getLastSeen() * 1000L);
String date = formatDate(value.getLastSeen() * 1000L);
return get("presence.at_day_time", sexType).replace("{time}", time).replace("{date}", date);
} else if (delta < 6 * 30 * 24 * 60 * 60) {
String date = formatDate(value.getLastSeen() * 1000L);
return get("presence.at_day", sexType).replace("{date}", date);
} else {
return get("presence.offline", sexType);
}
} else if (value.getState() == UserPresence.State.ONLINE) {
return get("presence.online", sexType);
}
return null;
}
use of com.google.j2objc.annotations.ObjectiveCName in project actor-platform by actorapp.
the class I18nEngine method formatMessagesExport.
//
// Exporting messages
//
/**
* Formatting messages for exporting
*
* @param messages messages to export
* @return formatted text
*/
@ObjectiveCName("formatMessagesExport:")
public String formatMessagesExport(Message[] messages) {
String text = "";
Arrays.sort(messages, new Comparator<Message>() {
int compare(long lhs, long rhs) {
return lhs < rhs ? -1 : (lhs == rhs ? 0 : 1);
}
@Override
public int compare(Message lhs, Message rhs) {
return compare(lhs.getEngineSort(), rhs.getEngineSort());
}
});
if (messages.length == 1) {
for (Message model : messages) {
if (!(model.getContent() instanceof TextContent)) {
continue;
}
text += ((TextContent) model.getContent()).getText();
}
} else {
for (Message model : messages) {
if (!(model.getContent() instanceof TextContent)) {
continue;
}
if (text.length() > 0) {
text += "\n";
}
text += getUser(model.getSenderId()).getName() + ": ";
text += ((TextContent) model.getContent()).getText();
}
}
return text;
}
Aggregations