~swisschili/chat

185d0837d6612f9e331196160da4379f412938e9 — swissChili 5 months ago 404cdee
Fix build for JDK 8
Motivation is BACK (thanks to spirrwell)
M .build.yml => .build.yml +1 -1
@@ 1,6 1,6 @@
image: debian/stable
packages:
  - openjdk-11-jdk
  - openjdk-8-jdk
sources:
  - https://github.com/swissChili/chat
tasks:

M .idea/misc.xml => .idea/misc.xml +1 -1
@@ 4,7 4,7 @@
  <component name="FrameworkDetectionExcludesConfiguration">
    <file type="web" url="file://$PROJECT_DIR$" />
  </component>
  <component name="ProjectRootManager" version="2" languageLevel="JDK_15" default="true" project-jdk-name="openjdk-15" project-jdk-type="JavaSDK">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/out" />
  </component>
</project>
\ No newline at end of file

M build.gradle => build.gradle +0 -2
@@ 26,7 26,5 @@ allprojects {
    dependencies {
        compile 'org.jetbrains:annotations:19.0.0'
        testCompile group: 'junit', name: 'junit', version: '4.12'

        compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
    }
}

M client/src/main/java/sh/swisschili/chat/client/AddGroupDialog.java => client/src/main/java/sh/swisschili/chat/client/AddGroupDialog.java +1 -1
@@ 65,7 65,7 @@ public class AddGroupDialog extends JDialog {
            private final Pattern pattern = Pattern.compile("^[0-9a-zA-Z\\.\\-]+$");

            private boolean isValid(String input) {
                if (input.isBlank())
                if (input.trim().isEmpty())
                    return false;

                Matcher matcher = pattern.matcher(input);

M client/src/main/java/sh/swisschili/chat/client/LoginDialog.java => client/src/main/java/sh/swisschili/chat/client/LoginDialog.java +2 -2
@@ 84,7 84,7 @@ public class LoginDialog extends JDialog {
                    .setPassword(String.valueOf(password.getPassword()))
                    .build();

            stub.signIn(request, new StreamObserver<>() {
            stub.signIn(request, new StreamObserver<ChatProtos.SignInResponse>() {
                private ChatProtos.User user;
                @Override
                public void onNext(ChatProtos.SignInResponse value) {


@@ 111,7 111,7 @@ public class LoginDialog extends JDialog {
                    .setPrivateKey(ByteString.copyFrom(SignedAuth.privateKeyToBytes(keys.getPrivate())))
                    .build();

            stub.register(request, new StreamObserver<>() {
            stub.register(request, new StreamObserver<ChatProtos.RegisterResponse>() {
                private boolean completed = false;

                @Override

M client/src/main/java/sh/swisschili/chat/client/MainWindow.java => client/src/main/java/sh/swisschili/chat/client/MainWindow.java +2 -2
@@ 95,7 95,7 @@ public class MainWindow {
        users.setCellRenderer(new UserStatusComponent.Renderer());

        DefaultComboBoxModel<String> statusModel = new DefaultComboBoxModel<>();
        statusModel.addAll(Arrays.asList("Online", "Away", "Do not disturb"));
        Arrays.asList("Online", "Away", "Do not disturb").forEach(statusModel::addElement);
        statusBox.setModel(statusModel);

        statusBox.addActionListener(e -> {


@@ 209,7 209,7 @@ public class MainWindow {
    }

    protected void sendMessage() {
        if (messageField.getText().isBlank() || currentChannel == null)
        if (messageField.getText().trim().isEmpty() || currentChannel == null)
            return;

        LOGGER.info("Message sent " + messageField.getText());

M client/src/main/java/sh/swisschili/chat/client/ServerChannel.java => client/src/main/java/sh/swisschili/chat/client/ServerChannel.java +2 -2
@@ 104,7 104,7 @@ public class ServerChannel {
    }

    public InfiniteScrollPane.BufferedLoader<Message> getBufferedLoader() {
        return new InfiniteScrollPane.BufferedLoader<>() {
        return new InfiniteScrollPane.BufferedLoader<Message>() {
            @Override
            public CompletableFuture<Void> loadMore(int number) {
                LOGGER.info(String.format("Starting to fetch from %d length %d", messageModel.getSize(), number));


@@ 114,7 114,7 @@ public class ServerChannel {
                                .setFrom(messageModel.getSize())
                                .setCount(number)
                                .setChannel(channel).build(),
                        new StreamObserver<>() {
                        new StreamObserver<MessageRangeResponse>() {
                            @Override
                            public void onNext(MessageRangeResponse value) {
                                SwingUtilities.invokeLater(() -> {

M client/src/main/java/sh/swisschili/chat/client/ServerGroup.java => client/src/main/java/sh/swisschili/chat/client/ServerGroup.java +5 -5
@@ 64,7 64,7 @@ public class ServerGroup {

        ServerGroup serverGroup = this;

        StreamObserver<AddUserResponse> addUserObserver = new StreamObserver<>() {
        StreamObserver<AddUserResponse> addUserObserver = new StreamObserver<AddUserResponse>() {
            @Override
            public void onNext(AddUserResponse value) {
                authorizedUser = value.getUser();


@@ 91,7 91,7 @@ public class ServerGroup {
                    @Override
                    public void onCompleted() {
                        pool.chatStubFor(server)
                                .getGroupChannels(group, new StreamObserver<>() {
                                .getGroupChannels(group, new StreamObserver<GroupChannelsResponse>() {
                                    @Override
                                    public void onNext(GroupChannelsResponse value) {
                                        channels = value.getChannelsList().stream()


@@ 99,7 99,7 @@ public class ServerGroup {
                                                .collect(Collectors.toList());

                                        model.clear();
                                        model.addAll(channels);
                                        channels.forEach(model::addElement);
                                    }

                                    @Override


@@ 115,7 115,7 @@ public class ServerGroup {

                        pool.chatStubFor(server)
                                .getGroupUserStatuses(GroupUserStatusRequest.newBuilder().setGroup(group).build(),
                                        new StreamObserver<>() {
                                        new StreamObserver<UserStatus>() {
                                            @Override
                                            public void onNext(UserStatus value) {
                                                LOGGER.info("Got user status " + value.toString());


@@ 159,7 159,7 @@ public class ServerGroup {
                                .setGroup(group)
                                .setStatus(status)
                                .build(),
                        new StreamObserver<>() {
                        new StreamObserver<SetUserStatusResponse>() {
                            @Override
                            public void onNext(SetUserStatusResponse value) {
                            }

M client/src/main/java/sh/swisschili/chat/client/SettingsDialog.java => client/src/main/java/sh/swisschili/chat/client/SettingsDialog.java +3 -2
@@ 81,8 81,9 @@ public class SettingsDialog extends JDialog {
        logInRegisterButton.setIcon(ColoredIcon.buildIcon(FontAwesome.USER_CIRCLE, 14));

        DefaultComboBoxModel<Theme> themeModel = new DefaultComboBoxModel<>();
        themeModel.addAll(Arrays.asList(new DarculaTheme(), new IntelliJTheme(), new SolarizedLightTheme(),
                new SolarizedDarkTheme(), new OneDarkTheme(), new HighContrastLightTheme(), new HighContrastDarkTheme()));
        Arrays.asList(new DarculaTheme(), new IntelliJTheme(), new SolarizedLightTheme(),
                new SolarizedDarkTheme(), new OneDarkTheme(), new HighContrastLightTheme(), new HighContrastDarkTheme())
            .forEach(themeModel::addElement);

        themeComboBox.setModel(themeModel);


M server/src/main/java/sh/swisschili/chat/server/ChatService.java => server/src/main/java/sh/swisschili/chat/server/ChatService.java +1 -1
@@ 77,7 77,7 @@ public class ChatService extends ChatGrpc.ChatImplBase {
            lock.unlock();
            LOGGER.info("Public key not cached, querying server for details");

            StreamObserver<ChatProtos.UserPublicKey> listener = new StreamObserver<>() {
            StreamObserver<ChatProtos.UserPublicKey> listener = new StreamObserver<ChatProtos.UserPublicKey>() {
                @Override
                public void onNext(ChatProtos.UserPublicKey value) {
                    try {

M util/build.gradle => util/build.gradle +2 -0
@@ 33,8 33,10 @@ sourceSets {

dependencies {
    // RPC
    compile group: 'com.google.protobuf', name: 'protobuf-java', version: '3.13.0'
    compile group: 'io.grpc', name: 'grpc-all', version: '1.25.0'
    compile "javax.annotation:javax.annotation-api:1.3.2"

    compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
    compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.30'
}
\ No newline at end of file