diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-06-04 12:35:54 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-06-04 12:35:54 +0300 |
| commit | 2c613cb0b0f1b73236bed1578b570c1ca6f6deaf (patch) | |
| tree | 46ae99310301f6c11638594ce118d1f9784f880f /Software | |
| parent | 922546a39a76280382a82607ed1f54e565f1d71e (diff) | |
| download | Tango-2c613cb0b0f1b73236bed1578b570c1ca6f6deaf.tar.gz Tango-2c613cb0b0f1b73236bed1578b570c1ca6f6deaf.zip | |
Implemented card printing screens and email.
Implemented Chrome Custom Tabs with WebView fallback for app URL's.
Several bug fixes and improvements.
Diffstat (limited to 'Software')
19 files changed, 221 insertions, 36 deletions
diff --git a/Software/Android_Studio/ColorCapture/app/build.gradle b/Software/Android_Studio/ColorCapture/app/build.gradle index 8aea1cf5a..b45606e5c 100644 --- a/Software/Android_Studio/ColorCapture/app/build.gradle +++ b/Software/Android_Studio/ColorCapture/app/build.gradle @@ -23,7 +23,7 @@ android { buildTypes { debug { - buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://tcc.twine-srv.com/api/\"" + buildConfigField "String", "WEB_SERVICE_ADDRESS", "\"http://192.168.1.218:45455/api/\"" buildConfigField "String", "WEB_SERVICE_APP_ID", "\"Tdf793i4ughsiduf8749509237885ehgfdlkghlT\"" } @@ -161,7 +161,7 @@ dependencies { compile 'com.google.android.gms:play-services-gcm:16.1.0' compile 'com.google.android.gms:play-services-auth:16.0.1' compile 'com.microsoft.azure.android:azure-storage-android:2.0.0@aar' - + compile 'com.android.support:customtabs:27.1.1' } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml b/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml index db6096485..cef72add8 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml +++ b/Software/Android_Studio/ColorCapture/app/src/main/AndroidManifest.xml @@ -31,15 +31,12 @@ android:noHistory="true" android:screenOrientation="portrait"> <intent-filter> + <action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> - <action android:name="android.intent.action.VIEW" /> - <category android:name="android.intent.category.DEFAULT" /> - <data android:scheme="http" android:host="twine-s.com" /> diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/browsing/CustomTabsBrowserProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/browsing/CustomTabsBrowserProvider.java new file mode 100644 index 000000000..357f50102 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/browsing/CustomTabsBrowserProvider.java @@ -0,0 +1,36 @@ +package com.twine.colorcapture.browsing; + +import android.net.Uri; +import android.support.customtabs.CustomTabsIntent; + +import com.twine.colorcapture.App; +import com.twine.colorcapture.R; +import com.twine.colorcapture.navigation.INavigationProvider; +import com.twine.colorcapture.navigation.NavigationFragment; + +public class CustomTabsBrowserProvider implements IBrowserProvider +{ + private INavigationProvider navigationProvider; + + public CustomTabsBrowserProvider(INavigationProvider navigationProvider) + { + this.navigationProvider = navigationProvider; + } + + @Override + public void navigateURL(String url) + { + try + { + CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); + builder.setToolbarColor(App.getContext().getResources().getColor(R.color.colorPrimaryBackground)); + + CustomTabsIntent customTabsIntent = builder.build(); + customTabsIntent.launchUrl(App.getContext(), Uri.parse(url)); + } + catch (Exception ex) + { + navigationProvider.navigateWithObjectTo(NavigationFragment.Web, true, false, url); + } + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/browsing/IBrowserProvider.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/browsing/IBrowserProvider.java new file mode 100644 index 000000000..27ba912d8 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/browsing/IBrowserProvider.java @@ -0,0 +1,6 @@ +package com.twine.colorcapture.browsing; + +public interface IBrowserProvider +{ + void navigateURL(String url); +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java index 86a6f337a..2878f3ea0 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ApplicationComponent.java @@ -30,7 +30,7 @@ import dagger.Component; */ @Singleton -@Component(modules = {ApplicationModule.class, ViewModelsModule.class, EventBusModule.class, NotificationModule.class, NavigationModule.class, WebModule.class}) +@Component(modules = {ApplicationModule.class, ViewModelsModule.class, EventBusModule.class, NotificationModule.class, NavigationModule.class, WebModule.class, BrowsingModule.class}) public interface ApplicationComponent { void inject(MainActivity view); diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/BrowsingModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/BrowsingModule.java new file mode 100644 index 000000000..332cec6f5 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/BrowsingModule.java @@ -0,0 +1,23 @@ +package com.twine.colorcapture.dagger; + +import com.squareup.otto.Bus; +import com.squareup.otto.ThreadEnforcer; +import com.twine.colorcapture.browsing.CustomTabsBrowserProvider; +import com.twine.colorcapture.browsing.IBrowserProvider; +import com.twine.colorcapture.navigation.INavigationProvider; + +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +@Module +public class BrowsingModule +{ + @Provides + @Singleton + public IBrowserProvider providBrowser(INavigationProvider navigationProvider) + { + return new CustomTabsBrowserProvider(navigationProvider); + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java index 9babc4961..7982268c0 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/dagger/ViewModelsModule.java @@ -1,6 +1,7 @@ package com.twine.colorcapture.dagger; import com.squareup.otto.Bus; +import com.twine.colorcapture.browsing.IBrowserProvider; import com.twine.colorcapture.dialogs.confirm.ConfirmDialogVM; import com.twine.colorcapture.dialogs.error.ErrorDialogVM; import com.twine.colorcapture.dialogs.processing.ProcessingDialogVM; @@ -117,23 +118,23 @@ public class ViewModelsModule @Provides @Singleton - public AboutFragmentVM provideAboutFragmentVM(INavigationProvider navigationProvider) + public AboutFragmentVM provideAboutFragmentVM(INavigationProvider navigationProvider, IBrowserProvider browserProvider) { - return new AboutFragmentVM(navigationProvider); + return new AboutFragmentVM(navigationProvider, browserProvider); } @Provides @Singleton - public TwineFragmentVM provideTwineFragmentVM(INavigationProvider navigationProvider) + public TwineFragmentVM provideTwineFragmentVM(INavigationProvider navigationProvider, IBrowserProvider browserProvider) { - return new TwineFragmentVM(navigationProvider); + return new TwineFragmentVM(navigationProvider, browserProvider); } @Provides @Singleton - public CardFragmentVM provideCardFragmentVM(INavigationProvider navigationProvider, INotificationProvider notificationProvider) + public CardFragmentVM provideCardFragmentVM(INavigationProvider navigationProvider, INotificationProvider notificationProvider, IBrowserProvider browserProvider) { - return new CardFragmentVM(navigationProvider, notificationProvider); + return new CardFragmentVM(navigationProvider, notificationProvider, browserProvider); } @Provides diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/about/AboutFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/about/AboutFragmentVM.java index a9e2c7595..f676709e6 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/about/AboutFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/about/AboutFragmentVM.java @@ -6,6 +6,7 @@ import android.content.pm.PackageManager; import android.net.Uri; import com.twine.colorcapture.App; +import com.twine.colorcapture.browsing.IBrowserProvider; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; @@ -17,6 +18,7 @@ import com.twine.colorcapture.navigation.TabStateManager; public class AboutFragmentVM extends ViewModelBase<IAboutFragment> { private INavigationProvider navigationProvider; + private IBrowserProvider browserProvider; public RelayCommand contactCommand; public RelayCommand termsOfUseCommand; @@ -24,9 +26,10 @@ public class AboutFragmentVM extends ViewModelBase<IAboutFragment> public DependencyProperty<String> version; - public AboutFragmentVM(INavigationProvider navigationProvider) + public AboutFragmentVM(INavigationProvider navigationProvider, IBrowserProvider browserProvider) { this.navigationProvider = navigationProvider; + this.browserProvider = browserProvider; contactCommand = new RelayCommand(() -> openBrowser("http://twine-s.com/contact/contact-us")); termsOfUseCommand = new RelayCommand(() -> openBrowser("http://twine-s.com/privacy-policy")); @@ -46,9 +49,7 @@ public class AboutFragmentVM extends ViewModelBase<IAboutFragment> private void openBrowser(String url) { - navigationProvider.navigateWithObjectTo(NavigationFragment.Web, true, false, url); -// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); -// App.getContext().startActivity(browserIntent); + browserProvider.navigateURL(url); } @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/card/CardFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/card/CardFragmentVM.java index 850061737..cb8a84c58 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/card/CardFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/card/CardFragmentVM.java @@ -1,5 +1,6 @@ package com.twine.colorcapture.views.card; +import com.twine.colorcapture.browsing.IBrowserProvider; import com.twine.colorcapture.logging.LogManager; import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; @@ -16,15 +17,17 @@ public class CardFragmentVM extends ViewModelBase<ICardFragment> { private INavigationProvider navigationProvider; private INotificationProvider notificationProvider; + private IBrowserProvider browserProvider; public RelayCommand orderCardCommand; public RelayCommand printCardCommand; @Inject - public CardFragmentVM(INavigationProvider navigationProvider, INotificationProvider notificationProvider) + public CardFragmentVM(INavigationProvider navigationProvider, INotificationProvider notificationProvider, IBrowserProvider browserProvider) { this.notificationProvider = notificationProvider; this.navigationProvider = navigationProvider; + this.browserProvider = browserProvider; orderCardCommand = new RelayCommand(this::handleOrderCardCommand); printCardCommand = new RelayCommand(this::handlePrintCardCommand); } @@ -66,7 +69,7 @@ public class CardFragmentVM extends ViewModelBase<ICardFragment> private void openBrowser(String url) { - navigationProvider.navigateWithObjectTo(NavigationFragment.Web, true, false, url); + browserProvider.navigateURL(url); } @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/print/PrintFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/print/PrintFragmentVM.java index ec3e66edc..e5e41b7b9 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/print/PrintFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/print/PrintFragmentVM.java @@ -1,5 +1,7 @@ package com.twine.colorcapture.views.print; +import com.twine.colorcapture.core.Task; +import com.twine.colorcapture.dialogs.progress.ProgressDialogVM; import com.twine.colorcapture.mvvm.DependencyProperty; import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; @@ -7,10 +9,19 @@ import com.twine.colorcapture.navigation.INavigationProvider; import com.twine.colorcapture.notification.INotificationProvider; import com.twine.colorcapture.settings.SettingsManager; import com.twine.colorcapture.web.ITCCService; +import com.twine.colorcapture.web.messages.PrintCardRequest; + +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + +import static br.com.zbra.androidlinq.Linq.stream; public class PrintFragmentVM extends ViewModelBase<IPrintFragment> { - private String from; + private String address; + private INotificationProvider notificationProvider; + private ITCCService tccService; + private INavigationProvider navigationProvider; public DependencyProperty<String> to; public RelayCommand sendCommand; @@ -18,6 +29,10 @@ public class PrintFragmentVM extends ViewModelBase<IPrintFragment> public PrintFragmentVM(INavigationProvider navigationProvider, INotificationProvider notificationProvider, ITCCService tccService) { + this.notificationProvider = notificationProvider; + this.tccService = tccService; + this.navigationProvider = navigationProvider; + message = new DependencyProperty<>("Your card is attached! Just send the file to your computer and print. "); to = new DependencyProperty<>(""); @@ -26,7 +41,45 @@ public class PrintFragmentVM extends ViewModelBase<IPrintFragment> private void handleSendCommand() { + AtomicBoolean abort = new AtomicBoolean(); + + ProgressDialogVM vm = notificationProvider.showProgress("Print card", "Sending the attached card to your\nemail address...", (x) -> + { + abort.set(true); + }); + new Task.TaskBuilder().setAction(() -> + { + PrintCardRequest request = new PrintCardRequest(); + request.setAddress(address); + request.setMessage(message.get()); + tccService.sendCardToEmail(request); + }).setError((ex) -> + { + if (!abort.get()) + { + invokeUI(() -> + { + vm.close(); + notificationProvider.showError("Print card", "Something bad happened. Please try again later.", (x) -> + { + }); + }); + } + }).setContinueWith(() -> + { + if (!abort.get()) + { + invokeUI(() -> + { + vm.close(); + notificationProvider.showSuccess("Print card", "Your attached card has been sent to your email address.", (x) -> + { + navigationProvider.navigateBack(); + }); + }); + } + }).build().start(); } @Override @@ -34,7 +87,7 @@ public class PrintFragmentVM extends ViewModelBase<IPrintFragment> { super.onNavigatedTo(); - from = SettingsManager.getInstance().getEmail(); - to.set(from); + address = SettingsManager.getInstance().getEmail(); + to.set(address); } } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/twine/TwineFragmentVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/twine/TwineFragmentVM.java index f69d02ef6..aea4aca08 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/twine/TwineFragmentVM.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/twine/TwineFragmentVM.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.net.Uri; import com.twine.colorcapture.App; +import com.twine.colorcapture.browsing.IBrowserProvider; import com.twine.colorcapture.mvvm.RelayCommand; import com.twine.colorcapture.mvvm.ViewModelBase; import com.twine.colorcapture.navigation.INavigationProvider; @@ -14,21 +15,20 @@ import com.twine.colorcapture.navigation.TabStateManager; public class TwineFragmentVM extends ViewModelBase<ITwineFragment> { private INavigationProvider navigationProvider; + private IBrowserProvider browserProvider; public RelayCommand contactCommand; - public TwineFragmentVM(INavigationProvider navigationProvider) + public TwineFragmentVM(INavigationProvider navigationProvider, IBrowserProvider browserProvider) { this.navigationProvider = navigationProvider; + this.browserProvider = browserProvider; contactCommand = new RelayCommand(() -> openBrowser("http://twine-s.com/contact/contact-us")); } private void openBrowser(String url) { - - navigationProvider.navigateWithObjectTo(NavigationFragment.Web, true, false, url); -// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); -// App.getContext().startActivity(browserIntent); + browserProvider.navigateURL(url); } @Override diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java index a386e51ba..ced9b7346 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/ITCCService.java @@ -6,6 +6,8 @@ import com.twine.colorcapture.web.messages.DefinitionResponse; import com.twine.colorcapture.web.messages.DetectionRequest; import com.twine.colorcapture.web.messages.DetectionResponse; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; +import com.twine.colorcapture.web.messages.PrintCardRequest; +import com.twine.colorcapture.web.messages.PrintCardResponse; import com.twine.colorcapture.web.messages.ResultByEmailRequest; import com.twine.colorcapture.web.messages.ResultByEmailResponse; @@ -21,4 +23,6 @@ public interface ITCCService MachineRegistrationResponse register(String serialNumber) throws Exception; ResultByEmailResponse sendResultByEmail(ResultByEmailRequest request) throws Exception; + + PrintCardResponse sendCardToEmail(PrintCardRequest request) throws Exception; } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java index ee38dac71..676ecd0e7 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/IWebServiceAPI.java @@ -8,6 +8,8 @@ import com.twine.colorcapture.web.messages.LoginRequest; import com.twine.colorcapture.web.messages.LoginResponse; import com.twine.colorcapture.web.messages.MachineRegistrationRequest; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; +import com.twine.colorcapture.web.messages.PrintCardRequest; +import com.twine.colorcapture.web.messages.PrintCardResponse; import com.twine.colorcapture.web.messages.ResultByEmailRequest; import com.twine.colorcapture.web.messages.ResultByEmailResponse; @@ -32,4 +34,7 @@ public interface IWebServiceAPI @POST("ColorDetection/SendResultByEmail") Call<ResultByEmailResponse> sendResultByEmail(@Body ResultByEmailRequest request); + + @POST("ColorDetection/SendCardToEmail") + Call<PrintCardResponse> sendCardToEmail(@Body PrintCardRequest request); } diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java index ea1c8e0a9..3852b7127 100644 --- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/TCCService.java @@ -21,6 +21,8 @@ import com.twine.colorcapture.web.messages.LoginRequest; import com.twine.colorcapture.web.messages.LoginResponse; import com.twine.colorcapture.web.messages.MachineRegistrationRequest; import com.twine.colorcapture.web.messages.MachineRegistrationResponse; +import com.twine.colorcapture.web.messages.PrintCardRequest; +import com.twine.colorcapture.web.messages.PrintCardResponse; import com.twine.colorcapture.web.messages.ResultByEmailRequest; import com.twine.colorcapture.web.messages.ResultByEmailResponse; @@ -177,6 +179,29 @@ public class TCCService implements ITCCService } } + @Override + public PrintCardResponse sendCardToEmail(PrintCardRequest request) throws Exception + { + LogManager.log("Sending print card request..."); + + ensureAuthenticated(); + + LogManager.log("Sending print card request:", request); + + Response<PrintCardResponse> response = webAPI.sendCardToEmail(request).execute(); + + if (response.isSuccessful()) + { + PrintCardResponse r = response.body(); + LogManager.log("Print card by email sent successfully."); + return r; + } + else + { + throw LogManager.log(new Exception(response.message()), "Print card by email has failed."); + } + } + private void ensureAuthenticated() throws Exception { diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/PrintCardRequest.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/PrintCardRequest.java new file mode 100644 index 000000000..5d5e79097 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/PrintCardRequest.java @@ -0,0 +1,27 @@ +package com.twine.colorcapture.web.messages; + +public class PrintCardRequest +{ + private String address; + private String message; + + public String getAddress() + { + return address; + } + + public void setAddress(String address) + { + this.address = address; + } + + public String getMessage() + { + return message; + } + + public void setMessage(String message) + { + this.message = message; + } +} diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/PrintCardResponse.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/PrintCardResponse.java new file mode 100644 index 000000000..d73fd9ff4 --- /dev/null +++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/web/messages/PrintCardResponse.java @@ -0,0 +1,6 @@ +package com.twine.colorcapture.web.messages; + +public class PrintCardResponse +{ + +} diff --git a/Software/Android_Studio/ColorCapture/gradlew b/Software/Android_Studio/ColorCapture/gradlew index cccdd3d51..f4d43377e 100644 --- a/Software/Android_Studio/ColorCapture/gradlew +++ b/Software/Android_Studio/ColorCapture/gradlew @@ -164,7 +164,7 @@ APP_ARGS=$(save "$@") # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +# by default we should be in the correct project dir, but when run address Finder on Mac, the cwd is wrong if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then cd "$(dirname "$0")" fi diff --git a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/PrintCardRequest.cs b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/PrintCardRequest.cs index b496a9041..23a1c396a 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/PrintCardRequest.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.BL/Web/PrintCardRequest.cs @@ -9,9 +9,7 @@ namespace Tango.TCC.BL.Web { public class PrintCardRequest : WebRequestMessage { - public String From { get; set; } - - public String To { get; set; } + public String Address { get; set; } public String Message { get; set; } } diff --git a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs index 9921b50a8..011b7f3be 100644 --- a/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs +++ b/Software/Visual_Studio/TCC/Tango.TCC.Service/Controllers/ColorDetectionController.cs @@ -317,7 +317,7 @@ namespace Tango.TCC.Service.Controllers if (device != null) { - device.Email = request.To; + device.Email = request.Address; db.SaveChanges(); } } @@ -327,11 +327,10 @@ namespace Tango.TCC.Service.Controllers var client = new SendGridClient(TCCServiceConfig.SEND_GRID_API_KEY); SendGridMessage msg = new SendGridMessage(); - msg.SetFrom("Twine Solutions LTD"); - msg.AddTo(request.To); + msg.SetFrom("info@twine-s.com", "Twine Solutions LTD"); + msg.AddTo(request.Address); msg.Subject = "Print a twine TTCâ„¢ card"; msg.SetTemplateId("d-43b1aa3fe9c140349e3fb0ba2d1afff1"); - var dynamicTemplateData = new { Message = request.Message, @@ -339,12 +338,13 @@ namespace Tango.TCC.Service.Controllers msg.SetTemplateData(dynamicTemplateData); - byte[] data = File.ReadAllBytes(HostingEnvironment.MapPath("~/AppData/card.pdf")); + byte[] data = File.ReadAllBytes(HostingEnvironment.MapPath("~/App_Data/card.pdf")); var base64 = Convert.ToBase64String(data); msg.AddAttachment("Twine TCC card.pdf", base64, "application/pdf"); var result = client.SendEmailAsync(msg).GetAwaiter().GetResult(); + //var a = result.DeserializeResponseBodyAsync(result.Body); //TODO find the actual error message like this! if (result.StatusCode != HttpStatusCode.Accepted) { |
