Skip to content

Commit

Permalink
prepare verion 1.0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smurf667 authored Sep 24, 2019
1 parent bd33984 commit b85565c
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 62 deletions.
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Change log

## 1.2.0 (TV-Browser: 1.0.2.0)

Changed the plugin ID and reduced the Calendar API access scope upon request by Google.

## 1.1.0 (TV-Browser: 1.0.1.0)

Updates:
- allow to suppress the export success message
- allow numerical placeholders
- avoid issue with TV-Browser 3.4.2
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ If you get an error message which indicates an `invalid_token` maybe something w

Recommended solution: Delete the file `StoredCredentials` in `%userprofile%\AppData\Roaming\TV-Browser\<TV-Browser-version>\.store\googlecalx` and restart TV-Browser. Using the calendar export should prompt for your login credentials again.
This question has been asked (in German) in the TV-Browser forum at https://hilfe.tvbrowser.org/viewtopic.php?t=17003&start=105#p109952

## What has changed in this release?

Please refer to the [changes document](CHANGES.md).
19 changes: 5 additions & 14 deletions googlecalx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>de.engehausen</groupId>
<artifactId>googlecalx</artifactId>
<packaging>jar</packaging>
<version>1.2.0-SNAPSHOT</version>
<version>1.2.0</version>
<name>googlecalx</name>
<url>https://github.com/smurf667/googlecalx</url>
<description>Plugin for TV-Browser (https://www.tvbrowser.org/) to export programs to Google Calendar.</description>
Expand All @@ -30,10 +30,9 @@
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<prerequisites>
<maven>3.0.5</maven>
</prerequisites>
<repositories>
<repository>
<id>tvbrowser-maven-repository</id>
Expand Down Expand Up @@ -78,24 +77,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<version>3.1.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.lang.reflect.InvocationTargetException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
Expand Down Expand Up @@ -242,7 +243,8 @@ protected Calendar getCalendar() throws IOException {
httpTransport,
jsonFactory,
clientSecrets,
Collections.singleton(CalendarScopes.CALENDAR_EVENTS)).setDataStoreFactory(fileDataStoreFactory).build();
Arrays.asList(CalendarScopes.CALENDAR_EVENTS, CalendarScopes.CALENDAR_READONLY)
).setDataStoreFactory(fileDataStoreFactory).build();
final Credential credential = new AuthorizationCodeInstalledApp(flow, new LocalServerReceiver()).authorize("user");
client = new Calendar.Builder(
httpTransport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class CalendarTargetField extends JTextField {
private CalendarTarget target;

public CalendarTargetField(final CalendarTarget aTarget) {
super(aTarget.getLabel(), 40);
super(aTarget.getLabel(), 24);
setEnabled(false);
}

Expand Down
31 changes: 14 additions & 17 deletions googlecalx/src/main/java/googlecalxplugin/GoogleCalXPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -294,24 +294,21 @@ protected ExportAction(final Program prog, final GoogleCalXPlugin parent) {
@Override
public void actionPerformed(final ActionEvent e) {
if (plugin.calendarAccess != null) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
plugin.calendarAccess.addEvent(
plugin.calendarAccess.createEvent(program)
);
program.mark(plugin);
if (plugin.settings.getShowExportSuccess()) {
JOptionPane.showMessageDialog(
plugin.getParentFrame(),
localizer.msg(MSG_EXPORT_OK, "Export to calendar was successful."),
localizer.msg(MSG_SUCCESS, "Success!"),
JOptionPane.INFORMATION_MESSAGE);
}
} catch (IOException ex) {
ErrorHandler.handle(localizer.msg(MSG_ERROR, "Service call error"), ex);
SwingUtilities.invokeLater(() -> {
try {
plugin.calendarAccess.addEvent(
plugin.calendarAccess.createEvent(program)
);
program.mark(plugin);
if (plugin.settings.getShowExportSuccess()) {
JOptionPane.showMessageDialog(
plugin.getParentFrame(),
localizer.msg(MSG_EXPORT_OK, "Export to calendar was successful."),
localizer.msg(MSG_SUCCESS, "Success!"),
JOptionPane.INFORMATION_MESSAGE);
}
} catch (IOException ex) {
ErrorHandler.handle(localizer.msg(MSG_ERROR, "Service call error"), ex);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,41 +218,37 @@ public void actionPerformed(final ActionEvent e) {
calendarAccess.deleteCredentials();
}
} else if (source == pickCalendarTarget) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
final List<CalendarTarget> targets = calendarAccess.getCalendarTargets();
if (targets.size() > 0) {
final CalendarTarget[] possibleValues = targets.toArray(new CalendarTarget[targets.size()]);
final Object selectedValue = JOptionPane.showInputDialog(
parent,
localizer.msg(GoogleCalXPlugin.MSG_CHOOSE_CALENDAR, "Choose calendar"),
localizer.msg(GoogleCalXPlugin.MSG_SELECT, "select"),
JOptionPane.INFORMATION_MESSAGE,
null,
possibleValues, possibleValues[0]);
if (selectedValue != null) {
fieldCalendarTarget.setCalendarTarget((CalendarTarget) selectedValue);
}
SwingUtilities.invokeLater(() -> {
try {
final List<CalendarTarget> targets = calendarAccess.getCalendarTargets();
if (targets.size() > 0) {
final CalendarTarget[] possibleValues = targets.toArray(new CalendarTarget[targets.size()]);
final Object selectedValue = JOptionPane.showInputDialog(
parent,
localizer.msg(GoogleCalXPlugin.MSG_CHOOSE_CALENDAR, "Choose calendar"),
localizer.msg(GoogleCalXPlugin.MSG_SELECT, "select"),
JOptionPane.INFORMATION_MESSAGE,
null,
possibleValues, possibleValues[0]);
if (selectedValue != null) {
fieldCalendarTarget.setCalendarTarget((CalendarTarget) selectedValue);
}
} catch (IOException ex) {
ErrorHandler.handle(localizer.msg(GoogleCalXPlugin.MSG_ERROR, "Service call error"), ex);
}
} catch (IOException ex) {
ErrorHandler.handle(localizer.msg(GoogleCalXPlugin.MSG_ERROR, "Service call error"), ex);
}
});
} else if (source == pickNotificationColor) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
final List<CalendarColor> colors = new ArrayList<CalendarColor>();
for (Map.Entry<String, ColorDefinition> entry : calendarAccess.getCalendarColors()) {
colors.add(new CalendarColor(entry.getKey(), entry.getValue()));
}
Collections.sort(colors);
notificationColor.setColor(NotificationColor.pickColor(parent, localizer.msg(GoogleCalXPlugin.MSG_CHOOSE_COLOR, "Choose color"), colors));
} catch (IOException ex) {
ErrorHandler.handle(localizer.msg(GoogleCalXPlugin.MSG_ERROR, "Service call error"), ex);
SwingUtilities.invokeLater(() -> {
try {
final List<CalendarColor> colors = new ArrayList<CalendarColor>();
for (Map.Entry<String, ColorDefinition> entry : calendarAccess.getCalendarColors()) {
colors.add(new CalendarColor(entry.getKey(), entry.getValue()));
}
Collections.sort(colors);
notificationColor.setColor(NotificationColor.pickColor(parent, localizer.msg(GoogleCalXPlugin.MSG_CHOOSE_COLOR, "Choose color"), colors));
} catch (IOException ex) {
ErrorHandler.handle(localizer.msg(GoogleCalXPlugin.MSG_ERROR, "Service call error"), ex);
}
});
}
Expand Down

0 comments on commit b85565c

Please sign in to comment.