diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/AppliverySdk.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/AppliverySdk.java index 6cae260..76637ec 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/AppliverySdk.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/AppliverySdk.java @@ -23,16 +23,19 @@ import android.os.AsyncTask; import android.os.Build; import android.util.Log; -import android.widget.Toast; import com.applivery.applvsdklib.domain.exceptions.NotForegroundActivityAvailable; import com.applivery.applvsdklib.network.api.AppliveryApiService; import com.applivery.applvsdklib.network.api.AppliveryApiServiceBuilder; import com.applivery.applvsdklib.domain.appconfig.ObtainAppConfigInteractor; import com.applivery.applvsdklib.tools.androidimplementations.AndroidCurrentAppInfo; import com.applivery.applvsdklib.tools.androidimplementations.AppliveryActivityLifecycleCallbacks; +import com.applivery.applvsdklib.tools.androidimplementations.ScreenCaptureUtils; import com.applivery.applvsdklib.tools.utils.Validate; import com.applivery.applvsdklib.tools.permissions.AndroidPermissionCheckerImpl; import com.applivery.applvsdklib.tools.permissions.PermissionChecker; +import com.applivery.applvsdklib.ui.model.ScreenCapture; +import com.applivery.applvsdklib.ui.views.feedback.FeedbackView; +import com.applivery.applvsdklib.ui.views.feedback.UserFeedbackView; import java.util.concurrent.*; /** @@ -131,6 +134,11 @@ private static void obtainAppConfig(boolean requestConfig) { } } + public static String getApplicationId(){ + Validate.sdkInitialized(); + return applicationId; + } + public static Executor getExecutor() { synchronized (LOCK) { if (AppliverySdk.executor == null) { @@ -214,8 +222,15 @@ public static void setUpdateCheckingTime(int updateCheckingTime) { AppliverySdk.updateCheckingTime = new Integer(updateCheckingTime * 1000).longValue(); } - public static void sendFeedbackOnShake() { - Toast.makeText(applicationContext, "You shake your phone", Toast.LENGTH_SHORT).show(); + public static void requestForUserFeedBack() { + + FeedbackView feedbackView = UserFeedbackView.getInstance(appliveryApiService); + + if (feedbackView.isNotShowing()){ + ScreenCapture screenCapture = ScreenCaptureUtils.getScreenCapture(getCurrentActivity()); + feedbackView.setScreenCapture(screenCapture); + feedbackView.show(); + } } public static class Logger { diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/BaseInteractor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/BaseInteractor.java index 51b49f5..a4c8188 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/BaseInteractor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/BaseInteractor.java @@ -52,6 +52,11 @@ protected void receivedResponse(BusinessObject obj, Class responseClass) { @Override public void run() { Message message = new Message(); message.obj = performRequest(); + + if (message.obj == null){ + message.obj = new ErrorObject(); + } + handler.sendMessage(message); } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/ObtainAppConfigInteractor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/ObtainAppConfigInteractor.java index 763b32d..a24fef4 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/ObtainAppConfigInteractor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/ObtainAppConfigInteractor.java @@ -34,7 +34,7 @@ public class ObtainAppConfigInteractor extends BaseInteractor { private final ObtainAppConfigRequest obtainAppConfigRequest; private final InteractorCallback appConfigInteractorCallback; - public ObtainAppConfigInteractor(AppliveryApiService apiService, String appId, String authToken, + private ObtainAppConfigInteractor(AppliveryApiService apiService, String appId, String authToken, CurrentAppInfo currentAppInfo) { this.obtainAppConfigRequest = new ObtainAppConfigRequest(apiService, appId, authToken); this.appConfigInteractorCallback = new ObtainAppConfigInteractorCallback(apiService, currentAppInfo); diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/CurrentAppInfo.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/CurrentAppInfo.java index a4aef4b..52e9ae8 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/CurrentAppInfo.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/CurrentAppInfo.java @@ -22,4 +22,6 @@ */ public interface CurrentAppInfo { long getVersionCode(); + + String getPackageName(); } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/UpdateListenerImpl.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/UpdateListenerImpl.java index 81f73d4..36396e4 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/UpdateListenerImpl.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/appconfig/update/UpdateListenerImpl.java @@ -23,7 +23,7 @@ import com.applivery.applvsdklib.domain.download.token.ObtainBuildTokenInteractorCallback; import com.applivery.applvsdklib.domain.model.AppConfig; import com.applivery.applvsdklib.network.api.AppliveryApiService; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageReader; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageReader; import com.applivery.applvsdklib.tools.androidimplementations.AndroidAppInstallerImpl; import com.applivery.applvsdklib.tools.androidimplementations.AndroidExternalStorageReaderImpl; import com.applivery.applvsdklib.ui.views.update.UpdateListener; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadBuildInteractor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadBuildInteractor.java index 69b7ddb..4a54905 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadBuildInteractor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadBuildInteractor.java @@ -25,8 +25,6 @@ import com.applivery.applvsdklib.domain.model.ErrorObject; import com.applivery.applvsdklib.network.api.AppliveryApiService; import com.applivery.applvsdklib.network.api.requests.DownloadBuildRequest; -import com.applivery.applvsdklib.network.api.requests.DownloadStatusListener; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageWriter; import com.applivery.applvsdklib.tools.androidimplementations.AndroidAppInstallerImpl; /** @@ -40,7 +38,7 @@ public class DownloadBuildInteractor extends BaseInteractor { private final DownloadStatusListener downloadStatusListener; private final AppInstaller appInstaller; - public DownloadBuildInteractor(AppliveryApiService appliveryApiService, String appName, + private DownloadBuildInteractor(AppliveryApiService appliveryApiService, String appName, BuildTokenInfo buildTokenInfo, final DownloadBuildInteractorCallback interactorCallback, ExternalStorageWriter externalStorageWriter) { diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadStatusListener.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadStatusListener.java similarity index 94% rename from applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadStatusListener.java rename to applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadStatusListener.java index 07bffd5..2e0873d 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadStatusListener.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/DownloadStatusListener.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.applivery.applvsdklib.network.api.requests; +package com.applivery.applvsdklib.domain.download.app; import com.applivery.applvsdklib.domain.model.DownloadResult; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ExternalStorageReader.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/ExternalStorageReader.java similarity index 94% rename from applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ExternalStorageReader.java rename to applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/ExternalStorageReader.java index b73180e..5e1cb71 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ExternalStorageReader.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/ExternalStorageReader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.applivery.applvsdklib.network.api.requests; +package com.applivery.applvsdklib.domain.download.app; import com.applivery.applvsdklib.tools.androidimplementations.AppPathReceiver; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ExternalStorageWriter.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/ExternalStorageWriter.java similarity index 93% rename from applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ExternalStorageWriter.java rename to applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/ExternalStorageWriter.java index bbb72d3..032b3cb 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ExternalStorageWriter.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/app/ExternalStorageWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.applivery.applvsdklib.network.api.requests; +package com.applivery.applvsdklib.domain.download.app; import java.io.InputStream; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainAppBuildDownloadTokenInteractor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainAppBuildDownloadTokenInteractor.java index d717a8d..c015184 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainAppBuildDownloadTokenInteractor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainAppBuildDownloadTokenInteractor.java @@ -33,7 +33,7 @@ public class ObtainAppBuildDownloadTokenInteractor extends BaseInteractor infoInteractorCallback; - public ObtainAppBuildDownloadTokenInteractor(AppliveryApiService appliveryApiService, + private ObtainAppBuildDownloadTokenInteractor(AppliveryApiService appliveryApiService, String buildId, InteractorCallback infoInteractorCallback) { this.obtainBuildDownloadTokenRequest = diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainBuildTokenInteractorCallback.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainBuildTokenInteractorCallback.java index e2f3e2c..73f8b58 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainBuildTokenInteractorCallback.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/download/token/ObtainBuildTokenInteractorCallback.java @@ -23,7 +23,7 @@ import com.applivery.applvsdklib.domain.model.BuildTokenInfo; import com.applivery.applvsdklib.domain.model.ErrorObject; import com.applivery.applvsdklib.network.api.AppliveryApiService; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageWriter; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageWriter; import com.applivery.applvsdklib.tools.androidimplementations.AndroidExternalStorageWriterImpl; import com.applivery.applvsdklib.ui.views.ShowErrorAlert; import com.applivery.applvsdklib.ui.views.update.UpdateView; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ApiFeedbackRequestData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/DeviceDetailsInfo.java similarity index 74% rename from applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ApiFeedbackRequestData.java rename to applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/DeviceDetailsInfo.java index 3305b32..f7cc9b9 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ApiFeedbackRequestData.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/DeviceDetailsInfo.java @@ -14,14 +14,21 @@ * limitations under the License. */ -package com.applivery.applvsdklib.network.api.requests; +package com.applivery.applvsdklib.domain.feedback; /** * Created by Sergio Martinez Rodriguez - * Date 3/1/16. + * Date 10/1/16. */ -public class ApiFeedbackRequestData { +public interface DeviceDetailsInfo { - //TODO next release stuff + String getOsName(); + String getVendor(); + + String getModel(); + + String getDeviceType(); + + String getOsversion(); } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractor.java index 6178ac9..901b95d 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractor.java @@ -16,8 +16,10 @@ package com.applivery.applvsdklib.domain.feedback; +import com.applivery.applvsdklib.AppliverySdk; import com.applivery.applvsdklib.domain.BaseInteractor; import com.applivery.applvsdklib.domain.InteractorCallback; +import com.applivery.applvsdklib.domain.appconfig.update.CurrentAppInfo; import com.applivery.applvsdklib.domain.model.BusinessObject; import com.applivery.applvsdklib.domain.model.ErrorObject; import com.applivery.applvsdklib.domain.model.Feedback; @@ -25,6 +27,9 @@ import com.applivery.applvsdklib.domain.model.FeedbackWrapper; import com.applivery.applvsdklib.network.api.AppliveryApiService; import com.applivery.applvsdklib.network.api.requests.FeedbackRequest; +import com.applivery.applvsdklib.tools.androidimplementations.AndroidCurrentAppInfo; +import com.applivery.applvsdklib.tools.androidimplementations.AndroidDeviceDetailsInfo; +import com.applivery.applvsdklib.ui.views.feedback.UserFeedbackPresenter; /** * Created by Sergio Martinez Rodriguez @@ -32,17 +37,17 @@ */ public class FeedbackInteractor extends BaseInteractor { - //TODO next release stuff - private final FeedbackRequest feedbackRequest; private final InteractorCallback feedbackCallback; private final FeedbackWrapper feedbackWrapper; - public FeedbackInteractor(FeedbackRequest feedbackRequest, InteractorCallback feedbackCallback, - Feedback feedback, AppliveryApiService appliveryApiService) { - this.feedbackWrapper = FeedbackWrapper.createWrapper(feedback); + public FeedbackInteractor(AppliveryApiService appliveryApiService, Feedback feedback, + CurrentAppInfo currentAppInfo, DeviceDetailsInfo deviceDetailsInfo, + InteractorCallback interactorCallback) { + + this.feedbackWrapper = FeedbackWrapper.createWrapper(feedback, currentAppInfo, deviceDetailsInfo); this.feedbackRequest = new FeedbackRequest(appliveryApiService, feedbackWrapper); - this.feedbackCallback = feedbackCallback; + this.feedbackCallback = interactorCallback; } @Override protected void receivedResponse(BusinessObject result) { @@ -58,7 +63,18 @@ public FeedbackInteractor(FeedbackRequest feedbackRequest, InteractorCallback fe } @Override protected BusinessObject performRequest() { - //TODO transform fee return feedbackRequest.execute(); } + + public static Runnable getInstance(AppliveryApiService service, Feedback feedback, UserFeedbackPresenter + userFeedbackPresenter) { + + CurrentAppInfo currentAppInfo = new AndroidCurrentAppInfo(AppliverySdk.getApplicationContext()); + DeviceDetailsInfo deviceDetailsInfo = new AndroidDeviceDetailsInfo(); + + FeedbackInteractor feedbackInteractor = new FeedbackInteractor(service, feedback, + currentAppInfo, deviceDetailsInfo, userFeedbackPresenter); + + return feedbackInteractor; + } } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractorCallback.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractorCallback.java new file mode 100644 index 0000000..9f65bcc --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/feedback/FeedbackInteractorCallback.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.domain.feedback; + +import com.applivery.applvsdklib.domain.InteractorCallback; +import com.applivery.applvsdklib.domain.model.ErrorObject; +import com.applivery.applvsdklib.domain.model.FeedbackResult; + +/** + * Created by Sergio Martinez Rodriguez + * Date 9/4/16. + */ +public class FeedbackInteractorCallback implements InteractorCallback { + + @Override public void onSuccess(FeedbackResult businessObject) { + + } + + @Override public void onError(ErrorObject error) { + + } + +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/ErrorObject.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/ErrorObject.java index 1eb4426..d7e5190 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/ErrorObject.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/ErrorObject.java @@ -34,6 +34,12 @@ public ErrorObject(ApiAppliveryServerErrorResponse serverResponse) { isBusinessError = serverResponse.isBusinessError(); } + public ErrorObject() { + businessCode = -99; + message = "Unknown Error"; + isBusinessError = false; + } + @Override public ErrorObject getObject() { return this; } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedBackType.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedBackType.java new file mode 100644 index 0000000..a7ee795 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedBackType.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.domain.model; + +import com.applivery.applvsdklib.tools.utils.StringValueEnum; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public enum FeedBackType implements StringValueEnum{ + FEEDBACK("feedback"), + BUG("bug"); + + private final String type; + + FeedBackType(final String type) { + this.type = type; + } + + public String getStringValue() { + return type; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/Feedback.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/Feedback.java index 6db781f..ed9787f 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/Feedback.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/Feedback.java @@ -16,10 +16,26 @@ package com.applivery.applvsdklib.domain.model; +import com.applivery.applvsdklib.ui.model.ScreenCapture; + /** * Created by Sergio Martinez Rodriguez * Date 3/1/16. */ public interface Feedback { - //TODO next release stuff + void setType(FeedBackType bug); + + void attachScreenshot(boolean activated); + + boolean mustAttachScreenshot(); + + void setMessage(String feedbackMessage); + + String getMessage(); + + void setScreenCapture(ScreenCapture screenCapture); + + String getBase64ScreenCapture(); + + FeedBackType getType(); } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedbackWrapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedbackWrapper.java index a8ffa8a..faad5e1 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedbackWrapper.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/FeedbackWrapper.java @@ -16,16 +16,108 @@ package com.applivery.applvsdklib.domain.model; +import com.applivery.applvsdklib.AppliverySdk; +import com.applivery.applvsdklib.domain.appconfig.update.CurrentAppInfo; +import com.applivery.applvsdklib.domain.feedback.DeviceDetailsInfo; + /** * Created by Sergio Martinez Rodriguez * Date 3/1/16. */ public class FeedbackWrapper { - //TODO next release stuff + final private String packageName; + final private String appVersionName; + final private String osName; + final private String screenShotBase64; + final private String feedBackMessage; + final private String vendor; + final private String model; + final private String type; + final private String appId; + final private String bugType; + final private String osVersion; + + public FeedbackWrapper(String packageName, String appVersionName, String osName, + String screenShotBase64, String feedBackMessage, String vendor, String model, String type, + String appId, String bugType, String osVersion) { + + this.packageName = packageName; + this.appVersionName = appVersionName; + this.osName = osName; + this.screenShotBase64 = screenShotBase64; + this.feedBackMessage = feedBackMessage; + this.vendor = vendor; + this.model = model; + this.type = type; + this.appId = appId; + this.bugType = bugType; + this.osVersion = osVersion; + + } + + public static FeedbackWrapper createWrapper(Feedback feedback, CurrentAppInfo currentAppInfo, + DeviceDetailsInfo deviceDetailsInfo) { + + FeedbackWrapper feedbackWrapper = + new FeedbackWrapper( + currentAppInfo.getPackageName(), + String.valueOf(currentAppInfo.getVersionCode()), + deviceDetailsInfo.getOsName(), + feedback.getBase64ScreenCapture(), + feedback.getMessage(), + deviceDetailsInfo.getVendor(), + deviceDetailsInfo.getModel(), + deviceDetailsInfo.getDeviceType(), + AppliverySdk.getApplicationId(), + feedback.getType().getStringValue(), + deviceDetailsInfo.getOsversion()); - public static FeedbackWrapper createWrapper(Feedback feedback) { - FeedbackWrapper feedbackWrapper = new FeedbackWrapper(); return feedbackWrapper; } + + + public String getPackageName() { + return packageName; + } + + public String getAppVersionName() { + return appVersionName; + } + + public String getOsName() { + return osName; + } + + public String getScreenShotBase64() { + return screenShotBase64; + } + + public String getFeedBackMessage() { + return feedBackMessage; + } + + public String getVendor() { + return vendor; + } + + public String getModel() { + return model; + } + + public String getType() { + return type; + } + + public String getAppId() { + return appId; + } + + public String getBugType() { + return bugType; + } + + public String getOsVersion() { + return osVersion; + } } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/UserFeedback.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/UserFeedback.java new file mode 100644 index 0000000..706a220 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/domain/model/UserFeedback.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.domain.model; + +import com.applivery.applvsdklib.ui.model.ScreenCapture; + +/** + * Created by Sergio Martinez Rodriguez + * Date 9/4/16. + */ +public class UserFeedback implements Feedback { + + private FeedBackType feedBackType; + private boolean screenshotAttached = true; + private String feedbackMessage; + private ScreenCapture screenCapture; + + @Override public void setType(FeedBackType feedBackType) { + this.feedBackType = feedBackType; + } + + @Override public void attachScreenshot(boolean activated) { + this.screenshotAttached = activated; + } + + @Override public boolean mustAttachScreenshot() { + return screenshotAttached; + } + + @Override public void setMessage(String feedbackMessage) { + this.feedbackMessage = feedbackMessage; + } + + @Override public String getMessage() { + return feedbackMessage; + } + + @Override public void setScreenCapture(ScreenCapture screenCapture) { + this.screenCapture = screenCapture; + } + + @Override public String getBase64ScreenCapture() { + if (screenCapture!=null){ + return screenCapture.getBase64(); + }else{ + return null; + } + + } + + @Override public FeedBackType getType() { + return feedBackType; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/AppliveryApiService.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/AppliveryApiService.java index 6a5617e..f69b620 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/AppliveryApiService.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/AppliveryApiService.java @@ -16,7 +16,7 @@ package com.applivery.applvsdklib.network.api; -import com.applivery.applvsdklib.network.api.requests.ApiFeedbackRequestData; +import com.applivery.applvsdklib.network.api.model.ApiFeedbackData; import com.applivery.applvsdklib.network.api.responses.ApiAppConfigResponse; import com.applivery.applvsdklib.network.api.responses.ApiBuildTokenResponse; import com.applivery.applvsdklib.network.api.responses.ApiFeedbackResponse; @@ -43,8 +43,8 @@ public interface AppliveryApiService { @Streaming Call downloadBuild(@Path("build_id") String buildId, @Path("download_token") String download_token); - @POST("/api/bugs") - Call sendFeedback(@Body ApiFeedbackRequestData bugRequest); + @POST("/api/feedback") + Call sendFeedback(@Body ApiFeedbackData feedback); //TODO this will be implemented in second phase diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiDeviceData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiDeviceData.java new file mode 100644 index 0000000..353ca0a --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiDeviceData.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiDeviceData { + + @SerializedName("model") @Expose private final String model; + @SerializedName("vendor") @Expose private final String vendor; + @SerializedName("type") @Expose private final String type; + + public ApiDeviceData(String model, String vendor, String type) { + this.model = model; + this.vendor = vendor; + this.type = type; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiDeviceInfoData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiDeviceInfoData.java new file mode 100644 index 0000000..2281300 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiDeviceInfoData.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiDeviceInfoData { + + @SerializedName("device") @Expose private final ApiDeviceData device; + @SerializedName("os") @Expose private final ApiOsData os; + + public ApiDeviceInfoData(ApiDeviceData device, ApiOsData os) { + this.device = device; + this.os = os; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiFeedbackData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiFeedbackData.java new file mode 100644 index 0000000..f248c99 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiFeedbackData.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * Created by Sergio Martinez Rodriguez + * Date 3/1/16. + */ +public class ApiFeedbackData { + + @SerializedName("app") @Expose private final String app; + @SerializedName("type") @Expose private final String type; + @SerializedName("message") @Expose private final String message; + + @SerializedName("packageInfo") @Expose private final ApiPackageInfoData packageInfo; + @SerializedName("deviceInfo") @Expose private final ApiDeviceInfoData deviceInfo; + + @SerializedName("screenshot") @Expose private final String screenshot; + + public ApiFeedbackData(String app, String type, String message, ApiPackageInfoData packageInfo, + ApiDeviceInfoData deviceInfo, String screenshot) { + this.app = app; + this.type = type; + this.message = message; + this.packageInfo = packageInfo; + this.deviceInfo = deviceInfo; + this.screenshot = screenshot; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiOsData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiOsData.java new file mode 100644 index 0000000..70ac6dd --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiOsData.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiOsData { + + @SerializedName("name") @Expose private final String name; + @SerializedName("version") @Expose private final String version; + + public ApiOsData(String name, String version) { + this.name = name; + this.version = version; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiPackageInfoData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiPackageInfoData.java new file mode 100644 index 0000000..588be75 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiPackageInfoData.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.model; + +import com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiPackageInfoData { + + @SerializedName("name") @Expose private final String name; + @SerializedName("version") @Expose private final String version; + + public ApiPackageInfoData(String name, String version) { + this.name = name; + this.version = version; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadBuildRequest.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadBuildRequest.java index 018e5f4..0c9af16 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadBuildRequest.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/DownloadBuildRequest.java @@ -17,6 +17,8 @@ package com.applivery.applvsdklib.network.api.requests; import com.applivery.applvsdklib.AppliverySdk; +import com.applivery.applvsdklib.domain.download.app.DownloadStatusListener; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageWriter; import com.applivery.applvsdklib.network.api.AppliveryApiService; import com.applivery.applvsdklib.domain.model.BuildTokenInfo; import com.applivery.applvsdklib.domain.model.BusinessObject; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/FeedbackRequest.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/FeedbackRequest.java index 455f334..95cda88 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/FeedbackRequest.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/FeedbackRequest.java @@ -16,11 +16,16 @@ package com.applivery.applvsdklib.network.api.requests; +import com.applivery.applvsdklib.network.api.requests.mappers.ApiFeedbackResponseMapper; import com.applivery.applvsdklib.network.api.AppliveryApiService; import com.applivery.applvsdklib.domain.model.BusinessObject; -import com.applivery.applvsdklib.domain.model.FeedbackResult; import com.applivery.applvsdklib.domain.model.FeedbackWrapper; +import com.applivery.applvsdklib.network.api.model.ApiFeedbackData; +import com.applivery.applvsdklib.network.api.requests.mappers.ApiDeviceInfoRequestMapper; +import com.applivery.applvsdklib.network.api.requests.mappers.ApiDeviceRequestMapper; import com.applivery.applvsdklib.network.api.requests.mappers.ApiFeedbackRequestMapper; +import com.applivery.applvsdklib.network.api.requests.mappers.ApiOsRequestMapper; +import com.applivery.applvsdklib.network.api.requests.mappers.ApiPackageInfoRequestMapper; import com.applivery.applvsdklib.network.api.responses.ApiFeedbackResponse; import retrofit2.Call; @@ -30,23 +35,37 @@ */ public class FeedbackRequest extends ServerRequest { - //TODO next release stuff - private final AppliveryApiService apiService; private final FeedbackWrapper feedbackWrapper; private final ApiFeedbackRequestMapper apiFeedbackRequestMapper; + private final ApiFeedbackResponseMapper apiFeedbackResponseMapper; public FeedbackRequest(AppliveryApiService apiService, FeedbackWrapper feedbackWrapper) { this.apiService = apiService; this.feedbackWrapper = feedbackWrapper; - this.apiFeedbackRequestMapper = new ApiFeedbackRequestMapper(); + this.apiFeedbackResponseMapper = new ApiFeedbackResponseMapper(); + this.apiFeedbackRequestMapper = createMappers(); + } + + private ApiFeedbackRequestMapper createMappers() { + + ApiOsRequestMapper apiOsRequestMapper = new ApiOsRequestMapper(); + ApiDeviceRequestMapper apiDeviceRequestMapper = new ApiDeviceRequestMapper(); + + ApiDeviceInfoRequestMapper apiDeviceInfoRequestMapper = + new ApiDeviceInfoRequestMapper(apiDeviceRequestMapper, apiOsRequestMapper); + + ApiPackageInfoRequestMapper apiPackageInfoRequestMapper = new ApiPackageInfoRequestMapper(); + + return new ApiFeedbackRequestMapper(apiPackageInfoRequestMapper, apiDeviceInfoRequestMapper); } @Override protected BusinessObject performRequest() { - ApiFeedbackRequestData apiFeedbackData = apiFeedbackRequestMapper.modelToData(feedbackWrapper); + ApiFeedbackData apiFeedbackData = apiFeedbackRequestMapper.modelToData(feedbackWrapper); Call response = apiService.sendFeedback(apiFeedbackData); ApiFeedbackResponse apiFeedbackResponse = super.performRequest(response); - return new FeedbackResult(apiFeedbackResponse.getStatus()); + BusinessObject businessObject = apiFeedbackResponseMapper.map(apiFeedbackResponse); + return businessObject; } } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ServerRequest.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ServerRequest.java index 94cc146..33f15c1 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ServerRequest.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/ServerRequest.java @@ -28,7 +28,8 @@ public abstract class ServerRequest { public final BusinessObject execute() { try { - return performRequest(); + BusinessObject businessObject = performRequest(); + return businessObject; }catch (RequestHttpException re){ return new ErrorObject(re.getServerResponse().getError()); } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiDeviceInfoRequestMapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiDeviceInfoRequestMapper.java new file mode 100644 index 0000000..092e450 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiDeviceInfoRequestMapper.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.requests.mappers; + +import com.applivery.applvsdklib.domain.model.FeedbackWrapper; +import com.applivery.applvsdklib.network.api.model.ApiDeviceData; +import com.applivery.applvsdklib.network.api.model.ApiDeviceInfoData; +import com.applivery.applvsdklib.network.api.model.ApiOsData; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiDeviceInfoRequestMapper implements RequestMapper{ + + private final ApiDeviceRequestMapper apiDeviceRequestMapper; + private final ApiOsRequestMapper apiOsRequestMapper; + + public ApiDeviceInfoRequestMapper(ApiDeviceRequestMapper apiDeviceRequestMapper, + ApiOsRequestMapper apiOsRequestMapper) { + this.apiDeviceRequestMapper = apiDeviceRequestMapper; + this.apiOsRequestMapper = apiOsRequestMapper; + } + + @Override public ApiDeviceInfoData modelToData(FeedbackWrapper feedbackWrapper) { + + ApiDeviceData apiDeviceData = apiDeviceRequestMapper.modelToData(feedbackWrapper); + ApiOsData apiOsData = apiOsRequestMapper.modelToData(feedbackWrapper); + + return new ApiDeviceInfoData(apiDeviceData, apiOsData); + } + + +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiDeviceRequestMapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiDeviceRequestMapper.java new file mode 100644 index 0000000..c39cd77 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiDeviceRequestMapper.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.requests.mappers; + +import com.applivery.applvsdklib.domain.model.FeedbackWrapper; +import com.applivery.applvsdklib.network.api.model.ApiDeviceData; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiDeviceRequestMapper implements RequestMapper{ + + @Override public ApiDeviceData modelToData(FeedbackWrapper feedbackWrapper) { + + String model = feedbackWrapper.getModel(); + String vendor = feedbackWrapper.getVendor(); + String type = feedbackWrapper.getType(); + + return new ApiDeviceData(model,vendor, type); + } + +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackRequestMapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackRequestMapper.java index 4843d22..f3bb163 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackRequestMapper.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackRequestMapper.java @@ -17,19 +17,40 @@ package com.applivery.applvsdklib.network.api.requests.mappers; import com.applivery.applvsdklib.domain.model.FeedbackWrapper; -import com.applivery.applvsdklib.network.api.requests.ApiFeedbackRequestData; +import com.applivery.applvsdklib.network.api.model.ApiDeviceInfoData; +import com.applivery.applvsdklib.network.api.model.ApiFeedbackData; +import com.applivery.applvsdklib.network.api.model.ApiPackageInfoData; /** * Created by Sergio Martinez Rodriguez * Date 3/1/16. */ public class ApiFeedbackRequestMapper - implements RequestMapper { + implements RequestMapper { + + private final ApiPackageInfoRequestMapper packageInfoMapper; + private final ApiDeviceInfoRequestMapper deviceInfoMapper; + + public ApiFeedbackRequestMapper(ApiPackageInfoRequestMapper packageInfoMapper, + ApiDeviceInfoRequestMapper deviceInfoMapper) { + this.packageInfoMapper = packageInfoMapper; + this.deviceInfoMapper = deviceInfoMapper; + } + + + @Override public ApiFeedbackData modelToData(FeedbackWrapper feedbackWrapper) { + + String app = feedbackWrapper.getAppId(); + String type = feedbackWrapper.getBugType(); + String meessage = feedbackWrapper.getFeedBackMessage(); + String screenShotBase64 = feedbackWrapper.getScreenShotBase64(); + + ApiPackageInfoData apiPackageInfoData = packageInfoMapper.modelToData(feedbackWrapper); + ApiDeviceInfoData apiDeviceInfoData = deviceInfoMapper.modelToData(feedbackWrapper); + + ApiFeedbackData apiFeedbackData = new ApiFeedbackData(app, type, meessage, apiPackageInfoData, + apiDeviceInfoData, screenShotBase64); - @Override public ApiFeedbackRequestData modelToData(FeedbackWrapper feedbackWrapper) { - ApiFeedbackRequestData apiFeedbackData = new ApiFeedbackRequestData(); - //TODO implement mapping of fields - //TODO next release stuff return apiFeedbackData; } } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackResponseMapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackResponseMapper.java new file mode 100644 index 0000000..c8fc7ff --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiFeedbackResponseMapper.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.requests.mappers; + +import com.applivery.applvsdklib.domain.model.BusinessObject; +import com.applivery.applvsdklib.domain.model.FeedbackResult; +import com.applivery.applvsdklib.network.api.responses.ApiFeedbackResponse; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiFeedbackResponseMapper extends BaseMapper { + + public ApiFeedbackResponseMapper() { + } + + public BusinessObject map(ApiFeedbackResponse apiFeedbackResponse) { + return super.map(apiFeedbackResponse); + } + + @Override protected FeedbackResult mapBusinessObject(Object serverResponse) { + FeedbackResult feedbackResult = new FeedbackResult(true); + return feedbackResult; + } + + //@Override protected AppConfig mapBusinessObject(ApiAppConfigData apiAppConfigData) { + // + // AppConfig appConfig = new AppConfig(); + // + // appConfig.setBuildsCount(apiAppConfigData.getBuildsCount()); + // + // appConfig.setCreated(DateUtils.stringToDateWithFormat(apiAppConfigData.getCreated(), + // DateFormatConstants.DATE_FORMAT)); + // + // appConfig.setModified(DateUtils.stringToDateWithFormat(apiAppConfigData.getModified(), + // DateFormatConstants.DATE_FORMAT)); + // + // appConfig.setDescription(apiAppConfigData.getDescription()); + // appConfig.setId(apiAppConfigData.getId()); + // appConfig.setName(apiAppConfigData.getName()); + // appConfig.setTotalDownloads(apiAppConfigData.getTotalDownloads()); + // appConfig.setCrashesCount(apiAppConfigData.getCrashesCount()); + // appConfig.setFeedBackCount(apiAppConfigData.getFeedbackCount()); + // appConfig.setSitesCount(apiAppConfigData.getSitesCount()); + // appConfig.setSo(apiAppConfigData.getSo()); + // appConfig.setTotalDownloads(apiAppConfigData.getTotalDownloads()); + // appConfig.setSdk(sdkMapper.dataToModel(apiAppConfigData.getSdk())); + // + // return appConfig; + //} +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiOsRequestMapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiOsRequestMapper.java new file mode 100644 index 0000000..37fe6d5 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiOsRequestMapper.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.requests.mappers; + +import com.applivery.applvsdklib.domain.model.FeedbackWrapper; +import com.applivery.applvsdklib.network.api.model.ApiOsData; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiOsRequestMapper implements RequestMapper{ + + @Override public ApiOsData modelToData(FeedbackWrapper feedbackWrapper) { + + String name = feedbackWrapper.getOsName(); + String version = feedbackWrapper.getOsVersion(); + + return new ApiOsData(name, version); + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiPackageInfoRequestMapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiPackageInfoRequestMapper.java new file mode 100644 index 0000000..b2b84aa --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/requests/mappers/ApiPackageInfoRequestMapper.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.network.api.requests.mappers; + +import com.applivery.applvsdklib.domain.model.FeedbackWrapper; +import com.applivery.applvsdklib.network.api.model.ApiPackageInfoData; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ApiPackageInfoRequestMapper implements RequestMapper{ + + @Override public ApiPackageInfoData modelToData(FeedbackWrapper feedbackWrapper) { + + String name = feedbackWrapper.getPackageName(); + String version = feedbackWrapper.getAppVersionName(); + + return new ApiPackageInfoData(name, version); + } + +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponse.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponse.java index 0c5f1f8..cfedf35 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponse.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponse.java @@ -16,11 +16,9 @@ package com.applivery.applvsdklib.network.api.responses; -import com.applivery.applvsdklib.network.api.requests.ApiFeedbackRequestData; - /** * Created by Sergio Martinez Rodriguez * Date 2/1/16. */ -public class ApiFeedbackResponse extends ServerResponse { +public class ApiFeedbackResponse extends ServerResponse { } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiFeedbackResponseData.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponseData.java similarity index 92% rename from applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiFeedbackResponseData.java rename to applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponseData.java index 88e0496..e503fd5 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/model/ApiFeedbackResponseData.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/network/api/responses/ApiFeedbackResponseData.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.applivery.applvsdklib.network.api.model; +package com.applivery.applvsdklib.network.api.responses; /** * Created by Sergio Martinez Rodriguez diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidAppInstallerImpl.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidAppInstallerImpl.java index 946170d..d1e435e 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidAppInstallerImpl.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidAppInstallerImpl.java @@ -20,7 +20,7 @@ import android.content.Intent; import android.net.Uri; import com.applivery.applvsdklib.domain.download.app.AppInstaller; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageReader; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageReader; /** * Created by Sergio Martinez Rodriguez diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidCurrentAppInfo.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidCurrentAppInfo.java index 65d53b7..f27cffe 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidCurrentAppInfo.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidCurrentAppInfo.java @@ -42,6 +42,10 @@ public AndroidCurrentAppInfo(Context context) { } } + @Override public String getPackageName() { + return context.getPackageName(); + } + public String getVersionName() { try { PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidDeviceDetailsInfo.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidDeviceDetailsInfo.java new file mode 100644 index 0000000..6c32901 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidDeviceDetailsInfo.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.tools.androidimplementations; + +import android.content.Context; +import android.content.res.Configuration; +import android.os.Build; +import com.applivery.applvsdklib.AppliverySdk; +import com.applivery.applvsdklib.domain.feedback.DeviceDetailsInfo; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class AndroidDeviceDetailsInfo implements DeviceDetailsInfo { + + private static final String ANDROID = "Android"; + private static final String TABLET = "tablet"; + private static final String MOBILE = "mobile"; + + + @Override public String getOsName() { + return ANDROID; + } + + @Override public String getVendor() { + return Build.MANUFACTURER; + } + + @Override public String getModel() { + String model = Build.MODEL; + if (model.contains(Build.MANUFACTURER+" ")){ + return model.replace(Build.MANUFACTURER+" ", ""); + } else { + return model; + } + } + + @Override public String getDeviceType() { + Context context = AppliverySdk.getApplicationContext(); + + boolean isTablet = false; + + isTablet = (context.getResources().getConfiguration().screenLayout + & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; + + if (isTablet){ + return TABLET; + } else{ + return MOBILE; + } + } + + @Override public String getOsversion() { + return Build.VERSION.RELEASE; + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageReaderImpl.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageReaderImpl.java index 0e3889d..926d588 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageReaderImpl.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageReaderImpl.java @@ -20,7 +20,7 @@ import android.support.annotation.NonNull; import com.applivery.applvsdklib.AppliverySdk; import com.applivery.applvsdklib.domain.download.permissions.ReadExternalPermission; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageReader; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageReader; import com.applivery.applvsdklib.tools.permissions.PermissionChecker; import com.applivery.applvsdklib.tools.permissions.UserPermissionRequestResponseListener; import java.io.File; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageWriterImpl.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageWriterImpl.java index 4f50bb8..ecdf412 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageWriterImpl.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/AndroidExternalStorageWriterImpl.java @@ -20,8 +20,8 @@ import com.applivery.applvsdklib.AppliverySdk; import com.applivery.applvsdklib.domain.download.permissions.WriteExternalPermission; import com.applivery.applvsdklib.domain.model.DownloadResult; -import com.applivery.applvsdklib.network.api.requests.DownloadStatusListener; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageWriter; +import com.applivery.applvsdklib.domain.download.app.DownloadStatusListener; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageWriter; import com.applivery.applvsdklib.tools.permissions.PermissionChecker; import com.applivery.applvsdklib.tools.permissions.UserPermissionRequestResponseListener; import java.io.File; diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/ScreenCaptureUtils.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/ScreenCaptureUtils.java new file mode 100644 index 0000000..5c80d87 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/ScreenCaptureUtils.java @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.tools.androidimplementations; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.view.View; +import com.applivery.applvsdklib.R; +import com.applivery.applvsdklib.ui.model.ScreenCapture; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ScreenCaptureUtils { + + private static final int COMPRESSION_BITMAP_QUALITY = 100; + + public static ScreenCapture getScreenCapture(Activity activity) { + + try { + View v1 = activity.getWindow().getDecorView().getRootView(); + v1.setDrawingCacheEnabled(true); + Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache()); + v1.setDrawingCacheEnabled(false); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + + bitmap.compress(Bitmap.CompressFormat.JPEG, COMPRESSION_BITMAP_QUALITY, out); + Bitmap decoded = BitmapFactory.decodeStream(new ByteArrayInputStream(out.toByteArray())); + + return new ScreenCapture(decoded); + } catch (Throwable e) { + e.printStackTrace(); + return new ScreenCapture(BitmapFactory.decodeResource(null, R.drawable.applivery_icon)); + } + } + +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AndroidSensorWrapper.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AndroidSensorWrapper.java index 3414f51..7594f3c 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AndroidSensorWrapper.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AndroidSensorWrapper.java @@ -25,11 +25,11 @@ public class AndroidSensorWrapper { private boolean enabled; - private final AppliverySensor appliverySensor; + private final AppliverySensorType appliverySensorType; private final SensorEventListener sensorEventListener; - public AndroidSensorWrapper(AppliverySensor appliverySensor, SensorEventListener listener) { - this.appliverySensor = appliverySensor; + public AndroidSensorWrapper(AppliverySensorType appliverySensorType, SensorEventListener listener) { + this.appliverySensorType = appliverySensorType; this.enabled = false; this.sensorEventListener = listener; } @@ -42,12 +42,12 @@ public boolean isEnabled() { return enabled; } - public AppliverySensor getAppliverySensor() { - return appliverySensor; + public AppliverySensorType getAppliverySensorType() { + return appliverySensorType; } public int getAndroidSensorType() { - return appliverySensor.toAndroidSensor(); + return appliverySensorType.toAndroidSensor(); } public SensorEventListener getSensorEventListener() { diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AppliverySensor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AppliverySensorType.java similarity index 85% rename from applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AppliverySensor.java rename to applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AppliverySensorType.java index 32b27d5..3193983 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AppliverySensor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/AppliverySensorType.java @@ -23,12 +23,12 @@ * Created by Sergio Martinez Rodriguez * Date 9/4/16. */ -public enum AppliverySensor implements StringValueEnum{ +public enum AppliverySensorType implements StringValueEnum{ ACCELEROMETER("ACCELEROMETER"); private final String type; - AppliverySensor(final String type) { + AppliverySensorType(final String type) { this.type = type; } @@ -45,10 +45,10 @@ public int toAndroidSensor(){ } } - public static AppliverySensor toAppliverySensor(int sensor){ + public static AppliverySensorType toAppliverySensor(int sensor){ switch (sensor){ case Sensor.TYPE_ACCELEROMETER: - return AppliverySensor.ACCELEROMETER; + return AppliverySensorType.ACCELEROMETER; default: return null; } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorEventsReceiver.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorEventsReceiver.java index ce34ab7..6a16196 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorEventsReceiver.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorEventsReceiver.java @@ -25,7 +25,7 @@ public class SensorEventsReceiver implements ShakeDetector.OnShakeListener { @Override public void onShake(int count) { - AppliverySdk.sendFeedbackOnShake(); + AppliverySdk.requestForUserFeedBack(); } } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorsAccessor.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorsAccessor.java index d662bbb..02fc6bc 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorsAccessor.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/SensorsAccessor.java @@ -36,8 +36,8 @@ public SensorsAccessor(SensorEventsReceiver sensorEventsReceiver) { private void initSensors(SensorEventsReceiver sensorEventsReceiver) { //init Accelerometer sensor SHAKE Detection - sensors.put(AppliverySensor.ACCELEROMETER.getStringValue(), - new AndroidSensorWrapper(AppliverySensor.ACCELEROMETER, + sensors.put(AppliverySensorType.ACCELEROMETER.getStringValue(), + new AndroidSensorWrapper(AppliverySensorType.ACCELEROMETER, new ShakeDetector(sensorEventsReceiver))); //init Init all required sensors here @@ -45,26 +45,26 @@ private void initSensors(SensorEventsReceiver sensorEventsReceiver) { } - public boolean isSensorAvailable(AppliverySensor appliverySensor){ - if (sensors.containsKey(appliverySensor.getStringValue())){ - AndroidSensorWrapper androidSensorWrapper = sensors.get(appliverySensor.getStringValue()); + public boolean isSensorAvailable(AppliverySensorType appliverySensorType){ + if (sensors.containsKey(appliverySensorType.getStringValue())){ + AndroidSensorWrapper androidSensorWrapper = sensors.get(appliverySensorType.getStringValue()); return androidSensorWrapper.isEnabled(); }else{ return false; } } - public void setSensorAsAvailable(AppliverySensor appliverySensor){ - if (!isSensorAvailable(appliverySensor) && - sensors.containsKey(appliverySensor.getStringValue())){ - AndroidSensorWrapper androidSensorWrapper = sensors.get(appliverySensor.getStringValue()); + public void setSensorAsAvailable(AppliverySensorType appliverySensorType){ + if (!isSensorAvailable(appliverySensorType) && + sensors.containsKey(appliverySensorType.getStringValue())){ + AndroidSensorWrapper androidSensorWrapper = sensors.get(appliverySensorType.getStringValue()); androidSensorWrapper.enableSensor(); } } public void enableSensor(int type) { - AppliverySensor appliverySensor = AppliverySensor.toAppliverySensor(type); - setSensorAsAvailable(appliverySensor); + AppliverySensorType appliverySensorType = AppliverySensorType.toAppliverySensor(type); + setSensorAsAvailable(appliverySensorType); } public boolean hasAvailableSensors() { diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/ShakeDetector.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/ShakeDetector.java index 37258a3..97ec157 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/ShakeDetector.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/androidimplementations/sensors/ShakeDetector.java @@ -69,12 +69,12 @@ public interface OnShakeListener { float gY = y / SensorManager.GRAVITY_EARTH; float gZ = z / SensorManager.GRAVITY_EARTH; - // gForce will be close to 1 when there is no movement. + // gForce will be applivery_close to 1 when there is no movement. double gForce = Math.sqrt(gX * gX + gY * gY + gZ * gZ); if (gForce > SHAKE_THRESHOLD_GRAVITY) { final long now = System.currentTimeMillis(); - // ignore shake events too close to each other (500ms) + // ignore shake events too applivery_close to each other (500ms) if (mShakeTimestamp + SHAKE_SLOP_TIME_MS > now) { return; } diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/utils/ImageUtils.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/utils/ImageUtils.java new file mode 100644 index 0000000..279bc39 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/tools/utils/ImageUtils.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.tools.utils; + +import android.graphics.Bitmap; +import android.util.Base64; +import java.io.ByteArrayOutputStream; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ImageUtils { + public static String getBase64(Bitmap screenShot) { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + screenShot.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); + byte[] byteArray = byteArrayOutputStream .toByteArray(); + return Base64.encodeToString(byteArray, Base64.DEFAULT); + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/model/ScreenCapture.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/model/ScreenCapture.java new file mode 100644 index 0000000..0e4d3da --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/model/ScreenCapture.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.ui.model; + +import android.graphics.Bitmap; +import com.applivery.applvsdklib.tools.utils.ImageUtils; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class ScreenCapture { + + private final Bitmap screenShot; + + public ScreenCapture(Bitmap screenShot) { + this.screenShot = screenShot; + } + + public Bitmap getScreenShot() { + return screenShot; + } + + public String getBase64() { + return ImageUtils.getBase64(screenShot); + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/FeedbackView.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/FeedbackView.java new file mode 100644 index 0000000..1a6cfa9 --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/FeedbackView.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.ui.views.feedback; + +import com.applivery.applvsdklib.ui.model.ScreenCapture; + +/** + * Created by Sergio Martinez Rodriguez + * Date 9/4/16. + */ +public interface FeedbackView { + + void show(); + + void showFeedbackFormView(); + + void dismissFeedBack(); + + void cleanScreenData(); + + void takeDataFromScreen(); + + void setBugButtonSelected(); + + void setFeedbackButtonSelected(); + + void showFeedbackImage(); + + void hideFeedbackImage(); + + void setScreenCapture(ScreenCapture screenCapture); + + boolean isNotShowing(); + +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/UserFeedbackPresenter.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/UserFeedbackPresenter.java new file mode 100644 index 0000000..f3c991f --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/UserFeedbackPresenter.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.ui.views.feedback; + +import com.applivery.applvsdklib.AppliverySdk; +import com.applivery.applvsdklib.domain.InteractorCallback; +import com.applivery.applvsdklib.domain.feedback.FeedbackInteractor; +import com.applivery.applvsdklib.domain.model.ErrorObject; +import com.applivery.applvsdklib.domain.model.FeedBackType; +import com.applivery.applvsdklib.domain.model.Feedback; +import com.applivery.applvsdklib.domain.model.FeedbackResult; +import com.applivery.applvsdklib.domain.model.UserFeedback; +import com.applivery.applvsdklib.network.api.AppliveryApiService; +import com.applivery.applvsdklib.ui.model.ScreenCapture; +import com.applivery.applvsdklib.ui.views.ShowErrorAlert; + +/** + * Created by Sergio Martinez Rodriguez + * Date 10/4/16. + */ +public class UserFeedbackPresenter implements InteractorCallback{ + + private final FeedbackView feedbackView; + private final Feedback feedback; + private AppliveryApiService appliveryApiService; + private ScreenCapture screenCapture; + + public UserFeedbackPresenter(FeedbackView feedbackView) { + this.feedbackView = feedbackView; + this.feedback = new UserFeedback(); + } + + public void setAppliveryApiService(AppliveryApiService appliveryApiService) { + this.appliveryApiService = appliveryApiService; + } + + public void cancelButtonPressed() { + feedbackView.cleanScreenData(); + feedbackView.dismissFeedBack(); + } + + public void nextButtonPressed() { + feedbackView.showFeedbackFormView(); + } + + public void sendButtonPressed() { + feedbackView.takeDataFromScreen(); + } + + public void feedbackButtonPressed() { + feedback.setType(FeedBackType.FEEDBACK); + feedbackView.setFeedbackButtonSelected(); + } + + public void bugButtonPressed() { + feedback.setType(FeedBackType.BUG); + feedbackView.setBugButtonSelected(); + } + + public void screenshotSwitchPressed(boolean activated) { + feedback.attachScreenshot(activated); + + if (activated){ + feedbackView.showFeedbackImage(); + }else{ + feedbackView.hideFeedbackImage(); + } + } + + public void setScreenCapture(ScreenCapture screenCapture) { + this.screenCapture = screenCapture; + } + + public ScreenCapture getScreenCapture() { + return screenCapture; + } + + public void sendFeedbackInfo(String feedbackMessage) { + feedback.setMessage(feedbackMessage); + + if (feedback.mustAttachScreenshot()){ + feedback.setScreenCapture(screenCapture); + }else{ + feedback.setScreenCapture(null); + } + + AppliverySdk.getExecutor().execute(FeedbackInteractor.getInstance(appliveryApiService, + feedback, this)); + + } + + @Override public void onSuccess(FeedbackResult businessObject) { + feedbackView.cleanScreenData(); + feedbackView.dismissFeedBack(); + } + + @Override public void onError(ErrorObject error) { + ShowErrorAlert showErrorAlert = new ShowErrorAlert(); + showErrorAlert.showError(error); + } +} diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/UserFeedbackView.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/UserFeedbackView.java new file mode 100644 index 0000000..b75e19a --- /dev/null +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/feedback/UserFeedbackView.java @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2016 Applivery + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.applivery.applvsdklib.ui.views.feedback; + +import android.app.Activity; +import android.app.Dialog; +import android.app.DialogFragment; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.widget.EditText; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.RelativeLayout; +import android.widget.Switch; +import android.widget.Toast; +import com.applivery.applvsdklib.AppliverySdk; +import com.applivery.applvsdklib.R; +import com.applivery.applvsdklib.network.api.AppliveryApiService; +import com.applivery.applvsdklib.ui.model.ScreenCapture; + +/** + * Created by Sergio Martinez Rodriguez + * Date 9/4/16. + */ +public class UserFeedbackView extends DialogFragment implements FeedbackView, View.OnClickListener { + + private static UserFeedbackView userFeedbackView; + + private ImageButton cancelButton; + private ImageButton nextButton; + private ImageButton sendButton; + + private LinearLayout feedbackButton; + private LinearLayout bugButton; + + private ImageView screenshot; + private ImageView feedbackImage; + private Switch screenShotSwitch; + + private EditText feedbackMessage; + + private LinearLayout feedbackFormContainer; + + private UserFeedbackPresenter userFeedbackPresenter; + + public UserFeedbackView(){ + this.userFeedbackPresenter = new UserFeedbackPresenter(this); + } + + public static FeedbackView getInstance(AppliveryApiService appliveryApiService) { + if (userFeedbackView == null){ + userFeedbackView = new UserFeedbackView(); + userFeedbackView.userFeedbackPresenter.setAppliveryApiService(appliveryApiService); + } + + return userFeedbackView; + } + + /** + * * Using DialogFragment instead of Dialog because DialogFragment is not dismissed in rotation. + * @param activity + */ + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + } + + /** + * Overrided in order to get fullScreen dialog + * @param savedInstanceState + * @return + */ + @Override + public Dialog onCreateDialog(final Bundle savedInstanceState) { + + final RelativeLayout root = new RelativeLayout(getActivity()); + root.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + + final Dialog dialog = new Dialog(getActivity()); + dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); + dialog.setContentView(root); + dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.YELLOW)); + dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); + + return dialog; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstState) { + View view = inflater.inflate(R.layout.user_feedback, container); + setCancelable(false); + initViewElements(view); + return view; + } + + private void initViewElements(View view) { + + cancelButton = (ImageButton) view.findViewById(R.id.applivery_feedback_cancel_button); + nextButton = (ImageButton) view.findViewById(R.id.applivery_feedback_next_button); + sendButton = (ImageButton) view.findViewById(R.id.applivery_feedback_send_button); + feedbackButton = (LinearLayout) view.findViewById(R.id.applivery_tab_button_selector_feedback); + bugButton = (LinearLayout) view.findViewById(R.id.applivery_tab_button_selector_bug); + screenshot = (ImageView) view.findViewById(R.id.appliveryScreenShot); + feedbackImage = (ImageView) view.findViewById(R.id.applivery_feedback_image); + feedbackMessage = (EditText) view.findViewById(R.id.applivery_feedback_description); + feedbackFormContainer = (LinearLayout) view.findViewById(R.id.applivery_feedback_form); + screenShotSwitch = (Switch) view.findViewById(R.id.attach_screenshot_switch); + + initViewState(); + + initElementActions(); + + } + + private void initViewState() { + showScreenshotElements(); + userFeedbackPresenter.feedbackButtonPressed(); + setFeedbackButtonSelected(); + screenShotSwitch.setChecked(true); + } + + @Override public void onClick(View v) { + + if (R.id.applivery_feedback_cancel_button == v.getId()){ + userFeedbackPresenter.cancelButtonPressed(); + }else if(R.id.applivery_feedback_next_button == v.getId()){ + userFeedbackPresenter.nextButtonPressed(); + }else if(R.id.applivery_feedback_send_button == v.getId()){ + userFeedbackPresenter.sendButtonPressed(); + }else if(R.id.applivery_tab_button_selector_feedback == v.getId()){ + userFeedbackPresenter.feedbackButtonPressed(); + }else if(R.id.applivery_tab_button_selector_bug == v.getId()){ + userFeedbackPresenter.bugButtonPressed(); + }else if(R.id.attach_screenshot_switch == v.getId()){ + userFeedbackPresenter.screenshotSwitchPressed(screenShotSwitch.isChecked()); + } + } + + private void initElementActions() { + cancelButton.setOnClickListener(this); + nextButton.setOnClickListener(this); + sendButton.setOnClickListener(this); + feedbackButton.setOnClickListener(this); + bugButton.setOnClickListener(this); + screenShotSwitch.setOnClickListener(this); + } + + private void showScreenshotElements() { + ScreenCapture screenCapture = userFeedbackPresenter.getScreenCapture(); + //NOTE screenshot get lost after screen capture + if (screenCapture!=null){ + screenshot.setImageBitmap(screenCapture.getScreenShot()); + } + screenshot.setVisibility(View.VISIBLE); + nextButton.setVisibility(View.VISIBLE); + } + + private void hideFormElements() { + feedbackFormContainer.setVisibility(View.GONE); + sendButton.setVisibility(View.GONE); + } + + private void showFormElements() { + feedbackFormContainer.setVisibility(View.VISIBLE); + sendButton.setVisibility(View.VISIBLE); + showFeedbackImage(); + } + + private void hideScreenShotElements() { + screenshot.setImageResource(android.R.color.transparent); + screenshot.setVisibility(View.GONE); + nextButton.setVisibility(View.GONE); + } + + @Override + public void show() { + show(AppliverySdk.getCurrentActivity().getFragmentManager(), ""); + } + + @Override public void showFeedbackFormView() { + hideScreenShotElements(); + showFormElements(); + } + + @Override public void dismissFeedBack() { + dismiss(); + } + + @Override public void cleanScreenData() { + hideFormElements(); + screenShotSwitch.setChecked(true); + screenshot.setImageResource(android.R.color.transparent); + feedbackImage.setImageResource(android.R.color.transparent); + feedbackImage.setVisibility(View.VISIBLE); + feedbackMessage.getText().clear(); + } + + @Override public void takeDataFromScreen() { + userFeedbackPresenter.sendFeedbackInfo(feedbackMessage.getText().toString()); + } + + @Override public void setBugButtonSelected() { + feedbackButton.setBackgroundResource(R.drawable.applivery_tab_button_selector); + bugButton.setBackgroundResource(R.drawable.applivery_selected_tab_button); + } + + @Override public void setFeedbackButtonSelected() { + feedbackButton.setBackgroundResource(R.drawable.applivery_selected_tab_button); + bugButton.setBackgroundResource(R.drawable.applivery_tab_button_selector); + } + + @Override public void showFeedbackImage() { + feedbackImage.setVisibility(View.VISIBLE); + ScreenCapture screenCapture = userFeedbackPresenter.getScreenCapture(); + //NOTE screenshot get lost after screen capture + if (screenCapture!=null) { + feedbackImage.setImageBitmap(screenCapture.getScreenShot()); + } + } + + @Override public void hideFeedbackImage() { + feedbackImage.setImageResource(android.R.color.transparent); + feedbackImage.setVisibility(View.GONE); + } + + @Override public void setScreenCapture(ScreenCapture screenCapture) { + userFeedbackPresenter.setScreenCapture(screenCapture); + } + + @Override public boolean isNotShowing() { + if (getDialog() == null){ + return true; + }else{ + return !getDialog().isShowing(); + } + } + +} \ No newline at end of file diff --git a/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/update/MustUpdateViewImpl.java b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/update/MustUpdateViewImpl.java index 75f505a..318bee2 100644 --- a/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/update/MustUpdateViewImpl.java +++ b/applvsdklib/src/main/java/com/applivery/applvsdklib/ui/views/update/MustUpdateViewImpl.java @@ -48,6 +48,8 @@ public class MustUpdateViewImpl extends DialogFragment implements UpdateView { + //TODO avoid dismiss dialog in rotation + private Button update; private UpdateInfo updateInfo; private ProgressBar progressBar; diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_arrow.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_arrow.png new file mode 100644 index 0000000..a72f8a4 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_arrow.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_arrow_selected.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_arrow_selected.png new file mode 100644 index 0000000..dc1f380 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_arrow_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_close.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_close.png new file mode 100644 index 0000000..f0112c3 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_close.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_close_pressed.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_close_pressed.png new file mode 100644 index 0000000..2b2d598 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_close_pressed.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_icon.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_icon.png new file mode 100644 index 0000000..6b44675 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_icon.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_plane.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_plane.png new file mode 100644 index 0000000..58bd4ff Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_plane.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_plane_selected.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_plane_selected.png new file mode 100644 index 0000000..9e81722 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_plane_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-hdpi/applivery_selected_tab_button.9.png b/applvsdklib/src/main/res/drawable-hdpi/applivery_selected_tab_button.9.png new file mode 100755 index 0000000..6d34ce3 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-hdpi/applivery_selected_tab_button.9.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_arrow.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_arrow.png new file mode 100644 index 0000000..b1478e1 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_arrow.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_arrow_selected.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_arrow_selected.png new file mode 100644 index 0000000..45e2bf1 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_arrow_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_close.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_close.png new file mode 100644 index 0000000..202066d Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_close.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_close_pressed.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_close_pressed.png new file mode 100644 index 0000000..2cde9b2 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_close_pressed.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_icon.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_icon.png new file mode 100644 index 0000000..5b53415 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_icon.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_plane.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_plane.png new file mode 100644 index 0000000..6b4598a Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_plane.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_plane_selected.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_plane_selected.png new file mode 100644 index 0000000..316e694 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_plane_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-mdpi/applivery_selected_tab_button.9.png b/applvsdklib/src/main/res/drawable-mdpi/applivery_selected_tab_button.9.png new file mode 100755 index 0000000..ab985ce Binary files /dev/null and b/applvsdklib/src/main/res/drawable-mdpi/applivery_selected_tab_button.9.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_arrow.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_arrow.png new file mode 100644 index 0000000..e9e8d0e Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_arrow.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_arrow_selected.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_arrow_selected.png new file mode 100644 index 0000000..10765af Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_arrow_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_close.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_close.png new file mode 100644 index 0000000..7061a82 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_close.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_close_pressed.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_close_pressed.png new file mode 100644 index 0000000..aeb31be Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_close_pressed.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_icon.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_icon.png new file mode 100644 index 0000000..e654e92 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_icon.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_plane.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_plane.png new file mode 100644 index 0000000..da72331 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_plane.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_plane_selected.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_plane_selected.png new file mode 100644 index 0000000..99a8326 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_plane_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-xhdpi/applivery_selected_tab_button.9.png b/applvsdklib/src/main/res/drawable-xhdpi/applivery_selected_tab_button.9.png new file mode 100755 index 0000000..f461ab4 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xhdpi/applivery_selected_tab_button.9.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_arrow.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_arrow.png new file mode 100644 index 0000000..ab96150 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_arrow.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_arrow_selected.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_arrow_selected.png new file mode 100644 index 0000000..4cf86f3 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_arrow_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_close.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_close.png new file mode 100644 index 0000000..490ad7d Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_close.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_close_pressed.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_close_pressed.png new file mode 100644 index 0000000..83bb91d Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_close_pressed.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_icon.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_icon.png new file mode 100644 index 0000000..48ddb79 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_icon.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_plane.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_plane.png new file mode 100644 index 0000000..2eb4daf Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_plane.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_plane_selected.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_plane_selected.png new file mode 100644 index 0000000..deb37b2 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_plane_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-xxhdpi/applivery_selected_tab_button.9.png b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_selected_tab_button.9.png new file mode 100755 index 0000000..3c4937a Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxhdpi/applivery_selected_tab_button.9.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_arrow.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_arrow.png new file mode 100644 index 0000000..145c671 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_arrow.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_arrow_selected.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_arrow_selected.png new file mode 100644 index 0000000..c5bf5f0 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_arrow_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_close.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_close.png new file mode 100644 index 0000000..58c1678 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_close.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_close_pressed.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_close_pressed.png new file mode 100644 index 0000000..660282a Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_close_pressed.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_icon.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_icon.png new file mode 100644 index 0000000..39355d6 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_icon.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_plane.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_plane.png new file mode 100644 index 0000000..0e3b551 Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_plane.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_plane_selected.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_plane_selected.png new file mode 100644 index 0000000..287f22d Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_plane_selected.png differ diff --git a/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_selected_tab_button.9.png b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_selected_tab_button.9.png new file mode 100755 index 0000000..f88adec Binary files /dev/null and b/applvsdklib/src/main/res/drawable-xxxhdpi/applivery_selected_tab_button.9.png differ diff --git a/applvsdklib/src/main/res/drawable/applivery_arrow_selector.xml b/applvsdklib/src/main/res/drawable/applivery_arrow_selector.xml new file mode 100644 index 0000000..0068496 --- /dev/null +++ b/applvsdklib/src/main/res/drawable/applivery_arrow_selector.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/applvsdklib/src/main/res/drawable/applivery_close_selector.xml b/applvsdklib/src/main/res/drawable/applivery_close_selector.xml new file mode 100644 index 0000000..c76a154 --- /dev/null +++ b/applvsdklib/src/main/res/drawable/applivery_close_selector.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/applvsdklib/src/main/res/drawable/applivery_plane_selector.xml b/applvsdklib/src/main/res/drawable/applivery_plane_selector.xml new file mode 100644 index 0000000..b1bc0c3 --- /dev/null +++ b/applvsdklib/src/main/res/drawable/applivery_plane_selector.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/applvsdklib/src/main/res/drawable/applivery_tab_button_selector.xml b/applvsdklib/src/main/res/drawable/applivery_tab_button_selector.xml new file mode 100644 index 0000000..07d97d0 --- /dev/null +++ b/applvsdklib/src/main/res/drawable/applivery_tab_button_selector.xml @@ -0,0 +1,27 @@ + + + + + + + + + \ No newline at end of file diff --git a/applvsdklib/src/main/res/layout/must_update.xml b/applvsdklib/src/main/res/layout/must_update.xml index 526f7d1..22fe088 100644 --- a/applvsdklib/src/main/res/layout/must_update.xml +++ b/applvsdklib/src/main/res/layout/must_update.xml @@ -15,15 +15,17 @@ ~ limitations under the License. --> - + @@ -35,16 +37,18 @@ /> - \ No newline at end of file + \ No newline at end of file diff --git a/applvsdklib/src/main/res/layout/user_feedback.xml b/applvsdklib/src/main/res/layout/user_feedback.xml new file mode 100644 index 0000000..10f4364 --- /dev/null +++ b/applvsdklib/src/main/res/layout/user_feedback.xml @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/applvsdklib/src/main/res/values/colors.xml b/applvsdklib/src/main/res/values/colors.xml index ae2aa98..97cb182 100644 --- a/applvsdklib/src/main/res/values/colors.xml +++ b/applvsdklib/src/main/res/values/colors.xml @@ -16,6 +16,6 @@ --> - #719AB0 + #6494A5 #ffffff \ No newline at end of file diff --git a/applvsdklib/src/main/res/values/dimens.xml b/applvsdklib/src/main/res/values/dimens.xml index a305579..e4d4cb1 100644 --- a/applvsdklib/src/main/res/values/dimens.xml +++ b/applvsdklib/src/main/res/values/dimens.xml @@ -16,12 +16,27 @@ --> - 45dp + 20dp + 56dp + 45dp + 7dp + 10dp + 50dp + 16dp + 50dp + 20dp + 40dp + 16dp + 20dp + 20dp + 144dp + 96dp 16dp 16dp 20dp 20dp 20dp 10dp - + 5dp + 10dp \ No newline at end of file diff --git a/applvsdklib/src/test/java/com/applivery/applvsdklib/network/api/mappers/ObtainBuildDownloadTest.java b/applvsdklib/src/test/java/com/applivery/applvsdklib/network/api/mappers/ObtainBuildDownloadTest.java index 24cd5f1..abee82e 100644 --- a/applvsdklib/src/test/java/com/applivery/applvsdklib/network/api/mappers/ObtainBuildDownloadTest.java +++ b/applvsdklib/src/test/java/com/applivery/applvsdklib/network/api/mappers/ObtainBuildDownloadTest.java @@ -21,8 +21,8 @@ import com.applivery.applvsdklib.domain.model.DownloadResult; import com.applivery.applvsdklib.network.api.AppliveryApiService; import com.applivery.applvsdklib.network.api.requests.DownloadBuildRequest; -import com.applivery.applvsdklib.network.api.requests.DownloadStatusListener; -import com.applivery.applvsdklib.network.api.requests.ExternalStorageWriter; +import com.applivery.applvsdklib.domain.download.app.DownloadStatusListener; +import com.applivery.applvsdklib.domain.download.app.ExternalStorageWriter; import com.applivery.applvsdklib.utils.MockAppliveryInstance; import java.io.IOException; import java.io.InputStream;