<commit_before>/*
 * Copyright (C) 2014-2015 Actor LLC. <https://actor.im>
 */

package im.actor.core.modules.groups;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import im.actor.core.api.ApiAdminSettings;
import im.actor.core.api.ApiGroupOutPeer;
import im.actor.core.api.ApiGroupType;
import im.actor.core.api.ApiOutPeer;
import im.actor.core.api.ApiPeerType;
import im.actor.core.api.ApiUserOutPeer;
import im.actor.core.api.rpc.RequestCreateGroup;
import im.actor.core.api.rpc.RequestDeleteGroup;
import im.actor.core.api.rpc.RequestEditGroupAbout;
import im.actor.core.api.rpc.RequestEditGroupShortName;
import im.actor.core.api.rpc.RequestEditGroupTitle;
import im.actor.core.api.rpc.RequestEditGroupTopic;
import im.actor.core.api.rpc.RequestGetGroupInviteUrl;
import im.actor.core.api.rpc.RequestGetIntegrationToken;
import im.actor.core.api.rpc.RequestInviteUser;
import im.actor.core.api.rpc.RequestJoinGroup;
import im.actor.core.api.rpc.RequestKickUser;
import im.actor.core.api.rpc.RequestLeaveGroup;
import im.actor.core.api.rpc.RequestLoadAdminSettings;
import im.actor.core.api.rpc.RequestLoadMembers;
import im.actor.core.api.rpc.RequestMakeUserAdminObsolete;
import im.actor.core.api.rpc.RequestRevokeIntegrationToken;
import im.actor.core.api.rpc.RequestRevokeInviteUrl;
import im.actor.core.api.rpc.RequestSaveAdminSettings;
import im.actor.core.api.rpc.RequestShareHistory;
import im.actor.core.api.rpc.RequestTransferOwnership;
import im.actor.core.api.rpc.ResponseIntegrationToken;
import im.actor.core.api.rpc.ResponseInviteUrl;
import im.actor.core.entity.Group;
import im.actor.core.entity.GroupMembersSlice;
import im.actor.core.entity.GroupPermissions;
import im.actor.core.entity.Peer;
import im.actor.core.entity.PeerType;
import im.actor.core.entity.User;
import im.actor.core.events.PeerChatOpened;
import im.actor.core.events.PeerInfoOpened;
import im.actor.core.modules.AbsModule;
import im.actor.core.modules.ModuleContext;
import im.actor.core.modules.api.ApiSupportConfiguration;
import im.actor.core.modules.groups.router.GroupRouterInt;
import im.actor.core.modules.profile.avatar.GroupAvatarChangeActor;
import im.actor.core.util.RandomUtils;
import im.actor.core.viewmodel.GroupAvatarVM;
import im.actor.core.viewmodel.GroupVM;
import im.actor.runtime.Storage;
import im.actor.runtime.actors.ActorRef;
import im.actor.runtime.actors.messages.Void;
import im.actor.runtime.eventbus.BusSubscriber;
import im.actor.runtime.eventbus.Event;
import im.actor.runtime.function.Function;
import im.actor.runtime.mvvm.MVVMCollection;
import im.actor.runtime.promise.Promise;
import im.actor.runtime.promise.Promises;
import im.actor.runtime.storage.KeyValueEngine;

import static im.actor.runtime.actors.ActorSystem.system;

public class GroupsModule extends AbsModule implements BusSubscriber {

    private final KeyValueEngine<Group> groups;
    private final MVVMCollection<Group, GroupVM> collection;
    private final HashMap<Integer, GroupAvatarVM> avatarVMs;
    private final ActorRef avatarChangeActor;
    private final GroupRouterInt groupRouterInt;

    public GroupsModule(final ModuleContext context) {
        super(context);

        collection = Storage.createKeyValue(STORAGE_GROUPS, GroupVM.CREATOR, Group.CREATOR);
        groups = collection.getEngine();

        groupRouterInt = new GroupRouterInt(context);

        avatarVMs = new HashMap<>();
        avatarChangeActor = system().actorOf("actor/avatar/group", () -> new GroupAvatarChangeActor(context));
    }

