Skip to content

Commit

Permalink
Notify My Androidを削除
Browse files Browse the repository at this point in the history
  • Loading branch information
nekopanda committed Nov 23, 2018
1 parent b5e4294 commit 4aff77a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 80 deletions.
34 changes: 19 additions & 15 deletions main/logbook/config/bean/AppConfigBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import java.util.List;
import java.util.Map;

import logbook.constants.AppConstants;
import logbook.dto.ShipFilterDto;

import org.apache.commons.io.FilenameUtils;
import org.eclipse.swt.graphics.RGB;

import logbook.constants.AppConstants;
import logbook.dto.ShipFilterDto;

/**
* アプリケーションの設定
*
Expand Down Expand Up @@ -81,10 +81,10 @@ public final class AppConfigBean {
/** Prowl による Push 通知 APIKey */
private String ProwlAPIKey = "";

/** NMA による Push 通知設定 */
/** NMA による Push 通知設定 (obsolete) */
private boolean NotifyNMA = false;

/** NMA による Push 通知 APIKey */
/** NMA による Push 通知 APIKey (obsolete) */
private String NMAAPIKey = "";

/** ImKayac による Push 通知設定 */
Expand Down Expand Up @@ -529,9 +529,13 @@ public void setShowCondCycleTimer(boolean showCondTimer) {
this.showCondCycleTimer = showCondTimer;
}

public boolean isShowResultRecord() { return showResultRecord; }
public boolean isShowResultRecord() {
return this.showResultRecord;
}

public void setShowResultRecord(boolean showResultRecord) { this.showResultRecord = showResultRecord; }
public void setShowResultRecord(boolean showResultRecord) {
this.showResultRecord = showResultRecord;
}

/**
* @return showNotifySetting
Expand Down Expand Up @@ -795,18 +799,21 @@ public void setPushoverApitoken(String apitoken) {
public boolean getNotifyLINE() {
return this.NotifyLINE;
}

/** LINE Notify API による 通知の Apitoken を取得します
* @return Apitoken
*/
public String getLINEApitoken() {
return this.LINEApitoken;
}

/** LINE Notify API による 通知を設定します
* @param LINE Notify API による 通知
*/
public void setNotifyLINE(boolean linecflg) {
this.NotifyLINE = linecflg;
}

/** LINE Notify API による 通知の Apitoken を設定します
* @param Apitoken
*/
Expand Down Expand Up @@ -1380,10 +1387,8 @@ public void setShowGunAndBulge(boolean showGunAndBulge) {
this.showGunAndBulge = showGunAndBulge;
}



public boolean isShowAA() {
return showAA;
return this.showAA;
}

