conflict_resolution
stringlengths
27
16k
<<<<<<< import static org.springframework.data.domain.Sort.Direction.DESC; ======= import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; >>>>>>> import static org.springframework.data.domain.Sort.Direction.DESC; import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; <<<<<<< final Page<Post> posts = postService.searchPostsBy(HtmlUtil.escape(keyword), PostTypeEnum.POST_TYPE_POST.getDesc(), PostStatusEnum.PUBLISHED.getCode(), pageable); log.debug("Search posts result: [{}]", posts); ======= final Page<Post> posts = postService.searchPosts(HtmlUtil.escape(keyword), PostTypeEnum.POST_TYPE_POST.getDesc(), PostStatusEnum.PUBLISHED.getCode(), pageable); >>>>>>> final Page<Post> posts = postService.searchPostsBy(HtmlUtil.escape(keyword), PostTypeEnum.POST_TYPE_POST.getDesc(), PostStatusEnum.PUBLISHED.getCode(), pageable);
<<<<<<< private static String[] CAN_EDIT_SUFFIX = {"ftl", "css", "js"}; ======= private final HaloProperties haloProperties; public ThemeServiceImpl(HaloProperties haloProperties) { this.haloProperties = haloProperties; } >>>>>>> private final HaloProperties haloProperties; public ThemeServiceImpl(HaloProperties haloProperties) { this.haloProperties = haloProperties; } private static String[] CAN_EDIT_SUFFIX = {"ftl", "css", "js"};
<<<<<<< import static org.springframework.data.domain.Sort.Direction.DESC; ======= import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; >>>>>>> import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; import static org.springframework.data.domain.Sort.Direction.DESC;
<<<<<<< import static org.springframework.data.domain.Sort.Direction.DESC; ======= import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; >>>>>>> import static org.springframework.data.domain.Sort.Direction.DESC; import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS;
<<<<<<< import static org.springframework.data.domain.Sort.Direction.DESC; ======= import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; >>>>>>> import static org.springframework.data.domain.Sort.Direction.DESC; import static cc.ryanc.halo.model.dto.HaloConst.OPTIONS; <<<<<<< ======= * @param size 每页数量 * >>>>>>>
<<<<<<< import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; ======= import net.fabricmc.fabric.api.event.server.ServerStartCallback; import net.fabricmc.fabric.api.event.server.ServerStopCallback; import net.fabricmc.fabric.api.event.server.ServerTickCallback; import net.fabricmc.fabric.api.registry.CommandRegistry; >>>>>>> import net.fabricmc.fabric.api.command.v1.CommandRegistrationCallback; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; <<<<<<< ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> { ======= ServerStartCallback.EVENT.register((MinecraftServer server) -> { this.serverInstance = server; >>>>>>> ServerLifecycleEvents.SERVER_STARTED.register((MinecraftServer server) -> { this.serverInstance = server;
<<<<<<< import com.stratio.decision.commons.constants.InternalTopic; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; ======= import java.util.HashMap; >>>>>>> import com.stratio.decision.commons.constants.InternalTopic; import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.HashMap; <<<<<<< ======= private final DroolsConfigurationBean droolsConfiguration; >>>>>>> private final DroolsConfigurationBean droolsConfiguration; <<<<<<< MONGO_PASSWORD("mongo.password"), CLUSTERING_GROUP_ID("clustering.groupId"), CLUSTERING_ENABLED("clustering.enabled"), CLUSTERING_GROUPS("clustering.clusterGroups"), CLUSTERING_ALL_ACK_ENABLED("clustering.allAckEnabled"), CLUSTERING_ACK_TIMEOUT("clustering.ackTimeout"); ======= MONGO_PASSWORD("mongo.password"), // Drools Config DROOLS_GROUP("drools.groups"), DROOLS_GROUP_NAME("name"), DROOLS_GROUP_SESSION("sessionName"), DROOLS_GROUP_GROUP_ID("groupId"), DROOLS_GROUP_ARTIFACT_ID("artifactId"), DROOLS_GROUP_VERSION("version"), DROOLS_GROUP_SCAN_TIME("scanFrequency"), DROOLS_GROUP_SESSION_TYPE("sessionType"), ; >>>>>>> MONGO_PASSWORD("mongo.password"), CLUSTERING_GROUP_ID("clustering.groupId"), CLUSTERING_ENABLED("clustering.enabled"), CLUSTERING_GROUPS("clustering.clusterGroups"), CLUSTERING_ALL_ACK_ENABLED("clustering.allAckEnabled"), CLUSTERING_ACK_TIMEOUT("clustering.ackTimeout"), // Drools Config DROOLS_GROUP("drools.groups"), DROOLS_GROUP_NAME("name"), DROOLS_GROUP_SESSION("sessionName"), DROOLS_GROUP_GROUP_ID("groupId"), DROOLS_GROUP_ARTIFACT_ID("artifactId"), DROOLS_GROUP_VERSION("version"), DROOLS_GROUP_SCAN_TIME("scanFrequency"), DROOLS_GROUP_SESSION_TYPE("sessionType"); <<<<<<< this.clusterGroups = (List<String>) this.getListOrNull(ConfigurationKeys.CLUSTERING_GROUPS.getKey(), config); this.allAckEnabled = config.getBoolean(ConfigurationKeys.CLUSTERING_ALL_ACK_ENABLED.getKey()); this.ackTimeout = config.getInt(ConfigurationKeys.CLUSTERING_ACK_TIMEOUT.getKey()); this.clusteringEnabled = config.getBoolean(ConfigurationKeys.CLUSTERING_ENABLED.getKey()); } public String getGroupId() { return groupId; ======= // Adding Drools config this.droolsConfiguration = new DroolsConfigurationBean(); Config droolsGroupsConfig = ConfigFactory.load("drools"); droolsConfiguration.setGroups(getDroolsConfigurationGroup(droolsGroupsConfig)); } private Map<String, DroolsConfigurationGroupBean> getDroolsConfigurationGroup(Config droolsConfig) { Map<String, DroolsConfigurationGroupBean> groups= new HashMap<>(); if (!droolsConfig.hasPath(ConfigurationKeys.DROOLS_GROUP.getKey())){ return groups; } List list = droolsConfig.getConfigList(ConfigurationKeys.DROOLS_GROUP.getKey()); Config groupConfig; for (int i=0; i<list.size(); i++){ groupConfig = (Config) list.get(i); DroolsConfigurationGroupBean g= new DroolsConfigurationGroupBean(); g.setSessionName((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_SESSION.getKey(), groupConfig)); g.setGroupId((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_GROUP_ID.getKey(), groupConfig)); g.setArtifactId((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_ARTIFACT_ID.getKey(), groupConfig)); g.setVersion((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_VERSION.getKey(), groupConfig)); g.setSessionType((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_SESSION_TYPE.getKey(), groupConfig)); // TODO Cast Problems using getValueOrNull with Long g.setScanFrequency(groupConfig.getLong(ConfigurationKeys.DROOLS_GROUP_SCAN_TIME.getKey())); String groupName = (String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_NAME.getKey(), groupConfig); g.setName(groupName); groups.put(groupName, g); } return groups; >>>>>>> this.clusterGroups = (List<String>) this.getListOrNull(ConfigurationKeys.CLUSTERING_GROUPS.getKey(), config); this.allAckEnabled = config.getBoolean(ConfigurationKeys.CLUSTERING_ALL_ACK_ENABLED.getKey()); this.ackTimeout = config.getInt(ConfigurationKeys.CLUSTERING_ACK_TIMEOUT.getKey()); this.clusteringEnabled = config.getBoolean(ConfigurationKeys.CLUSTERING_ENABLED.getKey()); this.droolsConfiguration = new DroolsConfigurationBean(); Config droolsGroupsConfig = ConfigFactory.load("drools"); droolsConfiguration.setGroups(getDroolsConfigurationGroup(droolsGroupsConfig)); } public String getGroupId() { return groupId; } private Map<String, DroolsConfigurationGroupBean> getDroolsConfigurationGroup(Config droolsConfig) { Map<String, DroolsConfigurationGroupBean> groups= new HashMap<>(); if (!droolsConfig.hasPath(ConfigurationKeys.DROOLS_GROUP.getKey())){ return groups; } List list = droolsConfig.getConfigList(ConfigurationKeys.DROOLS_GROUP.getKey()); Config groupConfig; for (int i=0; i<list.size(); i++){ groupConfig = (Config) list.get(i); DroolsConfigurationGroupBean g= new DroolsConfigurationGroupBean(); g.setSessionName((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_SESSION.getKey(), groupConfig)); g.setGroupId((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_GROUP_ID.getKey(), groupConfig)); g.setArtifactId((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_ARTIFACT_ID.getKey(), groupConfig)); g.setVersion((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_VERSION.getKey(), groupConfig)); g.setSessionType((String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_SESSION_TYPE.getKey(), groupConfig)); // TODO Cast Problems using getValueOrNull with Long g.setScanFrequency(groupConfig.getLong(ConfigurationKeys.DROOLS_GROUP_SCAN_TIME.getKey())); String groupName = (String) this.getValueOrNull(ConfigurationKeys.DROOLS_GROUP_NAME.getKey(), groupConfig); g.setName(groupName); groups.put(groupName, g); } return groups;
<<<<<<< import android.database.sqlite.SQLiteDatabase; ======= >>>>>>> import android.database.sqlite.SQLiteDatabase; <<<<<<< import java.io.File; ======= >>>>>>> import java.io.File;
<<<<<<< builder.append(ctx.firstToUpper(thing.getName()) + ".prototype._receive = function(message) {//takes a JSONified message\n"); builder.append("this.getQueue().push(message);\n"); /** MODIFICATION **/ builder.append("this.cepDispatch(message);\n"); /** END **/ ======= builder.append(ctx.firstToUpper(thing.getName()) + ".prototype._receive = function() {\n"); builder.append("this.getQueue().push(arguments);\n"); >>>>>>> builder.append(ctx.firstToUpper(thing.getName()) + ".prototype._receive = function() {\n"); builder.append("this.getQueue().push(arguments);\n"); /** MODIFICATION **/ builder.append("this.cepDispatch(message);\n"); /** END **/ <<<<<<< /** MODIFICATION **/ if(thing.getStreams().size() > 0) { builder.append("this.eventEmitterForStream = new EventEmitter();\n"); //fixme more dynamic } /** END **/ builder.append("//bindings\n"); builder.append("var connectors = [];\n"); builder.append("this.getConnectors = function() {\n"); builder.append("return connectors;\n"); builder.append("};\n\n"); ======= >>>>>>> /** MODIFICATION **/ if(thing.getStreams().size() > 0) { builder.append("this.eventEmitterForStream = new EventEmitter();\n"); //fixme more dynamic } /** END **/ builder.append("//bindings\n"); builder.append("var connectors = [];\n"); builder.append("this.getConnectors = function() {\n"); builder.append("return connectors;\n"); builder.append("};\n\n");
<<<<<<< Rules.add(new InternalTransitions()); Rules.add(new AutotransitionCycles()); Rules.add(new NonDeterministicTransitions()); ======= Rules.add(new FunctionUsage()); Rules.add(new StatesUsage()); >>>>>>> Rules.add(new InternalTransitions()); Rules.add(new AutotransitionCycles()); Rules.add(new NonDeterministicTransitions()); Rules.add(new FunctionUsage()); Rules.add(new StatesUsage());
<<<<<<< ======= import org.thingml.compilers.configuration.CfgBuildCompiler; import org.thingml.compilers.configuration.CfgExternalConnectorCompiler; import org.thingml.compilers.configuration.CfgMainGenerator; import org.thingml.compilers.thing.common.FSMBasedThingImplCompiler; import org.thingml.compilers.thing.ThingActionCompiler; import org.thingml.compilers.thing.ThingApiCompiler; import org.thingml.compilers.thing.ThingImplCompiler; >>>>>>> import org.thingml.compilers.configuration.CfgBuildCompiler; import org.thingml.compilers.configuration.CfgExternalConnectorCompiler; import org.thingml.compilers.configuration.CfgMainGenerator; import org.thingml.compilers.thing.common.FSMBasedThingImplCompiler; import org.thingml.compilers.thing.ThingActionCompiler; import org.thingml.compilers.thing.ThingApiCompiler; import org.thingml.compilers.thing.ThingImplCompiler; <<<<<<< this.buildCompiler = buildCompiler; this.behaviorCompiler = behaviorCompiler; this.cepCompiler = cepCompiler; ======= this.cfgBuildCompiler = cfgBuildCompiler; this.thingImplCompiler = thingImplCompiler; >>>>>>> this.cfgBuildCompiler = cfgBuildCompiler; this.thingImplCompiler = thingImplCompiler; this.cepCompiler = cepCompiler; <<<<<<< public CepCompiler getCepCompiler(){return cepCompiler;} public void addConnectorCompilers(Map<String, ConnectorCompiler> connectorCompilers) { ======= public void addConnectorCompilers(Map<String, CfgExternalConnectorCompiler> connectorCompilers) { >>>>>>> public CepCompiler getCepCompiler(){return cepCompiler;} public void addConnectorCompilers(Map<String, CfgExternalConnectorCompiler> connectorCompilers) {
<<<<<<< builder.append("//Instance " + inst.getName() + "\n"); builder.append("// Variables for the properties of the instance\n"); builder.append(ctx.getInstanceVarDecl(inst) + "\n"); if(cfg.hasAnnotation("c_dyn_connectors")) { for(Port p : inst.getType().allPorts()) { if(!p.getReceives().isEmpty()) { builder.append("struct Msg_Handler " + inst.getName() + "_" + p.getName() + "_handlers;\n"); builder.append("uint16_t " + inst.getName() + "_" + p.getName() + "_msgs[" + p.getReceives().size() + "];\n"); builder.append("void * " + inst.getName() + "_" + p.getName() + "_handlers_tab[" + p.getReceives().size() + "];\n\n"); ======= builder.append("//Instance " + inst.getName() + "\n"); builder.append("// Variables for the properties of the instance\n"); /*for (Property p : inst.getType().allPropertiesInDepth()) { if (p.getCardinality() != null) {//array builder.append(ctx.getCType(p.getType()) + " "); builder.append("array_" + inst.getName() + "_" + ctx.getCVarName(p)); builder.append("["); ctx.setConcreteInstance(inst); ctx.getCompiler().getThingActionCompiler().generate(p.getCardinality(), builder, ctx); ctx.clearConcreteInstance(); builder.append("]"); builder.append(";\n"); } }*/ /* for (Property a : cfg.allArrays(inst)) { builder.append(ctx.getCType(a.getType()) + " "); builder.append("array_" + inst.getName() + "_" + ctx.getCVarName(a)); builder.append("["); ctx.generateFixedAtInitValue(cfg, inst, a.getCardinality(), builder); builder.append("];\n"); }*/ builder.append(ctx.getInstanceVarDecl(inst) + "\n"); if (cfg.hasAnnotation("c_dyn_connectors")) { for (Port p : inst.getType().allPorts()) { if (!p.getReceives().isEmpty()) { builder.append("struct Msg_Handler " + inst.getName() + "_" + p.getName() + "_handlers;\n"); builder.append("uint16_t " + inst.getName() + "_" + p.getName() + "_msgs[" + p.getReceives().size() + "];\n"); builder.append("void * " + inst.getName() + "_" + p.getName() + "_handlers_tab[" + p.getReceives().size() + "];\n\n"); } } >>>>>>> builder.append("//Instance " + inst.getName() + "\n"); builder.append("// Variables for the properties of the instance\n"); /*for (Property p : inst.getType().allPropertiesInDepth()) { if (p.getCardinality() != null) {//array builder.append(ctx.getCType(p.getType()) + " "); builder.append("array_" + inst.getName() + "_" + ctx.getCVarName(p)); builder.append("["); ctx.setConcreteInstance(inst); ctx.getCompiler().getThingActionCompiler().generate(p.getCardinality(), builder, ctx); ctx.clearConcreteInstance(); builder.append("]"); builder.append(";\n"); } }*/ /* for (Property a : cfg.allArrays(inst)) { builder.append(ctx.getCType(a.getType()) + " "); builder.append("array_" + inst.getName() + "_" + ctx.getCVarName(a)); builder.append("["); ctx.generateFixedAtInitValue(cfg, inst, a.getCardinality(), builder); builder.append("];\n"); }*/ builder.append(ctx.getInstanceVarDecl(inst) + "\n"); if (cfg.hasAnnotation("c_dyn_connectors")) { for (Port p : inst.getType().allPorts()) { if (!p.getReceives().isEmpty()) { builder.append("struct Msg_Handler " + inst.getName() + "_" + p.getName() + "_handlers;\n"); builder.append("uint16_t " + inst.getName() + "_" + p.getName() + "_msgs[" + p.getReceives().size() + "];\n"); builder.append("void * " + inst.getName() + "_" + p.getName() + "_handlers_tab[" + p.getReceives().size() + "];\n\n"); } } <<<<<<< ======= /*protected void generateCppHeaderMessageEnqueue(Configuration cfg, StringBuilder builder, CCompilerContext ctx) { // Added by sdalgard to handle method headers for C++ // Generate the Enqueue operation only for ports which are not marked as "sync" for (Thing t : cfg.allThings()) { for(Port p : t.allPorts()) { if (p.isDefined("sync_send", "true")) continue; // do not generateMainAndInit for synchronous ports ctx.setConcreteThing(t); Map<Message, Map<Instance, List<AbstractMap.SimpleImmutableEntry<Instance, Port>>>> allMessageDispatch = cfg.allMessageDispatch(t, p); for(Message m : allMessageDispatch.keySet()) { builder.append("// Enqueue of messages " + t.getName() + "::" + p.getName() + "::" + m.getName() + "\n"); builder.append("void " + "enqueue_" + ctx.getSenderName(t, p, m)); ctx.appendFormalParameters(t, builder, m); builder.append(";\n"); } } } ctx.clearConcreteThing(); }*/ >>>>>>> <<<<<<< ======= /*protected void generateCppHeaderExternalMessageEnqueue(Configuration cfg, StringBuilder builder, CCompilerContext ctx) { // Added by sdalgard to handle method headers for C++ if(isThereNetworkListener(cfg)) { builder.append("void externalMessageEnqueue(uint8_t * msg, uint8_t msgSize, uint16_t listener_id);\n"); } }*/ >>>>>>> <<<<<<< ======= /*if(eco.hasAnnotation("port_name")) { portName = eco.annotation("port_name").iterator().next(); } else { portName = eco.getProtocol(); }*/ >>>>>>> <<<<<<< protected void generateInitializationCode(Configuration cfg, StringBuilder builder, CCompilerContext ctx) { //FIXME: Re-implement debug properly /* if (context.debug) { builder append context.init_debug_mode() + "\n" ======= protected void generateInitializationCode(Configuration cfg, StringBuilder builder, CCompilerContext ctx) { //ThingMLModel model = ThingMLHelpers.findContainingModel(cfg); //FIXME: Re-implement debug properly /* if (context.debug) { builder append context.init_debug_mode() + "\n" } */ //Initialize stdout if needed (for arduino) if (ctx.getCompiler().getID().compareTo("arduino") == 0) { int baudrate = 9600; if (ctx.getCurrentConfiguration().hasAnnotation("arduino_stdout_baudrate")) { Integer intb = Integer.parseInt(ctx.getCurrentConfiguration().annotation("arduino_stdout_baudrate").iterator().next()); baudrate = intb.intValue(); } if (ctx.getCurrentConfiguration().hasAnnotation("arduino_stdout")) { builder.append(ctx.getCurrentConfiguration().annotation("arduino_stdout").iterator().next() + ".begin(" + baudrate + ");\n"); } } // Call the initialization function builder.append("initialize_configuration_" + cfg.getName() + "();\n"); // Serach for the ThingMLSheduler Thing /*Thing arduino_scheduler = null; for (Thing t : model.allThings()) { if (t.getName().equals("ThingMLScheduler")) { arduino_scheduler = t; break; >>>>>>> protected void generateInitializationCode(Configuration cfg, StringBuilder builder, CCompilerContext ctx) { //ThingMLModel model = ThingMLHelpers.findContainingModel(cfg); //FIXME: Re-implement debug properly /* if (context.debug) { builder append context.init_debug_mode() + "\n" } */ //Initialize stdout if needed (for arduino) if (ctx.getCompiler().getID().compareTo("arduino") == 0) { int baudrate = 9600; if (ctx.getCurrentConfiguration().hasAnnotation("arduino_stdout_baudrate")) { Integer intb = Integer.parseInt(ctx.getCurrentConfiguration().annotation("arduino_stdout_baudrate").iterator().next()); baudrate = intb.intValue(); } if (ctx.getCurrentConfiguration().hasAnnotation("arduino_stdout")) { builder.append(ctx.getCurrentConfiguration().annotation("arduino_stdout").iterator().next() + ".begin(" + baudrate + ");\n"); } } // Call the initialization function builder.append("initialize_configuration_" + cfg.getName() + "();\n"); // Serach for the ThingMLSheduler Thing /*Thing arduino_scheduler = null; for (Thing t : model.allThings()) { if (t.getName().equals("ThingMLScheduler")) { arduino_scheduler = t; break; <<<<<<< if(ctx.getCompiler().getID().compareTo("arduino") != 0) { //FIXME Nicolas This code is awfull //New Empty Event Handler builder.append("int emptyEventConsumed = 1;\n"); builder.append("while (emptyEventConsumed != 0) {\n"); builder.append("emptyEventConsumed = 0;\n"); ======= if (ctx.getCompiler().getID().compareTo("arduino") != 0) { //FIXME Nicolas This code is awfull //New Empty Event Handler builder.append("int emptyEventConsumed = 1;\n"); builder.append("while (emptyEventConsumed != 0) {\n"); builder.append("emptyEventConsumed = 0;\n"); >>>>>>> if (ctx.getCompiler().getID().compareTo("arduino") != 0) { //FIXME Nicolas This code is awfull //New Empty Event Handler builder.append("int emptyEventConsumed = 1;\n"); builder.append("while (emptyEventConsumed != 0) {\n"); builder.append("emptyEventConsumed = 0;\n"); <<<<<<< traceDynCo += "\\n\", " + ctx.getInstanceVarName(inst) + ".id_" + p.getName() + ");\n"; } ======= traceDynCo += "\\n\", " + ctx.getInstanceVarName(inst) + ".id_" + p.getName() + ");\n"; } >>>>>>> traceDynCo += "\\n\", " + ctx.getInstanceVarName(inst) + ".id_" + p.getName() + ");\n"; }
<<<<<<< import org.thingml.compilers.CepCompiler; import org.thingml.compilers.OpaqueThingMLCompiler; ======= import org.thingml.compilers.utils.OpaqueThingMLCompiler; >>>>>>> import org.thingml.compilers.CepCompiler; import org.thingml.compilers.utils.OpaqueThingMLCompiler; <<<<<<< super(new CActionCompilerPosix(), new CApiCompiler(), new CMainGenerator(), new BuildCompiler(), new CBehaviorCompiler(), new CepCompiler()); ======= super(new CThingActionCompilerPosix(), new CThingApiCompiler(), new CCfgMainGenerator(), new PosixCCfgBuildCompiler(), new CThingImplCompiler()); >>>>>>> super(new CThingActionCompilerPosix(), new CThingApiCompiler(), new CCfgMainGenerator(), new PosixCCfgBuildCompiler(), new CThingImplCompiler(), new CepCompiler());
<<<<<<< if (cfg.hasAnnotation("c_dyn_connectors")) { b.append("//Port message handler structure\n" + "typedef struct Msg_Handler {\n" + " int nb_msg;\n" + " uint16_t * msg;\n" + " void ** msg_handler;\n" + " void * instance;\n" + "};\n\n"); ======= if (AnnotatedElementHelper.hasAnnotation(cfg, "c_dyn_connectors")) { b.append("//Port message handler structure\n" + "typedef struct Msg_Handler {\n" + " int nb_msg;\n" + " uint16_t * msg;\n" + " void ** msg_handler;\n" + " void * instance;\n" + "};\n\n"); >>>>>>> if (AnnotatedElementHelper.hasAnnotation(cfg, "c_dyn_connectors")) { b.append("//Port message handler structure\n" + "typedef struct Msg_Handler {\n" + " int nb_msg;\n" + " uint16_t * msg;\n" + " void ** msg_handler;\n" + " void * instance;\n" + "};\n\n"); <<<<<<< int nbMaxConnexion = cfg.allConnectors().size() * 2 + cfg.getExternalConnectors().size() + nbInternalPort; if (cfg.hasAnnotation("c_dyn_connectors")) { if (cfg.annotation("c_dyn_connectors").iterator().next().compareToIgnoreCase("*") != 0) { nbMaxConnexion = Integer.parseInt(cfg.annotation("c_dyn_connectors").iterator().next()); } builder.append("//Declaration of connexion array\n"); builder.append("#define NB_MAX_CONNEXION " + nbMaxConnexion + "\n"); builder.append("struct Msg_Handler * " + cfg.getName() + "_receivers[NB_MAX_CONNEXION];\n\n"); ======= int nbMaxConnexion = ConfigurationHelper.allConnectors(cfg).size() * 2 + ConfigurationHelper.getExternalConnectors(cfg).size() + nbInternalPort; if (AnnotatedElementHelper.hasAnnotation(cfg, "c_dyn_connectors")) { if (AnnotatedElementHelper.annotation(cfg, "c_dyn_connectors").iterator().next().compareToIgnoreCase("*") != 0) { nbMaxConnexion = Integer.parseInt(AnnotatedElementHelper.annotation(cfg, "c_dyn_connectors").iterator().next()); } builder.append("//Declaration of connexion array\n"); builder.append("#define NB_MAX_CONNEXION " + nbMaxConnexion + "\n"); builder.append("struct Msg_Handler * " + cfg.getName() + "_receivers[NB_MAX_CONNEXION];\n\n"); >>>>>>> int nbMaxConnexion = ConfigurationHelper.allConnectors(cfg).size() * 2 + ConfigurationHelper.getExternalConnectors(cfg).size() + nbInternalPort; if (AnnotatedElementHelper.hasAnnotation(cfg, "c_dyn_connectors")) { if (AnnotatedElementHelper.annotation(cfg, "c_dyn_connectors").iterator().next().compareToIgnoreCase("*") != 0) { nbMaxConnexion = Integer.parseInt(AnnotatedElementHelper.annotation(cfg, "c_dyn_connectors").iterator().next()); } builder.append("//Declaration of connexion array\n"); builder.append("#define NB_MAX_CONNEXION " + nbMaxConnexion + "\n"); builder.append("struct Msg_Handler * " + cfg.getName() + "_receivers[NB_MAX_CONNEXION];\n\n"); <<<<<<< if (!cfg.getExternalConnectors().isEmpty()) { ret = true; ======= if (!ConfigurationHelper.getExternalConnectors(cfg).isEmpty()) { ret = true; >>>>>>> if (!ConfigurationHelper.getExternalConnectors(cfg).isEmpty()) { ret = true; <<<<<<< //for (Message m : cfg.allMessages()) { ======= //for (Message m : ConfigurationHelper.allMessages(cfg)) { >>>>>>> //for (Message m : ConfigurationHelper.allMessages(cfg)) { <<<<<<< if (cfg.hasAnnotation("c_dyn_connectors")) { int i = 0; ======= if (AnnotatedElementHelper.hasAnnotation(cfg, "c_dyn_connectors")) { int i = 0; >>>>>>> if (AnnotatedElementHelper.hasAnnotation(cfg, "c_dyn_connectors")) { int i = 0; <<<<<<< if (inst.getType().allStateMachines() != null) { if (inst.getType().allStateMachines().get(0).allMessageHandlers() != null) { if (inst.getType().allStateMachines().get(0).allMessageHandlers().get(p) != null) { if (inst.getType().allStateMachines().get(0).allMessageHandlers().get(p).containsKey(m)) { builder.append(i + "] = (void*) &" + inst.getType().getName() + "_handle_" + p.getName() + "_" + m.getName() + ";\n"); ======= if (ThingMLHelpers.allStateMachines(inst.getType()) != null) { if (StateHelper.allMessageHandlers(ThingMLHelpers.allStateMachines(inst.getType()).get(0)) != null) { if (StateHelper.allMessageHandlers(ThingMLHelpers.allStateMachines(inst.getType()).get(0)).get(p) != null) { if (StateHelper.allMessageHandlers(ThingMLHelpers.allStateMachines(inst.getType()).get(0)).get(p).containsKey(m)) { builder.append(i + "] = (void*) &" + inst.getType().getName() + "_handle_" + p.getName() + "_" + m.getName() + ";\n"); } else { builder.append(i + "] = NULL;\n"); } >>>>>>> if (ThingMLHelpers.allStateMachines(inst.getType()) != null) { if (StateHelper.allMessageHandlers(ThingMLHelpers.allStateMachines(inst.getType()).get(0)) != null) { if (StateHelper.allMessageHandlers(ThingMLHelpers.allStateMachines(inst.getType()).get(0)).get(p) != null) { if (StateHelper.allMessageHandlers(ThingMLHelpers.allStateMachines(inst.getType()).get(0)).get(p).containsKey(m)) { builder.append(i + "] = (void*) &" + inst.getType().getName() + "_handle_" + p.getName() + "_" + m.getName() + ";\n"); <<<<<<< //Map.Entry<Instance, List<InternalPort>> entries : cfg.allInternalPorts().entrySet(); for (Map.Entry<Instance, List<InternalPort>> entries : cfg.allInternalPorts().entrySet()) { ======= //Map.Entry<Instance, List<InternalPort>> entries : ConfigurationHelper.allInternalPorts(cfg).entrySet(); for (Map.Entry<Instance, List<InternalPort>> entries : ConfigurationHelper.allInternalPorts(cfg).entrySet()) { >>>>>>> //Map.Entry<Instance, List<InternalPort>> entries : ConfigurationHelper.allInternalPorts(cfg).entrySet(); for (Map.Entry<Instance, List<InternalPort>> entries : ConfigurationHelper.allInternalPorts(cfg).entrySet()) { <<<<<<< if (ctx.getCurrentConfiguration().hasAnnotation("arduino_stdout")) { builder.append(ctx.getCurrentConfiguration().annotation("arduino_stdout").iterator().next() + ".begin(" + baudrate + ");\n"); ======= if (AnnotatedElementHelper.hasAnnotation(ctx.getCurrentConfiguration(), "arduino_stdout")) { builder.append(AnnotatedElementHelper.annotation(ctx.getCurrentConfiguration(), "arduino_stdout").iterator().next() + ".begin(" + baudrate + ");\n"); } >>>>>>> if (AnnotatedElementHelper.hasAnnotation(ctx.getCurrentConfiguration(), "arduino_stdout")) { builder.append(AnnotatedElementHelper.annotation(ctx.getCurrentConfiguration(), "arduino_stdout").iterator().next() + ".begin(" + baudrate + ");\n");
<<<<<<< ======= //public List<String> getFormalParameterNamelist(Thing thing, Message m) { // List<String> paramList = new ArrayList<String>(); // // for (Parameter p : m.getParameters()) { // paramList.add(p.getName()); // } // return paramList; //} >>>>>>> //public List<String> getFormalParameterNamelist(Thing thing, Message m) { // List<String> paramList = new ArrayList<String>(); // // for (Parameter p : m.getParameters()) { // paramList.add(p.getName()); // } // return paramList; //} <<<<<<< //public List<String> getFormalParameterNamelist(Thing thing, Message m) { // List<String> paramList = new ArrayList<String>(); // // for (Parameter p : m.getParameters()) { // paramList.add(p.getName()); // } // return paramList; //} ======= >>>>>>>
<<<<<<< ======= import org.sintef.thingml.helpers.ConfigurationHelper; >>>>>>> import org.sintef.thingml.helpers.ConfigurationHelper; <<<<<<< ======= import org.thingml.compilers.thing.ThingCepCompiler; import org.thingml.compilers.thing.ThingCepSourceDeclaration; import org.thingml.compilers.thing.ThingCepViewCompiler; >>>>>>> <<<<<<< import java.io.File; ======= >>>>>>>
<<<<<<< table.put("TabbedPane[contentBorder].enableTop", false); table.put("TabbedPane[contentBorder].enableLeaf", false); table.put("TabbedPane[contentBorder].enableRight", false); table.put("TabbedPane[contentBorder].enableBottom", false); table.put("TextField.caretForeground", Color.WHITE); table.put("TextArea.caretForeground", Color.WHITE); table.put("TextPane.caretForeground", Color.WHITE); table.put("PasswordField.caretForeground", Color.WHITE); ======= >>>>>>> table.put("TextField.caretForeground", Color.WHITE); table.put("TextArea.caretForeground", Color.WHITE); table.put("TextPane.caretForeground", Color.WHITE); table.put("PasswordField.caretForeground", Color.WHITE);
<<<<<<< private String title; private String path; private String user = ""; private String pass = ""; private String fabskin; private BookmarkCallback bookmarkCallback; private int studiomode = 0; ======= private UtilitiesProviderInterface utilsProvider; String title, path, user = "", pass = "", ipp = ""; String fabskin; Context c; BookmarkCallback bookmarkCallback; SharedPreferences Sp; int studiomode = 0; >>>>>>> private String title; private String path; private String user = ""; private String pass = ""; private BookmarkCallback bookmarkCallback; private int studiomode = 0; <<<<<<< bundle.putString("fabskin", fabskin); ======= bundle.putInt("fabskin", fabskin); >>>>>>> bundle.putString("fabskin", fabskin); <<<<<<< Context c = getActivity(); ======= c = getActivity(); >>>>>>> Context c = getActivity(); <<<<<<< SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c); studiomode = sp.getInt("studio", 0); if (dataUtils.containsBooks(new String[]{title, path}) != -1 || dataUtils.containsAccounts(new String[]{title, path}) != -1) { ======= Sp = PreferenceManager.getDefaultSharedPreferences(c); studiomode = Sp.getInt("studio", 0); if (DataUtils.containsBooks(new String[]{title, path}) != -1) { >>>>>>> SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(c); studiomode = sp.getInt("studio", 0); if (dataUtils.containsBooks(new String[]{title, path}) != -1) {
<<<<<<< public Collection<String> asserts() { return this.asser; } @Override ======= @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") >>>>>>> public Collection<String> asserts() { return this.asser; } @Override @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
<<<<<<< private final Collection<String> exc = new LinkedList<String>(); ======= private final transient Collection<String> exc = new LinkedList<>(); >>>>>>> private final Collection<String> exc = new LinkedList<>(); <<<<<<< private final Collection<String> asser = new LinkedList<String>(); ======= private final transient Collection<String> asser = new LinkedList<>(); >>>>>>> private final Collection<String> asser = new LinkedList<>();
<<<<<<< "BracketsStructureCheck", ======= "ConstantUsageCheck", >>>>>>> "BracketsStructureCheck", "ConstantUsageCheck",
<<<<<<< private final Collection<String> messages = new ConcurrentLinkedQueue<String>(); ======= private final transient Collection<String> messages = new ConcurrentLinkedQueue<>(); >>>>>>> private final Collection<String> messages = new ConcurrentLinkedQueue<>();
<<<<<<< import org.sonar.xoo.lang.CoveragePerTestSensor; import org.sonar.xoo.lang.MeasureSensor; import org.sonar.xoo.lang.SymbolReferencesSensor; import org.sonar.xoo.lang.SyntaxHighlightingSensor; import org.sonar.xoo.lang.TestCaseSensor; import org.sonar.xoo.lang.XooTokenizerSensor; import org.sonar.xoo.rule.CreateIssueByInternalKeySensor; import org.sonar.xoo.rule.OneIssueOnDirPerFileSensor; import org.sonar.xoo.rule.OneIssuePerLineSensor; import org.sonar.xoo.rule.XooQualityProfile; import org.sonar.xoo.rule.XooRulesDefinition; import org.sonar.xoo.scm.XooBlameCommand; import org.sonar.xoo.scm.XooScmProvider; ======= import org.sonar.xoo.lang.*; import org.sonar.xoo.rule.*; >>>>>>> import org.sonar.xoo.lang.*; import org.sonar.xoo.rule.*; import org.sonar.xoo.scm.XooBlameCommand; import org.sonar.xoo.scm.XooScmProvider; <<<<<<< // SCM XooScmProvider.class, XooBlameCommand.class, ======= XooFakeExporter.class, XooFakeImporter.class, XooFakeImporterWithMessages.class, >>>>>>> XooFakeExporter.class, XooFakeImporter.class, XooFakeImporterWithMessages.class, // SCM XooScmProvider.class, XooBlameCommand.class,
<<<<<<< Library lib = new Library(project.getKey(), dependency.version()); index.addResource(lib); // Temporary hack since we need snapshot id to persist dependencies resourcePersister.persist(); ======= Library lib = new Library(dependency.key(), dependency.version()); context.saveResource(lib); >>>>>>> Library lib = new Library(dependency.key(), dependency.version()); index.addResource(lib); // Temporary hack since we need snapshot id to persist dependencies resourcePersister.persist();
<<<<<<< DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao()); sut = new ComputationService(dbClient, steps, activityService, settingsFactory, tempFolder, system); ======= DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao(), new SnapshotDao(system)); sut = new ComputationService(dbClient, steps, activityService, tempFolder, system); >>>>>>> DbClient dbClient = new DbClient(dbTester.database(), dbTester.myBatis(), new ComponentDao(), new SnapshotDao(system)); sut = new ComputationService(dbClient, steps, activityService, settingsFactory, tempFolder, system);
<<<<<<< /** * @deprecated since 5.0 should not be an API. Everything should be accessed using {@link SensorContext}. */ @Deprecated ======= /** * @deprecated since 4.5.2 should not be used by plugins. */ @Deprecated >>>>>>> /** * @deprecated since 4.5.2 should not be used by plugins. Everything should be accessed using {@link SensorContext}. */ @Deprecated
<<<<<<< settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&useCursorFetch=true"); ======= settings.checkUrlParameters(JdbcSettings.Provider.mysql, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8"); >>>>>>> settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8"); <<<<<<< settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true"); ======= settings.checkUrlParameters(JdbcSettings.Provider.mysql, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance"); >>>>>>> settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance");
<<<<<<< settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8"); ======= settings.checkUrlParameters(JdbcSettings.Provider.mysql, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&useCursorFetch=true"); >>>>>>> settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&useCursorFetch=true"); <<<<<<< settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance"); ======= settings.checkUrlParameters(JdbcSettings.Provider.mysql, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true"); >>>>>>> settings.checkUrlParameters(JdbcSettings.Provider.MYSQL, "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true");
<<<<<<< .setCleanSonarGoals() // exclude pom.xml, otherwise it will be published in SQ 6.3+ and not in previous versions, resulting in a different number of // components ======= .setCleanPackageSonarGoals() // exclude pom.xml, otherwise it will be published in SQ 6.3+ and not in previous versions, resulting in a different number of components >>>>>>> .setCleanPackageSonarGoals() // exclude pom.xml, otherwise it will be published in SQ 6.3+ and not in previous versions, resulting in a different number of // components
<<<<<<< import com.google.common.collect.Maps; import org.sonar.api.batch.bootstrap.ProjectDefinition; ======= import org.slf4j.Logger; import org.slf4j.LoggerFactory; >>>>>>> import com.google.common.collect.Maps; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.bootstrap.ProjectDefinition;
<<<<<<< wsTester = new WsTester(new QProfilesWs(mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), mock(ProjectAssociationActions.class), new ChangelogAction(changelogLoader, profileFactory, new Languages(), dbTester.getDbClient()))); ======= dbTester.truncateTables(); esTester.truncateIndices(); System2 system = mock(System2.class); // create pre-defined rules RuleDto xooRule1 = RuleTesting.newXooX1().setSeverity("MINOR"); db.ruleDao().insert(dbSession, xooRule1); // create pre-defined profiles P1 and P2 db.qualityProfileDao().insert(dbSession, QProfileTesting.newXooP1(), QProfileTesting.newXooP2()); login = "david"; UserDto user = new UserDto().setLogin(login).setName("David").setEmail("[email protected]").setCreatedAt(System.currentTimeMillis()).setUpdatedAt(System.currentTimeMillis()); db.userDao().insert(dbSession, user); dbSession.commit(); dbSession.clearCache(); wsTester = new WsTester(new QProfilesWs(mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), new ChangelogAction(db, new ActivityIndex(esTester.client()), new QProfileFactory(db), LanguageTesting.newLanguages("xoo")))); >>>>>>> wsTester = new WsTester(new QProfilesWs(mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), new ChangelogAction(changelogLoader, profileFactory, new Languages(), dbTester.getDbClient())));
<<<<<<< String litresRel = null; int catalogType = NetworkCatalogItem.CATALOG_OTHER; for (ATOMLink link : entry.Links) { ======= boolean litresCatalogue = false; NetworkCatalogItem.CatalogType catalogType = NetworkCatalogItem.CatalogType.OTHER; for (ATOMLink link: entry.Links) { >>>>>>> String litresRel = null; NetworkCatalogItem.CatalogType catalogType = NetworkCatalogItem.CatalogType.OTHER; for (ATOMLink link : entry.Links) {
<<<<<<< import org.geometerplus.android.util.UIUtil; ======= import org.geometerplus.android.util.AndroidUtil; import org.geometerplus.android.fbreader.FBReader; >>>>>>> import org.geometerplus.android.util.UIUtil; import org.geometerplus.android.fbreader.FBReader;
<<<<<<< if (myDoGroupTitlesByFirstLetter) { final String letter = TitleTree.firstTitleLetter(book); if (letter != null) { final TitleTree tree = getFirstLevelTree(LibraryTree.ROOT_BY_TITLE).getTitleSubTree(letter); tree.createBookWithAuthorsSubTree(book); } } else { getFirstLevelTree(LibraryTree.ROOT_BY_TITLE).createBookWithAuthorsSubTree(book); } synchronized (this) { final SearchResultsTree found = (SearchResultsTree)getFirstLevelTree(LibraryTree.ROOT_FOUND); if (found != null && book.matches(found.getPattern())) { found.createBookWithAuthorsSubTree(book); } ======= final SearchResultsTree found = (SearchResultsTree)getFirstLevelTree(LibraryTree.ROOT_FOUND); if (found != null && book.matches(found.getPattern())) { found.createBookWithAuthorsSubTree(book); >>>>>>> synchronized (this) { final SearchResultsTree found = (SearchResultsTree)getFirstLevelTree(LibraryTree.ROOT_FOUND); if (found != null && book.matches(found.getPattern())) { found.createBookWithAuthorsSubTree(book); } <<<<<<< ======= private void build() { // Step 0: get database books marked as "existing" final FileInfoSet fileInfos = new FileInfoSet(myDatabase); final Map<Long,Book> savedBooksByFileId = myDatabase.loadBooks(fileInfos, true); final Map<Long,Book> savedBooksByBookId = new HashMap<Long,Book>(); for (Book b : savedBooksByFileId.values()) { savedBooksByBookId.put(b.getId(), b); } // Step 2: check if files corresponding to "existing" books really exists; // add books to library if yes (and reload book info if needed); // remove from recent/favorites list if no; // collect newly "orphaned" books final Set<Book> orphanedBooks = new HashSet<Book>(); final Set<ZLPhysicalFile> physicalFiles = new HashSet<ZLPhysicalFile>(); int count = 0; for (Book book : savedBooksByFileId.values()) { synchronized (this) { final ZLPhysicalFile file = book.File.getPhysicalFile(); if (file != null) { physicalFiles.add(file); } if (file != book.File && file != null && file.getPath().endsWith(".epub")) { continue; } if (book.File.exists()) { boolean doAdd = true; if (file == null) { continue; } if (!fileInfos.check(file, true)) { try { book.readMetaInfo(); book.save(); } catch (BookReadingException e) { doAdd = false; } file.setCached(false); } if (doAdd) { addBookToLibrary(book); if (++count % 16 == 0) { fireModelChangedEvent(ChangeListener.Code.BookAdded); } } } else { fireModelChangedEvent(ChangeListener.Code.BookRemoved); orphanedBooks.add(book); } } } fireModelChangedEvent(ChangeListener.Code.BookAdded); myDatabase.setExistingFlag(orphanedBooks, false); // Step 3: collect books from physical files; add new, update already added, // unmark orphaned as existing again, collect newly added final Map<Long,Book> orphanedBooksByFileId = myDatabase.loadBooks(fileInfos, false); final Set<Book> newBooks = new HashSet<Book>(); final List<ZLPhysicalFile> physicalFilesList = collectPhysicalFiles(); for (ZLPhysicalFile file : physicalFilesList) { if (physicalFiles.contains(file)) { continue; } collectBooks( file, fileInfos, savedBooksByFileId, orphanedBooksByFileId, newBooks, !fileInfos.check(file, true) ); file.setCached(false); } // Step 4: add help file try { final ZLFile helpFile = getHelpFile(); Book helpBook = savedBooksByFileId.get(fileInfos.getId(helpFile)); if (helpBook == null) { helpBook = new Book(helpFile); } addBookToLibrary(helpBook); fireModelChangedEvent(ChangeListener.Code.BookAdded); } catch (BookReadingException e) { // that's impossible e.printStackTrace(); } // Step 5: save changes into database fileInfos.save(); myDatabase.executeAsATransaction(new Runnable() { public void run() { for (Book book : newBooks) { book.save(); } } }); myDatabase.setExistingFlag(newBooks, true); } private volatile boolean myBuildStarted = false; public synchronized void startBuild() { if (myBuildStarted) { fireModelChangedEvent(ChangeListener.Code.StatusChanged); return; } myBuildStarted = true; setStatus(myStatusMask | STATUS_LOADING); final Thread builder = new Thread("Library.build") { public void run() { try { build(); } finally { setStatus(myStatusMask & ~STATUS_LOADING); } } }; builder.setPriority((Thread.MIN_PRIORITY + Thread.NORM_PRIORITY) / 2); builder.start(); } >>>>>>>
<<<<<<< private final class CoverSyncRunnable implements Runnable { private final ViewHolder myHolder; private final ZLLoadableImage myImage; private final int myWidth; private final int myHeight; private final Key myKey; private final NetworkTree myTree; CoverSyncRunnable(ViewHolder holder, ZLLoadableImage image, int width, int height) { myHolder = holder; myImage = image; myWidth = width; myHeight = height; synchronized(holder) { myKey = holder.key; myTree = holder.tree; holder.coverSyncRunnable = this; } } public void run() { synchronized (myHolder) { try { if (myHolder.coverSyncRunnable != this) return; if (myHolder.key != myKey || myHolder.tree != myTree) return; if (!myImage.isSynchronized()) return; if (myCachedBitmaps.containsKey(myHolder.key)) return; final ZLAndroidImageManager mgr = (ZLAndroidImageManager)ZLAndroidImageManager.Instance(); final ZLAndroidImageData data = mgr.getImageData(myImage); if (data == null) return; getActivity().runOnUiThread(new Runnable() { @Override public void run() { synchronized(myHolder) { if (myHolder.key != myKey || myHolder.tree != myTree) return; startUpdateCover(myHolder, myImage, myWidth, myHeight); } } }); } finally { if (myHolder.coverSyncRunnable == this) myHolder.coverSyncRunnable = null; } } } } public View getView(int position, View view, final ViewGroup parent) { ======= private static class ImageDataProcessor implements ZLAndroidImageManager.DataProcessor { public void process(ZLAndroidImageData data) { } } public View getView(int position, View convertView, final ViewGroup parent) { >>>>>>> private final class CoverSyncRunnable implements Runnable { private final ViewHolder myHolder; private final ZLLoadableImage myImage; private final int myWidth; private final int myHeight; private final Key myKey; private final NetworkTree myTree; CoverSyncRunnable(ViewHolder holder, ZLLoadableImage image, int width, int height) { myHolder = holder; myImage = image; myWidth = width; myHeight = height; synchronized(holder) { myKey = holder.key; myTree = holder.tree; holder.coverSyncRunnable = this; } } public void run() { synchronized (myHolder) { try { if (myHolder.coverSyncRunnable != this) return; if (myHolder.key != myKey || myHolder.tree != myTree) return; if (!myImage.isSynchronized()) return; if (myCachedBitmaps.containsKey(myHolder.key)) return; final ZLAndroidImageManager mgr = (ZLAndroidImageManager)ZLAndroidImageManager.Instance(); final ZLAndroidImageData data = mgr.getImageData(myImage); if (data == null) return; getActivity().runOnUiThread(new Runnable() { @Override public void run() { synchronized(myHolder) { if (myHolder.key != myKey || myHolder.tree != myTree) return; startUpdateCover(myHolder, myImage, myWidth, myHeight); } } }); } finally { if (myHolder.coverSyncRunnable == this) myHolder.coverSyncRunnable = null; } } } } private static class ImageDataProcessor implements ZLAndroidImageManager.DataProcessor { public void process(ZLAndroidImageData data) { } } public View getView(int position, View view, final ViewGroup parent) {
<<<<<<< lookNFeelCategory.addOption(ZLAndroidApplication.Instance().DontTurnScreenOffOption, "dontTurnScreenOff"); ======= lookNFeelCategory.addPreference(new BatteryLevelToTurnScreenOffPreference( this, ZLAndroidApplication.Instance().BatteryLevelToTurnScreenOffOption, lookNFeelCategory.Resource, "dontTurnScreenOff" )); String[] scrollBarTypes = {"hide", "show", "showAsProgress"}; lookNFeelCategory.addPreference(new ZLChoicePreference( this, lookNFeelCategory.Resource, "scrollbarType", fbReader.ScrollbarTypeOption, scrollBarTypes)); >>>>>>> lookNFeelCategory.addPreference(new BatteryLevelToTurnScreenOffPreference( this, ZLAndroidApplication.Instance().BatteryLevelToTurnScreenOffOption, lookNFeelCategory.Resource, "dontTurnScreenOff" ));
<<<<<<< if (myCoverManager == null) { view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final int height = view.getMeasuredHeight(); myCoverManager = new CoverManager(getActivity(), height * 15 / 32, height); view.requestLayout(); } CoverHolder holder = (CoverHolder)view.getTag(); if (holder == null) { final ImageView coverView = (ImageView)view.findViewById(R.id.library_tree_item_icon); holder = new CoverHolder(myCoverManager, coverView, tree.getUniqueKey()); view.setTag(holder); ======= if (myCoverManager == null) { view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); int coverHeight = view.getMeasuredHeight(); myCoverManager = new CoverManager(getActivity(), coverHeight * 15 / 32, coverHeight); view.requestLayout(); } final ImageView coverView = getCoverView(view); final Bitmap coverBitmap = getCoverBitmap(tree.getCover()); if (coverBitmap != null) { coverView.setImageBitmap(coverBitmap); >>>>>>> if (myCoverManager == null) { view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final int coverHeight = view.getMeasuredHeight(); myCoverManager = new CoverManager(getActivity(), coverHeight * 15 / 32, coverHeight); view.requestLayout(); } CoverHolder holder = (CoverHolder)view.getTag(); if (holder == null) { final ImageView coverView = (ImageView)view.findViewById(R.id.library_tree_item_icon); holder = new CoverHolder(myCoverManager, coverView, tree.getUniqueKey()); view.setTag(holder);
<<<<<<< public static interface CredentialsCreator { Credentials createCredentials(String scheme, AuthScope scope, boolean quietMode); boolean credentialsExist(AuthScope scope); void removeCredentials(AuthScope scope); } public static abstract class BasicCredentialsCreator implements ZLNetworkManager.CredentialsCreator { final private HashMap<AuthScope, Credentials> myCredentialsMap = new HashMap<AuthScope, Credentials> (); ======= public static abstract class CredentialsCreator { >>>>>>> public static abstract class CredentialsCreator { final private HashMap<AuthScope, Credentials> myCredentialsMap = new HashMap<AuthScope, Credentials> (); <<<<<<< public Credentials createCredentials(String scheme, AuthScope scope, boolean quietMode) { if (!"basic".equalsIgnoreCase(scope.getScheme()) && !"digest".equalsIgnoreCase(scope.getScheme())) { ======= public Credentials createCredentials(String scheme, AuthScope scope) { final String authScheme = scope.getScheme(); if (!"basic".equalsIgnoreCase(authScheme) && !"digest".equalsIgnoreCase(authScheme)) { >>>>>>> public Credentials createCredentials(String scheme, AuthScope scope, boolean quietMode) { final String authScheme = scope.getScheme(); if (!"basic".equalsIgnoreCase(authScheme) && !"digest".equalsIgnoreCase(authScheme)) {
<<<<<<< private final RootTree myRootTree; ======= private final Map<ZLFile,Book> myBooks = Collections.synchronizedMap(new HashMap<ZLFile,Book>()); private final RootTree myRootTree; >>>>>>> private final RootTree myRootTree; <<<<<<< myRootTree = new RootTree(collection); new FavoritesTree(myRootTree); new RecentBooksTree(myRootTree); new AuthorListTree(myRootTree); new FirstLevelTree(myRootTree, ROOT_BY_TITLE); new FirstLevelTree(myRootTree, ROOT_BY_TAG); new FileFirstLevelTree(myRootTree); } public void init() { Collection.addListener(new IBookCollection.Listener() { public void onBookEvent(BookEvent event, Book book) { switch (event) { case Added: addBookToLibrary(book); synchronized (myStatusLock) { if ((myStatusMask & STATUS_LOADING) == 0 || Collection.size() % 16 == 0) { Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); } } break; } } public void onBuildEvent(BuildEvent event) { switch (event) { case Started: //setStatus(myStatusMask | STATUS_LOADING); break; case Completed: Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); //setStatus(myStatusMask & ~STATUS_LOADING); break; } } }); final Thread initializer = new Thread() { public void run() { setStatus(myStatusMask | STATUS_LOADING); int count = 0; for (Book book : Collection.books()) { addBookToLibrary(book); if (++count % 16 == 0) { Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); } } Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); setStatus(myStatusMask & ~STATUS_LOADING); } }; initializer.setPriority((Thread.MIN_PRIORITY + Thread.NORM_PRIORITY) / 2); initializer.start(); ======= myRootTree = new RootTree(Collection); new FavoritesTree(myRootTree); new RecentBooksTree(myRootTree); new FirstLevelTree(myRootTree, LibraryTree.ROOT_BY_AUTHOR); new FirstLevelTree(myRootTree, LibraryTree.ROOT_BY_TITLE); new FirstLevelTree(myRootTree, LibraryTree.ROOT_BY_TAG); new FileFirstLevelTree(myRootTree); >>>>>>> myRootTree = new RootTree(collection); new FavoritesTree(myRootTree); new RecentBooksTree(myRootTree); new AuthorListTree(myRootTree); new FirstLevelTree(myRootTree, LibraryTree.ROOT_BY_TITLE); new FirstLevelTree(myRootTree, LibraryTree.ROOT_BY_TAG); new FileFirstLevelTree(myRootTree); } public void init() { Collection.addListener(new IBookCollection.Listener() { public void onBookEvent(BookEvent event, Book book) { switch (event) { case Added: addBookToLibrary(book); synchronized (myStatusLock) { if ((myStatusMask & STATUS_LOADING) == 0 || Collection.size() % 16 == 0) { Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); } } break; } } public void onBuildEvent(BuildEvent event) { switch (event) { case Started: //setStatus(myStatusMask | STATUS_LOADING); break; case Completed: Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); //setStatus(myStatusMask & ~STATUS_LOADING); break; } } }); final Thread initializer = new Thread() { public void run() { setStatus(myStatusMask | STATUS_LOADING); int count = 0; for (Book book : Collection.books()) { addBookToLibrary(book); if (++count % 16 == 0) { Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); } } Library.this.fireModelChangedEvent(ChangeListener.Code.BookAdded); setStatus(myStatusMask & ~STATUS_LOADING); } }; initializer.setPriority((Thread.MIN_PRIORITY + Thread.NORM_PRIORITY) / 2); initializer.start(); <<<<<<< ======= for (Author a : authors) { final AuthorTree authorTree = getFirstLevelTree(LibraryTree.ROOT_BY_AUTHOR).getAuthorSubTree(a); if (seriesInfo == null) { authorTree.getBookSubTree(book, false); } else { authorTree.getSeriesSubTree(seriesInfo.Title).getBookInSeriesSubTree(book); } } >>>>>>> <<<<<<< getFirstLevelTree(ROOT_BY_TITLE).getTitleSubTree(letter); tree.getBookWithAuthorsSubTree(book); ======= getFirstLevelTree(LibraryTree.ROOT_BY_TITLE).getTitleSubTree(letter); tree.getBookSubTree(book, true); >>>>>>> getFirstLevelTree(LibraryTree.ROOT_BY_TITLE).getTitleSubTree(letter); tree.getBookWithAuthorsSubTree(book); <<<<<<< getFirstLevelTree(ROOT_BY_TITLE).getBookWithAuthorsSubTree(book); ======= getFirstLevelTree(LibraryTree.ROOT_BY_TITLE).getBookSubTree(book, true); >>>>>>> getFirstLevelTree(LibraryTree.ROOT_BY_TITLE).getBookWithAuthorsSubTree(book); <<<<<<< synchronized (this) { final SearchResultsTree found = (SearchResultsTree)getFirstLevelTree(ROOT_FOUND); if (found != null && book.matches(found.getPattern())) { found.getBookWithAuthorsSubTree(book); } ======= final SearchResultsTree found = (SearchResultsTree)getFirstLevelTree(LibraryTree.ROOT_FOUND); if (found != null && book.matches(found.getPattern())) { found.getBookSubTree(book, true); >>>>>>> synchronized (this) { final SearchResultsTree found = (SearchResultsTree)getFirstLevelTree(LibraryTree.ROOT_FOUND); if (found != null && book.matches(found.getPattern())) { found.getBookWithAuthorsSubTree(book); } <<<<<<< ======= private void refreshInTree(String rootId, Book book) { final FirstLevelTree tree = getFirstLevelTree(rootId); if (tree != null) { int index = tree.indexOf(new BookTree(Collection, book, true)); if (index >= 0) { tree.removeBook(book, false); new BookTree(tree, book, true, index); } } } >>>>>>> <<<<<<< Collection.saveBook(book, true); myBooks.remove(book.getId()); removeFromTree(ROOT_FOUND, book); removeFromTree(ROOT_BY_TITLE, book); removeFromTree(ROOT_BY_SERIES, book); removeFromTree(ROOT_BY_TAG, book); ======= myBooks.remove(book.File); refreshInTree(LibraryTree.ROOT_FAVORITES, book); removeFromTree(LibraryTree.ROOT_FOUND, book); removeFromTree(LibraryTree.ROOT_BY_TITLE, book); removeFromTree(LibraryTree.ROOT_BY_SERIES, book); removeFromTree(LibraryTree.ROOT_BY_AUTHOR, book); removeFromTree(LibraryTree.ROOT_BY_TAG, book); >>>>>>> Collection.saveBook(book, true); myBooks.remove(book.getId()); removeFromTree(LibraryTree.ROOT_FOUND, book); removeFromTree(LibraryTree.ROOT_BY_TITLE, book); removeFromTree(LibraryTree.ROOT_BY_SERIES, book); removeFromTree(LibraryTree.ROOT_BY_TAG, book); <<<<<<< ======= private void build() { // Step 0: get database books marked as "existing" final FileInfoSet fileInfos = new FileInfoSet(myDatabase); final Map<Long,Book> savedBooksByFileId = myDatabase.loadBooks(fileInfos, true); final Map<Long,Book> savedBooksByBookId = new HashMap<Long,Book>(); for (Book b : savedBooksByFileId.values()) { savedBooksByBookId.put(b.getId(), b); } // Step 1: set myDoGroupTitlesByFirstLetter value, // add "existing" books into recent and favorites lists if (savedBooksByFileId.size() > 10) { final HashSet<String> letterSet = new HashSet<String>(); for (Book book : savedBooksByFileId.values()) { final String letter = TitleTree.firstTitleLetter(book); if (letter != null) { letterSet.add(letter); } } myDoGroupTitlesByFirstLetter = savedBooksByFileId.values().size() > letterSet.size() * 5 / 4; } for (Book book : Collection.favorites()) { getFirstLevelTree(LibraryTree.ROOT_FAVORITES).getBookSubTree(book, true); } fireModelChangedEvent(ChangeListener.Code.BookAdded); // Step 2: check if files corresponding to "existing" books really exists; // add books to library if yes (and reload book info if needed); // remove from recent/favorites list if no; // collect newly "orphaned" books final Set<Book> orphanedBooks = new HashSet<Book>(); final Set<ZLPhysicalFile> physicalFiles = new HashSet<ZLPhysicalFile>(); int count = 0; for (Book book : savedBooksByFileId.values()) { synchronized (this) { final ZLPhysicalFile file = book.File.getPhysicalFile(); if (file != null) { physicalFiles.add(file); } if (file != book.File && file != null && file.getPath().endsWith(".epub")) { continue; } if (book.File.exists()) { boolean doAdd = true; if (file == null) { continue; } if (!fileInfos.check(file, true)) { try { book.readMetaInfo(); book.save(); } catch (BookReadingException e) { doAdd = false; } file.setCached(false); } if (doAdd) { addBookToLibrary(book); if (++count % 16 == 0) { fireModelChangedEvent(ChangeListener.Code.BookAdded); } } } else { myRootTree.removeBook(book, true); fireModelChangedEvent(ChangeListener.Code.BookRemoved); orphanedBooks.add(book); } } } fireModelChangedEvent(ChangeListener.Code.BookAdded); myDatabase.setExistingFlag(orphanedBooks, false); // Step 3: collect books from physical files; add new, update already added, // unmark orphaned as existing again, collect newly added final Map<Long,Book> orphanedBooksByFileId = myDatabase.loadBooks(fileInfos, false); final Set<Book> newBooks = new HashSet<Book>(); final List<ZLPhysicalFile> physicalFilesList = collectPhysicalFiles(); for (ZLPhysicalFile file : physicalFilesList) { if (physicalFiles.contains(file)) { continue; } collectBooks( file, fileInfos, savedBooksByFileId, orphanedBooksByFileId, newBooks, !fileInfos.check(file, true) ); file.setCached(false); } // Step 4: add help file try { final ZLFile helpFile = getHelpFile(); Book helpBook = savedBooksByFileId.get(fileInfos.getId(helpFile)); if (helpBook == null) { helpBook = new Book(helpFile); } addBookToLibrary(helpBook); fireModelChangedEvent(ChangeListener.Code.BookAdded); } catch (BookReadingException e) { // that's impossible e.printStackTrace(); } // Step 5: save changes into database fileInfos.save(); myDatabase.executeAsATransaction(new Runnable() { public void run() { for (Book book : newBooks) { book.save(); } } }); myDatabase.setExistingFlag(newBooks, true); } private volatile boolean myBuildStarted = false; public synchronized void startBuild() { if (myBuildStarted) { fireModelChangedEvent(ChangeListener.Code.StatusChanged); return; } myBuildStarted = true; setStatus(myStatusMask | STATUS_LOADING); final Thread builder = new Thread("Library.build") { public void run() { try { build(); } finally { setStatus(myStatusMask & ~STATUS_LOADING); } } }; builder.setPriority((Thread.MIN_PRIORITY + Thread.NORM_PRIORITY) / 2); builder.start(); } >>>>>>> <<<<<<< synchronized (this) { for (Book book : Collection.books(pattern)) { if (newSearchResults == null) { if (oldSearchResults != null) { oldSearchResults.removeSelf(); ======= final List<Book> booksCopy; synchronized (myBooks) { booksCopy = new ArrayList<Book>(myBooks.values()); } for (Book book : booksCopy) { if (book.matches(pattern)) { synchronized (this) { if (newSearchResults == null) { if (oldSearchResults != null) { oldSearchResults.removeSelf(); } newSearchResults = new SearchResultsTree(myRootTree, LibraryTree.ROOT_FOUND, pattern); fireModelChangedEvent(ChangeListener.Code.Found); >>>>>>> synchronized (this) { for (Book book : Collection.books(pattern)) { if (newSearchResults == null) { if (oldSearchResults != null) { oldSearchResults.removeSelf(); <<<<<<< ======= public void addBookToRecentList(Book book) { Collection.addBookToRecentList(book); } public boolean isBookInFavorites(Book book) { if (book == null) { return false; } final LibraryTree rootFavorites = getFirstLevelTree(LibraryTree.ROOT_FAVORITES); for (FBTree tree : rootFavorites.subTrees()) { if (tree instanceof BookTree && book.equals(((BookTree)tree).Book)) { return true; } } return false; } public void addBookToFavorites(Book book) { if (isBookInFavorites(book)) { return; } final LibraryTree rootFavorites = getFirstLevelTree(LibraryTree.ROOT_FAVORITES); rootFavorites.getBookSubTree(book, true); Collection.setBookFavorite(book, true); } public void removeBookFromFavorites(Book book) { if (getFirstLevelTree(LibraryTree.ROOT_FAVORITES).removeBook(book, false)) { Collection.setBookFavorite(book, false); fireModelChangedEvent(ChangeListener.Code.BookRemoved); } } >>>>>>> <<<<<<< Collection.removeBook(book, (removeMode & REMOVE_FROM_DISK) != 0); ======= myBooks.remove(book.File); if (getFirstLevelTree(LibraryTree.ROOT_RECENT).removeBook(book, false)) { final List<Long> ids = myDatabase.loadRecentBookIds(); ids.remove(book.getId()); myDatabase.saveRecentBookIds(ids); } getFirstLevelTree(LibraryTree.ROOT_FAVORITES).removeBook(book, false); >>>>>>> Collection.removeBook(book, (removeMode & REMOVE_FROM_DISK) != 0);
<<<<<<< ======= private BooksDatabase myDatabase; >>>>>>> <<<<<<< mySelectedBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(SELECTED_BOOK_KEY)); ======= mySelectedBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(FBReader.BOOK_KEY)); >>>>>>> mySelectedBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(FBReader.BOOK_KEY));
<<<<<<< final NetworkCatalogTree catalogTree = (NetworkCatalogTree)tree; final NetworkCatalogItem item = catalogTree.Item; if (item.URLByType.get(NetworkCatalogItem.URL_CATALOG) != null) { ======= final NetworkCatalogItem item = ((NetworkCatalogTree)tree).Item; if (!(item instanceof NetworkURLCatalogItem)) { >>>>>>> final NetworkCatalogItem item = ((NetworkCatalogTree)tree).Item; if (!(item instanceof NetworkURLCatalogItem)) { <<<<<<< final NetworkCatalogTree catalogTree = (NetworkCatalogTree)tree; final NetworkCatalogItem item = catalogTree.Item; final boolean isLoading = NetworkView.Instance().containsItemsLoadingRunnable(tree.getUniqueKey()); ======= final NetworkCatalogItem item = ((NetworkCatalogTree)tree).Item; final NetworkURLCatalogItem urlItem = item instanceof NetworkURLCatalogItem ? (NetworkURLCatalogItem)item : null; >>>>>>> final NetworkCatalogItem item = ((NetworkCatalogTree)tree).Item; final NetworkURLCatalogItem urlItem = item instanceof NetworkURLCatalogItem ? (NetworkURLCatalogItem)item : null; <<<<<<< private boolean consumeByVisibility(final NetworkBaseActivity activity, final NetworkCatalogTree tree, final int actionCode) { switch (tree.Item.getVisibility()) { ======= private boolean consumeByVisibility(final NetworkBaseActivity activity, final NetworkTree tree, final int actionCode) { final NetworkCatalogItem item = ((NetworkCatalogTree)tree).Item; switch (item.getVisibility()) { >>>>>>> private boolean consumeByVisibility(final NetworkBaseActivity activity, final NetworkTree tree, final int actionCode) { final NetworkCatalogItem item = ((NetworkCatalogTree)tree).Item; switch (item.getVisibility()) { <<<<<<< ======= final NetworkCatalogTree catalogTree = (NetworkCatalogTree)tree; final NetworkCatalogItem item = catalogTree.Item; >>>>>>> final NetworkCatalogItem item = catalogTree.Item;
<<<<<<< import android.content.*; import android.os.Bundle; import android.view.*; import android.widget.*; import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.zlibrary.ui.android.R; ======= import android.os.Bundle; >>>>>>> import android.content.*; import android.os.Bundle; import android.view.*; import android.widget.*; import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.zlibrary.ui.android.R; <<<<<<< private final int ADD_NEW_DIR_POSITION = 0; private DirectoriesAdapter myAdapter; private String myDefaultDir = "/"; private ArrayList<String> myDirList; private String myChooserTitle; private ZLResource myResource; private boolean myChooseWritableDirectoriesOnly; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.folder_list_dialog); myDirList = getIntent().getStringArrayListExtra(Key.FOLDER_LIST); setTitle(getIntent().getStringExtra(Key.ACTIVITY_TITLE)); myChooserTitle = getIntent().getStringExtra(Key.CHOOSER_TITLE); myChooseWritableDirectoriesOnly = getIntent().getBooleanExtra(Key.WRITABLE_FOLDERS_ONLY, true); myResource = ZLResource.resource("dialog").getResource("folderList"); setupActionButtons(); myDirList.add(ADD_NEW_DIR_POSITION, myResource.getResource("addFolder").getValue()); setupDirectoriesAdapter(myDirList); } private void openFileChooser(int index, String dirName) { FileChooserUtil.runDirectoryChooser( this, index, myChooserTitle, dirName, myChooseWritableDirectoriesOnly ); } private void showMessage(String msg) { Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } private void updateDirs(int index, Intent data) { final String path = FileChooserUtil.pathFromData(data); if (!myDirList.contains(path)) { myDirList.set(index, path); myAdapter.notifyDataSetChanged(); } else if (!path.equals(myDirList.get(index))) { showMessage(myResource.getResource("duplicate").getValue().replace("%s", path)); } } private void addNewDir(Intent data) { final String path = FileChooserUtil.pathFromData(data); if (!myDirList.contains(path)) { myDirList.add(path); myAdapter.notifyDataSetChanged(); } else { showMessage(myResource.getResource("duplicate").getValue().replace("%s", path)); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if(requestCode != ADD_NEW_DIR_POSITION) { updateDirs(requestCode, data); } else { addNewDir(data); } } } private void setupDirectoriesAdapter(ArrayList<String> dirs) { myAdapter = new DirectoriesAdapter(this, dirs); setListAdapter(myAdapter); getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { String dirName = (String)parent.getItemAtPosition(position); if (position <= 0) { dirName = myDefaultDir; } openFileChooser(position, dirName); } }); } private void setupActionButtons() { final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button"); final Button okButton = (Button)findViewById(R.id.folder_list_dialog_button_ok); okButton.setText(buttonResource.getResource("ok").getValue()); okButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { myDirList.remove(0); final Intent result = new Intent(); result.putExtra(Key.FOLDER_LIST, myDirList); setResult(RESULT_OK, result); finish(); } }); final Button cancelButton = (Button)findViewById(R.id.folder_list_dialog_button_cancel); cancelButton.setText(buttonResource.getResource("cancel").getValue()); cancelButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { setResult(RESULT_CANCELED); finish(); } }); } private class DirectoriesAdapter extends ArrayAdapter<String> { public DirectoriesAdapter(Context context, ArrayList<String> dirs) { super(context, R.layout.folder_list_item, dirs); } private void removeItemView(final View view, final int position) { if (view != null && position < getCount()) { myDirList.remove(position); myAdapter.notifyDataSetChanged(); } } @Override public View getView (final int position, View convertView, ViewGroup parent) { final View view = LayoutInflater.from(getContext()).inflate(R.layout.folder_list_item, parent, false); final String dirName = (String) getItem(position); ((TextView)view.findViewById(R.id.folder_list_item_title)).setText(dirName); final ImageView deleteButton = (ImageView) view.findViewById(R.id.folder_list_item_remove); if (position != ADD_NEW_DIR_POSITION) { deleteButton.setVisibility(View.VISIBLE); deleteButton.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button"); final ZLResource removeDialogResource = myResource.getResource("removeDialog"); new AlertDialog.Builder(getContext()) .setCancelable(false) .setTitle(removeDialogResource.getValue()) .setMessage(removeDialogResource.getResource("message").getValue().replace("%s", dirName)) .setPositiveButton(buttonResource.getResource("yes").getValue(), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { removeItemView(v, position); } }) .setNegativeButton(buttonResource.getResource("cancel").getValue(), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { dialog.cancel(); } }).create().show(); } }); } else { deleteButton.setVisibility(View.INVISIBLE); } return view; } } ======= @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } >>>>>>> private final int ADD_NEW_DIR_POSITION = 0; private DirectoriesAdapter myAdapter; private ArrayList<String> myDirList; private String myChooserTitle; private ZLResource myResource; private boolean myChooseWritableDirectoriesOnly; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.folder_list_dialog); myDirList = getIntent().getStringArrayListExtra(Key.FOLDER_LIST); setTitle(getIntent().getStringExtra(Key.ACTIVITY_TITLE)); myChooserTitle = getIntent().getStringExtra(Key.CHOOSER_TITLE); myChooseWritableDirectoriesOnly = getIntent().getBooleanExtra(Key.WRITABLE_FOLDERS_ONLY, true); myResource = ZLResource.resource("dialog").getResource("folderList"); setupActionButtons(); myDirList.add(ADD_NEW_DIR_POSITION, myResource.getResource("addFolder").getValue()); setupDirectoriesAdapter(myDirList); } private void openFileChooser(int index, String dirName) { FileChooserUtil.runDirectoryChooser( this, index, myChooserTitle, dirName, myChooseWritableDirectoriesOnly ); } private void showMessage(String msg) { Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); } private void updateDirs(int index, Intent data) { final String path = FileChooserUtil.pathFromData(data); if (!myDirList.contains(path)) { myDirList.set(index, path); myAdapter.notifyDataSetChanged(); } else if (!path.equals(myDirList.get(index))) { showMessage(myResource.getResource("duplicate").getValue().replace("%s", path)); } } private void addNewDir(Intent data) { final String path = FileChooserUtil.pathFromData(data); if (!myDirList.contains(path)) { myDirList.add(path); myAdapter.notifyDataSetChanged(); } else { showMessage(myResource.getResource("duplicate").getValue().replace("%s", path)); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if(requestCode != ADD_NEW_DIR_POSITION) { updateDirs(requestCode, data); } else { addNewDir(data); } } } private void setupDirectoriesAdapter(ArrayList<String> dirs) { myAdapter = new DirectoriesAdapter(this, dirs); setListAdapter(myAdapter); getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { String dirName = (String)parent.getItemAtPosition(position); if (position <= 0) { dirName = "/"; } openFileChooser(position, dirName); } }); } private void setupActionButtons() { final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button"); final Button okButton = (Button)findViewById(R.id.folder_list_dialog_button_ok); okButton.setText(buttonResource.getResource("ok").getValue()); okButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { myDirList.remove(0); final Intent result = new Intent(); result.putExtra(Key.FOLDER_LIST, myDirList); setResult(RESULT_OK, result); finish(); } }); final Button cancelButton = (Button)findViewById(R.id.folder_list_dialog_button_cancel); cancelButton.setText(buttonResource.getResource("cancel").getValue()); cancelButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { setResult(RESULT_CANCELED); finish(); } }); } private class DirectoriesAdapter extends ArrayAdapter<String> { public DirectoriesAdapter(Context context, ArrayList<String> dirs) { super(context, R.layout.folder_list_item, dirs); } private void removeItemView(final View view, final int position) { if (view != null && position < getCount()) { myDirList.remove(position); myAdapter.notifyDataSetChanged(); } } @Override public View getView (final int position, View convertView, ViewGroup parent) { final View view = LayoutInflater.from(getContext()).inflate(R.layout.folder_list_item, parent, false); final String dirName = (String) getItem(position); ((TextView)view.findViewById(R.id.folder_list_item_title)).setText(dirName); final ImageView deleteButton = (ImageView) view.findViewById(R.id.folder_list_item_remove); if (position != ADD_NEW_DIR_POSITION) { deleteButton.setVisibility(View.VISIBLE); deleteButton.setOnClickListener(new View.OnClickListener() { public void onClick(final View v) { final ZLResource buttonResource = ZLResource.resource("dialog").getResource("button"); final ZLResource removeDialogResource = myResource.getResource("removeDialog"); new AlertDialog.Builder(getContext()) .setCancelable(false) .setTitle(removeDialogResource.getValue()) .setMessage(removeDialogResource.getResource("message").getValue().replace("%s", dirName)) .setPositiveButton(buttonResource.getResource("yes").getValue(), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { removeItemView(v, position); } }) .setNegativeButton(buttonResource.getResource("cancel").getValue(), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog,int id) { dialog.cancel(); } }).create().show(); } }); } else { deleteButton.setVisibility(View.INVISIBLE); } return view; } }
<<<<<<< ======= private static class ParagonInfoReader extends ZLXMLReaderAdapter { private final Context myContext; private int myCounter; ParagonInfoReader(Context context) { myContext = context; } @Override public boolean dontCacheAttributeValues() { return true; } @Override public boolean startElementHandler(String tag, ZLStringMap attributes) { if ("dictionary".equals(tag)) { final String id = attributes.getValue("id"); final String title = attributes.getValue("title"); final PackageInfo info = new PackageInfo( String.valueOf(++myCounter), attributes.getValue("package"), ".Start", attributes.getValue("title"), Intent.ACTION_VIEW, null, attributes.getValue("pattern") ); if (PackageUtil.canBeStarted(myContext, info.getDictionaryIntent("test"), false)) { ourInfos.put(info, FLAG_SHOW_AS_DICTIONARY | FLAG_INSTALLED_ONLY); } } return false; } } >>>>>>> <<<<<<< private static Intent getDictionaryIntent(String text, boolean singleWord) { return getDictionaryIntent(getCurrentDictionaryInfo(singleWord), text); } public static Intent getDictionaryIntent(PackageInfo dictionaryInfo, String text) { final Intent intent = new Intent(dictionaryInfo.IntentAction); if (dictionaryInfo.PackageName != null) { String cls = dictionaryInfo.ClassName; if (cls != null) { if (cls.startsWith(".")) { cls = dictionaryInfo.PackageName + cls; } intent.setComponent(new ComponentName( dictionaryInfo.PackageName, cls )); } } intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); text = dictionaryInfo.IntentDataPattern.replace("%s", text); if (dictionaryInfo.IntentKey != null) { return intent.putExtra(dictionaryInfo.IntentKey, text); } else { return intent.setData(Uri.parse(text)); } } public static class PopupFrameMetric { public final int Height; public final int Gravity; PopupFrameMetric(DisplayMetrics metrics, int selectionTop, int selectionBottom) { final int screenHeight = metrics.heightPixels; final int topSpace = selectionTop; final int bottomSpace = metrics.heightPixels - selectionBottom; final boolean showAtBottom = bottomSpace >= topSpace; final int space = (showAtBottom ? bottomSpace : topSpace) - metrics.densityDpi / 12; final int maxHeight = Math.min(metrics.densityDpi * 20 / 12, screenHeight * 2 / 3); final int minHeight = Math.min(metrics.densityDpi * 10 / 12, screenHeight * 2 / 3); Height = Math.max(minHeight, Math.min(maxHeight, space)); Gravity = showAtBottom ? android.view.Gravity.BOTTOM : android.view.Gravity.TOP; } } ======= >>>>>>> public static class PopupFrameMetric { public final int Height; public final int Gravity; PopupFrameMetric(DisplayMetrics metrics, int selectionTop, int selectionBottom) { final int screenHeight = metrics.heightPixels; final int topSpace = selectionTop; final int bottomSpace = metrics.heightPixels - selectionBottom; final boolean showAtBottom = bottomSpace >= topSpace; final int space = (showAtBottom ? bottomSpace : topSpace) - metrics.densityDpi / 12; final int maxHeight = Math.min(metrics.densityDpi * 20 / 12, screenHeight * 2 / 3); final int minHeight = Math.min(metrics.densityDpi * 10 / 12, screenHeight * 2 / 3); Height = Math.max(minHeight, Math.min(maxHeight, space)); Gravity = showAtBottom ? android.view.Gravity.BOTTOM : android.view.Gravity.TOP; } } <<<<<<< if (info instanceof OpenDictionaryPackageInfo) { Log.d("FBReader", "DictionaryUtil - work with Open Dictionary API :" + text); final OpenDictionaryPackageInfo openDictionary = (OpenDictionaryPackageInfo)info; openDictionary.Flyout.showTranslation(activity, text, frameMetrics); return; } final Intent intent = getDictionaryIntent(info, text); ======= final Intent intent = info.getDictionaryIntent(text); >>>>>>> if (info instanceof OpenDictionaryPackageInfo) { Log.d("FBReader", "DictionaryUtil - work with Open Dictionary API :" + text); final OpenDictionaryPackageInfo openDictionary = (OpenDictionaryPackageInfo)info; openDictionary.Flyout.showTranslation(activity, text, frameMetrics); return; } final Intent intent = info.getDictionaryIntent(text);
<<<<<<< private final Accessibility myAccessibility; public final int CatalogType; ======= public final int Visibility; private final CatalogType myCatalogType; >>>>>>> private final Accessibility myAccessibility; private final CatalogType myCatalogType; <<<<<<< * Creates new NetworkCatalogItem instance with <code>Accessibility.ALWAYS</code> accessibility and <code>CATALOG_OTHER</code> type. ======= * Creates new NetworkCatalogItem instance with <code>VISIBLE_ALWAYS</code> visibility and <code>CatalogType.OTHER</code> type. >>>>>>> * Creates new NetworkCatalogItem instance with <code>Accessibility.ALWAYS</code> accessibility and <code>CatalogType.OTHER</code> type. <<<<<<< public NetworkCatalogItem(INetworkLink link, String title, String summary, String cover, Map<Integer, String> urlByType, Accessibility accessibility) { this(link, title, summary, cover, urlByType, accessibility, CATALOG_OTHER); ======= public NetworkCatalogItem(INetworkLink link, String title, String summary, String cover, Map<Integer, String> urlByType, int visibility) { this(link, title, summary, cover, urlByType, visibility, CatalogType.OTHER); >>>>>>> public NetworkCatalogItem(INetworkLink link, String title, String summary, String cover, Map<Integer, String> urlByType, Accessibility accessibility) { this(link, title, summary, cover, urlByType, accessibility, CatalogType.OTHER); <<<<<<< myAccessibility = accessibility; CatalogType = catalogType; ======= Visibility = visibility; myCatalogType = catalogType; >>>>>>> myAccessibility = accessibility; myCatalogType = catalogType; <<<<<<< public ZLBoolean3 getVisibility() { final NetworkAuthenticationManager mgr = Link.authenticationManager(); switch (myAccessibility) { default: ======= public final CatalogType getCatalogType() { return myCatalogType; } public int getVisibility() { if (Visibility == VISIBLE_ALWAYS) { return ZLBoolean3.B3_TRUE; } if (Visibility == VISIBLE_LOGGED_USER) { if (Link.authenticationManager() == null) { >>>>>>> public final CatalogType getCatalogType() { return myCatalogType; } public ZLBoolean3 getVisibility() { final NetworkAuthenticationManager mgr = Link.authenticationManager(); switch (myAccessibility) { default:
<<<<<<< fbReader.addAction(ActionCode.SPEAK, new SpeakAction(this, fbReader)); ======= fbReader.addAction(ActionCode.CANCEL, new CancelAction(this, fbReader)); } @Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { final String pattern = intent.getStringExtra(SearchManager.QUERY); final Handler successHandler = new Handler() { public void handleMessage(Message message) { showTextSearchControls(true); } }; final Handler failureHandler = new Handler() { public void handleMessage(Message message) { UIUtil.showErrorMessage(FBReader.this, "textNotFound"); } }; final Runnable runnable = new Runnable() { public void run() { final FBReaderApp fbReader = (FBReaderApp)FBReaderApp.Instance(); fbReader.TextSearchPatternOption.setValue(pattern); if (fbReader.getTextView().search(pattern, true, false, false, false) != 0) { successHandler.sendEmptyMessage(0); } else { failureHandler.sendEmptyMessage(0); } } }; UIUtil.wait("search", runnable, this); } else { super.onNewIntent(intent); } >>>>>>> fbReader.addAction(ActionCode.SPEAK, new SpeakAction(this, fbReader)); fbReader.addAction(ActionCode.CANCEL, new CancelAction(this, fbReader)); } @Override protected void onNewIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { final String pattern = intent.getStringExtra(SearchManager.QUERY); final Handler successHandler = new Handler() { public void handleMessage(Message message) { showTextSearchControls(true); } }; final Handler failureHandler = new Handler() { public void handleMessage(Message message) { UIUtil.showErrorMessage(FBReader.this, "textNotFound"); } }; final Runnable runnable = new Runnable() { public void run() { final FBReaderApp fbReader = (FBReaderApp)FBReaderApp.Instance(); fbReader.TextSearchPatternOption.setValue(pattern); if (fbReader.getTextView().search(pattern, true, false, false, false) != 0) { successHandler.sendEmptyMessage(0); } else { failureHandler.sendEmptyMessage(0); } } }; UIUtil.wait("search", runnable, this); } else { super.onNewIntent(intent); }
<<<<<<< if (networkAccess != null && networkAccess.isCensored(this)) { ApplicationDependencies.getJobManager().add(new PushNotificationReceiveJob(this)); ======= if (networkAccess.isCensored(this)) { ApplicationDependencies.getJobManager().add(new PushNotificationReceiveJob()); >>>>>>> if (networkAccess != null && networkAccess.isCensored(this)) { ApplicationDependencies.getJobManager().add(new PushNotificationReceiveJob()); <<<<<<< Log.d(TAG, "[" + Log.tag(getClass()) + "] onMasterSecretCleared()"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { finishAndRemoveTask(); } else { finish(); } ======= Log.d(TAG, "onMasterSecretCleared()"); if (ApplicationDependencies.getAppForegroundObserver().isForegrounded()) routeApplicationState(true); else finish(); >>>>>>> Log.d(TAG, "[" + Log.tag(getClass()) + "] onMasterSecretCleared()"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { finishAndRemoveTask(); } else { finish(); }
<<<<<<< import org.thoughtcrime.securesms.*; ======= import com.google.android.material.snackbar.Snackbar; import org.thoughtcrime.securesms.ApplicationContext; import org.thoughtcrime.securesms.ApplicationPreferencesActivity; import org.thoughtcrime.securesms.BlockedContactsActivity; import org.thoughtcrime.securesms.PassphraseChangeActivity; import org.thoughtcrime.securesms.R; >>>>>>> import com.google.android.material.snackbar.Snackbar; import org.thoughtcrime.securesms.ApplicationContext; import org.thoughtcrime.securesms.ApplicationPreferencesActivity; import org.thoughtcrime.securesms.BlockedContactsActivity; import org.thoughtcrime.securesms.ChangePassphraseDialogFragment; import org.thoughtcrime.securesms.R; <<<<<<< import org.thoughtcrime.securesms.preferences.widgets.PassphraseLockTriggerPreference; ======= import org.thoughtcrime.securesms.lock.v2.CreateKbsPinActivity; import org.thoughtcrime.securesms.lock.v2.PinUtil; import org.thoughtcrime.securesms.service.KeyCachingService; >>>>>>> import org.thoughtcrime.securesms.lock.v2.CreateKbsPinActivity; import org.thoughtcrime.securesms.lock.v2.PinUtil; import org.thoughtcrime.securesms.preferences.widgets.PassphraseLockTriggerPreference; <<<<<<< SwitchPreferenceCompat regLock = (SwitchPreferenceCompat) this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF_V1); regLock.setChecked( TextSecurePreferences.isV1RegistrationLockEnabled(requireContext()) || SignalStore.kbsValues().isV2RegistrationLockEnabled() ); regLock.setOnPreferenceClickListener(new AccountLockClickListener()); ======= disablePassphrase = (CheckBoxPreference) this.findPreference("pref_enable_passphrase_temporary"); SwitchPreferenceCompat regLock = (SwitchPreferenceCompat) this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF_V1); Preference kbsPinChange = this.findPreference(TextSecurePreferences.KBS_PIN_CHANGE); Preference regGroup = this.findPreference("prefs_lock_v1"); Preference kbsGroup = this.findPreference("prefs_lock_v2"); if (FeatureFlags.pinsForAll()) { Preference preference = this.findPreference("pref_kbs_change"); regGroup.setVisible(false); if (PinUtil.userHasPin(ApplicationDependencies.getApplication())) { kbsPinChange.setOnPreferenceClickListener(new KbsPinUpdateListener()); preference.setWidgetLayoutResource(R.layout.kbs_pin_change_preference); } else { kbsPinChange.setOnPreferenceClickListener(new KbsPinCreateListener()); preference.setWidgetLayoutResource(R.layout.kbs_pin_create_preference); } } else { kbsGroup.setVisible(false); regLock.setChecked(PinUtil.userHasPin(requireContext())); regLock.setOnPreferenceClickListener(new AccountLockClickListener()); } >>>>>>> SwitchPreferenceCompat regLock = (SwitchPreferenceCompat) this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF_V1); Preference kbsPinChange = this.findPreference(TextSecurePreferences.KBS_PIN_CHANGE); Preference regGroup = this.findPreference("prefs_lock_v1"); Preference kbsGroup = this.findPreference("prefs_lock_v2"); if (FeatureFlags.pinsForAll()) { Preference preference = this.findPreference("pref_kbs_change"); regGroup.setVisible(false); if (PinUtil.userHasPin(ApplicationDependencies.getApplication())) { kbsPinChange.setOnPreferenceClickListener(new KbsPinUpdateListener()); preference.setWidgetLayoutResource(R.layout.kbs_pin_change_preference); } else { kbsPinChange.setOnPreferenceClickListener(new KbsPinCreateListener()); preference.setWidgetLayoutResource(R.layout.kbs_pin_create_preference); } } else { kbsGroup.setVisible(false); regLock.setChecked(PinUtil.userHasPin(requireContext())); regLock.setOnPreferenceClickListener(new AccountLockClickListener()); } <<<<<<< private class ChangePassphraseClickListener implements Preference.OnPreferenceClickListener { @Override public boolean onPreferenceClick(Preference preference) { if (TextSecurePreferences.isPassphraseLockEnabled(getContext())) { ChangePassphraseDialogFragment dialog = ChangePassphraseDialogFragment.newInstance(); dialog.setMasterSecretChangedListener(masterSecret -> { Toast.makeText(getActivity(), R.string.preferences__passphrase_changed, Toast.LENGTH_LONG).show(); masterSecret.close(); }); dialog.show(requireFragmentManager(), "ChangePassphraseDialogFragment"); } else { Toast.makeText(getActivity(), R.string.ApplicationPreferenceActivity_you_havent_set_a_passphrase_yet, Toast.LENGTH_LONG).show(); } return true; } } private class PassphraseLockTriggerChangeListener implements Preference.OnPreferenceChangeListener { @SuppressWarnings("unchecked") @Override public boolean onPreferenceChange(Preference preference, Object newValue) { PassphraseLockTriggerPreference trigger = new PassphraseLockTriggerPreference((Set<String>)newValue); preference.setSummary(getSummaryForPassphraseLockTrigger(trigger.getTriggers())); findPreference(TextSecurePreferences.PASSPHRASE_LOCK_TIMEOUT).setEnabled(trigger.isTimeoutEnabled()); return true; } } ======= private class KbsPinUpdateListener implements Preference.OnPreferenceClickListener { @Override public boolean onPreferenceClick(Preference preference) { startActivityForResult(CreateKbsPinActivity.getIntentForPinChangeFromSettings(requireContext()), CreateKbsPinActivity.REQUEST_NEW_PIN); return true; } } private class KbsPinCreateListener implements Preference.OnPreferenceClickListener { @Override public boolean onPreferenceClick(Preference preference) { startActivityForResult(CreateKbsPinActivity.getIntentForPinCreate(requireContext()), CreateKbsPinActivity.REQUEST_NEW_PIN); return true; } } >>>>>>> private class ChangePassphraseClickListener implements Preference.OnPreferenceClickListener { @Override public boolean onPreferenceClick(Preference preference) { if (TextSecurePreferences.isPassphraseLockEnabled(getContext())) { ChangePassphraseDialogFragment dialog = ChangePassphraseDialogFragment.newInstance(); dialog.setMasterSecretChangedListener(masterSecret -> { Toast.makeText(getActivity(), R.string.preferences__passphrase_changed, Toast.LENGTH_LONG).show(); masterSecret.close(); }); dialog.show(requireFragmentManager(), "ChangePassphraseDialogFragment"); } else { Toast.makeText(getActivity(), R.string.ApplicationPreferenceActivity_you_havent_set_a_passphrase_yet, Toast.LENGTH_LONG).show(); } return true; } } private class KbsPinUpdateListener implements Preference.OnPreferenceClickListener { @Override public boolean onPreferenceClick(Preference preference) { startActivityForResult(CreateKbsPinActivity.getIntentForPinChangeFromSettings(requireContext()), CreateKbsPinActivity.REQUEST_NEW_PIN); return true; } } private class PassphraseLockTriggerChangeListener implements Preference.OnPreferenceChangeListener { @SuppressWarnings("unchecked") @Override public boolean onPreferenceChange(Preference preference, Object newValue) { PassphraseLockTriggerPreference trigger = new PassphraseLockTriggerPreference((Set<String>)newValue); preference.setSummary(getSummaryForPassphraseLockTrigger(trigger.getTriggers())); findPreference(TextSecurePreferences.PASSPHRASE_LOCK_TIMEOUT).setEnabled(trigger.isTimeoutEnabled()); return true; } } private class KbsPinCreateListener implements Preference.OnPreferenceClickListener { @Override public boolean onPreferenceClick(Preference preference) { startActivityForResult(CreateKbsPinActivity.getIntentForPinCreate(requireContext()), CreateKbsPinActivity.REQUEST_NEW_PIN); return true; } }
<<<<<<< ======= import org.thoughtcrime.securesms.crypto.MasterSecretUtil; import org.thoughtcrime.securesms.database.Database; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.RecipientDatabase; >>>>>>> import org.thoughtcrime.securesms.database.Database; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.RecipientDatabase; <<<<<<< import org.thoughtcrime.securesms.preferences.widgets.PassphraseLockTriggerPreference; ======= import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.storage.StorageSyncHelper; >>>>>>> import org.thoughtcrime.securesms.preferences.widgets.PassphraseLockTriggerPreference; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.storage.StorageSyncHelper;
<<<<<<< ======= import org.thoughtcrime.securesms.migrations.ProfileMigrationJob; import org.thoughtcrime.securesms.migrations.RecipientSearchMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.ProfileMigrationJob; <<<<<<< ======= put(ProfileMigrationJob.KEY, new ProfileMigrationJob.Factory()); put(RecipientSearchMigrationJob.KEY, new RecipientSearchMigrationJob.Factory()); >>>>>>> put(ProfileMigrationJob.KEY, new ProfileMigrationJob.Factory());
<<<<<<< public static synchronized @NonNull KeyBackupService getKeyBackupService() { return getSignalServiceAccountManager().getKeyBackupService(IasKeyStore.getIasKeyStore(getApplication()), BuildConfig.KBS_ENCLAVE_NAME, Hex.fromStringOrThrow(BuildConfig.KBS_SERVICE_ID), BuildConfig.KBS_MRENCLAVE, ======= public static synchronized @NonNull KeyBackupService getKeyBackupService(@NonNull KbsEnclave enclave) { return getSignalServiceAccountManager().getKeyBackupService(IasKeyStore.getIasKeyStore(application), enclave.getEnclaveName(), Hex.fromStringOrThrow(enclave.getServiceId()), enclave.getMrEnclave(), >>>>>>> public static synchronized @NonNull KeyBackupService getKeyBackupService(@NonNull KbsEnclave enclave) { return getSignalServiceAccountManager().getKeyBackupService(IasKeyStore.getIasKeyStore(getApplication()), enclave.getEnclaveName(), Hex.fromStringOrThrow(enclave.getServiceId()), enclave.getMrEnclave(),
<<<<<<< if (KeyCachingService.isLocked()) { return; } Log.i(TAG, "onMessageReceived() ID: " + remoteMessage.getMessageId() + ", Delay: " + (System.currentTimeMillis() - remoteMessage.getSentTime())); ======= Log.i(TAG, "onMessageReceived() ID: " + remoteMessage.getMessageId() + ", Delay: " + (System.currentTimeMillis() - remoteMessage.getSentTime()) + ", Original Priority: " + remoteMessage.getOriginalPriority()); >>>>>>> if (KeyCachingService.isLocked()) { return; } Log.i(TAG, "onMessageReceived() ID: " + remoteMessage.getMessageId() + ", Delay: " + (System.currentTimeMillis() - remoteMessage.getSentTime()) + ", Original Priority: " + remoteMessage.getOriginalPriority());
<<<<<<< private final LiveData<Boolean> canDelete; ======= private final LiveData<Boolean> canUnblock; >>>>>>> private final LiveData<Boolean> canUnblock; private final LiveData<Boolean> canDelete; <<<<<<< LiveData<Boolean> getCanDelete() { return canDelete; } ======= LiveData<Boolean> getCanUnblock() { return canUnblock; } >>>>>>> LiveData<Boolean> getCanUnblock() { return canUnblock; } LiveData<Boolean> getCanDelete() { return canDelete; }
<<<<<<< import org.thoughtcrime.securesms.crypto.IdentityKeyUtil; import org.thoughtcrime.securesms.crypto.InvalidPassphraseException; import org.thoughtcrime.securesms.crypto.MasterSecretUtil; import org.thoughtcrime.securesms.crypto.UnrecoverableKeyException; ======= import org.thoughtcrime.securesms.database.DatabaseFactory; >>>>>>> import org.thoughtcrime.securesms.crypto.IdentityKeyUtil; import org.thoughtcrime.securesms.crypto.InvalidPassphraseException; import org.thoughtcrime.securesms.crypto.MasterSecretUtil; import org.thoughtcrime.securesms.crypto.UnrecoverableKeyException; import org.thoughtcrime.securesms.database.DatabaseFactory; <<<<<<< ======= import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.logging.AndroidLogger; >>>>>>> <<<<<<< import org.thoughtcrime.securesms.logging.LogManager; import org.thoughtcrime.securesms.logging.UncaughtExceptionLogger; ======= import org.thoughtcrime.securesms.logging.PersistentLogger; import org.thoughtcrime.securesms.logging.SignalUncaughtExceptionHandler; >>>>>>> import org.thoughtcrime.securesms.logging.LogManager; import org.thoughtcrime.securesms.logging.SignalUncaughtExceptionHandler; <<<<<<< ======= initializeBlobProvider(); initializeCleanup(); initializeCameraX(); FeatureFlags.init(); >>>>>>> initializeCleanup(); FeatureFlags.init(); <<<<<<< ======= FeatureFlags.refresh(); ApplicationDependencies.getRecipientCache().warmUp(); executePendingContactSync(); >>>>>>> <<<<<<< private final BroadcastReceiver keyEventReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { onLock(); } }; private void registerKeyEventReceiver() { IntentFilter filter = new IntentFilter(); filter.addAction(KeyCachingService.CLEAR_KEY_EVENT); registerReceiver(keyEventReceiver, filter, KeyCachingService.KEY_PERMISSION, null); } private void unregisterKeyEventReceiver() { unregisterReceiver(keyEventReceiver); } ======= private void initializeCleanup() { SignalExecutors.BOUNDED.execute(() -> { int deleted = DatabaseFactory.getAttachmentDatabase(this).deleteAbandonedPreuploadedAttachments(); Log.i(TAG, "Deleted " + deleted + " abandoned attachments."); }); } >>>>>>> private final BroadcastReceiver keyEventReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { onLock(); } }; private void registerKeyEventReceiver() { IntentFilter filter = new IntentFilter(); filter.addAction(KeyCachingService.CLEAR_KEY_EVENT); registerReceiver(keyEventReceiver, filter, KeyCachingService.KEY_PERMISSION, null); } private void unregisterKeyEventReceiver() { unregisterReceiver(keyEventReceiver); } private void initializeCleanup() { SignalExecutors.BOUNDED.execute(() -> { int deleted = DatabaseFactory.getAttachmentDatabase(this).deleteAbandonedPreuploadedAttachments(); Log.i(TAG, "Deleted " + deleted + " abandoned attachments."); }); }
<<<<<<< import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; import java.util.concurrent.RejectedExecutionException; ======= import java.util.concurrent.Executor; >>>>>>> import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionException; <<<<<<< executeTask(() -> { JobStorage jobStorage = configuration.getJobStorage(); jobStorage.init(); ======= executor.execute(() -> { synchronized (this) { if (WorkManagerMigrator.needsMigration(application)) { Log.i(TAG, "Detected an old WorkManager database. Migrating."); WorkManagerMigrator.migrate(application, configuration.getJobStorage(), configuration.getDataSerializer()); } JobStorage jobStorage = configuration.getJobStorage(); jobStorage.init(); >>>>>>> executor.execute(() -> { synchronized (this) { JobStorage jobStorage = configuration.getJobStorage(); jobStorage.init(); <<<<<<< executeTask(() -> { ======= runOnExecutor(()-> { int id = 0; >>>>>>> runOnExecutor(()-> { int id = 0; <<<<<<< return result.get(); } catch (ExecutionException | InterruptedException | RejectedExecutionException e) { ======= boolean finished = latch.await(10, TimeUnit.SECONDS); if (finished) { return result.get(); } else { return "Timed out waiting for Job info."; } } catch (InterruptedException e) { >>>>>>> boolean finished = latch.await(10, TimeUnit.SECONDS); if (finished) { return result.get(); } else { return "Timed out waiting for Job info."; } } catch (InterruptedException | RejectedExecutionException e) { <<<<<<< executeTask(() -> { emptyQueueListeners.add(listener); ======= runOnExecutor(() -> { synchronized (emptyQueueListeners) { emptyQueueListeners.add(listener); } >>>>>>> runOnExecutor(() -> { synchronized (emptyQueueListeners) { emptyQueueListeners.add(listener); } <<<<<<< executeTask(() -> { emptyQueueListeners.remove(listener); ======= runOnExecutor(() -> { synchronized (emptyQueueListeners) { emptyQueueListeners.remove(listener); } >>>>>>> runOnExecutor(() -> { synchronized (emptyQueueListeners) { emptyQueueListeners.remove(listener); } <<<<<<< executeTask(jobController::wakeUp); } private void executeTask(Runnable task) { try { executor.execute(task); } catch (RejectedExecutionException e) { Log.w(TAG, "Task " + task.toString() + " rejected for execution."); } ======= runOnExecutor(jobController::wakeUp); >>>>>>> runOnExecutor(jobController::wakeUp); <<<<<<< executeTask(() -> { ======= runOnExecutor(() -> { >>>>>>> runOnExecutor(() -> { <<<<<<< executeTask(() -> { for (EmptyQueueListener listener : emptyQueueListeners) { listener.onQueueEmpty(); ======= runOnExecutor(() -> { synchronized (emptyQueueListeners) { for (EmptyQueueListener listener : emptyQueueListeners) { listener.onQueueEmpty(); } >>>>>>> runOnExecutor(() -> { synchronized (emptyQueueListeners) { for (EmptyQueueListener listener : emptyQueueListeners) { listener.onQueueEmpty(); }
<<<<<<< public class ApplicationPreferencesActivity extends PassphraseRequiredActionBarActivity ======= public class ApplicationPreferencesActivity extends PassphraseRequiredActivity implements SharedPreferences.OnSharedPreferenceChangeListener >>>>>>> public class ApplicationPreferencesActivity extends PassphraseRequiredActivity
<<<<<<< ======= import org.thoughtcrime.securesms.migrations.TrimByLengthSettingsMigrationJob; import org.thoughtcrime.securesms.migrations.UuidMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.TrimByLengthSettingsMigrationJob; <<<<<<< ======= put(TrimByLengthSettingsMigrationJob.KEY, new TrimByLengthSettingsMigrationJob.Factory()); put(UuidMigrationJob.KEY, new UuidMigrationJob.Factory()); >>>>>>> put(TrimByLengthSettingsMigrationJob.KEY, new TrimByLengthSettingsMigrationJob.Factory());
<<<<<<< @Override public void clearNotifications(@NonNull Context context, boolean clearDelayed) { if (clearDelayed) { cancelDelayedNotifications(); } cancelActiveNotifications(context); updateBadge(context, 0); clearReminder(context); } private static void sendSingleThreadNotification(@NonNull Context context, @NonNull NotificationState notificationState, boolean signal, boolean bundled) ======= private static boolean sendSingleThreadNotification(@NonNull Context context, @NonNull NotificationState notificationState, boolean signal, boolean bundled, boolean isReminder) >>>>>>> @Override public void clearNotifications(@NonNull Context context, boolean clearDelayed) { if (clearDelayed) { cancelDelayedNotifications(); } cancelActiveNotifications(context); updateBadge(context, 0); clearReminder(context); } private static boolean sendSingleThreadNotification(@NonNull Context context, @NonNull NotificationState notificationState, boolean signal, boolean bundled, boolean isReminder)
<<<<<<< import org.thoughtcrime.securesms.R; ======= import org.thoughtcrime.securesms.BuildConfig; import org.thoughtcrime.securesms.R; >>>>>>> import org.thoughtcrime.securesms.R; <<<<<<< import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; ======= import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; import org.thoughtcrime.securesms.permissions.Permissions; >>>>>>> import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; import org.thoughtcrime.securesms.permissions.Permissions; <<<<<<< String appName = ApplicationDependencies.getApplication().getString(R.string.app_name); ======= File backups = getBackupDirectory(); if (!backups.exists()) { if (!backups.mkdirs()) { throw new NoExternalStorageException("Unable to create backup directory..."); } } return backups; } public static File getBackupDirectory() throws NoExternalStorageException { File storage = Environment.getExternalStorageDirectory(); File signal = new File(storage, "Signal"); File backups = new File(signal, "Backups"); >>>>>>> File backups = getBackupDirectory(); if (!backups.exists()) { if (!backups.mkdirs()) { throw new NoExternalStorageException("Unable to create backup directory..."); } } return backups; } public static File getBackupDirectory() throws NoExternalStorageException { String appName = ApplicationDependencies.getApplication().getString(R.string.app_name); File storage = Environment.getExternalStorageDirectory(); <<<<<<< public static File getVideoDir() throws NoExternalStorageException { return new File(getSignalStorageDir(), Environment.DIRECTORY_MOVIES); ======= public static File getLegacyBackupDirectory() throws NoExternalStorageException { return getSignalStorageDir(); } public static boolean canWriteToMediaStore() { return Build.VERSION.SDK_INT > 28 || Permissions.hasAll(ApplicationDependencies.getApplication(), Manifest.permission.WRITE_EXTERNAL_STORAGE); } public static boolean canReadFromMediaStore() { return Permissions.hasAll(ApplicationDependencies.getApplication(), Manifest.permission.READ_EXTERNAL_STORAGE); >>>>>>> public static boolean canWriteToMediaStore() { return Build.VERSION.SDK_INT > 28 || Permissions.hasAll(ApplicationDependencies.getApplication(), Manifest.permission.WRITE_EXTERNAL_STORAGE); } public static boolean canReadFromMediaStore() { return Permissions.hasAll(ApplicationDependencies.getApplication(), Manifest.permission.READ_EXTERNAL_STORAGE);
<<<<<<< import org.thoughtcrime.securesms.ApplicationContext; ======= import org.signal.core.util.logging.Log; >>>>>>> import org.signal.core.util.logging.Log; import org.thoughtcrime.securesms.ApplicationContext;
<<<<<<< ======= import org.thoughtcrime.securesms.migrations.UserNotificationMigrationJob; import org.thoughtcrime.securesms.migrations.UuidMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.UserNotificationMigrationJob; <<<<<<< ======= put(UserNotificationMigrationJob.KEY, new UserNotificationMigrationJob.Factory()); put(UuidMigrationJob.KEY, new UuidMigrationJob.Factory()); >>>>>>> put(UserNotificationMigrationJob.KEY, new UserNotificationMigrationJob.Factory());
<<<<<<< if (KeyCachingService.isLocked()) { return; } Log.i(TAG, "onMessageReceived() ID: " + remoteMessage.getMessageId() + ", Delay: " + (System.currentTimeMillis() - remoteMessage.getSentTime()) + ", Original Priority: " + remoteMessage.getOriginalPriority()); ======= Log.i(TAG, String.format(Locale.US, "onMessageReceived() ID: %s, Delay: %d, Priority: %d, Original Priority: %d", remoteMessage.getMessageId(), (System.currentTimeMillis() - remoteMessage.getSentTime()), remoteMessage.getPriority(), remoteMessage.getOriginalPriority())); >>>>>>> if (KeyCachingService.isLocked()) { return; } Log.i(TAG, String.format(Locale.US, "onMessageReceived() ID: %s, Delay: %d, Priority: %d, Original Priority: %d", remoteMessage.getMessageId(), (System.currentTimeMillis() - remoteMessage.getSentTime()), remoteMessage.getPriority(), remoteMessage.getOriginalPriority()));
<<<<<<< ======= private void handleReminderAction(@IdRes int reminderActionId) { switch (reminderActionId) { case R.id.reminder_action_invite: handleInviteLink(); reminderView.get().requestDismiss(); break; case R.id.reminder_action_view_insights: InsightsLauncher.showInsightsDashboard(getSupportFragmentManager()); break; case R.id.reminder_action_update_now: PlayStoreUtil.openPlayStoreOrOurApkDownloadPage(this); break; default: throw new IllegalArgumentException("Unknown ID: " + reminderActionId); } } >>>>>>> private void handleReminderAction(@IdRes int reminderActionId) { switch (reminderActionId) { case R.id.reminder_action_update_now: PlayStoreUtil.openPlayStoreOrOurApkDownloadPage(this); break; default: throw new IllegalArgumentException("Unknown ID: " + reminderActionId); } }
<<<<<<< public void onCreateEncryptedPreferences(@Nullable Bundle savedInstanceState, String rootKey) { ======= public void onCreatePreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) { >>>>>>> public void onCreateEncryptedPreferences(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
<<<<<<< ======= import org.thoughtcrime.securesms.insights.InsightsLauncher; import org.thoughtcrime.securesms.invites.InviteReminderModel; import org.thoughtcrime.securesms.invites.InviteReminderRepository; import org.thoughtcrime.securesms.jobs.GroupV1MigrationJob; >>>>>>> import org.thoughtcrime.securesms.jobs.GroupV1MigrationJob; <<<<<<< ======= @TargetApi(Build.VERSION_CODES.KITKAT) private void handleMakeDefaultSms() { startActivityForResult(SmsUtil.getSmsRoleIntent(this), SMS_DEFAULT); } >>>>>>> <<<<<<< ======= Optional<Reminder> inviteReminder = inviteReminderModel.getReminder(); Integer actionableRequestingMembers = groupViewModel.getActionableRequestingMembers().getValue(); >>>>>>> Integer actionableRequestingMembers = groupViewModel.getActionableRequestingMembers().getValue(); <<<<<<< ======= } else if (TextSecurePreferences.isPushRegistered(this) && TextSecurePreferences.isShowInviteReminders(this) && !isSecureText && inviteReminder.isPresent() && !recipient.get().isGroup()) { reminderView.get().setOnActionClickListener(this::handleReminderAction); reminderView.get().setOnDismissListener(() -> inviteReminderModel.dismissReminder()); reminderView.get().showReminder(inviteReminder.get()); } else if (actionableRequestingMembers != null && actionableRequestingMembers > 0 && FeatureFlags.groupsV2manageGroupLinks()) { reminderView.get().showReminder(PendingGroupJoinRequestsReminder.create(this, actionableRequestingMembers)); reminderView.get().setOnActionClickListener(id -> { if (id == R.id.reminder_action_review_join_requests) { startActivity(ManagePendingAndRequestingMembersActivity.newIntent(this, getRecipient().getGroupId().get().requireV2())); } }); >>>>>>> } else if (actionableRequestingMembers != null && actionableRequestingMembers > 0 && FeatureFlags.groupsV2manageGroupLinks()) { reminderView.get().showReminder(PendingGroupJoinRequestsReminder.create(this, actionableRequestingMembers)); reminderView.get().setOnActionClickListener(id -> { if (id == R.id.reminder_action_review_join_requests) { startActivity(ManagePendingAndRequestingMembersActivity.newIntent(this, getRecipient().getGroupId().get().requireV2())); } });
<<<<<<< ApplicationDependencies.provider = provider; ApplicationDependencies.messageNotifier = provider.provideMessageNotifier(); ======= ApplicationDependencies.application = application; ApplicationDependencies.provider = provider; ApplicationDependencies.messageNotifier = provider.provideMessageNotifier(); ApplicationDependencies.trimThreadsByDateManager = provider.provideTrimThreadsByDateManager(); >>>>>>> ApplicationDependencies.provider = provider; ApplicationDependencies.messageNotifier = provider.provideMessageNotifier(); ApplicationDependencies.trimThreadsByDateManager = provider.provideTrimThreadsByDateManager();
<<<<<<< ======= import org.thoughtcrime.securesms.jobmanager.impl.NetworkOrCellServiceConstraint; import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraint; import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver; import org.thoughtcrime.securesms.jobmanager.impl.WebsocketDrainedConstraint; import org.thoughtcrime.securesms.jobmanager.impl.WebsocketDrainedConstraintObserver; >>>>>>> import org.thoughtcrime.securesms.jobmanager.impl.WebsocketDrainedConstraint; import org.thoughtcrime.securesms.jobmanager.impl.WebsocketDrainedConstraintObserver; <<<<<<< import org.thoughtcrime.securesms.migrations.PinRemindersMigrationJob; ======= import org.thoughtcrime.securesms.migrations.PassingMigrationJob; import org.thoughtcrime.securesms.migrations.PinReminderMigrationJob; import org.thoughtcrime.securesms.migrations.RecipientSearchMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.PassingMigrationJob; import org.thoughtcrime.securesms.migrations.PinReminderMigrationJob; <<<<<<< ======= put(PinReminderMigrationJob.KEY, new PinReminderMigrationJob.Factory()); put(RecipientSearchMigrationJob.KEY, new RecipientSearchMigrationJob.Factory()); >>>>>>> put(PinReminderMigrationJob.KEY, new PinReminderMigrationJob.Factory()); <<<<<<< put(MasterSecretConstraint.KEY, new MasterSecretConstraint.Factory(application)); ======= put(NetworkOrCellServiceConstraint.KEY, new NetworkOrCellServiceConstraint.Factory(application)); put(NetworkOrCellServiceConstraint.LEGACY_KEY, new NetworkOrCellServiceConstraint.Factory(application)); put(SqlCipherMigrationConstraint.KEY, new SqlCipherMigrationConstraint.Factory(application)); put(WebsocketDrainedConstraint.KEY, new WebsocketDrainedConstraint.Factory()); >>>>>>> put(MasterSecretConstraint.KEY, new MasterSecretConstraint.Factory(application)); put(WebsocketDrainedConstraint.KEY, new WebsocketDrainedConstraint.Factory()); <<<<<<< return Arrays.asList(new NetworkConstraintObserver(application), new MasterSecretConstraintObserver(application)); ======= return Arrays.asList(CellServiceConstraintObserver.getInstance(application), new NetworkConstraintObserver(application), new SqlCipherMigrationConstraintObserver(), new WebsocketDrainedConstraintObserver()); >>>>>>> return Arrays.asList(new NetworkConstraintObserver(application), new MasterSecretConstraintObserver(application), new WebsocketDrainedConstraintObserver());
<<<<<<< if ((telcoCursor == null || telcoCursor.isAfterLast()) && (pushCursor == null || pushCursor.isAfterLast())) { clearNotifications(context, false); ======= if (telcoCursor == null || telcoCursor.isAfterLast()) { NotificationCancellationHelper.cancelAllMessageNotifications(context); updateBadge(context, 0); clearReminder(context); >>>>>>> if (telcoCursor == null || telcoCursor.isAfterLast()) { clearNotifications(context, false);
<<<<<<< public abstract @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address, long expiresIn, boolean isVideoOffer); public abstract @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address, long expiresIn, boolean isVideoOffer); public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long expiresIn, long timestamp, boolean isVideoOffer); public abstract @NonNull void insertOrUpdateGroupCall(@NonNull RecipientId groupRecipientId, @NonNull RecipientId sender, long timestamp, @Nullable String messageGroupCallEraId, @Nullable String peekGroupCallEraId, @NonNull Collection<UUID> peekJoinedUuids); ======= public abstract @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address, boolean isVideoOffer); public abstract @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address, boolean isVideoOffer); public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long timestamp, boolean isVideoOffer); public abstract void insertOrUpdateGroupCall(@NonNull RecipientId groupRecipientId, @NonNull RecipientId sender, long timestamp, @Nullable String peekGroupCallEraId, @NonNull Collection<UUID> peekJoinedUuids, boolean isCallFull); public abstract void insertOrUpdateGroupCall(@NonNull RecipientId groupRecipientId, @NonNull RecipientId sender, long timestamp, @Nullable String messageGroupCallEraId); public abstract boolean updatePreviousGroupCall(long threadId, @Nullable String peekGroupCallEraId, @NonNull Collection<UUID> peekJoinedUuids, boolean isCallFull); >>>>>>> public abstract @NonNull Pair<Long, Long> insertReceivedCall(@NonNull RecipientId address, long expiresIn, boolean isVideoOffer); public abstract @NonNull Pair<Long, Long> insertOutgoingCall(@NonNull RecipientId address, long expiresIn, boolean isVideoOffer); public abstract @NonNull Pair<Long, Long> insertMissedCall(@NonNull RecipientId address, long expiresIn, long timestamp, boolean isVideoOffer); public abstract void insertOrUpdateGroupCall(@NonNull RecipientId groupRecipientId, @NonNull RecipientId sender, long timestamp, @Nullable String peekGroupCallEraId, @NonNull Collection<UUID> peekJoinedUuids, boolean isCallFull); public abstract void insertOrUpdateGroupCall(@NonNull RecipientId groupRecipientId, @NonNull RecipientId sender, long timestamp, @Nullable String messageGroupCallEraId); public abstract boolean updatePreviousGroupCall(long threadId, @Nullable String peekGroupCallEraId, @NonNull Collection<UUID> peekJoinedUuids, boolean isCallFull);
<<<<<<< ======= import org.thoughtcrime.securesms.migrations.KbsEnclaveMigrationJob; import org.thoughtcrime.securesms.migrations.LegacyMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.KbsEnclaveMigrationJob; <<<<<<< ======= put(KbsEnclaveMigrationJob.KEY, new KbsEnclaveMigrationJob.Factory()); put(LegacyMigrationJob.KEY, new LegacyMigrationJob.Factory()); >>>>>>> put(KbsEnclaveMigrationJob.KEY, new KbsEnclaveMigrationJob.Factory());
<<<<<<< import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import android.os.CountDownTimer; ======= import android.text.Editable; import android.text.InputType; >>>>>>> import android.os.CountDownTimer; <<<<<<< ======= import androidx.appcompat.widget.Toolbar; import androidx.core.hardware.fingerprint.FingerprintManagerCompat; import androidx.core.os.CancellationSignal; import org.signal.core.util.logging.Log; import org.thoughtcrime.securesms.animation.AnimationCompleteListener; import org.thoughtcrime.securesms.components.AnimatingToggle; >>>>>>> import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; import org.signal.core.util.logging.Log;
<<<<<<< ======= import org.thoughtcrime.securesms.service.KeyCachingService; import org.thoughtcrime.securesms.util.CommunicationActions; >>>>>>> import org.thoughtcrime.securesms.util.CommunicationActions; <<<<<<< ======= @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (key.equals(TextSecurePreferences.THEME_PREF)) { recreate(); } else if (key.equals(TextSecurePreferences.LANGUAGE_PREF)) { recreate(); Intent intent = new Intent(this, KeyCachingService.class); intent.setAction(KeyCachingService.LOCALE_CHANGE_EVENT); startService(intent); } } public void pushFragment(@NonNull Fragment fragment) { getSupportFragmentManager().beginTransaction() .setCustomAnimations(R.anim.slide_from_end, R.anim.slide_to_start, R.anim.slide_from_start, R.anim.slide_to_end) .replace(android.R.id.content, fragment) .addToBackStack(null) .commit(); } >>>>>>> public void pushFragment(@NonNull Fragment fragment) { getSupportFragmentManager().beginTransaction() .setCustomAnimations(R.anim.slide_from_end, R.anim.slide_to_start, R.anim.slide_from_start, R.anim.slide_to_end) .replace(android.R.id.content, fragment) .addToBackStack(null) .commit(); }
<<<<<<< ======= import org.thoughtcrime.securesms.jobmanager.migrations.SendReadReceiptsJobMigration; import org.thoughtcrime.securesms.migrations.Argon2TestMigrationJob; import org.thoughtcrime.securesms.migrations.AvatarMigrationJob; import org.thoughtcrime.securesms.migrations.CachedAttachmentsMigrationJob; >>>>>>> import org.thoughtcrime.securesms.jobmanager.migrations.SendReadReceiptsJobMigration; <<<<<<< ======= import org.thoughtcrime.securesms.migrations.StickerAdditionMigrationJob; import org.thoughtcrime.securesms.migrations.StickerLaunchMigrationJob; import org.thoughtcrime.securesms.migrations.StorageKeyRotationMigrationJob; import org.thoughtcrime.securesms.migrations.StorageServiceMigrationJob; import org.thoughtcrime.securesms.migrations.UuidMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.StickerAdditionMigrationJob; import org.thoughtcrime.securesms.migrations.StorageKeyRotationMigrationJob; import org.thoughtcrime.securesms.migrations.StorageServiceMigrationJob; <<<<<<< ======= put(Argon2TestMigrationJob.KEY, new Argon2TestMigrationJob.Factory()); put(AvatarMigrationJob.KEY, new AvatarMigrationJob.Factory()); put(CachedAttachmentsMigrationJob.KEY, new CachedAttachmentsMigrationJob.Factory()); >>>>>>> <<<<<<< put(RegistrationPinV2MigrationJob.KEY, new RegistrationPinV2MigrationJob.Factory()); ======= put(RecipientSearchMigrationJob.KEY, new RecipientSearchMigrationJob.Factory()); put(RegistrationPinV2MigrationJob.KEY, new RegistrationPinV2MigrationJob.Factory()); put(StickerLaunchMigrationJob.KEY, new StickerLaunchMigrationJob.Factory()); put(StickerAdditionMigrationJob.KEY, new StickerAdditionMigrationJob.Factory()); put(StorageKeyRotationMigrationJob.KEY, new StorageKeyRotationMigrationJob.Factory()); put(StorageServiceMigrationJob.KEY, new StorageServiceMigrationJob.Factory()); put(UuidMigrationJob.KEY, new UuidMigrationJob.Factory()); >>>>>>> put(RegistrationPinV2MigrationJob.KEY, new RegistrationPinV2MigrationJob.Factory()); put(StickerAdditionMigrationJob.KEY, new StickerAdditionMigrationJob.Factory()); put(StorageKeyRotationMigrationJob.KEY, new StorageKeyRotationMigrationJob.Factory()); put(StorageServiceMigrationJob.KEY, new StorageServiceMigrationJob.Factory());
<<<<<<< import org.thoughtcrime.securesms.logging.Log; import org.thoughtcrime.securesms.util.SecurePreferenceManager; ======= >>>>>>> import org.thoughtcrime.securesms.util.SecurePreferenceManager;
<<<<<<< ======= import androidx.annotation.NonNull; import androidx.annotation.Nullable; >>>>>>> <<<<<<< ======= import org.signal.core.util.logging.Log; import org.thoughtcrime.securesms.ApplicationContext; >>>>>>> import org.signal.core.util.logging.Log; <<<<<<< ======= import org.thoughtcrime.securesms.crypto.MasterSecretUtil; import org.thoughtcrime.securesms.dependencies.ApplicationDependencies; >>>>>>> import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
<<<<<<< public void onRun() throws NoSuchMessageException, RetryLaterException { PushDatabase database = DatabaseFactory.getPushDatabase(context); SignalServiceEnvelope envelope = database.get(messageId); JobManager jobManager = ApplicationDependencies.getJobManager(); ======= public void onRun() throws RetryLaterException { if (needsMigration()) { Log.w(TAG, "Migration is still needed."); postMigrationNotification(); throw new RetryLaterException(); } List<Job> jobs = new LinkedList<>(); DecryptionResult result = MessageDecryptionUtil.decrypt(context, envelope); >>>>>>> public void onRun() throws RetryLaterException { List<Job> jobs = new LinkedList<>(); DecryptionResult result = MessageDecryptionUtil.decrypt(context, envelope); <<<<<<< private @NonNull List<Job> handleMessage(@NonNull SignalServiceEnvelope envelope) throws NoSenderException { Log.i(TAG, "Processing message ID " + envelope.getTimestamp()); try { SignalProtocolStore axolotlStore = new SignalProtocolStoreImpl(context); SignalServiceAddress localAddress = new SignalServiceAddress(Optional.of(TextSecurePreferences.getLocalUuid(context)), Optional.of(TextSecurePreferences.getLocalNumber(context))); SignalServiceCipher cipher = new SignalServiceCipher(localAddress, axolotlStore, UnidentifiedAccessUtil.getCertificateValidator()); SignalServiceContent content = cipher.decrypt(envelope); List<Job> jobs = new ArrayList<>(2); if (content != null) { jobs.add(new PushProcessMessageJob(content, messageId, smsMessageId, envelope.getTimestamp())); } if (envelope.isPreKeySignalMessage()) { jobs.add(new RefreshPreKeysJob()); } return jobs; } catch (ProtocolInvalidVersionException e) { Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.INVALID_VERSION, toExceptionMetadata(e), messageId, smsMessageId, envelope.getTimestamp())); } catch (ProtocolInvalidMessageException | ProtocolInvalidKeyIdException | ProtocolInvalidKeyException | ProtocolUntrustedIdentityException | ProtocolNoSessionException e) { Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); return Collections.singletonList(new AutomaticSessionResetJob(Recipient.external(context, e.getSender()).getId(), e.getSenderDevice(), envelope.getTimestamp())); } catch (ProtocolLegacyMessageException e) { Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.LEGACY_MESSAGE, toExceptionMetadata(e), messageId, smsMessageId, envelope.getTimestamp())); } catch (ProtocolDuplicateMessageException e) { Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.DUPLICATE_MESSAGE, toExceptionMetadata(e), messageId, smsMessageId, envelope.getTimestamp())); } catch (InvalidMetadataVersionException | InvalidMetadataMessageException e) { Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); return Collections.emptyList(); } catch (SelfSendException e) { Log.i(TAG, "Dropping UD message from self."); return Collections.emptyList(); } catch (UnsupportedDataMessageException e) { Log.w(TAG, String.valueOf(envelope.getTimestamp()), e); return Collections.singletonList(new PushProcessMessageJob(PushProcessMessageJob.MessageState.UNSUPPORTED_DATA_MESSAGE, toExceptionMetadata(e), messageId, smsMessageId, envelope.getTimestamp())); } } private static PushProcessMessageJob.ExceptionMetadata toExceptionMetadata(@NonNull UnsupportedDataMessageException e) throws NoSenderException { String sender = e.getSender(); if (sender == null) throw new NoSenderException(); GroupId groupId = null; if (e.getGroup().isPresent()) { try { groupId = GroupUtil.idFromGroupContext(e.getGroup().get()); } catch (BadGroupIdException ex) { Log.w(TAG, "Bad group id found in unsupported data message", ex); } } return new PushProcessMessageJob.ExceptionMetadata(sender, e.getSenderDevice(), groupId); } private static PushProcessMessageJob.ExceptionMetadata toExceptionMetadata(@NonNull ProtocolException e) throws NoSenderException { String sender = e.getSender(); if (sender == null) throw new NoSenderException(); return new PushProcessMessageJob.ExceptionMetadata(sender, e.getSenderDevice()); } ======= private boolean needsMigration() { return !IdentityKeyUtil.hasIdentityKey(context) || TextSecurePreferences.getNeedsSqlCipherMigration(context); } private void postMigrationNotification() { NotificationManagerCompat.from(context).notify(494949, new NotificationCompat.Builder(context, NotificationChannels.getMessagesChannel(context)) .setSmallIcon(R.drawable.ic_notification) .setPriority(NotificationCompat.PRIORITY_HIGH) .setCategory(NotificationCompat.CATEGORY_MESSAGE) .setContentTitle(context.getString(R.string.PushDecryptJob_new_locked_message)) .setContentText(context.getString(R.string.PushDecryptJob_unlock_to_view_pending_messages)) .setContentIntent(PendingIntent.getActivity(context, 0, MainActivity.clearTop(context), 0)) .setDefaults(NotificationCompat.DEFAULT_SOUND | NotificationCompat.DEFAULT_VIBRATE) .build()); } >>>>>>>
<<<<<<< import org.thoughtcrime.securesms.jobmanager.impl.MasterSecretConstraint; import org.thoughtcrime.securesms.jobmanager.impl.MasterSecretConstraintObserver; ======= import org.thoughtcrime.securesms.jobmanager.impl.CellServiceConstraintObserver; import org.thoughtcrime.securesms.jobmanager.impl.ChargingConstraint; import org.thoughtcrime.securesms.jobmanager.impl.ChargingConstraintObserver; >>>>>>> import org.thoughtcrime.securesms.jobmanager.impl.ChargingConstraint; import org.thoughtcrime.securesms.jobmanager.impl.ChargingConstraintObserver; import org.thoughtcrime.securesms.jobmanager.impl.MasterSecretConstraint; import org.thoughtcrime.securesms.jobmanager.impl.MasterSecretConstraintObserver; <<<<<<< return Arrays.asList(new NetworkConstraintObserver(application), new MasterSecretConstraintObserver(application), ======= return Arrays.asList(CellServiceConstraintObserver.getInstance(application), new ChargingConstraintObserver(application), new NetworkConstraintObserver(application), new SqlCipherMigrationConstraintObserver(), >>>>>>> return Arrays.asList(new MasterSecretConstraintObserver(application), new ChargingConstraintObserver(application), new NetworkConstraintObserver(application),
<<<<<<< ======= initializePlayServicesCheck(); >>>>>>> initializePlayServicesCheck(); <<<<<<< ======= RegistrationUtil.markRegistrationPossiblyComplete(); ProcessLifecycleOwner.get().getLifecycle().addObserver(this); if (Build.VERSION.SDK_INT < 21) { AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); } >>>>>>> RegistrationUtil.markRegistrationPossiblyComplete();
<<<<<<< import android.annotation.SuppressLint; import android.content.BroadcastReceiver; ======= >>>>>>> import android.content.BroadcastReceiver; <<<<<<< import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncTask; ======= import android.hardware.SensorManager; >>>>>>> import android.content.Intent; import android.content.IntentFilter; <<<<<<< if (!KeyCachingService.isLocked()) { onStartUnlock(); } } public void onStartUnlock() { FeatureFlags.refreshIfNecessary(); ApplicationDependencies.getRecipientCache().warmUp(); RetrieveProfileJob.enqueueRoutineFetchIfNecessary(this); GroupV1MigrationJob.enqueueRoutineMigrationsIfNecessary(this); executePendingContactSync(); ======= >>>>>>> if (!KeyCachingService.isLocked()) { onStartUnlock(); } Log.d(TAG, "onStart() took " + (System.currentTimeMillis() - startTime) + " ms"); } private void onStartUnlock() { <<<<<<< private final BroadcastReceiver keyEventReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { onLock(); } }; private void registerKeyEventReceiver() { IntentFilter filter = new IntentFilter(); filter.addAction(KeyCachingService.CLEAR_KEY_EVENT); registerReceiver(keyEventReceiver, filter, KeyCachingService.KEY_PERMISSION, null); } private void unregisterKeyEventReceiver() { unregisterReceiver(keyEventReceiver); } ======= @WorkerThread >>>>>>> @WorkerThread
<<<<<<< this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF).setOnPreferenceClickListener(new AccountLockClickListener()); this.findPreference(TextSecurePreferences.PASSPHRASE_LOCK).setOnPreferenceChangeListener(new PassphraseLockListener()); this.findPreference(TextSecurePreferences.PASSPHRASE_LOCK_TRIGGER).setOnPreferenceChangeListener(new PassphraseLockTriggerChangeListener()); this.findPreference(TextSecurePreferences.PASSPHRASE_LOCK_TIMEOUT).setOnPreferenceClickListener(new PassphraseLockTimeoutListener()); ======= disablePassphrase = (CheckBoxPreference) this.findPreference("pref_enable_passphrase_temporary"); SwitchPreferenceCompat regLock = (SwitchPreferenceCompat) this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF_V1); regLock.setChecked( TextSecurePreferences.isV1RegistrationLockEnabled(requireContext()) || SignalStore.kbsValues().isV2RegistrationLockEnabled() ); regLock.setOnPreferenceClickListener(new AccountLockClickListener()); this.findPreference(TextSecurePreferences.SCREEN_LOCK).setOnPreferenceChangeListener(new ScreenLockListener()); this.findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT).setOnPreferenceClickListener(new ScreenLockTimeoutListener()); >>>>>>> SwitchPreferenceCompat regLock = (SwitchPreferenceCompat) this.findPreference(TextSecurePreferences.REGISTRATION_LOCK_PREF_V1); regLock.setChecked( TextSecurePreferences.isV1RegistrationLockEnabled(requireContext()) || SignalStore.kbsValues().isV2RegistrationLockEnabled() ); regLock.setOnPreferenceClickListener(new AccountLockClickListener()); this.findPreference(TextSecurePreferences.PASSPHRASE_LOCK).setOnPreferenceChangeListener(new PassphraseLockListener()); this.findPreference(TextSecurePreferences.PASSPHRASE_LOCK_TRIGGER).setOnPreferenceChangeListener(new PassphraseLockTriggerChangeListener()); this.findPreference(TextSecurePreferences.PASSPHRASE_LOCK_TIMEOUT).setOnPreferenceClickListener(new PassphraseLockTimeoutListener());
<<<<<<< import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class AndroidLogger extends Log.Logger { ======= import android.annotation.SuppressLint; @SuppressLint("LogNotSignal") public final class AndroidLogger extends Log.Logger { >>>>>>> import android.annotation.SuppressLint; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @SuppressLint("LogNotSignal") public class AndroidLogger extends Log.Logger {
<<<<<<< private final Context context; private final MasterSecretConstraint masterSecretConstraint; private final NetworkConstraint networkConstraint; private final SignalServiceNetworkAccess networkAccess; ======= private final Context context; private final SignalServiceNetworkAccess networkAccess; private final List<Runnable> websocketDrainedListeners; >>>>>>> private final Context context; private final SignalServiceNetworkAccess networkAccess; private final List<Runnable> websocketDrainedListeners; <<<<<<< this.masterSecretConstraint = new MasterSecretConstraint.Factory(ApplicationContext.getInstance(context)).create(); new NetworkConstraintObserver(ApplicationContext.getInstance(context)).register(this); ======= >>>>>>> <<<<<<< public void quit() { context.stopService(new Intent(context, ForegroundService.class)); } @Override public void onConstraintMet(@NonNull String reason) { synchronized (this) { notifyAll(); ======= public synchronized void addWebsocketDrainedListener(@NonNull Runnable listener) { websocketDrainedListeners.add(listener); if (websocketDrained) { listener.run(); >>>>>>> public void quit() { context.stopService(new Intent(context, ForegroundService.class)); } public synchronized void addWebsocketDrainedListener(@NonNull Runnable listener) { websocketDrainedListeners.add(listener); if (websocketDrained) { listener.run(); <<<<<<< boolean isGcmDisabled = TextSecurePreferences.isFcmDisabled(context); Log.d(TAG, String.format("Network requirement: %s, app visible: %s, gcm disabled: %b", networkConstraint.isMet(), appVisible, isGcmDisabled)); return masterSecretConstraint.isMet() && TextSecurePreferences.isPushRegistered(context) && TextSecurePreferences.isWebsocketRegistered(context) && (appVisible || isGcmDisabled) && networkConstraint.isMet() && ApplicationDependencies.getInitialMessageRetriever().isCaughtUp() && ======= boolean registered = TextSecurePreferences.isPushRegistered(context); boolean websocketRegistered = TextSecurePreferences.isWebsocketRegistered(context); boolean isGcmDisabled = TextSecurePreferences.isFcmDisabled(context); boolean hasNetwork = NetworkConstraint.isMet(context); Log.d(TAG, String.format("Network: %s, Foreground: %s, FCM: %s, Censored: %s, Registered: %s, Websocket Registered: %s", hasNetwork, appVisible, !isGcmDisabled, networkAccess.isCensored(context), registered, websocketRegistered)); return registered && websocketRegistered && (appVisible || isGcmDisabled) && hasNetwork && >>>>>>> if (KeyCachingService.isLocked()) { return false; } boolean registered = TextSecurePreferences.isPushRegistered(context); boolean websocketRegistered = TextSecurePreferences.isWebsocketRegistered(context); boolean isGcmDisabled = TextSecurePreferences.isFcmDisabled(context); boolean hasNetwork = NetworkConstraint.isMet(context); Log.d(TAG, String.format("Network: %s, Foreground: %s, FCM: %s, Censored: %s, Registered: %s, Websocket Registered: %s", hasNetwork, appVisible, !isGcmDisabled, networkAccess.isCensored(context), registered, websocketRegistered)); return registered && websocketRegistered && (appVisible || isGcmDisabled) && hasNetwork &&
<<<<<<< ======= import org.thoughtcrime.securesms.migrations.AvatarMigrationJob; import org.thoughtcrime.securesms.migrations.BackupNotificationMigrationJob; import org.thoughtcrime.securesms.migrations.CachedAttachmentsMigrationJob; >>>>>>> import org.thoughtcrime.securesms.migrations.BackupNotificationMigrationJob; <<<<<<< ======= put(AvatarMigrationJob.KEY, new AvatarMigrationJob.Factory()); put(BackupNotificationMigrationJob.KEY, new BackupNotificationMigrationJob.Factory()); put(CachedAttachmentsMigrationJob.KEY, new CachedAttachmentsMigrationJob.Factory()); >>>>>>> put(BackupNotificationMigrationJob.KEY, new BackupNotificationMigrationJob.Factory());
<<<<<<< private GlideRequests glideRequests; protected ComposeText composeText; private AnimatingToggle buttonToggle; private SendButton sendButton; private ImageButton attachButton; protected ConversationTitleView titleView; private TextView charactersLeft; private ConversationFragment fragment; private Button unblockButton; private Button inviteButton; private Button registerButton; private InputAwareLayout container; protected Stub<ReminderView> reminderView; private Stub<UnverifiedBannerView> unverifiedBannerView; private Stub<ReviewBannerView> reviewBanner; private TypingStatusTextWatcher typingTextWatcher; private ConversationSearchBottomBar searchNav; private MenuItem searchViewItem; private MessageRequestsBottomView messageRequestBottomView; private ConversationReactionOverlay reactionOverlay; ======= private GlideRequests glideRequests; protected ComposeText composeText; private AnimatingToggle buttonToggle; private SendButton sendButton; private ImageButton attachButton; protected ConversationTitleView titleView; private TextView charactersLeft; private ConversationFragment fragment; private Button unblockButton; private Button makeDefaultSmsButton; private Button registerButton; private InputAwareLayout container; protected Stub<ReminderView> reminderView; private Stub<UnverifiedBannerView> unverifiedBannerView; private Stub<ReviewBannerView> reviewBanner; private TypingStatusTextWatcher typingTextWatcher; private ConversationSearchBottomBar searchNav; private MenuItem searchViewItem; private MessageRequestsBottomView messageRequestBottomView; private ConversationReactionDelegate reactionDelegate; >>>>>>> private GlideRequests glideRequests; protected ComposeText composeText; private AnimatingToggle buttonToggle; private SendButton sendButton; private ImageButton attachButton; protected ConversationTitleView titleView; private TextView charactersLeft; private ConversationFragment fragment; private Button unblockButton; private Button inviteButton; private Button registerButton; private InputAwareLayout container; protected Stub<ReminderView> reminderView; private Stub<UnverifiedBannerView> unverifiedBannerView; private Stub<ReviewBannerView> reviewBanner; private TypingStatusTextWatcher typingTextWatcher; private ConversationSearchBottomBar searchNav; private MenuItem searchViewItem; private MessageRequestsBottomView messageRequestBottomView; private ConversationReactionDelegate reactionDelegate;
<<<<<<< this.serviceClients = createServiceConnectionHolders(configuration.getSignalServiceUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns()); this.cdnClientsMap = createCdnClientsMap(configuration.getSignalCdnUrlMap(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns()); this.contactDiscoveryClients = createConnectionHolders(configuration.getSignalContactDiscoveryUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns()); this.keyBackupServiceClients = createConnectionHolders(configuration.getSignalKeyBackupServiceUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns()); this.storageClients = createConnectionHolders(configuration.getSignalStorageUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns()); ======= this.serviceClients = createServiceConnectionHolders(configuration.getSignalServiceUrls(), configuration.getNetworkInterceptors(), configuration.getDns(), configuration.getSignalProxy()); this.cdnClientsMap = createCdnClientsMap(configuration.getSignalCdnUrlMap(), configuration.getNetworkInterceptors(), configuration.getDns(), configuration.getSignalProxy()); this.contactDiscoveryClients = createConnectionHolders(configuration.getSignalContactDiscoveryUrls(), configuration.getNetworkInterceptors(), configuration.getDns(), configuration.getSignalProxy()); this.keyBackupServiceClients = createConnectionHolders(configuration.getSignalKeyBackupServiceUrls(), configuration.getNetworkInterceptors(), configuration.getDns(), configuration.getSignalProxy()); this.storageClients = createConnectionHolders(configuration.getSignalStorageUrls(), configuration.getNetworkInterceptors(), configuration.getDns(), configuration.getSignalProxy()); >>>>>>> this.serviceClients = createServiceConnectionHolders(configuration.getSignalServiceUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns(), configuration.getSignalProxy()); this.cdnClientsMap = createCdnClientsMap(configuration.getSignalCdnUrlMap(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns(), configuration.getSignalProxy()); this.contactDiscoveryClients = createConnectionHolders(configuration.getSignalContactDiscoveryUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns(), configuration.getSignalProxy()); this.keyBackupServiceClients = createConnectionHolders(configuration.getSignalKeyBackupServiceUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns(), configuration.getSignalProxy()); this.storageClients = createConnectionHolders(configuration.getSignalStorageUrls(), configuration.getNetworkInterceptors(), configuration.getSocketFactory(), configuration.getDns(), configuration.getSignalProxy()); <<<<<<< SocketFactory socketFactory, Optional<Dns> dns) ======= Optional<Dns> dns, Optional<SignalProxy> proxy) >>>>>>> SocketFactory socketFactory, Optional<Dns> dns, Optional<SignalProxy> proxy) <<<<<<< serviceConnectionHolders.add(new ServiceConnectionHolder(createConnectionClient(url, interceptors, socketFactory, dns), createConnectionClient(url, interceptors, socketFactory, dns), ======= serviceConnectionHolders.add(new ServiceConnectionHolder(createConnectionClient(url, interceptors, dns, proxy), createConnectionClient(url, interceptors, dns, proxy), >>>>>>> serviceConnectionHolders.add(new ServiceConnectionHolder(createConnectionClient(url, interceptors, socketFactory, dns, proxy), createConnectionClient(url, interceptors, socketFactory, dns, proxy), <<<<<<< final SocketFactory socketFactory, final Optional<Dns> dns) { ======= final Optional<Dns> dns, final Optional<SignalProxy> proxy) { >>>>>>> final SocketFactory socketFactory, final Optional<Dns> dns, final Optional<SignalProxy> proxy) { <<<<<<< createConnectionHolders(entry.getValue(), interceptors, socketFactory, dns)); ======= createConnectionHolders(entry.getValue(), interceptors, dns, proxy)); >>>>>>> createConnectionHolders(entry.getValue(), interceptors, socketFactory, dns, proxy)); <<<<<<< private static ConnectionHolder[] createConnectionHolders(SignalUrl[] urls, List<Interceptor> interceptors, SocketFactory socketFactory, Optional<Dns> dns) { ======= private static ConnectionHolder[] createConnectionHolders(SignalUrl[] urls, List<Interceptor> interceptors, Optional<Dns> dns, Optional<SignalProxy> proxy) { >>>>>>> private static ConnectionHolder[] createConnectionHolders(SignalUrl[] urls, List<Interceptor> interceptors, SocketFactory socketFactory, Optional<Dns> dns, Optional<SignalProxy> proxy) { <<<<<<< connectionHolders.add(new ConnectionHolder(createConnectionClient(url, interceptors, socketFactory, dns), url.getUrl(), url.getHostHeader())); ======= connectionHolders.add(new ConnectionHolder(createConnectionClient(url, interceptors, dns, proxy), url.getUrl(), url.getHostHeader())); >>>>>>> connectionHolders.add(new ConnectionHolder(createConnectionClient(url, interceptors, socketFactory, dns, proxy), url.getUrl(), url.getHostHeader())); <<<<<<< private static OkHttpClient createConnectionClient(SignalUrl url, List<Interceptor> interceptors, SocketFactory socketFactory, Optional<Dns> dns) { ======= private static OkHttpClient createConnectionClient(SignalUrl url, List<Interceptor> interceptors, Optional<Dns> dns, Optional<SignalProxy> proxy) { >>>>>>> private static OkHttpClient createConnectionClient(SignalUrl url, List<Interceptor> interceptors, SocketFactory socketFactory, Optional<Dns> dns, Optional<SignalProxy> proxy) {
<<<<<<< import org.thoughtcrime.securesms.BuildConfig; ======= import org.thoughtcrime.securesms.MainActivity; >>>>>>> import org.thoughtcrime.securesms.BuildConfig; import org.thoughtcrime.securesms.MainActivity;
<<<<<<< import org.thoughtcrime.securesms.jobs.StickerPackDownloadJob; import org.thoughtcrime.securesms.keyvalue.SignalStore; ======= import org.thoughtcrime.securesms.jobs.RefreshPreKeysJob; import org.thoughtcrime.securesms.jobs.StorageSyncJob; import org.thoughtcrime.securesms.logging.AndroidLogger; >>>>>>> import org.thoughtcrime.securesms.jobs.RefreshPreKeysJob; import org.thoughtcrime.securesms.jobs.StorageSyncJob; <<<<<<< ApplicationDependencies.getJobManager().beginJobLoop(); registerKeyEventReceiver(); onStartUnlock(); ======= RefreshPreKeysJob.scheduleIfNecessary(); StorageSyncJob.scheduleIfNecessary(); ProcessLifecycleOwner.get().getLifecycle().addObserver(this); >>>>>>> RefreshPreKeysJob.scheduleIfNecessary(); StorageSyncJob.scheduleIfNecessary(); ApplicationDependencies.getJobManager().beginJobLoop(); registerKeyEventReceiver(); onStartUnlock(); <<<<<<< KeyCachingService.onAppForegrounded(this); if (!KeyCachingService.isLocked()) { onStartUnlock(); } } public void onStartUnlock() { FeatureFlags.refresh(); ======= FeatureFlags.refreshIfNecessary(); >>>>>>> KeyCachingService.onAppForegrounded(this); if (!KeyCachingService.isLocked()) { onStartUnlock(); } } public void onStartUnlock() { FeatureFlags.refreshIfNecessary(); <<<<<<< InsightsOptOut.userRequestedOptOut(this); TextSecurePreferences.setAppMigrationVersion(this, ApplicationMigrations.CURRENT_VERSION); TextSecurePreferences.setJobManagerVersion(this, JobManager.CURRENT_VERSION); ApplicationDependencies.getMegaphoneRepository().onFirstEverAppLaunch(); SignalStore.registrationValues().onNewInstall(); ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.ZOZO.getPackId(), BlessedPacks.ZOZO.getPackKey(), false)); ApplicationDependencies.getJobManager().add(StickerPackDownloadJob.forInstall(BlessedPacks.BANDIT.getPackId(), BlessedPacks.BANDIT.getPackKey(), false)); ======= AppInitialization.onFirstEverAppLaunch(this); >>>>>>> AppInitialization.onFirstEverAppLaunch(this);
<<<<<<< import androidx.annotation.MainThread; ======= import androidx.annotation.NonNull; >>>>>>> import androidx.annotation.NonNull; <<<<<<< import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.AsyncTask; import android.os.Build; import androidx.annotation.NonNull; ======= >>>>>>> <<<<<<< import org.thoughtcrime.securesms.jobs.StorageSyncJob; ======= import org.thoughtcrime.securesms.logging.AndroidLogger; >>>>>>> <<<<<<< import org.thoughtcrime.securesms.revealable.ViewOnceMessageManager; import org.thoughtcrime.securesms.service.WipeMemoryService; ======= >>>>>>> import org.thoughtcrime.securesms.service.WipeMemoryService; <<<<<<< ======= >>>>>>> <<<<<<< StorageSyncJob.scheduleIfNecessary(); ======= StorageSyncHelper.scheduleRoutineSync(); ProcessLifecycleOwner.get().getLifecycle().addObserver(this); if (Build.VERSION.SDK_INT < 21) { AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); } >>>>>>> StorageSyncHelper.scheduleRoutineSync();
<<<<<<< RegistrationLockDialog.showReminderIfNecessary(this); ======= RatingManager.showRatingDialogIfNecessary(requireContext()); RegistrationLockV1Dialog.showReminderIfNecessary(this); >>>>>>> RegistrationLockV1Dialog.showReminderIfNecessary(this);
<<<<<<< ======= import org.greenrobot.eventbus.EventBus; import org.signal.core.util.logging.Log; >>>>>>> import org.signal.core.util.logging.Log; <<<<<<< import org.thoughtcrime.securesms.preferences.widgets.PassphraseLockTriggerPreference; import org.thoughtcrime.securesms.profiles.ProfileName; ======= >>>>>>> import org.thoughtcrime.securesms.preferences.widgets.PassphraseLockTriggerPreference;
<<<<<<< import java.util.Date; public class QiscusChatActivity extends RxAppCompatActivity implements QiscusUserStatusPresenter.View, QiscusChatFragment.UserTypingListener { private static final String CHAT_ROOM_DATA = "chat_room_data"; ======= public class QiscusChatActivity extends RxAppCompatActivity { protected static final String CHAT_ROOM_DATA = "chat_room_data"; >>>>>>> import java.util.Date; public class QiscusChatActivity extends RxAppCompatActivity implements QiscusUserStatusPresenter.View, QiscusChatFragment.UserTypingListener { protected static final String CHAT_ROOM_DATA = "chat_room_data"; <<<<<<< private QiscusChatConfig chatConfig; private QiscusChatRoom qiscusChatRoom; private QiscusUserStatusPresenter userStatusPresenter; ======= protected QiscusChatConfig chatConfig; protected QiscusChatRoom qiscusChatRoom; >>>>>>> protected QiscusChatConfig chatConfig; protected QiscusChatRoom qiscusChatRoom; private QiscusUserStatusPresenter userStatusPresenter;
<<<<<<< public void updateLastDeliveredComment(int lastDeliveredCommentId) { this.lastDeliveredCommentId = lastDeliveredCommentId; notifyDataSetChanged(); } public void updateLastReadComment(int lastReadCommentId) { this.lastReadCommentId = lastReadCommentId; notifyDataSetChanged(); } ======= public void detachView() { int size = data.size(); for (int i = 0; i < size; i++) { data.get(i).destroy(); } } >>>>>>> public void updateLastDeliveredComment(int lastDeliveredCommentId) { this.lastDeliveredCommentId = lastDeliveredCommentId; notifyDataSetChanged(); } public void updateLastReadComment(int lastReadCommentId) { this.lastReadCommentId = lastReadCommentId; notifyDataSetChanged(); } public void detachView() { int size = data.size(); for (int i = 0; i < size; i++) { data.get(i).destroy(); } }
<<<<<<< if (qiscusComment.getState() == QiscusComment.STATE_ON_QISCUS || qiscusComment.getState() == QiscusComment.STATE_DELIVERED) { if (qiscusComment.getType() == QiscusComment.Type.FILE || qiscusComment.getType() == QiscusComment.Type.IMAGE) { ======= if (qiscusComment.getState() == QiscusComment.STATE_ON_QISCUS || qiscusComment.getState() == QiscusComment.STATE_ON_PUSHER) { if (qiscusComment.getType() == QiscusComment.Type.FILE || qiscusComment.getType() == QiscusComment.Type.IMAGE || qiscusComment.getType() == QiscusComment.Type.AUDIO) { >>>>>>> if (qiscusComment.getState() == QiscusComment.STATE_ON_QISCUS || qiscusComment.getState() == QiscusComment.STATE_DELIVERED) { if (qiscusComment.getType() == QiscusComment.Type.FILE || qiscusComment.getType() == QiscusComment.Type.IMAGE || qiscusComment.getType() == QiscusComment.Type.AUDIO) { <<<<<<< QiscusPusherApi.getInstance().setUserTyping(qiscusChatRoom.getId(), qiscusChatRoom.getLastTopicId(), false); ======= chatAdapter.detachView(); if (recordAudioPanel != null) { recordAudioPanel.cancelRecord(); } >>>>>>> QiscusPusherApi.getInstance().setUserTyping(qiscusChatRoom.getId(), qiscusChatRoom.getLastTopicId(), false); chatAdapter.detachView(); if (recordAudioPanel != null) { recordAudioPanel.cancelRecord(); }
<<<<<<< protected int lastDeliveredCommentId; protected int lastReadCommentId; ======= protected boolean groupChat; >>>>>>> protected int lastDeliveredCommentId; protected int lastReadCommentId; protected boolean groupChat;
<<<<<<< import android.text.format.DateUtils; import android.view.Menu; import android.view.MenuItem; ======= >>>>>>> import android.text.format.DateUtils; <<<<<<< import com.qiscus.sdk.data.model.QiscusComment; import com.qiscus.sdk.data.model.QiscusRoomMember; import com.qiscus.sdk.presenter.QiscusUserStatusPresenter; ======= >>>>>>> <<<<<<< import com.trello.rxlifecycle.components.support.RxAppCompatActivity; import java.util.Date; import java.util.List; public class QiscusChatActivity extends RxAppCompatActivity implements QiscusUserStatusPresenter.View, QiscusChatFragment.UserTypingListener, QiscusBaseChatFragment.CommentSelectedListener, ActionMode.Callback { protected static final String CHAT_ROOM_DATA = "chat_room_data"; ======= >>>>>>> import java.util.Date; <<<<<<< protected QiscusChatConfig chatConfig; protected QiscusChatRoom qiscusChatRoom; private QiscusUserStatusPresenter userStatusPresenter; private ActionMode actionMode; ======= >>>>>>> <<<<<<< protected void onPause() { super.onPause(); QiscusCacheManager.getInstance().setLastChatActivity(false, qiscusChatRoom.getId()); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(CHAT_ROOM_DATA, qiscusChatRoom); } @Override public void onUserStatusChanged(String user, boolean online, Date lastActive) { if (qiscusChatRoom.getSubtitle().isEmpty()) { String last = DateUtils.getRelativeTimeSpanString(lastActive.getTime(), System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS).toString(); tvSubtitle.setText(online ? "Online" : "Last seen " + last); tvSubtitle.setVisibility(View.VISIBLE); } } @Override public void onUserTyping(String user, boolean typing) { if (qiscusChatRoom.getSubtitle().isEmpty()) { tvSubtitle.setText(typing ? "Typing..." : "Online"); tvSubtitle.setVisibility(View.VISIBLE); } } @Override public void showError(String errorMessage) { } @Override public void showLoading() { } @Override public void dismissLoading() { } @Override protected void onStop() { super.onStop(); QiscusCacheManager.getInstance().setLastChatActivity(false, 0); } @Override protected void onDestroy() { super.onDestroy(); userStatusPresenter.detachView(); } public void onCommentSelected(List<QiscusComment> selectedComments) { boolean hasCheckedItems = selectedComments.size() > 0; if (hasCheckedItems && actionMode == null) { actionMode = startSupportActionMode(this); } else if (!hasCheckedItems && actionMode != null) { actionMode.finish(); } if (actionMode != null) { actionMode.setTitle(selectedComments.size() + " selected"); } } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.comment_action, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { if (Build.VERSION.SDK_INT < 11) { MenuItemCompat.setShowAsAction(menu.findItem(R.id.action_copy), MenuItemCompat.SHOW_AS_ACTION_NEVER); MenuItemCompat.setShowAsAction(menu.findItem(R.id.action_share), MenuItemCompat.SHOW_AS_ACTION_NEVER); } else { menu.findItem(R.id.action_copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.findItem(R.id.action_share).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } return true; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { QiscusChatFragment fragment = (QiscusChatFragment) getSupportFragmentManager() .findFragmentByTag(QiscusChatFragment.class.getName()); if (fragment == null) { mode.finish(); return false; } List<QiscusComment> selectedComments = fragment.getSelectedComments(); int i = item.getItemId(); String text = ""; for (QiscusComment qiscusComment : selectedComments) { text += qiscusComment.getSender() + ": "; text += qiscusComment.isAttachment() ? qiscusComment.getAttachmentName() : qiscusComment.getMessage(); text += "\n"; } if (i == R.id.action_copy) { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.chat_activity_label_clipboard), text); clipboard.setPrimaryClip(clip); Toast.makeText(this, selectedComments.size() + " messages copied!", Toast.LENGTH_SHORT).show(); mode.finish(); } else if (i == R.id.action_share) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Messages"); intent.putExtra(Intent.EXTRA_TEXT, text); startActivity(Intent.createChooser(intent, "Share")); mode.finish(); } return false; ======= protected void onViewReady(Bundle savedInstanceState) { super.onViewReady(savedInstanceState); tvTitle.setText(qiscusChatRoom.getName()); tvSubtitle.setText(qiscusChatRoom.getSubtitle()); tvSubtitle.setVisibility(qiscusChatRoom.getSubtitle().isEmpty() ? View.GONE : View.VISIBLE); >>>>>>> protected void onViewReady(Bundle savedInstanceState) { super.onViewReady(savedInstanceState); tvTitle.setText(qiscusChatRoom.getName()); tvSubtitle.setText(qiscusChatRoom.getSubtitle()); tvSubtitle.setVisibility(qiscusChatRoom.getSubtitle().isEmpty() ? View.GONE : View.VISIBLE);
<<<<<<< private int cardTitleColor = R.color.qiscus_primary_text; private int cardDescriptionColor = R.color.qiscus_secondary_text; /** * @deprecated please use {@link #sendButtonIcon} instead */ @Deprecated private int sendActiveIcon = R.drawable.ic_qiscus_send_on; /** * @deprecated please use {@link #sendButtonIcon} instead */ @Deprecated private int sendInactiveIcon = R.drawable.ic_qiscus_send_off; ======= >>>>>>> private int cardTitleColor = R.color.qiscus_primary_text; private int cardDescriptionColor = R.color.qiscus_secondary_text;
<<<<<<< import android.text.format.DateUtils; ======= import android.view.Menu; import android.view.MenuItem; >>>>>>> import android.text.format.DateUtils; import android.view.Menu; import android.view.MenuItem; <<<<<<< import com.qiscus.sdk.data.model.QiscusRoomMember; import com.qiscus.sdk.presenter.QiscusUserStatusPresenter; ======= import com.qiscus.sdk.data.model.QiscusComment; import com.qiscus.sdk.ui.fragment.QiscusBaseChatFragment; >>>>>>> import com.qiscus.sdk.data.model.QiscusComment; import com.qiscus.sdk.data.model.QiscusRoomMember; import com.qiscus.sdk.presenter.QiscusUserStatusPresenter; import com.qiscus.sdk.ui.fragment.QiscusBaseChatFragment; <<<<<<< import java.util.Date; public class QiscusChatActivity extends RxAppCompatActivity implements QiscusUserStatusPresenter.View, QiscusChatFragment.UserTypingListener { ======= import java.util.List; public class QiscusChatActivity extends RxAppCompatActivity implements QiscusBaseChatFragment.CommentSelectedListener, ActionMode.Callback { >>>>>>> import java.util.Date; import java.util.List; public class QiscusChatActivity extends RxAppCompatActivity implements QiscusUserStatusPresenter.View, QiscusChatFragment.UserTypingListener, QiscusBaseChatFragment.CommentSelectedListener, ActionMode.Callback { <<<<<<< private QiscusUserStatusPresenter userStatusPresenter; ======= private ActionMode actionMode; >>>>>>> private QiscusUserStatusPresenter userStatusPresenter; private ActionMode actionMode; <<<<<<< userStatusPresenter = new QiscusUserStatusPresenter(this); ======= setSupportActionBar(toolbar); >>>>>>> setSupportActionBar(toolbar); userStatusPresenter = new QiscusUserStatusPresenter(this); <<<<<<< @Override protected void onDestroy() { super.onDestroy(); userStatusPresenter.detachView(); } ======= @Override public void onCommentSelected(List<QiscusComment> selectedComments) { boolean hasCheckedItems = selectedComments.size() > 0; if (hasCheckedItems && actionMode == null) { actionMode = startSupportActionMode(this); } else if (!hasCheckedItems && actionMode != null) { actionMode.finish(); } if (actionMode != null) { actionMode.setTitle(selectedComments.size() + " selected"); } } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.comment_action, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { if (Build.VERSION.SDK_INT < 11) { MenuItemCompat.setShowAsAction(menu.findItem(R.id.action_copy), MenuItemCompat.SHOW_AS_ACTION_NEVER); MenuItemCompat.setShowAsAction(menu.findItem(R.id.action_share), MenuItemCompat.SHOW_AS_ACTION_NEVER); } else { menu.findItem(R.id.action_copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.findItem(R.id.action_share).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } return true; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { QiscusChatFragment fragment = (QiscusChatFragment) getSupportFragmentManager() .findFragmentByTag(QiscusChatFragment.class.getName()); if (fragment == null) { mode.finish(); return false; } List<QiscusComment> selectedComments = fragment.getSelectedComments(); int i = item.getItemId(); String text = ""; for (QiscusComment qiscusComment : selectedComments) { text += qiscusComment.getSender() + ": "; text += qiscusComment.isAttachment() ? qiscusComment.getAttachmentName() : qiscusComment.getMessage(); text += "\n"; } if (i == R.id.action_copy) { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.chat_activity_label_clipboard), text); clipboard.setPrimaryClip(clip); Toast.makeText(this, selectedComments.size() + " messages copied!", Toast.LENGTH_SHORT).show(); mode.finish(); } else if (i == R.id.action_share) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Messages"); intent.putExtra(Intent.EXTRA_TEXT, text); startActivity(Intent.createChooser(intent, "Share")); mode.finish(); } return false; } @Override public void onDestroyActionMode(ActionMode mode) { actionMode = null; QiscusChatFragment fragment = (QiscusChatFragment) getSupportFragmentManager() .findFragmentByTag(QiscusChatFragment.class.getName()); if (fragment != null) { fragment.clearSelectedComments(); } } >>>>>>> @Override protected void onDestroy() { super.onDestroy(); userStatusPresenter.detachView(); } public void onCommentSelected(List<QiscusComment> selectedComments) { boolean hasCheckedItems = selectedComments.size() > 0; if (hasCheckedItems && actionMode == null) { actionMode = startSupportActionMode(this); } else if (!hasCheckedItems && actionMode != null) { actionMode.finish(); } if (actionMode != null) { actionMode.setTitle(selectedComments.size() + " selected"); } } @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.comment_action, menu); return true; } @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { if (Build.VERSION.SDK_INT < 11) { MenuItemCompat.setShowAsAction(menu.findItem(R.id.action_copy), MenuItemCompat.SHOW_AS_ACTION_NEVER); MenuItemCompat.setShowAsAction(menu.findItem(R.id.action_share), MenuItemCompat.SHOW_AS_ACTION_NEVER); } else { menu.findItem(R.id.action_copy).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.findItem(R.id.action_share).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); } return true; } @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { QiscusChatFragment fragment = (QiscusChatFragment) getSupportFragmentManager() .findFragmentByTag(QiscusChatFragment.class.getName()); if (fragment == null) { mode.finish(); return false; } List<QiscusComment> selectedComments = fragment.getSelectedComments(); int i = item.getItemId(); String text = ""; for (QiscusComment qiscusComment : selectedComments) { text += qiscusComment.getSender() + ": "; text += qiscusComment.isAttachment() ? qiscusComment.getAttachmentName() : qiscusComment.getMessage(); text += "\n"; } if (i == R.id.action_copy) { ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText(getString(R.string.chat_activity_label_clipboard), text); clipboard.setPrimaryClip(clip); Toast.makeText(this, selectedComments.size() + " messages copied!", Toast.LENGTH_SHORT).show(); mode.finish(); } else if (i == R.id.action_share) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); intent.putExtra(Intent.EXTRA_SUBJECT, "Messages"); intent.putExtra(Intent.EXTRA_TEXT, text); startActivity(Intent.createChooser(intent, "Share")); mode.finish(); } return false; } @Override public void onDestroyActionMode(ActionMode mode) { actionMode = null; QiscusChatFragment fragment = (QiscusChatFragment) getSupportFragmentManager() .findFragmentByTag(QiscusChatFragment.class.getName()); if (fragment != null) { fragment.clearSelectedComments(); } }
<<<<<<< Qiscus.getChatConfig() .setStatusBarColor(R.color.accent) .setAppBarColor(R.color.accent) .setTitleColor(R.color.qiscus_dark_white) .setLeftBubbleColor(R.color.accent) .setRightBubbleColor(R.color.primary) .setRightBubbleTextColor(R.color.qiscus_white) .setRightBubbleTimeColor(R.color.primary_light) .setReadIconColor(R.color.qiscus_white) .setTimeFormat(date -> new SimpleDateFormat("HH:mm").format(date)); ======= >>>>>>>
<<<<<<< import org.opennars.io.events.Events; import org.opennars.io.events.EventEmitter; import java.io.Serializable; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Deque; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Random; import org.opennars.main.NAR; import org.opennars.main.NAR.RuntimeParameters; import org.opennars.main.NarParameters; import org.opennars.main.Parameters; import org.opennars.io.events.Events.ResetEnd; import org.opennars.io.events.Events.ResetStart; import org.opennars.io.events.Events.TaskRemove; ======= >>>>>>> <<<<<<< public void localInference(Task task, NarParameters narParameters) { DerivationContext cont = new DerivationContext(this, narParameters); ======= public void localInference(final Task task) { final DerivationContext cont = new DerivationContext(this); >>>>>>> public void localInference(final Task task, NarParameters narParameters) { final DerivationContext cont = new DerivationContext(this, narParameters);
<<<<<<< Sentence projGoal = task.sentence.projection(concept.memory.time(), Parameters.DURATION); if(projGoal!=null && projGoal.truth.getExpectation() > nal.narParameters.DECISION_THRESHOLD) { ======= final Sentence projGoal = task.sentence.projection(concept.memory.time(), Parameters.DURATION); if(projGoal!=null && projGoal.truth.getExpectation() > nal.memory.param.decisionThreshold.get()) { >>>>>>> final Sentence projGoal = task.sentence.projection(concept.memory.time(), Parameters.DURATION); if(projGoal!=null && projGoal.truth.getExpectation() > nal.narParameters.DECISION_THRESHOLD) { <<<<<<< if(bestop != null && bestop_truthexp > nal.narParameters.DECISION_THRESHOLD /*&& Math.random() < bestop_truthexp */) { Sentence createdSentence = new Sentence( bestop, Symbols.JUDGMENT_MARK, bestop_truth, projectedGoal.stamp); Task t = new Task(createdSentence, new BudgetValue(1.0f,1.0f,1.0f), false); //System.out.println("used " +t.getTerm().toString() + String.valueOf(memory.randomNumber.nextInt())); if(!task.sentence.stamp.evidenceIsCyclic()) { if(!executeDecision(nal, t)) { //this task is just used as dummy concept.memory.emit(Events.UnexecutableGoal.class, task, concept, nal); } else { concept.memory.decisionBlock = concept.memory.time() + Parameters.AUTOMATIC_DECISION_USUAL_DECISION_BLOCK_CYCLES; generatePotentialNegConfirmation(nal, executable_precond.sentence, executable_precond.budget, mintime, maxtime, 2); } ======= if(bestop != null && bestop_truthexp > concept.memory.param.decisionThreshold.get() /*&& Math.random() < bestop_truthexp */) { final Sentence createdSentence = new Sentence( bestop, Symbols.JUDGMENT_MARK, bestop_truth, projectedGoal.stamp); final Task t = new Task(createdSentence, new BudgetValue(1.0f,1.0f,1.0f), false); //System.out.println("used " +t.getTerm().toString() + String.valueOf(memory.randomNumber.nextInt())); if(!task.sentence.stamp.evidenceIsCyclic()) { if(!executeDecision(nal, t)) { //this task is just used as dummy concept.memory.emit(Events.UnexecutableGoal.class, task, concept, nal); } else { concept.memory.decisionBlock = concept.memory.time() + Parameters.AUTOMATIC_DECISION_USUAL_DECISION_BLOCK_CYCLES; generatePotentialNegConfirmation(nal, executable_precond.sentence, executable_precond.budget, mintime, maxtime, 2); >>>>>>> if(bestop != null && bestop_truthexp > nal.narParameters.DECISION_THRESHOLD /*&& Math.random() < bestop_truthexp */) { final Sentence createdSentence = new Sentence( bestop, Symbols.JUDGMENT_MARK, bestop_truth, projectedGoal.stamp); final Task t = new Task(createdSentence, new BudgetValue(1.0f,1.0f,1.0f), false); //System.out.println("used " +t.getTerm().toString() + String.valueOf(memory.randomNumber.nextInt())); if(!task.sentence.stamp.evidenceIsCyclic()) { if(!executeDecision(nal, t)) { //this task is just used as dummy concept.memory.emit(Events.UnexecutableGoal.class, task, concept, nal); } else { concept.memory.decisionBlock = concept.memory.time() + Parameters.AUTOMATIC_DECISION_USUAL_DECISION_BLOCK_CYCLES; generatePotentialNegConfirmation(nal, executable_precond.sentence, executable_precond.budget, mintime, maxtime, 2);
<<<<<<< private final int mIconId; ======= private final int mFieldId; >>>>>>> private final int mIconId; private final int mFieldId; <<<<<<< public FieldInflater(FieldAdapter<?> adapter, int fieldTitle, int detailsLayout, int editLayout, int iconId) ======= public FieldInflater(FieldAdapter<?> adapter, int fieldId, int fieldTitle, int detailsLayout, int editLayout) >>>>>>> public FieldInflater(FieldAdapter<?> adapter, int fieldId, int fieldTitle, int detailsLayout, int editLayout, int iconId) <<<<<<< mIconId = iconId; ======= mFieldId = fieldId; >>>>>>> mIconId = iconId; mFieldId = fieldId; <<<<<<< FIELD_INFLATER_MAP.put("title", new FieldInflater(TaskFieldAdapters.TITLE, R.string.task_title, R.layout.text_field_view, R.layout.text_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("location", new FieldInflater(TaskFieldAdapters.LOCATION, R.string.task_location, R.layout.text_field_view, R.layout.text_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("description", new FieldInflater(TaskFieldAdapters.DESCRIPTION, R.string.task_description, R.layout.text_field_view, R.layout.text_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("checklist", new FieldInflater(TaskFieldAdapters.CHECKLIST, R.string.task_checklist, R.layout.checklist_field_view, R.layout.checklist_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("dtstart", new FieldInflater(TaskFieldAdapters.DTSTART, R.string.task_start, R.layout.time_field_view, R.layout.time_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("due", new FieldInflater(TaskFieldAdapters.DUE, R.string.task_due, R.layout.time_field_view, R.layout.time_field_editor, R.drawable.ic_label_due).addDetailsLayoutOption(LayoutDescriptor.OPTION_TIME_FIELD_SHOW_ADD_BUTTONS, true)); FIELD_INFLATER_MAP.put("completed", new FieldInflater(TaskFieldAdapters.COMPLETED, R.string.task_completed, R.layout.time_field_view, R.layout.time_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("percent_complete", new FieldInflater(TaskFieldAdapters.PERCENT_COMPLETE, R.string.task_percent_complete, R.layout.percentage_field_view, R.layout.percentage_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("status", new FieldInflater(TaskFieldAdapters.STATUS, R.string.task_status, R.layout.choices_field_view, R.layout.choices_field_editor, R.drawable.ic_label_start) ======= FIELD_INFLATER_MAP.put("title", new FieldInflater(TaskFieldAdapters.TITLE, R.id.task_field_title, R.string.task_title, R.layout.text_field_view, R.layout.text_field_editor)); FIELD_INFLATER_MAP.put("location", new FieldInflater(TaskFieldAdapters.LOCATION, R.id.task_field_location, R.string.task_location, R.layout.text_field_view, R.layout.text_field_editor)); FIELD_INFLATER_MAP.put("description", new FieldInflater(TaskFieldAdapters.DESCRIPTION, R.id.task_field_description, R.string.task_description, R.layout.text_field_view, R.layout.text_field_editor)); FIELD_INFLATER_MAP.put("checklist", new FieldInflater(TaskFieldAdapters.CHECKLIST, R.id.task_field_checklist, R.string.task_checklist, R.layout.checklist_field_view, R.layout.checklist_field_editor)); FIELD_INFLATER_MAP.put("dtstart", new FieldInflater(TaskFieldAdapters.DTSTART, R.id.task_field_dtstart, R.string.task_start, R.layout.time_field_view, R.layout.time_field_editor)); FIELD_INFLATER_MAP.put("due", new FieldInflater(TaskFieldAdapters.DUE, R.id.task_field_due, R.string.task_due, R.layout.time_field_view, R.layout.time_field_editor).addDetailsLayoutOption(LayoutDescriptor.OPTION_TIME_FIELD_SHOW_ADD_BUTTONS, true)); FIELD_INFLATER_MAP.put("completed", new FieldInflater(TaskFieldAdapters.COMPLETED, R.id.task_field_completed, R.string.task_completed, R.layout.time_field_view, R.layout.time_field_editor)); FIELD_INFLATER_MAP.put("percent_complete", new FieldInflater(TaskFieldAdapters.PERCENT_COMPLETE, R.id.task_field_percent_complete, R.string.task_percent_complete, R.layout.percentage_field_view, R.layout.percentage_field_editor)); FIELD_INFLATER_MAP.put("status", new FieldInflater(TaskFieldAdapters.STATUS, R.id.task_field_status, R.string.task_status, R.layout.choices_field_view, R.layout.choices_field_editor) >>>>>>> FIELD_INFLATER_MAP.put("title", new FieldInflater(TaskFieldAdapters.TITLE, R.id.task_field_title, R.string.task_title, R.layout.text_field_view, R.layout.text_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("location", new FieldInflater(TaskFieldAdapters.LOCATION, R.id.task_field_location, R.string.task_location, R.layout.text_field_view, R.layout.text_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("description", new FieldInflater(TaskFieldAdapters.DESCRIPTION, R.id.task_field_description, R.string.task_description, R.layout.text_field_view, R.layout.text_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("checklist", new FieldInflater(TaskFieldAdapters.CHECKLIST, R.id.task_field_checklist, R.string.task_checklist, R.layout.checklist_field_view, R.layout.checklist_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("dtstart", new FieldInflater(TaskFieldAdapters.DTSTART, R.id.task_field_dtstart, R.string.task_start, R.layout.time_field_view, R.layout.time_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("due", new FieldInflater(TaskFieldAdapters.DUE, R.id.task_field_due, R.string.task_due, R.layout.time_field_view, R.layout.time_field_editor, R.drawable.ic_label_due).addDetailsLayoutOption(LayoutDescriptor.OPTION_TIME_FIELD_SHOW_ADD_BUTTONS, true)); FIELD_INFLATER_MAP.put("completed", new FieldInflater(TaskFieldAdapters.COMPLETED, R.id.task_field_completed, R.string.task_completed, R.layout.time_field_view, R.layout.time_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("percent_complete", new FieldInflater(TaskFieldAdapters.PERCENT_COMPLETE, R.id.task_field_percent_complete, R.string.task_percent_complete, R.layout.percentage_field_view, R.layout.percentage_field_editor, R.drawable.ic_label_start)); FIELD_INFLATER_MAP.put("status", new FieldInflater(TaskFieldAdapters.STATUS, R.id.task_field_status, R.string.task_status, R.layout.choices_field_view, R.layout.choices_field_editor, R.drawable.ic_label_start) <<<<<<< FIELD_INFLATER_MAP.put("priority", new FieldInflater(TaskFieldAdapters.PRIORITY, R.string.task_priority, R.layout.choices_field_view, R.layout.choices_field_editor, R.drawable.ic_label_start) ======= FIELD_INFLATER_MAP.put("priority", new FieldInflater(TaskFieldAdapters.PRIORITY, R.id.task_field_priority, R.string.task_priority, R.layout.choices_field_view, R.layout.choices_field_editor) >>>>>>> FIELD_INFLATER_MAP.put("priority", new FieldInflater(TaskFieldAdapters.PRIORITY, R.id.task_field_priority, R.string.task_priority, R.layout.choices_field_view, R.layout.choices_field_editor, R.drawable.ic_label_start) <<<<<<< FIELD_INFLATER_MAP.put("classification", new FieldInflater(TaskFieldAdapters.CLASSIFICATION, R.string.task_classification, R.layout.choices_field_view, R.layout.choices_field_editor, R.drawable.ic_label_start) ======= FIELD_INFLATER_MAP.put("classification", new FieldInflater(TaskFieldAdapters.CLASSIFICATION, R.id.task_field_classification, R.string.task_classification, R.layout.choices_field_view, R.layout.choices_field_editor) >>>>>>> FIELD_INFLATER_MAP.put("classification", new FieldInflater(TaskFieldAdapters.CLASSIFICATION, R.id.task_field_classification, R.string.task_classification, R.layout.choices_field_view, R.layout.choices_field_editor, R.drawable.ic_label_start) <<<<<<< FIELD_INFLATER_MAP.put("timezone", new FieldInflater(TaskFieldAdapters.TIMEZONE, R.string.task_timezone, -1, R.layout.choices_field_editor, R.drawable.ic_label_start) ======= FIELD_INFLATER_MAP.put("timezone", new FieldInflater(TaskFieldAdapters.TIMEZONE, R.id.task_field_timezone, R.string.task_timezone, -1, R.layout.choices_field_editor) >>>>>>> FIELD_INFLATER_MAP.put("timezone", new FieldInflater(TaskFieldAdapters.TIMEZONE, R.id.task_field_timezone, R.string.task_timezone, -1, R.layout.choices_field_editor, R.drawable.ic_label_start)