    public void run() {<commit_msg>fix(core): Fixing iOS compatibility<commit_after>/*
 * Copyright (C) 2014-2015 Actor LLC. <https://actor.im>
 */

package im.actor.core.modules.groups;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import im.actor.core.api.ApiAdminSettings;
import im.actor.core.api.ApiGroupOutPeer;
import im.actor.core.api.ApiGroupType;
import im.actor.core.api.ApiOutPeer;
import im.actor.core.api.ApiPeerType;
import im.actor.core.api.ApiUserOutPeer;
import im.actor.core.api.rpc.RequestCreateGroup;
import im.actor.core.api.rpc.RequestDeleteGroup;
import im.actor.core.api.rpc.RequestEditGroupAbout;
import im.actor.core.api.rpc.RequestEditGroupShortName;
import im.actor.core.api.rpc.RequestEditGroupTitle;
import im.actor.core.api.rpc.RequestEditGroupTopic;
import im.actor.core.api.rpc.RequestGetGroupInviteUrl;
import im.actor.core.api.rpc.RequestGetIntegrationToken;
import im.actor.core.api.rpc.RequestInviteUser;
import im.actor.core.api.rpc.RequestJoinGroup;
import im.actor.core.api.rpc.RequestKickUser;
import im.actor.core.api.rpc.RequestLeaveGroup;
import im.actor.core.api.rpc.RequestLoadAdminSettings;
import im.actor.core.api.rpc.RequestLoadMembers;
import im.actor.core.api.rpc.RequestMakeUserAdminObsolete;
import im.actor.core.api.rpc.RequestRevokeIntegrationToken;
import im.actor.core.api.rpc.RequestRevokeInviteUrl;
import im.actor.core.api.rpc.RequestSaveAdminSettings;
import im.actor.core.api.rpc.RequestShareHistory;
import im.actor.core.api.rpc.RequestTransferOwnership;
import im.actor.core.api.rpc.ResponseIntegrationToken;
import im.actor.core.api.rpc.ResponseInviteUrl;
import im.actor.core.api.rpc.ResponseVoid;
import im.actor.core.entity.Group;
import im.actor.core.entity.GroupMembersSlice;
import im.actor.core.entity.GroupPermissions;
import im.actor.core.entity.Peer;
import im.actor.core.entity.PeerType;
import im.actor.core.entity.User;
import im.actor.core.events.PeerChatOpened;
import im.actor.core.events.PeerInfoOpened;
import im.actor.core.modules.AbsModule;
import im.actor.core.modules.ModuleContext;
import im.actor.core.modules.api.ApiSupportConfiguration;
import im.actor.core.modules.groups.router.GroupRouterInt;
import im.actor.core.modules.profile.avatar.GroupAvatarChangeActor;
import im.actor.core.util.RandomUtils;
import im.actor.core.viewmodel.GroupAvatarVM;
import im.actor.core.viewmodel.GroupVM;
import im.actor.runtime.Storage;
import im.actor.runtime.actors.ActorRef;
import im.actor.runtime.actors.messages.Void;
import im.actor.runtime.eventbus.BusSubscriber;
import im.actor.runtime.eventbus.Event;
import im.actor.runtime.function.Function;
import im.actor.runtime.mvvm.MVVMCollection;
import im.actor.runtime.promise.Promise;
import im.actor.runtime.promise.Promises;
import im.actor.runtime.storage.KeyValueEngine;

import static im.actor.runtime.actors.ActorSystem.system;

public class GroupsModule extends AbsModule implements BusSubscriber {

    // Workaround for j2objc bug
    private static final Void DUMB = null;
    private static final ResponseVoid DUMB2 = null;

    private final KeyValueEngine<Group> groups;
    private final MVVMCollection<Group, GroupVM> collection;
    private final HashMap<Integer, GroupAvatarVM> avatarVMs;
    private final ActorRef avatarChangeActor;
    private final GroupRouterInt groupRouterInt;

    public GroupsModule(final ModuleContext context) {
        super(context);

        collection = Storage.createKeyValue(STORAGE_GROUPS, GroupVM.CREATOR, Group.CREATOR);
        groups = collection.getEngine();

        groupRouterInt = new GroupRouterInt(context);

        avatarVMs = new HashMap<>();
        avatarChangeActor = system().actorOf("actor/avatar/group", () -> new GroupAvatarChangeActor(context));
    }

    public void run() {
{'fraction_non_alphanumeric': 0.11085481682496608, 'fraction_numerical': 0.0024423337856173677, 'mean_word_length': 5.359792924935289, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5532834', 'n_tokens_mistral': 2324, 'n_tokens_neox': 2289, 'n_words': 379}