public void setShowAA(boolean showAA) {
Expand Down Expand Up @@ -2263,17 +2268,16 @@ public void setUseLockedOnlyFleetFormat(boolean useLockedOnlyFleetFormat) {
this.useLockedOnlyFleetFormat = useLockedOnlyFleetFormat;
}

public double getBunkitenKeisu(){
return bunkitenKeisu;
public double getBunkitenKeisu() {
return this.bunkitenKeisu;
}

public void setBunkitenKeisu(double keisu){
public void setBunkitenKeisu(double keisu) {
this.bunkitenKeisu = keisu;
}


public boolean isShowAirbase() {
return showAirbase;
return this.showAirbase;
}

public void setShowAirbase(boolean showAirbase) {
Expand Down
21 changes: 0 additions & 21 deletions main/logbook/gui/ConfigDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -826,21 +826,6 @@ public void widgetSelected(SelectionEvent e) {
prowlAPIKey.setLayoutData(gdprowlAPIKey);
prowlAPIKey.setText(AppConfig.get().getProwlAPIKey());

final Button nma = new Button(compositePushNotify, SWT.CHECK);
nma.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
nma.setText("Notify My Android (NMA)によるPush通知");
nma.setSelection(AppConfig.get().getNotifyNMA());

Label label12 = new Label(compositePushNotify, SWT.NONE);
label12.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
label12.setText("NMA APIKey");

final Text nmaAPIKey = new Text(compositePushNotify, SWT.BORDER);
GridData gdnmaAPIKey = new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1);
gdnmaAPIKey.widthHint = SwtUtils.DPIAwareWidth(200);
nmaAPIKey.setLayoutData(gdnmaAPIKey);
nmaAPIKey.setText(AppConfig.get().getNMAAPIKey());

final Button imkayac = new Button(compositePushNotify, SWT.CHECK);
imkayac.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
imkayac.setText("ImKayac によるPush通知(秘密鍵優先)");
Expand Down Expand Up @@ -973,8 +958,6 @@ public void widgetSelected(SelectionEvent e) {
public void widgetSelected(SelectionEvent e) {
AppConfig.get().setNotifyProwl(prowl.getSelection());
AppConfig.get().setProwlAPIKey(prowlAPIKey.getText());
AppConfig.get().setNotifyNMA(nma.getSelection());
AppConfig.get().setNMAAPIKey(nmaAPIKey.getText());
AppConfig.get().setNotifyImKayac(imkayac.getSelection());
AppConfig.get().setImKayacUserName(imkayacUserName.getText());
AppConfig.get().setImKayacPasswd(imkayacPasswd.getText());
Expand Down Expand Up @@ -1002,8 +985,6 @@ public void widgetSelected(SelectionEvent e) {
public void widgetSelected(SelectionEvent e) {
AppConfig.get().setNotifyProwl(prowl.getSelection());
AppConfig.get().setProwlAPIKey(prowlAPIKey.getText());
AppConfig.get().setNotifyNMA(nma.getSelection());
AppConfig.get().setNMAAPIKey(nmaAPIKey.getText());
AppConfig.get().setNotifyImKayac(imkayac.getSelection());
AppConfig.get().setImKayacUserName(imkayacUserName.getText());
AppConfig.get().setImKayacPasswd(imkayacPasswd.getText());
Expand Down Expand Up @@ -1223,8 +1204,6 @@ public void widgetSelected(SelectionEvent e) {
// push notify
AppConfig.get().setNotifyProwl(prowl.getSelection());
AppConfig.get().setProwlAPIKey(prowlAPIKey.getText());
AppConfig.get().setNotifyNMA(nma.getSelection());
AppConfig.get().setNMAAPIKey(nmaAPIKey.getText());
AppConfig.get().setNotifyImKayac(imkayac.getSelection());
AppConfig.get().setImKayacUserName(imkayacUserName.getText());
AppConfig.get().setImKayacPasswd(imkayacPasswd.getText());
Expand Down
44 changes: 0 additions & 44 deletions main/logbook/gui/logic/PushNotify.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ public static void push(String[] msg) {
pushProwl(msg);
}

if (AppConfig.get().getNotifyNMA()) {
pushNMA(msg);
}

if (AppConfig.get().getNotifyImKayac()) {
pushImKayac(msg);
}
Expand Down Expand Up @@ -120,46 +116,6 @@ private static void pushProwl(String[] msg) {

}

/**
* NMAによる通知
*
* @param String 通知メッセージ
*/
private static void pushNMA(String msg[]) {

StringBuilder postdata = new StringBuilder();
String result = null;

addPOSTData(postdata, "apikey", AppConfig.get().getNMAAPIKey());
addPOSTData(postdata, "application", AppConstants.PUSH_NOTIFY_APPNAME);
addPOSTData(postdata, "description", msg[0]);
addPOSTData(postdata, "event", msg[1]);
addPOSTData(postdata, "priority", msg[2]);

try {
result = HttpPOSTRequest(AppConstants.PUSH_NOTIFY_NMA_URI, postdata);

if (result != "") {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder db = factory.newDocumentBuilder();
InputSource inStream = new InputSource();
inStream.setCharacterStream(new StringReader(result));
Document doc = db.parse(inStream);
Element root = doc.getDocumentElement();
if (root.getTagName().equals("nma")) {
Node item = root.getFirstChild();
String childName = item.getNodeName();
if (!childName.equals("success")) {
LOG.get().warn("NMA による Push 通知に失敗しました。", result);
}
}
}
} catch (Exception e) {
LOG.get().warn("NMA による Push 通知に失敗しました。", e);
}

}

/**
* ImKayacによる通知
*
Expand Down

0 comments on commit 4aff77a

Please sign in to comment.