-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Tweet when Mizo return home. fixes #308 @6H
- Loading branch information
みぞ@CrazyBeatCoder
committed
Feb 2, 2018
1 parent
5820ed5
commit ad9be70
Showing
17 changed files
with
105 additions
and
160 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...appspot/mizo310ki/MailHandlerServlet.java → ...mizo0203/location/MailHandlerServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.mizo0203.location.domain; | ||
|
||
import com.mizo0203.location.repo.Repository; | ||
import twitter4j.Twitter; | ||
|
||
import javax.mail.MessagingException; | ||
import javax.mail.internet.MimeMessage; | ||
import java.io.Closeable; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.logging.Logger; | ||
|
||
public class UseCase implements Closeable { | ||
private static final Logger LOG = Logger.getLogger(UseCase.class.getName()); | ||
private final Repository mRepository; | ||
|
||
public UseCase() { | ||
mRepository = new Repository(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
mRepository.destroy(); | ||
} | ||
|
||
public void onReceiveMizoLocationMail(String name, MimeMessage message) | ||
throws MessagingException { | ||
switch (name) { | ||
case "enter": | ||
onEnter(message); | ||
break; | ||
case "exit": | ||
onExit(message); | ||
break; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
private void onEnter(MimeMessage message) throws MessagingException { | ||
String subject = message.getSubject(); | ||
long etaMillis = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(4); | ||
mRepository.enqueueReminderTask("", etaMillis, subject); | ||
} | ||
|
||
private void onExit(MimeMessage message) { | ||
mRepository.deleteReminderTask(); | ||
} | ||
|
||
public void pushReminderMessage(String source_id, String message) { | ||
Twitter mizo0203 = mRepository.createTwitterInstance(); | ||
try { | ||
mizo0203.updateStatus("帰宅ったー"); | ||
} catch (Exception e) { | ||
LOG.warning(e.getMessage()); | ||
} finally { | ||
mRepository.deleteReminderTask(); | ||
} | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...izo0203/lilywhite/repo/OfyRepository.java → ...mizo0203/location/repo/OfyRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...va/com/mizo0203/lilywhite/repo/State.java → ...ava/com/mizo0203/location/repo/State.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...3/lilywhite/repo/objectify/OfyHelper.java → ...03/location/repo/objectify/OfyHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...hite/repo/objectify/entity/KeyEntity.java → ...tion/repo/objectify/entity/KeyEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...com/mizo0203/lilywhite/util/HttpUtil.java → .../com/mizo0203/location/util/HttpUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.mizo0203.lilywhite.util; | ||
package com.mizo0203.location.util; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters