Skip to content

Commit

Permalink
For #132 - renamed API key to Access Token to conform to pushbullet t…
Browse files Browse the repository at this point in the history
…erminology, updated UI
  • Loading branch information
vitalidze committed Apr 7, 2015
1 parent 6fec24c commit 36e0013
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/traccar/web/client/i18n/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,5 @@ public interface Messages extends com.google.gwt.i18n.client.Messages {

String event();

String apiKey();
String accessToken();
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public interface NotificationSettingsHandler {
PasswordField password;

@UiField
TextField pushbulletApiKey;
TextField pushbulletAccessToken;

@UiField(provided = true)
Messages i18n = GWT.create(Messages.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<ui:with type="com.sencha.gxt.widget.core.client.form.NumberPropertyEditor" field="integerPropertyEditor" />

<gxt:Window ui:field="window" pixelSize="300, 405" modal="true" headingText="{i18n.notificationSettings}" focusWidget="{saveButton}">
<gxt:Window ui:field="window" pixelSize="350, 405" modal="true" headingText="{i18n.notificationSettings}" focusWidget="{saveButton}">
<container:VerticalLayoutContainer>
<container:child layoutData="{verticalLayoutData}">
<gxt:FramedPanel headingText="{i18n.email}">
Expand Down Expand Up @@ -87,9 +87,9 @@
<gxt:FramedPanel headingText="Pushbullet">
<container:VerticalLayoutContainer>
<container:child layoutData="{verticalLayoutData}">
<form:FieldLabel text="{i18n.apiKey}" labelWidth="60">
<form:FieldLabel text="{i18n.accessToken}" labelWidth="86">
<form:widget>
<form:TextField ui:field="pushbulletApiKey" />
<form:TextField ui:field="pushbulletAccessToken" />
</form:widget>
</form:FieldLabel>
</container:child>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private boolean sendEmail(NotificationSettings settings, User user, String subje

private boolean sendPushbullet(NotificationSettings settings, User user, String subject, String body) {
// perform some validation of Pushbullet settings
if (settings.getPushbulletApiKey() == null || settings.getPushbulletApiKey().trim().isEmpty()) {
if (settings.getPushbulletAccessToken() == null || settings.getPushbulletAccessToken().trim().isEmpty()) {
return false;
}
logger.info("Sending Pushbullet notification to '" + user.getEmail() + "'...");
Expand All @@ -331,7 +331,7 @@ private boolean sendPushbullet(NotificationSettings settings, User user, String
URL url = new URL("https://api.pushbullet.com/v2/pushes");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Authorization", "Bearer " + settings.getPushbulletApiKey());
conn.setRequestProperty("Authorization", "Bearer " + settings.getPushbulletAccessToken());
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
os = conn.getOutputStream();
Expand Down Expand Up @@ -450,7 +450,7 @@ public void checkPushbulletSettings(NotificationSettings settings) {
URL url = new URL("https://api.pushbullet.com/v2/users/me");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Authorization", "Bearer " + settings.getPushbulletApiKey());
conn.setRequestProperty("Authorization", "Bearer " + settings.getPushbulletAccessToken());
is = conn.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ public void setSecureConnectionType(SecureConnectionType secureConnectionType) {
this.secureConnectionType = secureConnectionType;
}

private String pushbulletApiKey;
private String pushbulletAccessToken;

public String getPushbulletApiKey() {
return pushbulletApiKey;
public String getPushbulletAccessToken() {
return pushbulletAccessToken;
}

public void setPushbulletApiKey(String pushbulletApiKey) {
this.pushbulletApiKey = pushbulletApiKey;
public void setPushbulletAccessToken(String pushbulletApiKey) {
this.pushbulletAccessToken = pushbulletApiKey;
}

public void copyFrom(NotificationSettings s) {
Expand All @@ -171,6 +171,6 @@ public void copyFrom(NotificationSettings s) {
setUsername(s.getUsername());
setPassword(s.getPassword());
setSecureConnectionType(s.getSecureConnectionType());
setPushbulletApiKey(s.getPushbulletApiKey());
setPushbulletAccessToken(s.getPushbulletAccessToken());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ testFailed = Test failed. Please check settings.
testSucceeded = Test succeeded.
email = Email
invalidEmail = Invalid Email address
apiKey = API Key
accessToken = Access Token
# Archive style menu
style = Style
fullPalette = Full palette
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ testFailed = Тест провалился. Проверьте пожалуйс
testSucceeded = Тест прошел успешно.
email = Эл. почта
invalidEmail = Некорректный адрес электронной почты
apiKey = Ключ API
accessToken = Ключ Доступа
# Archive style menu
style = Стиль
fullPalette = Вся палитра
Expand Down

0 comments on commit 36e0013

Please sign in to comment.