diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-09 17:56:37 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-09 17:56:37 -0700 |
commit | adafc5f6130854dd88c191dd04489073419ee41d (patch) | |
tree | e101d03069894f9a2fbfd388d9b3f93424cbe4d0 /src/main/java/org/traccar/MainModule.java | |
parent | 29b5d05cfd66a9f51b7ce272c1fb07077bc715b2 (diff) | |
download | trackermap-server-adafc5f6130854dd88c191dd04489073419ee41d.tar.gz trackermap-server-adafc5f6130854dd88c191dd04489073419ee41d.tar.bz2 trackermap-server-adafc5f6130854dd88c191dd04489073419ee41d.zip |
Remove SMS from context
Diffstat (limited to 'src/main/java/org/traccar/MainModule.java')
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 9ec73d819..f6621a18e 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -57,7 +57,9 @@ import org.traccar.geolocation.UnwiredGeolocationProvider; import org.traccar.handler.GeocoderHandler; import org.traccar.handler.GeolocationHandler; import org.traccar.handler.SpeedLimitHandler; +import org.traccar.sms.HttpSmsClient; import org.traccar.sms.SmsManager; +import org.traccar.sms.SnsSmsClient; import org.traccar.speedlimit.OverpassSpeedLimitProvider; import org.traccar.speedlimit.SpeedLimitProvider; import org.traccar.storage.Storage; @@ -115,9 +117,15 @@ public class MainModule extends AbstractModule { return Context.getDeviceManager(); } + @Singleton @Provides - public static SmsManager provideSmsManager() { - return Context.getSmsManager(); + public static SmsManager provideSmsManager(Config config) { + if (config.hasKey(Keys.SMS_HTTP_URL)) { + return new HttpSmsClient(); + } else if (config.hasKey(Keys.SMS_AWS_REGION)) { + return new SnsSmsClient(); + } + return null; } @Singleton |