diff --git a/android/build.gradle b/android/build.gradle index f5913b578..246cacf92 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,7 +21,7 @@ android { dependencies { compile 'com.facebook.react:react-native:0.20.+' - compile ('com.instabug.library:instabug:4.15.3'){ + compile ('com.instabug.library:instabug:8.0.1'){ exclude group: 'com.android.support:appcompat-v7' } } diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java index e0cb52c62..a8fc232fa 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java @@ -5,6 +5,7 @@ import android.os.Handler; import android.os.Looper; import android.support.annotation.Nullable; +import android.util.Log; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.ReactApplicationContext; @@ -19,36 +20,50 @@ import com.facebook.react.bridge.Callback; import com.facebook.react.modules.core.DeviceEventManagerModule; -import com.instabug.library.ActionType; +import com.instabug.bug.BugReporting; +import com.instabug.bug.PromptOption; +import com.instabug.bug.invocation.InvocationMode; +import com.instabug.bug.invocation.InvocationOption; +import com.instabug.crash.CrashReporting; +import com.instabug.featuresrequest.FeatureRequests; +import com.instabug.featuresrequest.ActionType; import com.instabug.library.Feature; import com.instabug.library.Instabug; +import com.instabug.library.OnSdkDismissCallback; import com.instabug.library.extendedbugreport.ExtendedBugReport; import com.instabug.library.internal.module.InstabugLocale; import com.instabug.library.invocation.InstabugInvocationEvent; import com.instabug.library.invocation.InstabugInvocationMode; import com.instabug.library.InstabugColorTheme; -import com.instabug.library.invocation.util.InstabugVideoRecordingButtonCorner; +import com.instabug.library.invocation.OnInvokeCallback; +import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition; import com.instabug.library.logging.InstabugLog; import com.instabug.library.bugreporting.model.ReportCategory; import com.instabug.library.ui.onboarding.WelcomeMessage; import com.instabug.library.InstabugCustomTextPlaceHolder; +import com.instabug.library.model.Report; import com.instabug.library.user.UserEventParam; -import com.instabug.library.OnSdkDismissedCallback; -import com.instabug.library.bugreporting.model.Bug; import com.instabug.library.visualusersteps.State; -import com.instabug.survey.InstabugSurvey; import com.instabug.reactlibrary.utils.ArrayUtil; import com.instabug.reactlibrary.utils.MapUtil; +import com.instabug.survey.OnDismissCallback; +import com.instabug.survey.OnShowCallback; +import com.instabug.survey.Survey; +import com.instabug.survey.Surveys; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.json.JSONTokener; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.Iterator; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -58,6 +73,8 @@ */ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { + private static final String TAG = RNInstabugReactnativeModule.class.getSimpleName(); + //InvocationEvents private final String INVOCATION_EVENT_NONE = "none"; private final String INVOCATION_EVENT_SHAKE = "shake"; @@ -135,6 +152,15 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule { private final String ACTION_TYPE_REQUEST_NEW_FEATURE = "requestNewFeature"; private final String ACTION_TYPE_ADD_COMMENT_TO_FEATURE = "addCommentToFeature"; + private final String PROMPT_OPTION_BUG = "promptOptionBug"; + private final String PROMPT_OPTION_CHAT = "promptOptionChat"; + private final String PROMPT_OPTION_FEEDBACK = "promptOptionFeedback"; + + private final String EMAIL_FIELD_HIDDEN = "emailFieldHidden"; + private final String EMAIL_FIELD_OPTIONAL = "emailFieldOptional"; + private final String COMMENT_FIELD_REQUIRED = "commentFieldRequired"; + private final String DISABLE_POST_SENDING_DIALOG = "disablePostSendingDialog"; + private final String CONVERSATIONS_LIST_TITLE = "conversationsHeaderTitle"; private final String ADD_VOICE_MESSAGE = "addVoiceMessage"; @@ -179,19 +205,10 @@ public String getName() { return "Instabug"; } - @ReactMethod - public void startWithToken(String androidToken, String invocationEvent) { - mInstabug = new Instabug.Builder(this.androidApplication, androidToken) - .setIntroMessageEnabled(false) - .setInvocationEvent(getInvocationEventById(invocationEvent)) - .build(); - //init placHolders - placeHolders = new InstabugCustomTextPlaceHolder(); - - } - /** - * invoke sdk manually + * invoke sdk manually with mode and options + * + * @param */ @ReactMethod public void invoke() { @@ -200,7 +217,7 @@ public void invoke() { handler.post(new Runnable() { @Override public void run() { - mInstabug.invoke(); + BugReporting.invoke(); } }); } catch (Exception e) { @@ -236,6 +253,59 @@ public void invokeWithInvocationMode(String invocationMode) { } } + /** + * invoke sdk manually with desire invocation mode + * + * @param invocationMode the invocation mode + * @param invocationOptions the array of invocation options + */ + @ReactMethod + public void invokeWithInvocationModeAndOptions(String invocationMode, ReadableArray invocationOptions) { + InvocationMode mode; + + + if (invocationMode.equals(INVOCATION_MODE_NEW_BUG)) { + mode = InvocationMode.NEW_BUG; + } else if (invocationMode.equals(INVOCATION_MODE_NEW_FEEDBACK)) { + mode = InvocationMode.NEW_FEEDBACK; + } else if (invocationMode.equals(INVOCATION_MODE_NEW_CHAT)) { + mode = InvocationMode.NEW_CHAT; + } else if (invocationMode.equals(INVOCATION_MODE_CHATS_LIST)) { + mode = InvocationMode.CHATS_LIST; + } else { + mode = InvocationMode.PROMPT_OPTION; + } + + Object[] objectArray = ArrayUtil.toArray(invocationOptions); + String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); + + int[] arrayOfParsedOptions = new int[stringArray.length]; + int i = 0; + for (String option : stringArray) { + switch (option) { + case EMAIL_FIELD_HIDDEN: + arrayOfParsedOptions[i++] = InvocationOption.EMAIL_FIELD_HIDDEN; + break; + case EMAIL_FIELD_OPTIONAL: + arrayOfParsedOptions[i++] = InvocationOption.EMAIL_FIELD_OPTIONAL; + break; + case COMMENT_FIELD_REQUIRED: + arrayOfParsedOptions[i++] = InvocationOption.COMMENT_FIELD_REQUIRED; + break; + case DISABLE_POST_SENDING_DIALOG: + arrayOfParsedOptions[i++] = InvocationOption.DISABLE_POST_SENDING_DIALOG; + break; + default: + break; + } + } + try { + BugReporting.invoke(mode, arrayOfParsedOptions); + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * Dismisses all visible Instabug views @@ -243,7 +313,7 @@ public void invokeWithInvocationMode(String invocationMode) { @ReactMethod public void dismiss() { try { - mInstabug.dismiss(); + Instabug.dismiss(); } catch (Exception e) { e.printStackTrace(); } @@ -322,16 +392,16 @@ public void setExtendedBugReportMode(String extendedBugReportMode) { try { switch (extendedBugReportMode) { case EXTENDED_BUG_REPORT_REQUIRED_FIELDS: - Instabug.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_REQUIRED_FIELDS); + BugReporting.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_REQUIRED_FIELDS); break; case EXTENDED_BUG_REPORT_OPTIONAL_FIELDS: - Instabug.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_OPTIONAL_FIELDS); + BugReporting.setExtendedBugReportState(ExtendedBugReport.State.ENABLED_WITH_OPTIONAL_FIELDS); break; case EXTENDED_BUG_REPORT_DISABLED: - Instabug.setExtendedBugReportState(ExtendedBugReport.State.DISABLED); + BugReporting.setExtendedBugReportState(ExtendedBugReport.State.DISABLED); break; default: - Instabug.setExtendedBugReportState(ExtendedBugReport.State.DISABLED); + BugReporting.setExtendedBugReportState(ExtendedBugReport.State.DISABLED); } } catch (Exception e) { e.printStackTrace(); @@ -360,7 +430,7 @@ public void setViewHierarchyEnabled(boolean enabled) { @ReactMethod public void setVideoRecordingFloatingButtonPosition(String corner) { try { - mInstabug.setVideoRecordingFloatingButtonCorner(getVideoRecordingButtonCorner(corner)); + BugReporting.setVideoRecordingFloatingButtonPosition(getVideoRecordingButtonCorner(corner)); } catch (Exception e) { e.printStackTrace(); } @@ -535,7 +605,7 @@ public void setPrimaryColor(int primaryColor) { /** * Sets whether attachments in bug reporting and in-app messaging are enabled or not. * - * @param {boolean} screenShot A boolean to enable or disable screenshot attachments. + * @param screenshot A boolean to enable or disable screenshot attachments. * @param {boolean} extraScreenShot A boolean to enable or disable extra screenshot attachments. * @param {boolean} galleryImage A boolean to enable or disable gallery image attachments. * @param {boolean} screenRecording A boolean to enable or disable screen recording attachments. @@ -667,7 +737,7 @@ public void disable() { @ReactMethod public void showFeatureRequests() { try { - Instabug.showFeatureRequests(); + FeatureRequests.show(); } catch (Exception e) { e.printStackTrace(); } @@ -715,7 +785,51 @@ public void getUnreadMessagesCount(Callback messageCountCallback) { @ReactMethod public void setInvocationEvent(String invocationEventValue) { try { - mInstabug.changeInvocationEvent(getInvocationEventById(invocationEventValue)); + BugReporting.setInvocationEvents(getInvocationEventById(invocationEventValue)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Sets the event used to invoke Instabug SDK + * + * @param invocationEventValues the invocation event value + * @see InstabugInvocationEvent + */ + @ReactMethod + public void setInvocationEvents(ReadableArray invocationEventValues) { + + try { + Object[] objectArray = ArrayUtil.toArray(invocationEventValues); + String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); + ArrayList parsedInvocationEvents = new ArrayList<>(); + + Log.d(TAG, Arrays.toString(stringArray) + " " + INVOCATION_EVENT_FLOATING_BUTTON); + + for (String action : stringArray) { + switch (action) { + case INVOCATION_EVENT_FLOATING_BUTTON: + parsedInvocationEvents.add(InstabugInvocationEvent.FLOATING_BUTTON); + break; + case INVOCATION_EVENT_TWO_FINGERS_SWIPE: + parsedInvocationEvents.add(InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT); + break; + case INVOCATION_EVENT_SHAKE: + parsedInvocationEvents.add(InstabugInvocationEvent.SHAKE); + break; + case INVOCATION_EVENT_SCREENSHOT: + parsedInvocationEvents.add(InstabugInvocationEvent.SCREENSHOT_GESTURE); + break; + case INVOCATION_EVENT_NONE: + parsedInvocationEvents.add(InstabugInvocationEvent.NONE); + break; + default: + parsedInvocationEvents.add(InstabugInvocationEvent.SHAKE); + break; + } + } + BugReporting.setInvocationEvents(parsedInvocationEvents.toArray(new InstabugInvocationEvent[0])); } catch (Exception e) { e.printStackTrace(); } @@ -742,6 +856,44 @@ private InstabugInvocationEvent getInvocationEventById(String invocationEventVal return invocationEvent; } + /** + * Sets the event used to invoke Instabug SDK + * + * @param invocationOptionValues the invocation event value + * @see InstabugInvocationEvent + */ + @ReactMethod + public void setInvocationOptions(ReadableArray invocationOptionValues) { + try { + Object[] objectArray = ArrayUtil.toArray(invocationOptionValues); + String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); + for (String option : stringArray) { + switch (option) { + case EMAIL_FIELD_HIDDEN: + BugReporting.setInvocationOptions(InvocationOption.EMAIL_FIELD_HIDDEN); + return; + case EMAIL_FIELD_OPTIONAL: + BugReporting.setInvocationOptions(InvocationOption.EMAIL_FIELD_OPTIONAL); + break; + case COMMENT_FIELD_REQUIRED: + BugReporting.setInvocationOptions(InvocationOption.COMMENT_FIELD_REQUIRED); + break; + case DISABLE_POST_SENDING_DIALOG: + BugReporting.setInvocationOptions(InvocationOption.DISABLE_POST_SENDING_DIALOG); + break; + default: + BugReporting.setInvocationOptions(InvocationOption.EMAIL_FIELD_HIDDEN, + InvocationOption.EMAIL_FIELD_OPTIONAL, + InvocationOption.COMMENT_FIELD_REQUIRED, + InvocationOption.DISABLE_POST_SENDING_DIALOG); + break; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * Enabled/disable chat notification * @@ -750,7 +902,7 @@ private InstabugInvocationEvent getInvocationEventById(String invocationEventVal @ReactMethod public void setChatNotificationEnabled(boolean isChatNotificationEnable) { try { - mInstabug.setChatNotificationEnabled(isChatNotificationEnable); + Instabug.setReplyNotificationEnabled(isChatNotificationEnable); } catch (Exception e) { e.printStackTrace(); } @@ -796,9 +948,9 @@ public void reportJsException(ReadableArray stack, String message, String errorI Throwable throwable = new Throwable(message); throwable.setStackTrace(stackTraceElements); if (errorIdentifier != null) - mInstabug.reportException(throwable); + CrashReporting.reportException(throwable); else - mInstabug.reportException(throwable, errorIdentifier); + CrashReporting.reportException(throwable, errorIdentifier); } catch (Exception e) { e.printStackTrace(); @@ -874,7 +1026,7 @@ public void clearLogs() { public void hasRespondedToSurveyWithToken(String surveyToken, Callback hasRespondedCallback) { boolean hasResponded; try { - hasResponded = Instabug.hasRespondToSurvey(surveyToken); + hasResponded = Surveys.hasRespondToSurvey(surveyToken); hasRespondedCallback.invoke(hasResponded); } catch (Exception e) { e.printStackTrace(); @@ -891,7 +1043,7 @@ public void hasRespondedToSurveyWithToken(String surveyToken, Callback hasRespon @ReactMethod public void showSurveyWithToken(String surveyToken) { try { - Instabug.showSurvey(surveyToken); + Surveys.showSurvey(surveyToken); } catch (Exception e) { e.printStackTrace(); } @@ -984,10 +1136,10 @@ public void clearAllUserAttributes() { public void setColorTheme(String theme) { try { if (theme.equals(COLOR_THEME_LIGHT)) { - mInstabug.setTheme(InstabugColorTheme.InstabugColorThemeLight); + Instabug.setColorTheme(InstabugColorTheme.InstabugColorThemeLight); } else if (theme.equals(COLOR_THEME_DARK)) { - mInstabug.setTheme(InstabugColorTheme.InstabugColorThemeDark); + Instabug.setColorTheme(InstabugColorTheme.InstabugColorThemeDark); } } catch (Exception e) { e.printStackTrace(); @@ -1046,7 +1198,7 @@ public void setEmailFieldRequired(boolean isEmailFieldRequired) { @ReactMethod public void setCommentFieldRequired(boolean isCommentFieldRequired) { try { - mInstabug.setCommentFieldRequired(isCommentFieldRequired); + BugReporting.setInvocationOptions(InvocationOption.COMMENT_FIELD_REQUIRED); } catch (java.lang.Exception exception) { exception.printStackTrace(); } @@ -1156,13 +1308,12 @@ public void logUserEventWithNameAndParams(String name, ReadableMap params) { @ReactMethod public void setPreInvocationHandler(final Callback preInvocationHandler) { try { - Runnable preInvocationRunnable = new Runnable() { + BugReporting.setOnInvokeCallback(new OnInvokeCallback() { @Override - public void run() { + public void onInvoke() { sendEvent(getReactApplicationContext(), "IBGpreInvocationHandler", null); } - }; - mInstabug.setPreInvocation(preInvocationRunnable); + }); } catch (java.lang.Exception exception) { exception.printStackTrace(); } @@ -1180,18 +1331,67 @@ public void run() { @ReactMethod public void setPreSendingHandler(final Callback preSendingHandler) { try { - Runnable preSendingRunnable = new Runnable() { + + Instabug.onReportSubmitHandler(new Report.OnReportCreatedListener() { @Override - public void run() { - sendEvent(getReactApplicationContext(), "IBGpreSendingHandler", null); + public void onReportCreated(Report report) { + WritableMap reportParam = Arguments.createMap(); + reportParam.putArray("tagsArray", convertArrayListToWritableArray(report.getTags())); + reportParam.putArray("consoleLogs", convertArrayListToWritableArray(report.getConsoleLog())); + reportParam.putString("userData", report.getUserData()); + reportParam.putMap("userAttributes", convertFromHashMapToWriteableMap(report.getUserAttributes())); + reportParam.putMap("fileAttachments", convertFromHashMapToWriteableMap(report.getFileAttachments())); + sendEvent(getReactApplicationContext(), "IBGpreSendingHandler", reportParam); } - }; - mInstabug.setPreSendingRunnable(preSendingRunnable); + }); } catch (java.lang.Exception exception) { exception.printStackTrace(); } } + private WritableMap convertFromHashMapToWriteableMap(HashMap hashMap) { + WritableMap writableMap = new WritableNativeMap(); + for(int i = 0; i < hashMap.size(); i++) { + Object key = hashMap.keySet().toArray()[i]; + Object value = hashMap.get(key); + writableMap.putString((String) key,(String) value); + } + return writableMap; + } + + private static JSONObject objectToJSONObject(Object object){ + Object json = null; + JSONObject jsonObject = null; + try { + json = new JSONTokener(object.toString()).nextValue(); + } catch (JSONException e) { + e.printStackTrace(); + } + if (json instanceof JSONObject) { + jsonObject = (JSONObject) json; + } + return jsonObject; + } + + private WritableArray convertArrayListToWritableArray(List arrayList) { + WritableArray writableArray = new WritableNativeArray(); + + for(int i = 0; i < arrayList.size(); i++) { + Object object = arrayList.get(i); + + if(object instanceof String) { + writableArray.pushString((String) object); + } + else { + JSONObject jsonObject = objectToJSONObject(object); + writableArray.pushMap((WritableMap) jsonObject); + } + } + + return writableArray; + + } + /** * Sets a block of code to be executed right after the SDK's UI is dismissed. * This block is executed on the UI thread. Could be used for performing any @@ -1203,17 +1403,15 @@ public void run() { @ReactMethod public void setPostInvocationHandler(final Callback postInvocationHandler) { try { - - mInstabug.setOnSdkDismissedCallback(new OnSdkDismissedCallback() { - @Override - public void onSdkDismissed(DismissType issueState, Bug.Type bugType) { - WritableMap params = Arguments.createMap(); - params.putString("issueState", issueState.toString()); - params.putString("bugType", bugType.toString()); - sendEvent(getReactApplicationContext(), "IBGpostInvocationHandler", params); - } - }); - + BugReporting.setOnDismissCallback(new OnSdkDismissCallback() { + @Override + public void call(DismissType dismissType, ReportType reportType) { + WritableMap params = Arguments.createMap(); + params.putString("dismissType", dismissType.toString()); + params.putString("reportType", reportType.toString()); + sendEvent(getReactApplicationContext(), "IBGpostInvocationHandler", params); + } + }); } catch (java.lang.Exception exception) { exception.printStackTrace(); } @@ -1227,7 +1425,7 @@ public void onSdkDismissed(DismissType issueState, Bug.Type bugType) { @ReactMethod public void showSurveysIfAvailable() { try { - mInstabug.showValidSurvey(); + Surveys.showSurveyIfAvailable(); } catch (java.lang.Exception exception) { exception.printStackTrace(); } @@ -1241,7 +1439,7 @@ public void showSurveysIfAvailable() { @ReactMethod public void setSurveysEnabled(boolean surveysEnabled) { try { - InstabugSurvey.setSurveysAutoShowing(surveysEnabled); + Surveys.setAutoShowingEnabled(surveysEnabled); } catch (java.lang.Exception exception) { exception.printStackTrace(); } @@ -1270,17 +1468,13 @@ public void setIntroMessageEnabled(boolean enabled) { */ @ReactMethod public void setWillShowSurveyHandler(final Callback willShowSurveyHandler) { - try { - Runnable willShowSurveyRunnable = new Runnable() { + + Surveys.setOnShowCallback(new OnShowCallback() { @Override - public void run() { + public void onShow() { sendEvent(getReactApplicationContext(), "IBGWillShowSurvey", null); } - }; - mInstabug.setPreShowingSurveyRunnable(willShowSurveyRunnable); - } catch (java.lang.Exception exception) { - exception.printStackTrace(); - } + }); } /** @@ -1292,25 +1486,19 @@ public void run() { */ @ReactMethod public void setDidDismissSurveyHandler(final Callback didDismissSurveyHandler) { - try { - Runnable didDismissSurveyRunnable = new Runnable() { + + Surveys.setOnDismissCallback(new OnDismissCallback() { @Override - public void run() { + public void onDismiss() { sendEvent(getReactApplicationContext(), "IBGDidDismissSurvey", null); } - }; - mInstabug.setAfterShowingSurveyRunnable(didDismissSurveyRunnable); - } catch (java.lang.Exception exception) { - exception.printStackTrace(); - } + }); } /** * Enable/Disable prompt options when SDK invoked. When only a single option is enabled it - * becomes the default - * invocation option that SDK gets invoked with and prompt options screen will not show. When - * none is enabled, Bug - * reporting becomes the default invocation option. + * becomes the default invocation option that SDK gets invoked with and prompt options screen + * will not show. When none is enabled, Bug reporting becomes the default invocation option. * * @param chat weather Talk to us is enable or not * @param bug weather Report a Problem is enable or not @@ -1318,8 +1506,55 @@ public void run() { */ @ReactMethod public void setPromptOptionsEnabled(boolean chat, boolean bug, boolean feedback) { + + ArrayList options = new ArrayList<>(); + + if (chat) { + options.add(PromptOption.CHAT); + } + + if (feedback) { + options.add(PromptOption.FEEDBACK); + } + + if (bug) { + options.add(PromptOption.BUG); + } + + try { + BugReporting.setPromptOptionsEnabled(options.toArray(new PromptOption[0])); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Sets whether email field is required or not when submitting + * bug/feedback/new-feature-request/new-comment-on-feature + * + * @param promptOptions Bitwise-or of prompt option types + */ + @ReactMethod + public void setPromptOptions(ReadableArray promptOptions) { try { - mInstabug.setPromptOptionsEnabled(chat, bug, feedback); + Object[] objectArray = ArrayUtil.toArray(promptOptions); + String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); + for (String action : stringArray) { + switch (action) { + case PROMPT_OPTION_BUG: + BugReporting.setPromptOptionsEnabled(); + return; + case PROMPT_OPTION_CHAT: + BugReporting.setPromptOptionsEnabled(); + break; + case PROMPT_OPTION_FEEDBACK: + BugReporting.setPromptOptionsEnabled(); + break; + default: + BugReporting.setPromptOptionsEnabled(); + break; + } + } } catch (Exception e) { e.printStackTrace(); } @@ -1430,7 +1665,7 @@ public void setWelcomeMessageMode(String welcomeMessageMode) { @ReactMethod public void setShakingThresholdForAndroid(int androidThreshold) { try { - mInstabug.setShakingThreshold(androidThreshold); + BugReporting.setShakingThreshold(androidThreshold); } catch (Exception e) { e.printStackTrace(); } @@ -1451,7 +1686,7 @@ public void run() { sendEvent(getReactApplicationContext(), "IBGonNewMessageHandler", null); } }; - mInstabug.setNewMessageHandler(onNewMessageRunnable); + Instabug.setOnNewReplyReceivedCallback(onNewMessageRunnable); } catch (java.lang.Exception exception) { exception.printStackTrace(); } @@ -1462,11 +1697,14 @@ public void run() { */ @ReactMethod public void setSuccessDialogEnabled(boolean enabled) { - try { - mInstabug.setSuccessDialogEnabled(enabled); - } catch (Exception e) { - e.printStackTrace(); + if (enabled) { + try { + BugReporting.setInvocationOptions(InvocationOption.DISABLE_POST_SENDING_DIALOG); + } catch (Exception e) { + e.printStackTrace(); + } } + } /** @@ -1478,12 +1716,99 @@ public void setSuccessDialogEnabled(boolean enabled) { @ReactMethod public void setThresholdForReshowingSurveyAfterDismiss(int sessionsCount, int daysCount) { try { - Instabug.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount); + Surveys.setThresholdForReshowingSurveyAfterDismiss(sessionsCount, daysCount); } catch (Exception e) { e.printStackTrace(); } } + /** + * Returns an array containing the available surveys. + * @param availableSurveysCallback - Callback with the returned value of the available surveys + * + */ + @ReactMethod + public void getAvailableSurveys(Callback availableSurveysCallback) { + try { + List availableSurveys = Surveys.getAvailableSurveys(); + JSONArray surveysArray = toJson(availableSurveys); + WritableArray array = convertJsonToArray(surveysArray); + availableSurveysCallback.invoke(array); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + private static WritableMap convertJsonToMap(JSONObject jsonObject) throws JSONException { + WritableMap map = new WritableNativeMap(); + + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + Object value = jsonObject.get(key); + if (value instanceof JSONObject) { + map.putMap(key, convertJsonToMap((JSONObject) value)); + } else if (value instanceof JSONArray) { + map.putArray(key, convertJsonToArray((JSONArray) value)); + } else if (value instanceof Boolean) { + map.putBoolean(key, (Boolean) value); + } else if (value instanceof Integer) { + map.putInt(key, (Integer) value); + } else if (value instanceof Double) { + map.putDouble(key, (Double) value); + } else if (value instanceof String) { + map.putString(key, (String) value); + } else { + map.putString(key, value.toString()); + } + } + return map; + } + + private static WritableArray convertJsonToArray(JSONArray jsonArray) throws JSONException { + WritableArray array = new WritableNativeArray(); + + for (int i = 0; i < jsonArray.length(); i++) { + Object value = jsonArray.get(i); + if (value instanceof JSONObject) { + array.pushMap(convertJsonToMap((JSONObject) value)); + } else if (value instanceof JSONArray) { + array.pushArray(convertJsonToArray((JSONArray) value)); + } else if (value instanceof Boolean) { + array.pushBoolean((Boolean) value); + } else if (value instanceof Integer) { + array.pushInt((Integer) value); + } else if (value instanceof Double) { + array.pushDouble((Double) value); + } else if (value instanceof String) { + array.pushString((String) value); + } + } + return array; + } + + /** + * Convenience method to convert from a list of Surveys to a JSON array + * + * @param list + * List of Surveys to be converted to JSON array + */ + public static JSONArray toJson(List list) { + JSONArray jsonArray = new JSONArray(); + try{ + for (Survey obj : list) { + JSONObject object = new JSONObject(); + object.put("title", obj.getTitle()); + jsonArray.put(object); + } + } catch (JSONException e) { + e.printStackTrace(); + } + return jsonArray; + } + /** * Set Surveys auto-showing state, default state auto-showing enabled * @@ -1492,7 +1817,7 @@ public void setThresholdForReshowingSurveyAfterDismiss(int sessionsCount, int da @ReactMethod public void setAutoShowingSurveysEnabled(boolean autoShowingSurveysEnabled) { try { - Instabug.setSurveysAutoShowing(autoShowingSurveysEnabled); + Surveys.setAutoShowingEnabled(autoShowingSurveysEnabled); } catch (Exception e) { e.printStackTrace(); } @@ -1508,7 +1833,7 @@ public void setAutoShowingSurveysEnabled(boolean autoShowingSurveysEnabled) { @ReactMethod public void setEnableInAppNotificationSound(boolean shouldPlaySound) { try { - mInstabug.setEnableInAppNotificationSound(shouldPlaySound); + Instabug.setInAppReplyNotificationSound(shouldPlaySound); } catch (Exception e) { e.printStackTrace(); } @@ -1541,20 +1866,52 @@ public void setSessionProfilerEnabled(boolean sessionProfilerEnabled) { @ReactMethod public void setShouldShowSurveysWelcomeScreen(boolean shouldShow) { try { - InstabugSurvey.setShouldShowSurveysWelcomeScreen(shouldShow); + Surveys.setShouldShowWelcomeScreen(shouldShow); } catch (java.lang.Exception exception) { exception.printStackTrace(); } } /** - * ets whether email field is required or not when submitting + * Sets whether email field is required or not when submitting + * new-feature-request/new-comment-on-feature + * + * @param isEmailRequired set true to make email field required + * @param actionTypes Bitwise-or of actions + */ + @ReactMethod + public void setEmailFieldRequiredForFeatureRequests(boolean isEmailRequired, ReadableArray actionTypes) { + try { + Object[] objectArray = ArrayUtil.toArray(actionTypes); + String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); + int[] parsedActionTypes = new int[stringArray.length]; + int i = 0; + for (String action : stringArray) { + switch (action) { + case ACTION_TYPE_REQUEST_NEW_FEATURE: + parsedActionTypes[i++] = ActionType.REQUEST_NEW_FEATURE; + break; + case ACTION_TYPE_ADD_COMMENT_TO_FEATURE: + parsedActionTypes[i++] = ActionType.ADD_COMMENT_TO_FEATURE; + break; + default: + + break; + } + } + + FeatureRequests.setEmailFieldRequired(isEmailRequired, parsedActionTypes); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Sets whether email field is required or not when submitting * bug/feedback/new-feature-request/new-comment-on-feature * * @param isEmailRequired set true to make email field required * @param actionTypes Bitwise-or of actions - * {@link ActionType#ALL_ACTIONS} - * {@link ActionType#REPORT_BUG} * {@link ActionType#ADD_COMMENT_TO_FEATURE} * {@link ActionType#REQUEST_NEW_FEATURE} */ @@ -1565,12 +1922,12 @@ public void setEmailFieldRequiredForActions(boolean isEmailRequired, ReadableArr String[] stringArray = Arrays.copyOf(objectArray, objectArray.length, String[].class); for (String action : stringArray) { switch (action) { - case ACTION_TYPE_ALL_ACTIONS: - Instabug.setEmailFieldRequired(isEmailRequired, ActionType.ALL_ACTIONS); - return; - case ACTION_TYPE_REPORT_BUG: - Instabug.setEmailFieldRequired(isEmailRequired, ActionType.REPORT_BUG); - break; +// case ACTION_TYPE_ALL_ACTIONS: +// Instabug.setEmailFieldRequired(isEmailRequired, ActionType.ALL_ACTIONS); +// return; +// case ACTION_TYPE_REPORT_BUG: +// Instabug.setEmailFieldRequired(isEmailRequired, ActionType.REPORT_BUG); +// break; case ACTION_TYPE_REQUEST_NEW_FEATURE: Instabug.setEmailFieldRequired(isEmailRequired, ActionType.REQUEST_NEW_FEATURE); break; @@ -1640,17 +1997,17 @@ private InstabugCustomTextPlaceHolder.Key getStringToKeyConstant(String key) { } } - private InstabugVideoRecordingButtonCorner getVideoRecordingButtonCorner(String cornerValue) { - InstabugVideoRecordingButtonCorner corner = InstabugVideoRecordingButtonCorner.BOTTOM_RIGHT; + private InstabugVideoRecordingButtonPosition getVideoRecordingButtonCorner(String cornerValue) { + InstabugVideoRecordingButtonPosition corner = InstabugVideoRecordingButtonPosition.BOTTOM_RIGHT; try { if (cornerValue.equals(BOTTOM_RIGHT)) { - corner = InstabugVideoRecordingButtonCorner.BOTTOM_RIGHT; + corner = InstabugVideoRecordingButtonPosition.BOTTOM_RIGHT; } else if (cornerValue.equals(BOTTOM_LEFT)) { - corner = InstabugVideoRecordingButtonCorner.BOTTOM_LEFT; + corner = InstabugVideoRecordingButtonPosition.BOTTOM_LEFT; } else if (cornerValue.equals(TOP_LEFT)) { - corner = InstabugVideoRecordingButtonCorner.TOP_LEFT; + corner = InstabugVideoRecordingButtonPosition.TOP_LEFT; } else if (cornerValue.equals(TOP_RIGHT)) { - corner = InstabugVideoRecordingButtonCorner.TOP_RIGHT; + corner = InstabugVideoRecordingButtonPosition.TOP_RIGHT; } } catch (Exception e) { @@ -1787,6 +2144,15 @@ public Map getConstants() { constants.put("requestNewFeature", ACTION_TYPE_REQUEST_NEW_FEATURE); constants.put("addCommentToFeature", ACTION_TYPE_ADD_COMMENT_TO_FEATURE); + constants.put("emailFieldHidden", EMAIL_FIELD_HIDDEN); + constants.put("emailFieldOptional", EMAIL_FIELD_OPTIONAL); + constants.put("commentFieldRequired", COMMENT_FIELD_REQUIRED); + constants.put("disablePostSendingDialog", DISABLE_POST_SENDING_DIALOG); + + constants.put("promptOptionBug", PROMPT_OPTION_BUG); + constants.put("promptOptionChat", PROMPT_OPTION_CHAT); + constants.put("promptOptionFeedback", PROMPT_OPTION_FEEDBACK); + constants.put("shakeHint", SHAKE_HINT); constants.put("swipeHint", SWIPE_HINT); constants.put("invalidEmailMessage", INVALID_EMAIL_MESSAGE); diff --git a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java index 5c8302568..0c2996092 100644 --- a/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java +++ b/android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativePackage.java @@ -7,6 +7,7 @@ import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; +import com.instabug.bug.BugReporting; import com.instabug.library.Feature; import com.instabug.library.Instabug; import com.instabug.library.InstabugColorTheme; @@ -14,64 +15,92 @@ import com.instabug.library.invocation.util.InstabugFloatingButtonEdge; import com.instabug.library.visualusersteps.State; import android.graphics.Color; +import android.util.Log; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.List; public class RNInstabugReactnativePackage implements ReactPackage { + private static final String TAG = RNInstabugReactnativePackage.class.getSimpleName(); + private Application androidApplication; private String mAndroidApplicationToken; private Instabug mInstabug; private Instabug.Builder mBuilder; - private InstabugInvocationEvent invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON; + private ArrayList invocationEvents = new ArrayList<>(); private InstabugColorTheme instabugColorTheme = InstabugColorTheme.InstabugColorThemeLight; public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication, - String invocationEventValue, String primaryColor, + String[] invocationEventValues, String primaryColor, InstabugFloatingButtonEdge floatingButtonEdge, int offset) { this.androidApplication = androidApplication; this.mAndroidApplicationToken = androidApplicationToken; //setting invocation event - if (invocationEventValue.equals("button")) { - this.invocationEvent = InstabugInvocationEvent.FLOATING_BUTTON; - } else if (invocationEventValue.equals("swipe")) { - this.invocationEvent = InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT; - - } else if (invocationEventValue.equals("shake")) { - this.invocationEvent = InstabugInvocationEvent.SHAKE; - - } else if (invocationEventValue.equals("screenshot")) { - this.invocationEvent = InstabugInvocationEvent.SCREENSHOT_GESTURE; - - } else if (invocationEventValue.equals("none")) { - this.invocationEvent = InstabugInvocationEvent.NONE; - - } else { - this.invocationEvent = InstabugInvocationEvent.SHAKE; - } - + this.parseInvocationEvent(invocationEventValues); mInstabug = new Instabug.Builder(this.androidApplication, this.mAndroidApplicationToken) - .setInvocationEvent(this.invocationEvent) + .setInvocationEvents(this.invocationEvents.toArray(new InstabugInvocationEvent[0])) .setCrashReportingState(Feature.State.ENABLED) .setReproStepsState(State.DISABLED) .build(); Instabug.setPrimaryColor(Color.parseColor(primaryColor)); - Instabug.setFloatingButtonEdge(floatingButtonEdge); - Instabug.setFloatingButtonOffsetFromTop(offset); + BugReporting.setFloatingButtonEdge(floatingButtonEdge); + BugReporting.setFloatingButtonOffset(offset); } public RNInstabugReactnativePackage(String androidApplicationToken, Application androidApplication, - String invocationEventValue, String primaryColor) { - new RNInstabugReactnativePackage(androidApplicationToken,androidApplication,invocationEventValue,primaryColor, + String[] invocationEventValues, String primaryColor) { + new RNInstabugReactnativePackage(androidApplicationToken,androidApplication,invocationEventValues,primaryColor, InstabugFloatingButtonEdge.LEFT,250); } + private void parseInvocationEvent(String[] invocationEventValues) { + + for (int i = 0; i < invocationEventValues.length; i++) { + if (invocationEventValues[i].equals("button")) { + this.invocationEvents.add(InstabugInvocationEvent.FLOATING_BUTTON); + } else if (invocationEventValues[i].equals("swipe")) { + this.invocationEvents.add(InstabugInvocationEvent.TWO_FINGER_SWIPE_LEFT); + + } else if (invocationEventValues[i].equals("shake")) { + this.invocationEvents.add(InstabugInvocationEvent.SHAKE); + + } else if (invocationEventValues[i].equals("screenshot")) { + this.invocationEvents.add(InstabugInvocationEvent.SCREENSHOT_GESTURE); + + } else if (invocationEventValues[i].equals("none")) { + this.invocationEvents.add(InstabugInvocationEvent.NONE); + } + } + + if (invocationEvents.isEmpty()) { + invocationEvents.add(InstabugInvocationEvent.SHAKE); + } + } + + @Override + public List createNativeModules(ReactApplicationContext reactContext) { + List modules = new ArrayList<>(); + modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication, this.mInstabug)); + return modules; + } + + public List> createJSModules() { + return Collections.emptyList(); + } + + @Override + public List createViewManagers(ReactApplicationContext reactContext) { + return Collections.emptyList(); + } + + public static class Builder { //FloatingButtonEdge private final String FLOATING_BUTTON_EDGE_RIGHT = "right"; @@ -79,7 +108,7 @@ public static class Builder { String androidApplicationToken; Application application; - String invocationEvent; + String[] invocationEvents; String primaryColor; InstabugFloatingButtonEdge floatingButtonEdge; int offset; @@ -89,8 +118,8 @@ public Builder(String androidApplicationToken, Application application) { this.application = application; } - public Builder setInvocationEvent(String invocationEvent) { - this.invocationEvent = invocationEvent; + public Builder setInvocationEvent(String... invocationEvents) { + this.invocationEvents = invocationEvents; return this; } @@ -110,7 +139,7 @@ public Builder setFloatingButtonOffsetFromTop(int offset) { } public RNInstabugReactnativePackage build() { - return new RNInstabugReactnativePackage(androidApplicationToken,application,invocationEvent,primaryColor,floatingButtonEdge,offset); + return new RNInstabugReactnativePackage(androidApplicationToken,application,invocationEvents,primaryColor,floatingButtonEdge,offset); } private InstabugFloatingButtonEdge getFloatingButtonEdge(String floatingButtonEdgeValue) { @@ -130,20 +159,4 @@ private InstabugFloatingButtonEdge getFloatingButtonEdge(String floatingButtonEd } } - @Override - public List createNativeModules(ReactApplicationContext reactContext) { - List modules = new ArrayList<>(); - modules.add(new RNInstabugReactnativeModule(reactContext, this.androidApplication, this.mInstabug)); - return modules; - } - - public List> createJSModules() { - return Collections.emptyList(); - } - - @Override - public List createViewManagers(ReactApplicationContext reactContext) { - return Collections.emptyList(); - } - } diff --git a/index.js b/index.js index c10c5b2c7..14d7887f2 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,9 @@ import {NativeModules, NativeAppEventEmitter, DeviceEventEmitter, Platform} from "react-native"; let {Instabug} = NativeModules; import InstabugUtils from './utils/InstabugUtils.js'; +import BugReporting from './modules/BugReporting.js'; +import Surveys from './modules/Surveys.js'; +import FeatureRequests from './modules/FeatureRequests.js'; InstabugUtils.captureJsErrors(); @@ -8,7 +11,7 @@ InstabugUtils.captureJsErrors(); * Instabug * @exports Instabug */ -module.exports = { +const InstabugModule = { /** * Starts the SDK. @@ -26,6 +29,7 @@ module.exports = { }, /** + * @deprecated Use {@link BugReporting.invoke()} instead. * Invokes the SDK manually with the default invocation mode. * Shows a view that asks the user whether they want to start a chat, report * a problem or suggest an improvement. @@ -35,6 +39,7 @@ module.exports = { }, /** + * @deprecated Use {@link BugReporting.invokeWithInvocationModeAndOptions} instead. * Invokes the SDK with a specific mode. * Invokes the SDK and show a specific view, instead of showing a prompt for * users to choose from. @@ -46,6 +51,7 @@ module.exports = { }, /** + * @deprecated Use {@link BugReporting.dismiss() instead} * Dismisses any Instabug views that are currently being shown. */ dismiss: function () { @@ -104,6 +110,16 @@ module.exports = { Instabug.setUserStepsEnabled(isUserStepsEnabled); }, + /** + * Sets whether IBGLog should also print to Xcode's console log or not. + * @param {boolean} printsToConsole A boolean to set whether printing to + * Xcode's console is enabled or not. + */ + setIBGLogPrintsToConsole: function (printsToConsole) { + if (Platform.OS === 'ios') + Instabug.setIBGLogPrintsToConsole(printsToConsole); + }, + /** * Report un-caught exceptions to Instabug dashboard * We don't send exceptions from __DEV__, since it's way too noisy! @@ -113,6 +129,7 @@ module.exports = { }, /** + * @deprecated Use {@link BugReporting.onReportSubmitHandler} instead. * Sets a block of code to be executed before sending each report. * This block is executed in the background before sending each report. Could * be used for attaching logs and extra data to reports. @@ -135,6 +152,31 @@ module.exports = { }, /** + * Sets a block of code to be executed when a prompt option is selected. + * @param {function} didSelectPromptOptionHandler - A block of code that + * gets executed when a prompt option is selected. + */ + setDidSelectPromptOptionHandler: function (didSelectPromptOptionHandler) { + if (Platform.OS === 'ios') { + Instabug.addListener('IBGDidSelectPromptOptionHandler'); + NativeAppEventEmitter.addListener( + 'IBGDidSelectPromptOptionHandler', + function (payload) { + didSelectPromptOptionHandler(payload['promptOption']); + } + ); + } else { + DeviceEventEmitter.addListener('IBGDidSelectPromptOptionHandler', function(payload) { + didSelectPromptOptionHandler(payload.promptOption); + }); + } + + Instabug.didSelectPromptOptionHandler(didSelectPromptOptionHandler); + + }, + + /** + * @deprecated * Shows survey with a specific token. * Does nothing if there are no available surveys with that specific token. * Answered and cancelled surveys won't show up again. @@ -146,6 +188,7 @@ module.exports = { }, /** + * @deprecated * Returns true if the survey with a specific token was answered before. * Will return false if the token does not exist or if the survey was not answered before. * @param {string} surveyToken - A String with a survey token. @@ -168,6 +211,7 @@ module.exports = { }, /** + * @deprecated Use {@link BugReporting.onInvokeHandler} instead * Sets a block of code to be executed just before the SDK's UI is presented. * This block is executed on the UI thread. Could be used for performing any * UI changes before the SDK's UI is shown. @@ -189,6 +233,7 @@ module.exports = { }, /** + * @deprecated {@link BugReporting.onSDKDismissedHandler} instead * Sets a block of code to be executed right after the SDK's UI is dismissed. * This block is executed on the UI thread. Could be used for performing any * UI changes after the SDK's UI is dismissed. @@ -206,7 +251,7 @@ module.exports = { ); } else { DeviceEventEmitter.addListener('IBGpostInvocationHandler', function(payload) { - postInvocationHandler(payload.issueState, payload.bugType); + postInvocationHandler(payload.dismissType, payload.reportType); }); } @@ -215,8 +260,7 @@ module.exports = { }, /** - * @deprecated Use {@link showWelcomeMessage} instead. - * Present a view that educates the user on how to invoke the SDK with the + * @deprecated Present a view that educates the user on how to invoke the SDK with the * currently set invocation event. */ showIntroMessage: function () { @@ -243,7 +287,7 @@ module.exports = { }, /** - * Enables/disables screenshot view when reporting a bug/improvement. + * @deprecated Enables/disables screenshot view when reporting a bug/improvement. * By default, screenshot view is shown when reporting a bug, but not when * sending feedback. * @param {boolean} willSkipScreenshotAnnotation sets whether screenshot view is @@ -266,6 +310,7 @@ module.exports = { }, /** + * @deprecated Use {@link setInvocationEvents} instead. * Sets the event that invoke the feedback form. * Default is set by `Instabug.startWithToken`. * @param {invocationEvent} invocationEvent Event that invokes the @@ -287,8 +332,7 @@ module.exports = { }, /** - * @deprecated Use {@link setEmailFieldRequiredForActions} instead. - * Sets whether users are required to enter an email address or not when + * @deprecated Sets whether users are required to enter an email address or not when * sending reports. * Defaults to YES. * @param {boolean} isEmailFieldRequired A boolean to indicate whether email @@ -312,9 +356,8 @@ module.exports = { Instabug.setEmailFieldRequiredForActions(isEmailFieldRequired, actionTypes); }, - /** - * Sets whether users are required to enter a comment or not when sending reports. + * @deprecated Sets whether users are required to enter a comment or not when sending reports. * Defaults to NO. * @param {boolean} isCommentFieldRequired A boolean to indicate whether comment * field is required or not. @@ -324,6 +367,8 @@ module.exports = { }, /** + * @deprecated since version 2.3.0. Use {@link setShakingThresholdForiPhone} + * and {@link setShakingThresholdForiPad} instead. * Sets the threshold value of the shake gesture for iPhone/iPod Touch and iPad. * Default for iPhone is 2.5. * Default for iPad is 0.6. @@ -336,6 +381,29 @@ module.exports = { }, /** + * @deprecated + * Sets the threshold value of the shake gesture for iPhone/iPod Touch + * Default for iPhone is 2.5. + * @param {number} iPhoneShakingThreshold Threshold for iPhone. + */ + setShakingThresholdForiPhone: function (iPhoneShakingThreshold) { + if (Platform.OS === 'ios') + Instabug.setShakingThresholdForiPhone(iPhoneShakingThreshold); + }, + + /** + * @deprecated + * Sets the threshold value of the shake gesture for iPad. + * Default for iPad is 0.6. + * @param {number} iPadShakingThreshold Threshold for iPad. + */ + setShakingThresholdForiPad: function (iPadShakingThreshold) { + if (Platform.OS === 'ios') + Instabug.setShakingThresholdForiPad(iPadShakingThreshold); + }, + + /** + * @deprecated * Sets the threshold value of the shake gesture for android devices. * Default for android is an integer value equals 350. * you could increase the shaking difficulty level by @@ -377,7 +445,7 @@ module.exports = { }, /** - * Sets whether the intro message that gets shown on launching the app is + * @deprecated Sets whether the intro message that gets shown on launching the app is * enabled or not. * Defaults to YES. * @param {boolean} isIntroMessageEnabled A boolean to indicate whether the @@ -563,7 +631,8 @@ module.exports = { }, /** - * ets whether the extended bug report mode should be disabled, enabled with + * @deprecated + * Sets whether the extended bug report mode should be disabled, enabled with * required fields or enabled with optional fields. * @param {extendedBugReportMode} extendedBugReportMode An enum to disable * the extended bug report mode, enable it @@ -574,7 +643,7 @@ module.exports = { }, /** - * Logs a user event that happens through the lifecycle of the application. + * @deprecated Logs a user event that happens through the lifecycle of the application. * Logged user events are going to be sent with each report, as well as at the end of a session. * @param {string} name Event name. */ @@ -797,6 +866,7 @@ module.exports = { }, /** + * @deprecated * @summary Sets a block of code to be executed just before the survey's UI is presented. * This block is executed on the UI thread. Could be used for performing any UI changes before * the survey's UI is shown. @@ -819,6 +889,7 @@ module.exports = { }, /** + * @deprecated * @summary Sets a block of code to be executed right after the survey's UI is dismissed. * This block is executed on the UI thread. Could be used for performing any UI * changes after the survey's UI is dismissed. @@ -841,6 +912,7 @@ module.exports = { }, /** + * @deprecated * Enable/Disable prompt options when SDK invoked. When only a single option is enabled it * becomes the default * invocation option that SDK gets invoked with and prompt options screen will not show. When @@ -901,6 +973,8 @@ module.exports = { }, /** + * @deprecated + * * @param enabled true to show success dialog after submitting a bug report * */ @@ -954,6 +1028,7 @@ module.exports = { }, /** + * @deprecated * Sets a threshold for numbers of sessions and another for number of days * required before a survey, that has been dismissed once, would show again. * @param {number} sessionCount Number of sessions required to be @@ -966,6 +1041,7 @@ module.exports = { }, /** + * @deprecated * Sets whether auto surveys showing are enabled or not. * @param autoShowingSurveysEnabled A boolean to indicate whether the * surveys auto showing are enabled or not. @@ -976,6 +1052,7 @@ module.exports = { }, /** + * @deprecated * Shows the UI for feature requests list * */ @@ -1049,6 +1126,17 @@ module.exports = { addAttachment: Instabug.dismissTypeAddAttachment }, + /** + * Type of SDK dismiss + * @readonly + * @enum {number} + */ + promptOption: { + bug: Instabug.promptOptionBug, + chat: Instabug.promptOptionChat, + feedback: Instabug.promptOptionFeedback + }, + /** * Type of report to be submit * @readonly @@ -1072,6 +1160,18 @@ module.exports = { chatsList: Instabug.invocationModeChatsList }, + /** + * The options used upon invocating the SDK + * @readonly + * @enum {number} + */ + invocationOptions: { + invocationOptionsEmailFieldHidden: Instabug.emailFieldHidden, + invocationOptionsEmailFieldOptional: Instabug.emailFieldOptional, + invocationOptionsCommentFieldRequired: Instabug.commentFieldRequired, + invocationOptionsDisablePostSendingDialog: Instabug.disablePostSendingDialog + }, + /** * The extended bug report mode * @readonly @@ -1213,3 +1313,9 @@ module.exports = { thankYouAlertText: Instabug.thankYouAlertText, } }; + +InstabugModule.BugReporting = BugReporting; +InstabugModule.Surveys = Surveys; +InstabugModule.FeatureRequests = FeatureRequests; + +module.exports = InstabugModule; \ No newline at end of file diff --git a/ios/Instabug.framework/Headers/IBGBugReporting.h b/ios/Instabug.framework/Headers/IBGBugReporting.h new file mode 100644 index 000000000..42d054fd5 --- /dev/null +++ b/ios/Instabug.framework/Headers/IBGBugReporting.h @@ -0,0 +1,144 @@ +// +// IBGBugReporting.h +// InstabugBugReporting +// +// Created by Yousef Hamza on 5/17/18. +// Copyright © 2018 Moataz. All rights reserved. +// + +#import +#import +#import + +NS_SWIFT_NAME(BugReporting) +@interface IBGBugReporting : NSObject + +/** + @brief Sets a block of code to be executed just before the SDK's UI is presented. + + @discussion This block is executed on the UI thread. Could be used for performing any UI changes before the SDK's UI + is shown. + */ +@property(class, atomic, strong) void(^willInvokeHandler)(void); + +/** + @brief Sets a block of code to be executed right after the SDK's UI is dismissed. + + @discussion This block is executed on the UI thread. Could be used for performing any UI changes after the SDK's UI + is dismissed. + + The block has the following parameters: + + - dismissType: How the SDK was dismissed. + - reportType: Type of report that has been sent. Will be set to IBGReportTypeBug in case the SDK has been dismissed + without selecting a report type, so you might need to check dismissType before reportType. + + @see IBGReportType, IBGDismissType + */ +@property(class, atomic, strong) void(^didDismissHandler)(IBGDismissType dismissType, IBGReportType reportType); + +/** + @brief Sets a block of code to be executed when a prompt option is selected + + @param didSelectPromptOptionHandler A block of code that gets executed when a prompt option is selected. + + The block has the following parameters: + - prompOption: The option selected in prompt. + */ +@property(class, atomic, strong) void(^didSelectPromptOptionHandler)(IBGPromptOption promptOption); + +/** + @brief Sets the events that invoke the feedback form. + + @discussion Default is set by `startWithToken:invocationEvent:`. + + @see IBGInvocationEvent + */ +@property(class, atomic, assign) IBGInvocationEvent invocationEvents; + +/** + @brief Sets the threshold value of the shake gesture for iPhone/iPod Touch + + @discussion Default for iPhone is 2.5. + */ +@property(class, atomic, assign) CGFloat shakingThresholdForiPhone; + +/** + @brief Sets the threshold value of the shake gesture for iPad. + + @discussion Default for iPad is 0.6. + */ +@property(class, atomic, assign) CGFloat shakingThresholdForiPad; + +/** + @brief Sets the default edge at which the floating button will be shown. Different orientations are already handled. + + @discussion Default for `floatingButtonEdge` is `CGRectMaxXEdge`. + */ +@property(class, atomic, assign) CGRectEdge floatingButtonEdge; + +/** + @brief Sets the default offset from the top at which the floating button will be shown. + + @discussion Default for `floatingButtonOffsetFromTop` is 50 + */ +@property(class, atomic, assign) CGFloat floatingButtonTopOffset; + +/** + @brief Sets whether attachments in bug reporting and in-app messaging are enabled. + */ +@property(class, atomic, assign) IBGAttachmentType enabledAttachmentTypes; + +/** + @brief Enables/disables prompt options when SDK is invoked. + + @discussion When only a single option is enabled, it become the default invocation mode. + If all options are disabled, bug reporting becomes the default invocation mode. + + By default, all three options are enabled. + */ +@property(class, atomic, assign) IBGPromptOption promptOptions; + +/** + @brief Sets whether the extended bug report mode should be disabled, enabled with required fields or enabled with optional fields. + + @discussion This feature is disabled by default. When enabled, it adds more fields for your reporters to fill in. You can set whether the extra fields are required or optional. + 1. Expected Results. + 2. Actual Results. + 3. Steps to Reproduce. + + An enum to disable the extended bug report mode, enable it with required or with optional fields. + */ +@property(class, atomic, assign) IBGExtendedBugReportMode extendedBugReportMode; + +/** + @brief Use to specify different options that would affect how Instabug is shown and other aspects about the reporting experience. + + @discussion See IBGInvocationOptions. + */ +@property(class, atomic, assign) IBGBugReportingInvocationOption invocationOptions; + +/** + @brief Invokes the SDK manually with the default invocation mode. + + @discussion Shows a view that asks the user whether they want to start a chat, report a problem or suggest an improvement. + */ ++ (void)invoke; + +/** + @brief Invokes the SDK with a specific mode. + + @discussion Invokes the SDK and show a specific view with specified options, instead of showing a prompt for users to choose from. + + @see IBGInvocationMode + @see IBGBugReportingInvocationOption + */ ++ (void)invokeWithMode:(IBGInvocationMode)invocationMode options:(IBGBugReportingInvocationOption)options; + +/** + @brief Dismisses any Instabug views that are currently being shown. + */ ++ (void)dismiss; + + +@end diff --git a/ios/Instabug.framework/Headers/IBGCrashReporting.h b/ios/Instabug.framework/Headers/IBGCrashReporting.h new file mode 100644 index 000000000..2338024e8 --- /dev/null +++ b/ios/Instabug.framework/Headers/IBGCrashReporting.h @@ -0,0 +1,30 @@ +// +// IBGCrashReporting.h +// InstabugCrashReporting +// +// Created by Yousef Hamza on 5/17/18. +// Copyright © 2018 Moataz. All rights reserved. +// + +#import + +NS_SWIFT_NAME(CrashReporting) +@interface IBGCrashReporting : NSObject + +@property (class, atomic, assign) BOOL enabled; + +/** + @brief Report an exception manually. + + @param exception Exception to be reported. + */ ++ (void)reportException:(NSException *)exception; + +/** + @brief Report an error manually. + + @param error error to be reported. + */ ++ (void)reportError:(NSError *)error; + +@end diff --git a/ios/Instabug.framework/Headers/IBGFeatureRequests.h b/ios/Instabug.framework/Headers/IBGFeatureRequests.h new file mode 100644 index 000000000..6acb4ce2a --- /dev/null +++ b/ios/Instabug.framework/Headers/IBGFeatureRequests.h @@ -0,0 +1,29 @@ +// +// IBGFeatureRequests.h +// Instabug +// +// Created by Yousef Hamza on 5/17/18. +// Copyright © 2018 Moataz. All rights reserved. +// + +#import +#import + +NS_SWIFT_NAME(FeatureRequests) +@interface IBGFeatureRequests : NSObject +/** + @brief Sets whether users are required to enter an email address or not when doing a certain action `IBGAction`. + + @discussion Defaults to YES. + + @param isEmailFieldRequired A boolean to indicate whether email field is required or not. + @param actionType An enum that indicates which action types will have the isEmailFieldRequired. + */ ++ (void)setEmailFieldRequired:(BOOL)isEmailFieldRequired forAction:(IBGAction)actionType; + +/** + @brief Shows the UI for feature requests list + */ ++ (void)show; + +@end diff --git a/ios/Instabug.framework/Headers/IBGLog.h b/ios/Instabug.framework/Headers/IBGLog.h new file mode 100644 index 000000000..62258e1d3 --- /dev/null +++ b/ios/Instabug.framework/Headers/IBGLog.h @@ -0,0 +1,148 @@ +// +// IBGLog.h +// InstabugI +// +// Created by Yousef Hamza on 5/17/18. +// Copyright © 2018 Moataz. All rights reserved. +// + +#import +#import + +@interface IBGLog : NSObject + +@property (class, atomic, assign) BOOL printsToConsole; + +/** + @brief Adds custom logs that will be sent with each report. Logs are added with the debug log level. + + @param log Message to be logged. + */ ++ (void)log:(NSString *)log; + +/** + @brief Adds custom logs with the verbose log level. Logs will be sent with each report. + + @param log Message to be logged. + */ ++ (void)logVerbose:(NSString *)log; + +/** + @brief Adds custom logs with the debug log level. Logs will be sent with each report. + + @param log Message to be logged. + */ ++ (void)logDebug:(NSString *)log; + +/** + @brief Adds custom logs with the info log level. Logs will be sent with each report. + + @param log Message to be logged. + */ ++ (void)logInfo:(NSString *)log; + +/** + @brief Adds custom logs with the warn log level. Logs will be sent with each report. + + @param log Message to be logged. + */ ++ (void)logWarn:(NSString *)log; + +/** + @brief Adds custom logs with the error log level. Logs will be sent with each report. + + @param log Message to be logged. + */ ++ (void)logError:(NSString *)log; + +/** + @brief Clear all Logs. + + @discussion Clear all Instabug logs, console logs, network logs and user steps. + + */ ++ (void)clearAllLogs; + +/** + @brief Adds custom logs that will be sent with each report. + + @discussion Can be used in a similar fashion to NSLog. Logs are added with the debug log level. + For usage in Swift, see `Instabug.ibgLog()`. + + @param format Format string. + @param ... Optional varargs arguments. + */ +OBJC_EXTERN void InstabugLog(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); + +/** + @brief Adds custom logs with the verbose log level. Logs will be sent with each report. + + @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logVerbose()`. + + @param format Format string. + @param ... Optional varargs arguments. + */ +OBJC_EXTERN void IBGLogVerbose(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); + +/** + @brief Adds custom logs with the debug log level. Logs will be sent with each report. + + @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logDebug()`. + + @param format Format string. + @param ... Optional varargs arguments. + */ +OBJC_EXTERN void IBGLogDebug(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); + +/** + @brief Adds custom logs with the info log level. Logs will be sent with each report. + + @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logInfo()`. + + @param format Format string. + @param ... Optional varargs arguments. + */ +OBJC_EXTERN void IBGLogInfo(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); + +/** + @brief Adds custom logs with the warn log level. Logs will be sent with each report. + + @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logWarn()`. + + @param format Format string. + @param ... Optional varargs arguments. + */ +OBJC_EXTERN void IBGLogWarn(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); + +/** + @brief Adds custom logs with the error log level. Logs will be sent with each report. + + @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logError()`. + + @param format Format string. + @param ... Optional varargs arguments. + */ +OBJC_EXTERN void IBGLogError(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2) ; + +/** + @brief Used to reroute all your NSLogs to Instabug to be able to automatically include them with reports. + + @discussion For details on how to reroute your NSLogs to Instabug, see http://docs.instabug.com/docs/logging + + @param format Format string. + @param args Arguments list. + */ +OBJC_EXTERN void IBGNSLog(NSString *format, va_list args); + +/** + @brief Used to reroute all your NSLogs to Instabug with their log level to be able to automatically include them with reports. + + @discussion For details on how to reroute your NSLogs to Instabug, see https://docs.instabug.com/docs/ios-logging + + @param format Format string. + @param args Arguments list. + @param logLevel log level. + */ +OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel logLevel); + +@end diff --git a/ios/Instabug.framework/Headers/IBGSurvey.h b/ios/Instabug.framework/Headers/IBGSurvey.h new file mode 100644 index 000000000..3142a59a5 --- /dev/null +++ b/ios/Instabug.framework/Headers/IBGSurvey.h @@ -0,0 +1,17 @@ +// +// IBGSurvey.h +// InstabugSurveys +// +// Created by Yousef Hamza on 5/25/18. +// Copyright © 2018 Moataz. All rights reserved. +// + +#import + +@interface IBGSurvey : NSObject + +@property (nonatomic, readonly) NSString *title; + +- (void)show; + +@end diff --git a/ios/Instabug.framework/Headers/IBGSurveys.h b/ios/Instabug.framework/Headers/IBGSurveys.h new file mode 100644 index 000000000..5711b3866 --- /dev/null +++ b/ios/Instabug.framework/Headers/IBGSurveys.h @@ -0,0 +1,94 @@ +// +// IBGSurveys.h +// Instabug +// +// Created by Yousef Hamza on 5/17/18. +// Copyright © 2018 Moataz. All rights reserved. +// + +#import +#import "IBGSurvey.h" + +NS_SWIFT_NAME(Surveys) +@interface IBGSurveys : NSObject + +@property (class, atomic, assign) BOOL enabled; +/** + @brief Sets whether auto surveys showing are enabled or not. + + @discussion If you disable surveys auto showing on the SDK but still have active surveys on your Instabug dashboard, those surveys are still going to be sent to the device, but are not going to be shown automatically. + + To manually display any available surveys, call `+ [Instabug showSurveyIfAvailable]`. + + Defaults to YES. + */ +@property (class, atomic, assign) BOOL autoShowingEnabled; + +/** + @brief Returns array of available surveys that match the current device/user. + */ +@property (class, atomic, readonly, strong) NSArray *availableSurveys; + +/** + @brief Sets a block of code to be executed just before the survey's UI is presented. + + @discussion This block is executed on the UI thread. Could be used for performing any UI changes before the survey's UI + is shown. + */ +@property (class, atomic, strong) void(^willShowSurveyHandler)(void); + +/** + @brief Sets a block of code to be executed right after the survey's UI is dismissed. + + @discussion This block is executed on the UI thread. Could be used for performing any UI changes after the survey's UI + is dismissed. + */ +@property (class, atomic, strong) void(^didDismissSurveyHandler)(void); + +/** + @brief Setting an option for all the surveys to show a welcome screen before the user starts taking the survey. + + @discussion By enabling this option, any survey that appears to the user will have a welcome screen with a title, subtitle + and a button that if clicked, will take the user to the survey. All the strings in the welcome screen have a default value + and localized. They can also be modified using the strings API. The default value of this option is false. + */ +@property (class, atomic, assign) BOOL shouldShowWelcomeScreen; + +/** + @brief Shows one of the surveys that were not shown before, that also have conditions that match the current device/user. + + @discussion Does nothing if there are no available surveys. + */ ++ (void)showSurveyIfAvailable; + +/** + @brief Shows Survey with a specific token. + + @discussion Does nothing if there are no available surveys with that specific token. Answered and canceled surveys won't show up again. + + @param surveyToken A String with a survey token. + */ ++ (void)showSurveyWithToken:(NSString *)surveyToken; + + +/** + @brief Sets a threshold for numbers of sessions and another for number of days required before a survey, that has been dismissed once, would show again. + + @discussion When a survey that has been shown to the user gets dismissed once, it will not reappear to the user unless a certain number of sessions have started AND a certain number of days have passed since the user first dismissed the survey. Note that if a survey is dismissed for a second time, it will not show again, in other words, it will be set to `canceled`. This applies to both surveys with and without tokens. + + @param sessionCount : Number of sessions required to be initialized before a dismissed survey can be shown again. + @param daysCount : Number of days required to pass before a dismissed survey can be shown again. + */ ++ (void)setThresholdForReshowingSurveyAfterDismiss:(NSInteger)sessionCount daysCount:(NSInteger)daysCount; + +/** + @brief Returns true if the survey with a specific token was answered before . + + @discussion Will return false if the token does not exist or if the survey was not answered before. + + @param surveyToken A String with a survey token. + */ ++ (BOOL)hasRespondedToSurveyWithToken:(NSString *)surveyToken; + + +@end diff --git a/ios/Instabug.framework/Headers/Instabug.h b/ios/Instabug.framework/Headers/Instabug.h index ed42bd491..719fd1952 100644 --- a/ios/Instabug.framework/Headers/Instabug.h +++ b/ios/Instabug.framework/Headers/Instabug.h @@ -5,12 +5,19 @@ Copyright: (c) 2013-2018 by Instabug, Inc., all rights reserved. - Version: 7.14.5 + Version: 8.0.2 */ #import #import #import +#import +#import +#import "IBGLog.h" +#import "IBGBugReporting.h" +#import "IBGCrashReporting.h" +#import "IBGSurveys.h" +#import "IBGFeatureRequests.h" /** This is the API for using Instabug's SDK. For more details about the SDK integration, @@ -23,6 +30,134 @@ NS_ASSUME_NONNULL_BEGIN typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *response); + +/** + @brief Sets whether the SDK is recording the screen or not. + + @discussion Enabling auto screen recording would give you an insight on the scenario a user has performed before encountering a bug or a crash. screen recording is attached with each report being sent. + + Auto screen recording is disabled by default. + */ +@property (class, atomic, assign) BOOL autoScreenRecordingEnabled; + +/** + @brief Sets whether the session profiler is enabled or disabled. + + @discussion The session profiler is enabled by default and it attaches to the bug and crash reports the following information during the last 60 seconds before the report is sent. + 1. CPU load. + 2. Dispatch queues latency. + 3. Memory usage. + 4. Storage usage. + 5. Connectivity. + 6. Battery percentage and state. + 7. Orientation. + */ +@property (class, atomic, assign) BOOL sessionProfilerEnabled; + +/** + @brief Sets maximum auto screen recording video duration. + + @discussion sets maximum auto screen recording video duration with max value 30 seconds and min value greater than 1 sec. + */ +@property (class, atomic, assign) CGFloat autoScreenRecordingDuration; + +/** + @brief Enables/disables inspect view hierarchy when reporting a bug/feedback. + */ +@property (class, atomic, assign) BOOL shouldCaptureViewHierarchy; + +/** + @brief Sets the primary color of the SDK's UI. + + @discussion Sets the color of UI elements indicating interactivity or call to action. + */ +@property (class, atomic, strong) UIColor *tintColor; + +/** + @brief Sets a block of code that gets executed when a new message is received. + */ +@property (class, atomic, strong) void (^didRecieveReplyHandler)(void); + +/** + @brief Sets a block of code to be executed before sending each report. + + @discussion This block is executed in the background before sending each report. Could be used for attaching logs + and extra data to reports. + + @param willSendReportHandler A block of code that gets executed before sending each bug report. + */ +@property(class, atomic, strong) IBGReport*(^willSendReportHandler)(IBGReport *report); + +/** + @brief Enables/disables showing in-app notifications when the user receives a new message. + */ +@property (class, atomic, assign) BOOL replyNotificationsEnabled; + +/** + @brief Returns the number of unread messages the user currently has. + + @discussion Use this method to get the number of unread messages the user has, then possibly notify them about it with + your own UI. + + @return Notifications count, or -1 incase the SDK has not been initialized. + */ +@property (class, atomic, assign, readonly) NSInteger unreadMessagesCount; + + +/** + @brief Sets whether the SDK is tracking user steps or not. + + @discussion Enabling user steps would give you an insight on the scenario a user has performed before encountering a + bug or a crash. User steps are attached with each report being sent. + + User Steps tracking is enabled by default if it's available in your current plan. + */ +@property (class, atomic, assign) BOOL trackUserSteps; + +/** + @brief Sets whether user steps tracking is visual, non visula or disabled. + + @discussion Enabling user steps would give you an insight on the scenario a user has performed before encountering a + bug or a crash. User steps are attached with each report being sent. + + User Steps tracking is enabled by default if it's available in your current plan. + */ +@property (class, atomic, assign) IBGUserStepsMode reproStepsMode; + + +/** + @brief Sets the welcome message mode to live, beta or disabled. + + @discussion By default, the welcome message live mode is enabled. It appears automatically after 10 seconds from the user's first session. You can change it to the beta mode or disable it. + The live mode consists of one step to inform the users how to report a bug or feedback. The beta mode consists of three steps to welcome your testers on board, inform them how to report a bug or feedback and to motivate them to always be on the latest app version. Please note, the into message appears only if the invocation event isn't set to none. + */ +@property (class, atomic, assign) IBGWelcomeMessageMode welcomeMessageMode; + +/** + @brief Attaches user data to each report being sent. + + @discussion Each call to this method overrides the user data to be attached. + Maximum size of the string is 1,000 characters. + */ +@property (class, atomic, strong) NSString *userData; + ++ (void)startWithToken:(NSString *)token invocationEvents:(IBGInvocationEvent)invocationEvents; + +#pragma mark - SDK Debugging + +/// ------------------------ +/// @name SDK Debugging +/// ------------------------ + +/** + @brief Sets the verbosity level of logs used to debug the Instabug SDK itself. + + @discussion This API sets the verbosity level of logs used to debug The SDK. The defualt value in debug mode is IBGSDKDebugLogsLevelVerbose and in production is IBGSDKDebugLogsLevelError. + */ +@property (class, atomic, assign) IBGSDKDebugLogsLevel SDKDebugLogsLevel; + +#pragma mark - Old APIs + /// ------------------------ /// @name SDK Initialization /// ------------------------ @@ -38,7 +173,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGInvocationEvent */ -+ (void)startWithToken:(NSString *)token invocationEvent:(IBGInvocationEvent)invocationEvent; ++ (void)startWithToken:(NSString *)token invocationEvent:(IBGInvocationEvent)invocationEvent DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// --------------------------- /// @name SDK Manual Invocation @@ -50,7 +185,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @discussion Shows a view that asks the user whether they want to start a chat, report a problem or suggest an improvement. */ -+ (void)invoke; ++ (void)invoke DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Invokes the SDK with a specific mode. @@ -61,12 +196,12 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGInvocationMode */ -+ (void)invokeWithInvocationMode:(IBGInvocationMode)invocationMode; ++ (void)invokeWithInvocationMode:(IBGInvocationMode)invocationMode DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Dismisses any Instabug views that are currently being shown. */ -+ (void)dismiss; ++ (void)dismiss DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ---------------------- /// @name SDK Pro Features @@ -86,7 +221,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param fileLocation Path to a file that's going to be attached to each report. */ -+ (void)setFileAttachment:(NSString *)fileLocation DEPRECATED_MSG_ATTRIBUTE("Use addFileAttachmentWithURL: instead."); ++ (void)setFileAttachment:(NSString *)fileLocation DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Attaches a file to each report being sent. @@ -102,7 +237,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param fileURL Path to a file that's going to be attached to each report. */ -+ (void)setFileAttachmentWithURL:(NSURL *)fileURL DEPRECATED_MSG_ATTRIBUTE("Use addFileAttachmentWithURL: instead."); ++ (void)setFileAttachmentWithURL:(NSURL *)fileURL DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @@ -139,16 +274,6 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r */ + (void)clearFileAttachments; -/** - @brief Attaches user data to each report being sent. - - @discussion Each call to this method overrides the user data to be attached. - Maximum size of the string is 1,000 characters. - - @param userData A string to be attached to each report, with a maximum size of 1,000 characters. - */ -+ (void)setUserData:(NSString *)userData; - /** @brief Sets whether the SDK is tracking user steps or not. @@ -159,54 +284,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isUserStepsEnabled A boolean to set user steps tracking to being enabled or disabled. */ -+ (void)setUserStepsEnabled:(BOOL)isUserStepsEnabled; - -/** - @brief Sets whether the session profiler is enabled or disabled. - - @discussion The session profiler is enabled by default and it attaches to the bug and crash reports the following information during the last 60 seconds before the report is sent. - 1. CPU load. - 2. Dispatch queues latency. - 3. Memory usage. - 4. Storage usage. - 5. Connectivity. - 6. Battery percentage and state. - 7. Orientation. - - @param sessionProfilerEnabled A boolean parameter to enable or disable the feature. - */ -+ (void)setSessionProfilerEnabled:(BOOL)sessionProfilerEnabled; - -/** - @brief Sets whether the SDK is recording the screen or not. - - @discussion Enabling auto screen recording would give you an insight on the scenario a user has performed before encountering a bug or a crash. screen recording is attached with each report being sent. - - Auto screen recording is disabled by default. - - @param enabled A boolean to set auto screen recording to being enabled or disabled. - */ -+ (void)setAutoScreenRecordingEnabled:(BOOL)enabled; - -/** - @brief Sets maximum auto screen recording video duration. - - @discussion sets maximum auto screen recording video duration with max value 30 seconds and min value greater than 1 sec. - - @param duration A float to set maximum auto screen recording video duration. - */ -+ (void)setAutoScreenRecordingDuration:(CGFloat)duration; -/** - @brief Sets whether user steps tracking is visual, non visula or disabled. - - @discussion Enabling user steps would give you an insight on the scenario a user has performed before encountering a - bug or a crash. User steps are attached with each report being sent. - - User Steps tracking is enabled by default if it's available in your current plan. - - @param userStepsMode An enum to set user steps tracking to be enabled , non visual or disabled. - */ -+ (void)setReproStepsMode:(IBGUserStepsMode)userStepsMode; ++ (void)setUserStepsEnabled:(BOOL)isUserStepsEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether to track and report crashes or not. @@ -217,7 +295,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isReportingCrashes A boolean to set crash reporting to being enabled or disabled. */ -+ (void)setCrashReportingEnabled:(BOOL)isReportingCrashes; ++ (void)setCrashReportingEnabled:(BOOL)isReportingCrashes DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether In-App Conversations button and notifications are displayed or not. @@ -230,7 +308,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isInAppConversationsEnabled A boolean to set In-App Conversations to being enabled or disabled. */ -+ (void)setInAppConversationsEnabled:(BOOL)isInAppConversationsEnabled DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setPromptOptionsEnabled: instead."); ++ (void)setInAppConversationsEnabled:(BOOL)isInAppConversationsEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed before sending each report. @@ -242,7 +320,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param preSendingBlock A block of code that gets executed before sending each bug report. */ -+ (void)setPreSendingBlock:(void (^)(void))preSendingBlock DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setPreSendingHandler: instead."); ++ (void)setPreSendingBlock:(void (^)(void))preSendingBlock DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed before sending each report. @@ -252,7 +330,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param preSendingHandler A block of code that gets executed before sending each bug report. */ -+ (void)setPreSendingHandler:(void (^)(void))preSendingHandler; ++ (void)setPreSendingHandler:(void (^)(void))preSendingHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed just before the SDK's UI is presented. @@ -264,7 +342,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param preInvocationBlock A block of code that gets executed before presenting the SDK's UI. */ -+ (void)setPreInvocationBlock:(void (^)(void))preInvocationBlock DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setPreInvocationHandler: instead."); ++ (void)setPreInvocationBlock:(void (^)(void))preInvocationBlock DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed just before the SDK's UI is presented. @@ -274,7 +352,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param preInvocationHandler A block of code that gets executed before presenting the SDK's UI. */ -+ (void)setPreInvocationHandler:(void (^)(void))preInvocationHandler; ++ (void)setPreInvocationHandler:(void (^)(void))preInvocationHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed right after the SDK's UI is dismissed. @@ -295,7 +373,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGIssueState, IBGFeedbackType */ -+ (void)setPostInvocationBlock:(void (^)(IBGIssueState issueState, IBGFeedbackType feedbackType))postInvocationBlock DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setPostInvocationHandler: instead."); ++ (void)setPostInvocationBlock:(void (^)(IBGIssueState issueState, IBGFeedbackType feedbackType))postInvocationBlock DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed right after the SDK's UI is dismissed. @@ -313,7 +391,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGReportType, IBGDismissType */ -+ (void)setPostInvocationHandler:(void (^)(IBGDismissType dismissType, IBGReportType reportType))postInvocationHandler; ++ (void)setPostInvocationHandler:(void (^)(IBGDismissType dismissType, IBGReportType reportType))postInvocationHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed when a prompt option is selected @@ -323,15 +401,14 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r The block has the following parameters: - prompOption: The option selected in prompt. */ -+ (void)setDidSelectPromptOptionHandler:(void (^)(IBGPromptOption promptOption))didSelectPromptOptionHandler; ++ (void)setDidSelectPromptOptionHandler:(void (^)(IBGPromptOption promptOption))didSelectPromptOptionHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Present a view that educates the user on how to invoke the SDK with the currently set invocation event. @discussion Does nothing if invocation event is set to anything other than IBGInvocationEventShake or IBGInvocationEventScreenshot. */ -+ (void)showIntroMessage DEPRECATED_MSG_ATTRIBUTE("Use showWelcomeMessageWithMode: instead."); - ++ (void)showIntroMessage DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Shows the welcome message in a specific mode. @@ -342,16 +419,6 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r */ + (void)showWelcomeMessageWithMode:(IBGWelcomeMessageMode)welcomeMessageMode; -/** - @brief Sets the welcome message mode to live, beta or disabled. - - @discussion By default, the welcome message live mode is enabled. It appears automatically after 10 seconds from the user's first session. You can change it to the beta mode or disable it. - The live mode consists of one step to inform the users how to report a bug or feedback. The beta mode consists of three steps to welcome your testers on board, inform them how to report a bug or feedback and to motivate them to always be on the latest app version. Please note, the into message appears only if the invocation event isn't set to none. - - @param welcomeMessageMode An enum to set the welcome message mode to live, beta or disabled. - */ -+ (void)setWelcomeMessageMode:(IBGWelcomeMessageMode)welcomeMessageMode; - /** @brief Enables/disables the attachment of an initial screenshot when reporting a bug/improvement. @@ -360,7 +427,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param willTakeScreenshot A boolean to set whether attachment of an initial screenshot is enabled or disabled. */ -+ (void)setWillTakeScreenshot:(BOOL)willTakeScreenshot DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setAttachmentTypesEnabledScreenShot:extraScreenShot:galleryImage:voiceNote:screenRecording: instead."); ++ (void)setWillTakeScreenshot:(BOOL)willTakeScreenshot DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the user email and name for all sent reports. @@ -384,7 +451,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param userEmail An email address to be set as the user's email. */ -+ (void)setUserEmail:(NSString *)userEmail DEPRECATED_MSG_ATTRIBUTE("Use identifyUserWithEmail:Name: instead."); ++ (void)setUserEmail:(NSString *)userEmail DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the default value of the user's name to be included with all reports. @@ -393,7 +460,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param userName Name of the user to be set. */ -+ (void)setUserName:(NSString *)userName DEPRECATED_MSG_ATTRIBUTE("Use identifyUserWithEmail:Name: instead."); ++ (void)setUserName:(NSString *)userName DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Shows/Hides email field. @@ -402,7 +469,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isShowingEmailField YES to show the email field, NO to hide it. */ -+ (void)setShowEmailField:(BOOL)isShowingEmailField; ++ (void)setShowEmailField:(BOOL)isShowingEmailField DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Enables/disables screenshot view when reporting a bug/improvement. @@ -414,7 +481,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param willShowScreenshotView A boolean to set whether screenshot view is shown or not. Passing YES will show screenshot view for both feedback and bug reporting, while passing NO will disable it for both. */ -+ (void)setWillShowScreenshotView:(BOOL)willShowScreenshotView DEPRECATED_MSG_ATTRIBUTE("This API has no effect now and will be removed soon"); ++ (void)setWillShowScreenshotView:(BOOL)willShowScreenshotView DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Enables/disables screenshot view when reporting a bug/improvement. @@ -424,7 +491,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param willSkipScreenShot A boolean to set whether screenshot view is shown or not. Passing YES will show screenshot view for both feedback and bug reporting, while passing NO will disable it for both. */ -+ (void)setWillSkipScreenshotAnnotation:(BOOL)willSkipScreenShot DEPRECATED_MSG_ATTRIBUTE("This API has no effect now and will be removed soon"); ++ (void)setWillSkipScreenshotAnnotation:(BOOL)willSkipScreenShot DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Returns the number of unread messages the user currently has. @@ -434,7 +501,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @return Notifications count, or -1 incase the SDK has not been initialized. */ -+ (NSInteger)getUnreadMessagesCount; ++ (NSInteger)getUnreadMessagesCount DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ------------------ /// @name SDK Settings @@ -449,7 +516,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGInvocationEvent */ -+ (void)setInvocationEvent:(IBGInvocationEvent)invocationEvent; ++ (void)setInvocationEvent:(IBGInvocationEvent)invocationEvent DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the default SDK invocation mode. @@ -462,7 +529,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGInvocationMode */ -+ (void)setDefaultInvocationMode:(IBGInvocationMode)invocationMode DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setPromptOptionsEnabledWithBug:feedback:chat: instead"); ++ (void)setDefaultInvocationMode:(IBGInvocationMode)invocationMode DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Enables/disables the use of push notifications in the SDK. @@ -488,7 +555,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isEmailFieldRequired A boolean to indicate whether email field is required or not. */ -+ (void)setEmailFieldRequired:(BOOL)isEmailFieldRequired DEPRECATED_MSG_ATTRIBUTE("Use setEmailFieldRequired:forAction: instead"); ++ (void)setEmailFieldRequired:(BOOL)isEmailFieldRequired DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether users are required to enter a comment or not when sending reports. @@ -497,7 +564,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isCommentFieldRequired A boolean to indicate whether comment field is required or not. */ -+ (void)setCommentFieldRequired:(BOOL)isCommentFieldRequired; ++ (void)setCommentFieldRequired:(BOOL)isCommentFieldRequired DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the threshold value of the shake gesture for iPhone/iPod Touch and iPad. @@ -508,7 +575,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param iPhoneShakingThreshold Threshold for iPhone. @param iPadShakingThreshold Threshold for iPad. */ -+ (void)setShakingThresholdForiPhone:(double)iPhoneShakingThreshold foriPad:(double)iPadShakingThreshold; ++ (void)setShakingThresholdForiPhone:(double)iPhoneShakingThreshold foriPad:(double)iPadShakingThreshold DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the default edge and offset from the top at which the floating button will be shown. Different orientations @@ -520,7 +587,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param floatingButtonEdge `CGRectMaxXEdge` to show on the right, or `CGRectMinXEdge` to show on the left. @param floatingButtonOffsetFromTop Top offset for floating button. */ -+ (void)setFloatingButtonEdge:(CGRectEdge)floatingButtonEdge withTopOffset:(double)floatingButtonOffsetFromTop; ++ (void)setFloatingButtonEdge:(CGRectEdge)floatingButtonEdge withTopOffset:(double)floatingButtonOffsetFromTop DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the default position at which the Instabug screen recording button will be shown. Different orientations are already handled. @@ -529,7 +596,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param position `topLeft` to show on the top left of screen , or `bottomRight` to show on the bottom right of scrren. */ -+ (void)setVideoRecordingFloatingButtonPosition:(IBGPosition)position; ++ (void)setVideoRecordingFloatingButtonPosition:(IBGPosition)position DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the SDK's locale. @@ -550,7 +617,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isIntroMessageEnabled A boolean to indicate whether the intro message is enabled or not. */ -+ (void)setIntroMessageEnabled:(BOOL)isIntroMessageEnabled DEPRECATED_MSG_ATTRIBUTE("Use setWelcomeMessageMode: instead."); ++ (void)setIntroMessageEnabled:(BOOL)isIntroMessageEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether to show a "Thank You" dialog after a bug report is sent or not. @@ -559,7 +626,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param isPostSendingDialogEnabled A boolean to indicate whether the dialog is enabled or not. */ -+ (void)setPostSendingDialogEnabled:(BOOL)isPostSendingDialogEnabled; ++ (void)setPostSendingDialogEnabled:(BOOL)isPostSendingDialogEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets the color theme of the SDK's whole UI. @@ -577,7 +644,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param color A color to set the UI elements of the SDK to. */ -+ (void)setPrimaryColor:(UIColor *)color; ++ (void)setPrimaryColor:(UIColor *)color DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code that is used to capture a screenshot. @@ -588,7 +655,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param screenshotCapturingBlock A block of code that's going to be used to capture screenshots. */ -+ (void)setScreenshotCapturingBlock:(UIImage *(^)(void))screenshotCapturingBlock DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use setScreenshotCapturingHandler: instead."); ++ (void)setScreenshotCapturingBlock:(UIImage *(^)(void))screenshotCapturingBlock DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code that is used to capture a screenshot. @@ -607,7 +674,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param tag A set of tags. @param ... ... */ -+ (void)addTags:(NSString *)tag, ... NS_REQUIRES_NIL_TERMINATION DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use appendTags: instead."); ++ (void)addTags:(NSString *)tag, ... NS_REQUIRES_NIL_TERMINATION DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Appends a set of tags to previously added tags of reported feedback, bug or crash. @@ -628,7 +695,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param tag tag @param arguments arguments */ -+ (void)addTags:(NSString *)tag withArguments:(va_list)arguments DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use appendTags: instead."); ++ (void)addTags:(NSString *)tag withArguments:(va_list)arguments DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Appends a set of tags to previously added tags of reported feedback, bug or crash. @@ -661,7 +728,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @see IBGString */ -+ (void)setString:(NSString*)value toKey:(IBGString)key DEPRECATED_MSG_ATTRIBUTE("Use setValue:forStringWithKey: instead."); ++ (void)setString:(NSString*)value toKey:(IBGString)key DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Overrides any of the strings shown in the SDK with custom ones. @@ -689,27 +756,27 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r extraScreenShot:(BOOL)extraScreenShot galleryImage:(BOOL)galleryImage voiceNote:(BOOL)voiceNote - screenRecording:(BOOL)screenRecording DEPRECATED_MSG_ATTRIBUTE("Starting from v7.6.1, use setEnabledAttachmentTypes: instead"); + screenRecording:(BOOL)screenRecording DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether attachments in bug reporting and in-app messaging are enabled. @param attachmentTypes A NS_OPTIONS to add enabled attachments type. */ -+ (void)setEnabledAttachmentTypes:(IBGAttachmentType)attachmentTypes; ++ (void)setEnabledAttachmentTypes:(IBGAttachmentType)attachmentTypes DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Enables/disables showing in-app notifications when the user receives a new message. @param chatNotificationEnabled A boolean to set whether notifications are enabled or disabled. */ -+ (void)setChatNotificationEnabled:(BOOL)chatNotificationEnabled; ++ (void)setChatNotificationEnabled:(BOOL)chatNotificationEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code that gets executed when a new message is received. @param onNewMessageHandler A block of code that gets executed when a new message is received. */ -+ (void)setOnNewMessageHandler:(void (^)(void))onNewMessageHandler; ++ (void)setOnNewMessageHandler:(void (^)(void))onNewMessageHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Enables/disables prompt options when SDK is invoked. @@ -723,7 +790,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param feedbackEnabled A boolean to indicate whether feedback is enabled or disabled. @param chatEnabled A boolean to indicate whether chat is enabled or disabled. */ -+ (void)setPromptOptionsEnabledWithBug:(BOOL)bugReportEnabled feedback:(BOOL)feedbackEnabled chat:(BOOL)chatEnabled; ++ (void)setPromptOptionsEnabledWithBug:(BOOL)bugReportEnabled feedback:(BOOL)feedbackEnabled chat:(BOOL)chatEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets an array of report categories to be shown for users to select from before reporting a bug or sending @@ -736,7 +803,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param names Array of names of icons to be shown along with titles. Use the same names you would use with `+ [UIImage imageNamed:]`. */ -+ (void)setReportCategoriesWithTitles:(NSArray *)titles iconNames:(nullable NSArray *)names DEPRECATED_MSG_ATTRIBUTE("Starting from v7.9, you can add categories from dashboard."); ++ (void)setReportCategoriesWithTitles:(NSArray *)titles iconNames:(nullable NSArray *)names DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets an array of report categories to be shown for users to select from before reporting a bug or sending @@ -747,14 +814,14 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param title extra field key. @param required determine whether this field is required or not. */ -+ (void)addExtraReportFieldWithTitle:(NSString *)title required:(BOOL)required DEPRECATED_MSG_ATTRIBUTE("Starting from v7.9, use setExtendedBugReportMode: instead");; ++ (void)addExtraReportFieldWithTitle:(NSString *)title required:(BOOL)required DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Remove all extra fields. @discussion Use this method to remove all added extra fields. */ -+ (void)removeExtraReportFields DEPRECATED_MSG_ATTRIBUTE("Starting from v7.9, use setExtendedBugReportMode: instead");; ++ (void)removeExtraReportFields DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether the extended bug report mode should be disabled, enabled with required fields or enabled with optional fields. @@ -766,7 +833,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param extendedBugReportMode An enum to disable the extended bug report mode, enable it with required or with optional fields. */ -+ (void)setExtendedBugReportMode:(IBGExtendedBugReportMode)extendedBugReportMode; ++ (void)setExtendedBugReportMode:(IBGExtendedBugReportMode)extendedBugReportMode DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Set custom user attributes that are going to be sent with each feedback, bug or crash. @@ -806,17 +873,17 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param viewHierarchyEnabled A boolean to set whether view hierarchy are enabled or disabled. */ -+ (void)setViewHierarchyEnabled:(BOOL)viewHierarchyEnabled; ++ (void)setViewHierarchyEnabled:(BOOL)viewHierarchyEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** - @brief Sets whether users are required to enter an email address or not when doing a certain action `IBGActionType`. + @brief Sets whether users are required to enter an email address or not when doing a certain action `IBGAction`. @discussion Defaults to YES. @param isEmailFieldRequired A boolean to indicate whether email field is required or not. @param actionType An enum that indicates which action types will have the isEmailFieldRequired. */ -+ (void)setEmailFieldRequired:(BOOL)isEmailFieldRequired forAction:(IBGActionType)actionType; ++ (void)setEmailFieldRequired:(BOOL)isEmailFieldRequired forAction:(IBGAction)actionType DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ------------------- /// @name SDK Reporting @@ -827,14 +894,14 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param exception Exception to be reported. */ -+ (void)reportException:(NSException *)exception; ++ (void)reportException:(NSException *)exception DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Report an error manually. @param error error to be reported. */ -+ (void)reportError:(NSError *)error; ++ (void)reportError:(NSError *)error DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// -------------------------- /// @name In-App Conversations @@ -845,7 +912,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @deprecated Starting from v6.0, use `invokeWithInvocationMode:` instead. */ -+ (void)invokeConversations DEPRECATED_MSG_ATTRIBUTE("Starting from v6.0, use invokeWithInvocationMode: instead."); ++ (void)invokeConversations DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ------------------------ /// @name Push Notifications @@ -862,7 +929,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @return YES if notification is from Instabug. */ -+ (BOOL)isInstabugNotification:(NSDictionary *)notification; ++ (BOOL)isInstabugNotification:(NSDictionary *)notification DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Use this method to set Apple Push Notification token to enable receiving Instabug push notifications. @@ -886,7 +953,7 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r `[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]` from `-[UIApplicationDelegate application:didFinishLaunchingWithOptions:]`. */ -+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfo; ++ (BOOL)didReceiveRemoteNotification:(NSDictionary *)userInfo; /** @brief Logs a user event that happens through the lifecycle of the application. @@ -905,135 +972,53 @@ typedef void (^NetworkObfuscationCompletionBlock)(NSData *data, NSURLResponse *r @param name Event name. @param params An optional dictionary or parameters to be associated with the event. Make sure it's JSON serializable. */ -+ (void)logUserEventWithName:(NSString *)name params:(nullable NSDictionary *)params; ++ (void)logUserEventWithName:(NSString *)name params:(nullable NSDictionary *)params DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ------------------------ /// @name IBGLog /// ------------------------ -/** - @brief Adds custom logs that will be sent with each report. - - @discussion Can be used in a similar fashion to NSLog. Logs are added with the debug log level. - For usage in Swift, see `Instabug.ibgLog()`. - - @param format Format string. - @param ... Optional varargs arguments. - */ -OBJC_EXTERN void IBGLog(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); - -/** - @brief Adds custom logs with the verbose log level. Logs will be sent with each report. - - @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logVerbose()`. - - @param format Format string. - @param ... Optional varargs arguments. - */ -OBJC_EXTERN void IBGLogVerbose(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); - -/** - @brief Adds custom logs with the debug log level. Logs will be sent with each report. - - @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logDebug()`. - - @param format Format string. - @param ... Optional varargs arguments. - */ -OBJC_EXTERN void IBGLogDebug(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); - -/** - @brief Adds custom logs with the info log level. Logs will be sent with each report. - - @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logInfo()`. - - @param format Format string. - @param ... Optional varargs arguments. - */ -OBJC_EXTERN void IBGLogInfo(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); - -/** - @brief Adds custom logs with the warn log level. Logs will be sent with each report. - - @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logWarn()`. - - @param format Format string. - @param ... Optional varargs arguments. - */ -OBJC_EXTERN void IBGLogWarn(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); - -/** - @brief Adds custom logs with the error log level. Logs will be sent with each report. - - @discussion Can be used in a similar fashion to NSLog. For usage in Swift, see `Instabug.logError()`. - - @param format Format string. - @param ... Optional varargs arguments. - */ -OBJC_EXTERN void IBGLogError(NSString *format, ...) NS_FORMAT_FUNCTION(1, 2); - -/** - @brief Used to reroute all your NSLogs to Instabug to be able to automatically include them with reports. - - @discussion For details on how to reroute your NSLogs to Instabug, see http://docs.instabug.com/docs/logging - - @param format Format string. - @param args Arguments list. - */ -OBJC_EXTERN void IBGNSLog(NSString *format, va_list args) DEPRECATED_MSG_ATTRIBUTE("Use IBGNSLogWithLevel instead"); - -/** - @brief Used to reroute all your NSLogs to Instabug with their log level to be able to automatically include them with reports. - - @discussion For details on how to reroute your NSLogs to Instabug, see https://docs.instabug.com/docs/ios-logging - - @param format Format string. - @param args Arguments list. - @param logLevel log level. - */ -OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel logLevel); - /** @brief Adds custom logs that will be sent with each report. Logs are added with the debug log level. @param log Message to be logged. */ -+ (void)IBGLog:(NSString *)log; ++ (void)IBGLog:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Adds custom logs with the verbose log level. Logs will be sent with each report. @param log Message to be logged. */ -+ (void)logVerbose:(NSString *)log; ++ (void)logVerbose:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Adds custom logs with the debug log level. Logs will be sent with each report. @param log Message to be logged. */ -+ (void)logDebug:(NSString *)log; ++ (void)logDebug:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Adds custom logs with the info log level. Logs will be sent with each report. @param log Message to be logged. */ -+ (void)logInfo:(NSString *)log; ++ (void)logInfo:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Adds custom logs with the warn log level. Logs will be sent with each report. @param log Message to be logged. */ -+ (void)logWarn:(NSString *)log; ++ (void)logWarn:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Adds custom logs with the error log level. Logs will be sent with each report. @param log Message to be logged. */ -+ (void)logError:(NSString *)log; ++ (void)logError:(NSString *)log DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether IBGLog should also print to Xcode's console log or not. @@ -1042,7 +1027,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param enabled A boolean to set whether printing to Xcode's console is enabled or not. */ -+ (void)setIBGLogPrintsToConsole:(BOOL)enabled; ++ (void)setIBGLogPrintsToConsole:(BOOL)enabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Clear all Logs. @@ -1050,7 +1035,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @discussion Clear all Instabug logs, console logs, network logs and user steps. */ -+ (void)clearAllLogs; ++ (void)clearAllLogs DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ------------------------ /// @name Network Logging @@ -1066,7 +1051,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param isNetworkLoggingEnabled A boolean to set network logging to be enabled to disabled. */ -+ (void)setNetworkLoggingEnabled:(BOOL)isNetworkLoggingEnabled; ++ (void)setNetworkLoggingEnabled:(BOOL)isNetworkLoggingEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Specify an NSPredicate to be used to omit certain requests from being logged. @@ -1078,7 +1063,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param filterPredicate An NSPredicate to match against an NSURLRequest. Matching requests will be omitted. */ -+ (void)setNetworkLoggingFilterPredicate:(NSPredicate *)filterPredicate DEPRECATED_MSG_ATTRIBUTE("Use setNetworkLoggingRequestFilterPredicate:responseFilterPredicate: instead."); ++ (void)setNetworkLoggingFilterPredicate:(NSPredicate *)filterPredicate DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Specify NSPredicates to be used to omit certain network requests from being logged based on their request or @@ -1096,7 +1081,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param requestFilterPredicate An NSPredicate to match against an NSURLRequest. Matching requests will be omitted. @param responseFilterPredicate An NSPredicate to match against an NSHTTPURLResponse. Matching responses will be omitted. */ -+ (void)setNetworkLoggingRequestFilterPredicate:(nullable NSPredicate *)requestFilterPredicate responseFilterPredicate:(nullable NSPredicate *)responseFilterPredicate; ++ (void)setNetworkLoggingRequestFilterPredicate:(nullable NSPredicate *)requestFilterPredicate responseFilterPredicate:(nullable NSPredicate *)responseFilterPredicate DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Enable logging for network requests and responses on a custom NSURLSessionConfiguration. @@ -1106,7 +1091,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param URLSessionConfiguration The NSURLSessionConfiguration of your custom NSURLSession. */ -+ (void)enableLoggingForURLSessionConfiguration:(NSURLSessionConfiguration *)URLSessionConfiguration; ++ (void)enableLoggingForURLSessionConfiguration:(NSURLSessionConfiguration *)URLSessionConfiguration DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Set HTTP body of a POST request to be included in network logs. @@ -1119,7 +1104,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param body Body data of a POST request. @param request The POST request that is being sent. */ -+ (void)logHTTPBody:(NSData *)body forRequest:(NSMutableURLRequest *)request DEPRECATED_MSG_ATTRIBUTE("Request body is now captured automatically"); ++ (void)logHTTPBody:(NSData *)body forRequest:(NSMutableURLRequest *)request DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Use to obfuscate a URL that's going to be included in network logs. @@ -1132,7 +1117,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param obfuscationHandler A block that obfuscates the passed URL and returns it. */ -+ (void)setNetworkLoggingURLObfuscationHandler:(nonnull NSURL * (^)(NSURL * _Nonnull url))obfuscationHandler DEPRECATED_MSG_ATTRIBUTE("Use setNetworkLogRequestObfuscationHandler: instead"); ++ (void)setNetworkLoggingURLObfuscationHandler:(nonnull NSURL * (^)(NSURL * _Nonnull url))obfuscationHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Use to obfuscate a request that's going to be included in network logs. @@ -1149,7 +1134,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param obfuscationHandler A block that takes a request and returns a new modified one to be logged.. */ -+ (void)setNetworkLogRequestObfuscationHandler:(nonnull NSURLRequest * (^)(NSURLRequest * _Nonnull request))obfuscationHandler; ++ (void)setNetworkLogRequestObfuscationHandler:(nonnull NSURLRequest * (^)(NSURLRequest * _Nonnull request))obfuscationHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Use to obfuscate a request's response that's going to be included in network logs. @@ -1164,7 +1149,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param obfuscationHandler A block that takes the original response, its data and a return block as parameters. The return block should be called with the modified data and response. */ -+ (void)setNetworkLogResponseObfuscationHandler:(void (^)(NSData * _Nullable responseData, NSURLResponse * _Nonnull response, NetworkObfuscationCompletionBlock returnBlock))obfuscationHandler; ++ (void)setNetworkLogResponseObfuscationHandler:(void (^)(NSData * _Nullable responseData, NSURLResponse * _Nonnull response, NetworkObfuscationCompletionBlock returnBlock))obfuscationHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Use to get callbacks about progress of sending body content of a particular request when networking logging is @@ -1177,7 +1162,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l */ + (void)setProgressHandlerForRequestURL:(nonnull NSURL *)URL - progressHandler:(nonnull void (^)(NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))requestProgressHandler; + progressHandler:(nonnull void (^)(NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))requestProgressHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Used to ask whether your app is prepared to handle a particular authentication challenge. Can be called on any thread. @@ -1187,7 +1172,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param protectionSpaceHandler A block that takes the protection space for the authentication challenge and should return true or false. */ -+ (void)setCanAuthenticateAgainstProtectionSpaceHandler:(BOOL(^)(NSURLProtectionSpace *protectionSpace))protectionSpaceHandler; ++ (void)setCanAuthenticateAgainstProtectionSpaceHandler:(BOOL(^)(NSURLProtectionSpace *protectionSpace))protectionSpaceHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Used to process an authentication challenge and return an NSURLCredential object. @@ -1196,7 +1181,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param reciveChallengeHandler A block that takes the authentication challenge and returns NSURLCredential. */ -+ (void)setDidReceiveAuthenticationChallengeHandler:(NSURLCredential* (^)(NSURLAuthenticationChallenge *challenge))reciveChallengeHandler; ++ (void)setDidReceiveAuthenticationChallengeHandler:(NSURLCredential* (^)(NSURLAuthenticationChallenge *challenge))reciveChallengeHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /// ------------------------ /// @name Surveys @@ -1213,7 +1198,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param autoShowingSurveysEnabled A boolean to indicate whether the surveys auto showing are enabled or not. */ -+ (void)setAutoShowingSurveysEnabled:(BOOL)autoShowingSurveysEnabled; ++ (void)setAutoShowingSurveysEnabled:(BOOL)autoShowingSurveysEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets whether surveys are enabled or not. @@ -1224,19 +1209,19 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param surveysEnabled A boolean to indicate whether the survey feature is enabled or not. */ -+ (void)setSurveysEnabled:(BOOL)surveysEnabled; ++ (void)setSurveysEnabled:(BOOL)surveysEnabled DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Shows one of the surveys that were not shown before, that also have conditions that match the current device/user. @discussion Does nothing if there are no available surveys. */ -+ (void)showSurveyIfAvailable; ++ (void)showSurveyIfAvailable DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Returns true if there are any surveys that match the current device/user. */ -+ (BOOL)hasAvailableSurveys; ++ (BOOL)hasAvailableSurveys DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed just before the survey's UI is presented. @@ -1246,7 +1231,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param willShowSurveyHandler A block of code that gets executed before presenting the survey's UI. */ -+ (void)setWillShowSurveyHandler:(void (^)(void))willShowSurveyHandler; ++ (void)setWillShowSurveyHandler:(void (^)(void))willShowSurveyHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a block of code to be executed right after the survey's UI is dismissed. @@ -1256,7 +1241,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param didShowSurveyHandler A block of code that gets executed after the survey's UI is dismissed. */ -+ (void)setDidDismissSurveyHandler:(void (^)(void))didShowSurveyHandler; ++ (void)setDidDismissSurveyHandler:(void (^)(void))didShowSurveyHandler DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Shows Survey with a specific token. @@ -1265,7 +1250,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param surveyToken A String with a survey token. */ -+ (void)showSurveyWithToken:(NSString *)surveyToken; ++ (void)showSurveyWithToken:(NSString *)surveyToken DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Returns true if the survey with a specific token was answered before . @@ -1274,7 +1259,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param surveyToken A String with a survey token. */ -+ (BOOL)hasRespondedToSurveyWithToken:(NSString *)surveyToken; ++ (BOOL)hasRespondedToSurveyWithToken:(NSString *)surveyToken DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Sets a threshold for numbers of sessions and another for number of days required before a survey, that has been dismissed once, would show again. @@ -1284,7 +1269,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param sessionCount : Number of sessions required to be initialized before a dismissed survey can be shown again. @param daysCount : Number of days required to pass before a dismissed survey can be shown again. */ -+ (void)setThresholdForReshowingSurveyAfterDismiss:(NSInteger)sessionCount daysCount:(NSInteger)daysCount; ++ (void)setThresholdForReshowingSurveyAfterDismiss:(NSInteger)sessionCount daysCount:(NSInteger)daysCount DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); /** @brief Setting an option for all the surveys to show a welcome screen before the user starts taking the survey. @@ -1295,7 +1280,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l @param shouldShowWelcomeScreen : Boolean for setting wether the welcome screen should show. */ -+ (void)setShouldShowSurveysWelcomeScreen:(BOOL)shouldShowWelcomeScreen; ++ (void)setShouldShowSurveysWelcomeScreen:(BOOL)shouldShowWelcomeScreen DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); #pragma mark - Feature Requests /// ------------------------ @@ -1305,22 +1290,7 @@ OBJC_EXTERN void IBGNSLogWithLevel(NSString *format, va_list args, IBGLogLevel l /** @brief Shows the UI for feature requests list */ -+ (void)showFeatureRequests; - -#pragma mark - SDK Debugging - -/// ------------------------ -/// @name SDK Debugging -/// ------------------------ - -/** - @brief Sets the verbosity level of logs used to debug the Instabug SDK itself. - - @discussion This API sets the verbosity level of logs used to debug The SDK. The defualt value in debug mode is IBGSDKDebugLogsLevelVerbose and in production is IBGSDKDebugLogsLevelError. - - @param level Logs verbosity level. - */ -+ (void)setSDKDebugLogsLevel:(IBGSDKDebugLogsLevel)level; ++ (void)showFeatureRequests DEPRECATED_MSG_ATTRIBUTE("This API has been deprecated. See https://docs.instabug.com/v1.0/docs/ios-migration-guide for instructions on migrating to SDK v8.x APIs."); @end diff --git a/ios/Instabug.framework/Info.plist b/ios/Instabug.framework/Info.plist index a340881cf..b022b003f 100644 Binary files a/ios/Instabug.framework/Info.plist and b/ios/Instabug.framework/Info.plist differ diff --git a/ios/Instabug.framework/Instabug b/ios/Instabug.framework/Instabug index 3889c39e0..862455042 100755 Binary files a/ios/Instabug.framework/Instabug and b/ios/Instabug.framework/Instabug differ diff --git a/ios/Instabug.framework/_CodeSignature/CodeResources b/ios/Instabug.framework/_CodeSignature/CodeResources index bdef8537c..3b5d18d19 100644 --- a/ios/Instabug.framework/_CodeSignature/CodeResources +++ b/ios/Instabug.framework/_CodeSignature/CodeResources @@ -4,13 +4,37 @@ files + Headers/IBGBugReporting.h + + hkW+zJJsTEIuI83iyxEliITjaI4= + + Headers/IBGCrashReporting.h + + J+nbZD9XLGOqQ5NKTdmlUS7jT5U= + + Headers/IBGFeatureRequests.h + + sx6/m+HVdAWLpz7z0LMFlmUiDAw= + + Headers/IBGLog.h + + CxPMwV9poTITtelgp5bcDhpihjI= + + Headers/IBGSurvey.h + + f9xxYupSdHZNxQm+RHLGAsVfBj0= + + Headers/IBGSurveys.h + + FOZwr54D5o1Nk/VAyF+LvDj6+xk= + Headers/Instabug.h - A2hIp+URGCShxY4uOIeKgQ3r51o= + sepwzdEifs9Ddm1FiudYWFolrvo= Info.plist - 86L44nwgzIeTUUbjcO61nWuaqwo= + m5cMWHqfcC+/uQOYadUc2MkNcVY= Modules/module.modulemap @@ -19,15 +43,81 @@ files2 + Headers/IBGBugReporting.h + + hash + + hkW+zJJsTEIuI83iyxEliITjaI4= + + hash2 + + cDXE2vpwnAVAENM3At2M7ImV7wqYKduxznWmWjvLYcY= + + + Headers/IBGCrashReporting.h + + hash + + J+nbZD9XLGOqQ5NKTdmlUS7jT5U= + + hash2 + + HUs2+a+2SGjZoROjTaHV04YmCMc6tzAjmRpxsw2rNgE= + + + Headers/IBGFeatureRequests.h + + hash + + sx6/m+HVdAWLpz7z0LMFlmUiDAw= + + hash2 + + 0W+UgtPWulyL+kZpyxTXH65IcOA3kbMHXGxWENdsx1I= + + + Headers/IBGLog.h + + hash + + CxPMwV9poTITtelgp5bcDhpihjI= + + hash2 + + ruxbDMyVVaC/a+WaTdnoKb2Eemck5+hH+km8Pv7zh2k= + + + Headers/IBGSurvey.h + + hash + + f9xxYupSdHZNxQm+RHLGAsVfBj0= + + hash2 + + NpBT5tUdWWmyd7mSMSENa8AxHzxULGxV1LCnIitkikU= + + + Headers/IBGSurveys.h + + hash + + FOZwr54D5o1Nk/VAyF+LvDj6+xk= + + hash2 + + wSSM8KdRPq2ZKgNUh73yPRqA2/LI+TnurOK3Zu1LT3o= + + Headers/Instabug.h hash - A2hIp+URGCShxY4uOIeKgQ3r51o= + sepwzdEifs9Ddm1FiudYWFolrvo= hash2 - 0GvzeDByhOxwApnpaxjQ9ZgLHJVqzI5ZFp8yeA6lFCU= + 1MNZcuO9wLxiZsIm6WWpSPZeX75HvtkYpSRYp3I9HQ8= Modules/module.modulemap diff --git a/ios/InstabugCore.framework/Assets.car b/ios/InstabugCore.framework/Assets.car index 660d304dd..314384c5c 100644 Binary files a/ios/InstabugCore.framework/Assets.car and b/ios/InstabugCore.framework/Assets.car differ diff --git a/ios/InstabugCore.framework/Headers/IBGNetworkLogger.h b/ios/InstabugCore.framework/Headers/IBGNetworkLogger.h new file mode 100644 index 000000000..d23bef01d --- /dev/null +++ b/ios/InstabugCore.framework/Headers/IBGNetworkLogger.h @@ -0,0 +1,117 @@ +// +// IBGNetworkLogger.h +// InstabugCore +// +// Created by Yousef Hamza on 5/17/18. +// Copyright © 2018 Instabug. All rights reserved. +// + +#import +#import "IBGTypes.h" + +NS_SWIFT_NAME(NetworkLogger) +@interface IBGNetworkLogger : NSObject + +@property (class, atomic, assign) BOOL enabled; + +/* CHECK NULLABILITY! */ +typedef void (^NetworkObfuscationCompletionBlock)(NSData * _Nullable data, NSURLResponse * _Nonnull response); + + +/** + @brief Enable logging for network requests and responses on a custom NSURLSessionConfiguration. + + @discussion Logging for network requests and responses may not work if you're using a custom `NSURLSession` object. + If this is the case, call this method passing in your custom NSURLSessions's configuration to enable logging for it. + + @param URLSessionConfiguration The NSURLSessionConfiguration of your custom NSURLSession. + */ ++ (void)enableLoggingForURLSessionConfiguration:(NSURLSessionConfiguration *_Nonnull)URLSessionConfiguration; + + +/** + @brief Use to obfuscate a request that's going to be included in network logs. + + @discussion Use this method if you want to make any modifications to requests before it is added to the network log. + This won't be applied to already filtered requests + + Note that thsese changes doesn't affect the actual request. + + The provided block will be called for every request. You should do whatever processing you need to do on the request inside + that block, then return a request to be included in network logs. + + This method usage overrides modifications made by `setNetworkLoggingURLObfuscationHandler:`. + + @param obfuscationHandler A block that takes a request and returns a new modified one to be logged.. + */ ++ (void)setRequestObfuscationHandler:(nonnull NSURLRequest * _Nonnull (^)(NSURLRequest * _Nonnull request))obfuscationHandler; + +/** + @brief Use to obfuscate a request's response that's going to be included in network logs. + + @discussion Use this method if you want to make any modifications to a request's respone and its data before it's + added to network logs. + + The provided block will be called for every response. You should do whatever processing you need to do on the response + and data inside that block, then return response and data to be included in network logs. Changes you make to the + response and its data only affect network logs, not the actual response. + + @param obfuscationHandler A block that takes the original response, its data and a return block as parameters. The + return block should be called with the modified data and response. + */ ++ (void)setResponseObfuscationHandler:(void (^_Nonnull)(NSData * _Nullable responseData, NSURLResponse * _Nonnull response, NetworkObfuscationCompletionBlock _Nonnull returnBlock))obfuscationHandler; + +/** + @brief Use to get callbacks about progress of sending body content of a particular request when networking logging is + enabled. + + @discussion The provided block will get periodical callbacks about the progress of sending the body content of a request. + + @param URL URL which will be attached with requestProgressHandler. + @param requestProgressHandler A block that will be called for the requestURL when SDK intercept that request. + + */ ++ (void)setProgressHandlerForRequestURL:(nonnull NSURL *)URL + progressHandler:(nonnull void (^)(NSURLSessionTask * _Nonnull task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))requestProgressHandler; + + +/** + @brief Used to ask whether your app is prepared to handle a particular authentication challenge. Can be called on any thread. + + @discussion Set this block if your app implements SSL pinning and you have network logging enabled. + + @param protectionSpaceHandler A block that takes the protection space for the authentication challenge and should return + true or false. + */ ++ (void)setCanAuthenticateAgainstProtectionSpaceHandler:(BOOL(^_Nonnull)(NSURLProtectionSpace * _Nonnull protectionSpace))protectionSpaceHandler; + + +/** + @brief Used to process an authentication challenge and return an NSURLCredential object. + + @discussion Set this block if your app implements SSL pinning and you have network logging enabled. + + @param reciveChallengeHandler A block that takes the authentication challenge and returns NSURLCredential. + */ ++ (void)setDidReceiveAuthenticationChallengeHandler:(NSURLCredential* _Nonnull (^_Nonnull)(NSURLAuthenticationChallenge * _Nonnull challenge))reciveChallengeHandler; + + +/** + @brief Specify NSPredicates to be used to omit certain network requests from being logged based on their request or + response objects. + + @discussion `requestFilterPredicate` will be matched against an `NSURLRequest`. It can be used to filter out requests + to a specific domain for example. + + `responseFilterPredicate` will be matched against an `NSHTTPURLResponse`. It can be used to filter out responses that + match specific status codes. + + If both predicates are specified, `requestFilterPredicate` is evaluated first, if it matches, the request is omitted + from logging without evaluating `responseFilterPredicate`. + + @param requestFilterPredicate An NSPredicate to match against an NSURLRequest. Matching requests will be omitted. + @param responseFilterPredicate An NSPredicate to match against an NSHTTPURLResponse. Matching responses will be omitted. + */ ++ (void)setNetworkLoggingRequestFilterPredicate:(nullable NSPredicate *)requestFilterPredicate responseFilterPredicate:(nullable NSPredicate *)responseFilterPredicate; + +@end diff --git a/ios/InstabugCore.framework/Headers/IBGReport.h b/ios/InstabugCore.framework/Headers/IBGReport.h new file mode 100644 index 000000000..f30468525 --- /dev/null +++ b/ios/InstabugCore.framework/Headers/IBGReport.h @@ -0,0 +1,31 @@ +// +// IBGReport.h +// InstabugCore +// +// Created by khaled mohamed el morabea on 1/21/18. +// Copyright © 2018 Instabug. All rights reserved. +// + +#import + +@interface IBGReport : NSObject + +@property (nonatomic, copy, readonly) NSArray *tags; +@property (nonatomic, copy, readonly) NSArray *instabugLogs; +@property (nonatomic, copy, readonly) NSArray *consoleLogs; +@property (nonatomic, copy, readonly) NSDictionary *userAttributes; +@property (nonatomic, copy, readonly) NSArray *fileLocations; +@property (nonatomic, copy) NSString *userData; + +- (void)appendTag:(NSString *)tag; +- (void)logVerbose:(NSString *)log; +- (void)logDebug:(NSString *)log; +- (void)logInfo:(NSString *)log; +- (void)logWarn:(NSString *)log; +- (void)logError:(NSString *)log; +- (void)appendToConsoleLogs:(NSString *)log; +- (void)setUserAttribute:(NSString *)userAttribute withKey:(NSString *)key; +- (void)addFileAttachmentWithURL:(NSURL *)url; +- (void)addFileAttachmentWithData:(NSData *)data; + +@end diff --git a/ios/InstabugCore.framework/Headers/IBGTypes.h b/ios/InstabugCore.framework/Headers/IBGTypes.h index 406f40d02..2d64699a0 100644 --- a/ios/InstabugCore.framework/Headers/IBGTypes.h +++ b/ios/InstabugCore.framework/Headers/IBGTypes.h @@ -5,7 +5,7 @@ Copyright: (c) 2013-2018 by Instabug, Inc., all rights reserved. - Version: 7.14.5 + Version: 8.0.2 */ #import @@ -153,19 +153,19 @@ extern NSString * const kIBGDiscardAlertCancel; /** The event used to invoke the feedback form. */ -typedef NS_ENUM(NSInteger, IBGInvocationEvent) { - /** No event will be registered to show the feedback form, you'll need to code your own and call the method showFeedbackForm. */ - IBGInvocationEventNone, +typedef NS_OPTIONS(NSInteger, IBGInvocationEvent) { /** Shaking the device while in any screen to show the feedback form. */ - IBGInvocationEventShake, + IBGInvocationEventShake = 1 << 0, /** Taking a screenshot using the Home+Lock buttons while in any screen to show the feedback form. */ - IBGInvocationEventScreenshot, + IBGInvocationEventScreenshot = 1 << 1, /** Swiping two fingers left while in any screen to show the feedback form. */ - IBGInvocationEventTwoFingersSwipeLeft, + IBGInvocationEventTwoFingersSwipeLeft = 1 << 2, /** Swiping one finger left from the right edge of the screen to show the feedback form, substituted with IBGInvocationEventTwoFingersSwipeLeft on iOS 6.1.3 and earlier. */ - IBGInvocationEventRightEdgePan, + IBGInvocationEventRightEdgePan = 1 << 3, /** Shows a floating button on top of all views, when pressed it takes a screenshot. */ - IBGInvocationEventFloatingButton + IBGInvocationEventFloatingButton = 1 << 4, + /** No event will be registered to show the feedback form, you'll need to code your own and call the method showFeedbackForm. */ + IBGInvocationEventNone = 1 << 5, }; /** @@ -189,6 +189,14 @@ typedef NS_ENUM(NSInteger, IBGInvocationMode) { IBGInvocationModeChatsList }; +typedef NS_OPTIONS(NSInteger, IBGBugReportingInvocationOption) { + IBGBugReportingInvocationOptionEmailFieldHidden = 1 << 0, + IBGBugReportingInvocationOptionEmailFieldOptional = 1 << 1, + IBGBugReportingInvocationOptionCommentFieldRequired = 1 << 2, + IBGBugReportingInvocationOptionDisablePostSendingDialog = 1 << 3, + IBGBugReportingInvocationOptionNone = 1 << 4, +}; + /** Type of report to be submitted. */ @@ -399,10 +407,11 @@ typedef NS_ENUM(NSInteger, IBGString) { /** The prompt option selected in Instabug prompt. */ -typedef NS_ENUM(NSInteger, IBGPromptOption) { - IBGPromptOptionChat, - IBGPromptOptionBug, - IBGPromptOptionFeedback +typedef NS_OPTIONS(NSInteger, IBGPromptOption) { + IBGPromptOptionChat = 1 << 0, + IBGPromptOptionBug = 1 << 1, + IBGPromptOptionFeedback = 1 << 2, + IBGPromptOptionNone = 1 << 3, }; /** @@ -455,6 +464,13 @@ typedef NS_ENUM(NSInteger, IBGExtendedBugReportMode) { IBGExtendedBugReportModeDisabled }; +typedef NS_OPTIONS(NSInteger, IBGAction) { + IBGActionAllActions = 1 << 0, + IBGActionReportBug = 1 << 1, + IBGActionRequestNewFeature = 1 << 2, + IBGActionAddCommentToFeature = 1 << 3, +}; + /** The welcome message mode. */ @@ -464,13 +480,6 @@ typedef NS_ENUM(NSInteger, IBGWelcomeMessageMode) { IBGWelcomeMessageModeDisabled }; -typedef enum : NSUInteger { - IBGActionAllActions = 1 << 0, - IBGActionReportBug = 1 << 1, - IBGActionRequestNewFeature = 1 << 2, - IBGActionAddCommentToFeature = 1 << 3, -} IBGActionType; - @interface UIView (Instabug) /** diff --git a/ios/InstabugCore.framework/Headers/InstabugCore.h b/ios/InstabugCore.framework/Headers/InstabugCore.h index 16dc9a76c..da1df092f 100644 --- a/ios/InstabugCore.framework/Headers/InstabugCore.h +++ b/ios/InstabugCore.framework/Headers/InstabugCore.h @@ -5,11 +5,12 @@ Copyright: (c) 2013-2018 by Instabug, Inc., all rights reserved. - Version: 7.14.5 + Version: 8.0.2 */ #import #import "IBGTypes.h" +#import "IBGReport.h" @interface InstabugCore : NSObject diff --git a/ios/InstabugCore.framework/IBGActionSheetCell.nib b/ios/InstabugCore.framework/IBGActionSheetCell.nib index f8607cf2b..a06213df7 100644 Binary files a/ios/InstabugCore.framework/IBGActionSheetCell.nib and b/ios/InstabugCore.framework/IBGActionSheetCell.nib differ diff --git a/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/objects-11.0+.nib b/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/objects-11.0+.nib index a6d57f0f1..392eec362 100644 Binary files a/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/objects-11.0+.nib and b/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/objects-11.0+.nib differ diff --git a/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/runtime.nib b/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/runtime.nib index 451fb9f20..13eb65146 100644 Binary files a/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/runtime.nib and b/ios/InstabugCore.framework/IBGActionSheetVC-iPhone.nib/runtime.nib differ diff --git a/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/objects-11.0+.nib b/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/objects-11.0+.nib index ca0c53947..398731137 100644 Binary files a/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/objects-11.0+.nib and b/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/objects-11.0+.nib differ diff --git a/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/runtime.nib b/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/runtime.nib index 641d9941d..232ded6c7 100644 Binary files a/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/runtime.nib and b/ios/InstabugCore.framework/IBGBugVC-iPhone.nib/runtime.nib differ diff --git a/ios/InstabugCore.framework/IBGChatCell.nib b/ios/InstabugCore.framework/IBGChatCell.nib index 7bafd34c3..ecceb9366 100644 Binary files a/ios/InstabugCore.framework/IBGChatCell.nib and b/ios/InstabugCore.framework/IBGChatCell.nib differ diff --git a/ios/InstabugCore.framework/IBGChatListVC-iPhone.nib b/ios/InstabugCore.framework/IBGChatListVC-iPhone.nib index dec20f47c..6841d13ca 100644 Binary files a/ios/InstabugCore.framework/IBGChatListVC-iPhone.nib and b/ios/InstabugCore.framework/IBGChatListVC-iPhone.nib differ diff --git a/ios/InstabugCore.framework/IBGChatVC-iPhone.nib b/ios/InstabugCore.framework/IBGChatVC-iPhone.nib index fde98edcc..e8dd809b3 100644 Binary files a/ios/InstabugCore.framework/IBGChatVC-iPhone.nib and b/ios/InstabugCore.framework/IBGChatVC-iPhone.nib differ diff --git a/ios/InstabugCore.framework/IBGFullScreenImageViewController.nib b/ios/InstabugCore.framework/IBGFullScreenImageViewController.nib index 4f0636f91..ddae839c4 100644 Binary files a/ios/InstabugCore.framework/IBGFullScreenImageViewController.nib and b/ios/InstabugCore.framework/IBGFullScreenImageViewController.nib differ diff --git a/ios/InstabugCore.framework/IBGPoweredByView.nib b/ios/InstabugCore.framework/IBGPoweredByView.nib index 492b97dac..098729293 100644 Binary files a/ios/InstabugCore.framework/IBGPoweredByView.nib and b/ios/InstabugCore.framework/IBGPoweredByView.nib differ diff --git a/ios/InstabugCore.framework/IBGPromptCell.nib b/ios/InstabugCore.framework/IBGPromptCell.nib index 600484837..133d3780f 100644 Binary files a/ios/InstabugCore.framework/IBGPromptCell.nib and b/ios/InstabugCore.framework/IBGPromptCell.nib differ diff --git a/ios/InstabugCore.framework/IBGPromptVC-iPhone.nib b/ios/InstabugCore.framework/IBGPromptVC-iPhone.nib index 2bf51dfd7..ee21ef59f 100644 Binary files a/ios/InstabugCore.framework/IBGPromptVC-iPhone.nib and b/ios/InstabugCore.framework/IBGPromptVC-iPhone.nib differ diff --git a/ios/InstabugCore.framework/IBGReplyView-iPhone.nib b/ios/InstabugCore.framework/IBGReplyView-iPhone.nib index 010f8be91..f84b18c76 100644 Binary files a/ios/InstabugCore.framework/IBGReplyView-iPhone.nib and b/ios/InstabugCore.framework/IBGReplyView-iPhone.nib differ diff --git a/ios/InstabugCore.framework/IBGReportCategoriesVC-iPhone.nib b/ios/InstabugCore.framework/IBGReportCategoriesVC-iPhone.nib index 18aeb6834..46683c9cb 100644 Binary files a/ios/InstabugCore.framework/IBGReportCategoriesVC-iPhone.nib and b/ios/InstabugCore.framework/IBGReportCategoriesVC-iPhone.nib differ diff --git a/ios/InstabugCore.framework/IBGScreenshotVC-iPhone.nib b/ios/InstabugCore.framework/IBGScreenshotVC-iPhone.nib index 3730260ad..d872eb2b3 100644 Binary files a/ios/InstabugCore.framework/IBGScreenshotVC-iPhone.nib and b/ios/InstabugCore.framework/IBGScreenshotVC-iPhone.nib differ diff --git a/ios/InstabugCore.framework/IBGVideoPlaybackViewController.nib b/ios/InstabugCore.framework/IBGVideoPlaybackViewController.nib index 635919fc9..160e37aa6 100644 Binary files a/ios/InstabugCore.framework/IBGVideoPlaybackViewController.nib and b/ios/InstabugCore.framework/IBGVideoPlaybackViewController.nib differ diff --git a/ios/InstabugCore.framework/IBGVoiceNoteRecordingViewController-iPhone.nib b/ios/InstabugCore.framework/IBGVoiceNoteRecordingViewController-iPhone.nib index d5f360333..198e77ad8 100644 Binary files a/ios/InstabugCore.framework/IBGVoiceNoteRecordingViewController-iPhone.nib and b/ios/InstabugCore.framework/IBGVoiceNoteRecordingViewController-iPhone.nib differ diff --git a/ios/InstabugCore.framework/Info.plist b/ios/InstabugCore.framework/Info.plist index 90848f7f5..70bc05cf0 100644 Binary files a/ios/InstabugCore.framework/Info.plist and b/ios/InstabugCore.framework/Info.plist differ diff --git a/ios/InstabugCore.framework/InstabugCore b/ios/InstabugCore.framework/InstabugCore index 0e2d74d7f..fcd8e8c14 100755 Binary files a/ios/InstabugCore.framework/InstabugCore and b/ios/InstabugCore.framework/InstabugCore differ diff --git a/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 12.mom b/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 12.mom index 8c799ac00..15414ca59 100644 Binary files a/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 12.mom and b/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 12.mom differ diff --git a/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.mom b/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.mom index f1e11cc99..f69056568 100644 Binary files a/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.mom and b/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.mom differ diff --git a/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.omo b/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.omo index 80873d173..6b40a210b 100644 Binary files a/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.omo and b/ios/InstabugCore.framework/InstabugDataModel.momd/InstabugDataModel 14.omo differ diff --git a/ios/InstabugCore.framework/Modules/module.modulemap b/ios/InstabugCore.framework/Modules/module.modulemap index 257f7742d..9cf938e5e 100644 --- a/ios/InstabugCore.framework/Modules/module.modulemap +++ b/ios/InstabugCore.framework/Modules/module.modulemap @@ -1,8 +1,6 @@ framework module InstabugCore { umbrella header "InstabugCore.h" - header "IBGTypes.h" - export * module * { export * } } diff --git a/ios/InstabugCore.framework/_CodeSignature/CodeResources b/ios/InstabugCore.framework/_CodeSignature/CodeResources index d21d22d5c..73ef2a9c9 100644 --- a/ios/InstabugCore.framework/_CodeSignature/CodeResources +++ b/ios/InstabugCore.framework/_CodeSignature/CodeResources @@ -6,83 +6,91 @@ Assets.car - G/pMvd2rKP+/8RPLmwh8QnuILu0= + Y8rnlmNA+AHOr3yVrHGZ4G+MVdM= + + Headers/IBGNetworkLogger.h + + BB9a5/5E2YClznA2NfjspFVY6hU= + + Headers/IBGReport.h + + jqvjTfQzVkTaCt0pZwrQlCAbRXM= Headers/IBGTypes.h - fCx9w7SPmvCFMRp6vvBmq7TMspg= + TQaN9Cuuw94djK5jTlVjI18h7X0= Headers/InstabugCore.h - mBllPfKTyyjar45EziGI2eGHSgk= + mICN3xjtOp1S5AypRsydkHxHcps= IBGActionSheetCell.nib - rbwdyTqjeNtnhE0bfbbh1DJaa0o= + 5vdaiKHujFYUfWHBUuBkRtc0Mvs= IBGActionSheetVC-iPhone.nib/objects-11.0+.nib - CE6NjtgYPKbyzj8GYOuF0KjraL0= + TDL35Taeg+35ILZjhSRVjI5wYb8= IBGActionSheetVC-iPhone.nib/runtime.nib - eqccSCt/OrcAoA5AOLT8TRSHi7s= + +XgcQt88kKKQNTauKvOJX1Ht8U0= IBGBugVC-iPhone.nib/objects-11.0+.nib - gYCgDKUQG03zDsVLVQ/hv5wuP+8= + 3coKWj34dKknWXKlCZ0Ya9cr60k= IBGBugVC-iPhone.nib/runtime.nib - RBDwQB9fj/ZcOgvMOSl2wFH7+jU= + TLC1DbISq6c+736M5yoI60LiJ7Y= IBGChatCell.nib - RZ35sIN1ypwHSFwzMhjr14U1nQo= + DRm/QOVKwImlfHxLe3NEm8Hh+Gs= IBGChatListVC-iPhone.nib - s89QOHRRHPpfbX824vYiDsz0wEM= + IX28uZWL7B8Rz4yxApStoYnnykA= IBGChatVC-iPhone.nib - 5wLcdFx81P0HrdugiD5KJmp5mwE= + +XiGOx3UAY+q2cVxxeltkr1eEQ4= IBGFullScreenImageViewController.nib - eAywDxWWGJSK57nBF3xk5CnpYqI= + KswMLCxfsMpQdb7jF2YJXuKxpSs= IBGPoweredByView.nib - 52Yz66LhupdE8yVoZOaXoY5hrDw= + 9lKoN9cxil0mLxI35BlAFQIvok4= IBGPromptCell.nib - 3y2rIHXg8ZQX15NSWV/4wADDlT0= + 6W2aeK25WyRVLbqCjcUOnEmcd4E= IBGPromptVC-iPhone.nib - i3UrKlZ6sb1tO47HAPIfaWB61s4= + 44n4dkZGefCM4GLLk6kJwL87/2E= IBGReplyView-iPhone.nib - yg2lPj+GJZt45gL6Y7u2BvXorIA= + IVTf6qrYWPK4RnrG9C1kQf0OmL0= IBGReportCategoriesVC-iPhone.nib - ZlLqosjzXYM/uD8L5n++jhAJpTg= + /DXAD2SeYh6j3kqjGHAEjn2jBeM= IBGScreenshotVC-iPhone.nib - quh4ZrTpRFg5sjCyUx3Cf2KBmx0= + Yx/p2STBwynCGZXRH8Cwhz0wDLw= IBGVideoPlaybackViewController.nib - iCCBacW5QkwaiWZU9WkfOfaZGd4= + 4vmpeYHyODI2//4BZqFOcVfFhW8= IBGVoiceNoteRecordingViewController-iPhone.nib - hhFi6UwXnO38Hilq4YcuJR/2fTE= + uw+MuZe/0dpq/H1o0EahUa6J/uw= InAppScreenshotPlaceholder.png @@ -110,7 +118,7 @@ Info.plist - sj5nBe0CyuAQ14Jb0nWgYk2/fAY= + sUsX+EZO1yJNnY4GDKzFpNTjpKU= Inject_DSYM_Project-Archive.sh @@ -126,15 +134,15 @@ InstabugDataModel.momd/InstabugDataModel 12.mom - NtIzBzkxwtmIlGVa26zMGx7h9t8= + fCTQP3x1e78pecuXMGSk71wO30Q= InstabugDataModel.momd/InstabugDataModel 14.mom - aoN5qtELGkeIbL4/Lkh0tj6zrmQ= + T43MHUm2D+VoZ3oj6mrV+EX07H4= InstabugDataModel.momd/InstabugDataModel 14.omo - 307c1WheCh/JIpnx+m8mPp4hnvI= + oA70R+9aXlf7A4O3iYhunSj9hC0= InstabugDataModel.momd/InstabugDataModel 2.mom @@ -417,220 +425,242 @@ hash - G/pMvd2rKP+/8RPLmwh8QnuILu0= + Y8rnlmNA+AHOr3yVrHGZ4G+MVdM= hash2 - yje66cXlCzQWTI9X2EjlowPmPKQZfPDw4sZK9XPWSv0= + 5sl1xiI5yNzeiPM7PogKdKJWF3HDRECRyKZvnEbIGfM= + + + Headers/IBGNetworkLogger.h + + hash + + BB9a5/5E2YClznA2NfjspFVY6hU= + + hash2 + + Gy27u0FdhOuxHc3u11fxUUTo3i8GVCDnoJe2dupni60= + + + Headers/IBGReport.h + + hash + + jqvjTfQzVkTaCt0pZwrQlCAbRXM= + + hash2 + + paHuVWTQuf118JEXNoo7fYXWGStFAo4OCxYMqQuW1fk= Headers/IBGTypes.h hash - fCx9w7SPmvCFMRp6vvBmq7TMspg= + TQaN9Cuuw94djK5jTlVjI18h7X0= hash2 - uAACh30c6HP5GtjcHjoQOpl78reIUw8OCIkPneteQ3U= + k5oqrLRinMXi44HXA3pOxE9fhzwSf/uOg2lmwx1vQDU= Headers/InstabugCore.h hash - mBllPfKTyyjar45EziGI2eGHSgk= + mICN3xjtOp1S5AypRsydkHxHcps= hash2 - OEfhiZKtlpStEmhHsVXBPwRhJoWvByYbmi8U+cg58uw= + VuBztYlc7sB2UF8FxzozXu9O7BDr7nRHng9byAzxDmU= IBGActionSheetCell.nib hash - rbwdyTqjeNtnhE0bfbbh1DJaa0o= + 5vdaiKHujFYUfWHBUuBkRtc0Mvs= hash2 - OjFzv5hiKA3MVBN3On8XmqQwVDqgl9vByC2nGyiW2hg= + tuiitAicROidDOZkziiE0sb8mzUOzUS60R8s1aadKxM= IBGActionSheetVC-iPhone.nib/objects-11.0+.nib hash - CE6NjtgYPKbyzj8GYOuF0KjraL0= + TDL35Taeg+35ILZjhSRVjI5wYb8= hash2 - gESlEYofuhonh/+8Av9+yuMTTtju9Gf1AMski3IYd/w= + auOvfn5AZQaqi5jgo1oh/cMLHypr+927VybD5zq5DXI= IBGActionSheetVC-iPhone.nib/runtime.nib hash - eqccSCt/OrcAoA5AOLT8TRSHi7s= + +XgcQt88kKKQNTauKvOJX1Ht8U0= hash2 - VF/Luv/l1+gIG7MqFQMt3et7y8pJDU0VpDf2kzB8hZs= + 9D1nE/yFpPdKYymSUxmgWqKT5IvuyCEdot1lrahmUNs= IBGBugVC-iPhone.nib/objects-11.0+.nib hash - gYCgDKUQG03zDsVLVQ/hv5wuP+8= + 3coKWj34dKknWXKlCZ0Ya9cr60k= hash2 - mjZRK0yjk6yGBu9/PqKI9usKanj1RKmJKNByRSt8sQ0= + PaDurMbElOQpjZ0SofWmBKWZ83p/0w84WGTSxytysTY= IBGBugVC-iPhone.nib/runtime.nib hash - RBDwQB9fj/ZcOgvMOSl2wFH7+jU= + TLC1DbISq6c+736M5yoI60LiJ7Y= hash2 - qEN1OPBQjq+k8vZfo5LB8xdBhbqtAYfqkM+Gwsk8USQ= + U4Ij5+bBbQToWKhBje6BfM7jueYaQONmXr19cGSg+6g= IBGChatCell.nib hash - RZ35sIN1ypwHSFwzMhjr14U1nQo= + DRm/QOVKwImlfHxLe3NEm8Hh+Gs= hash2 - dKuC2884apDYyfAhHv/kVceecLZCnGfhgJJNqqHVi3k= + kjOwyS6kpTEUivw4KVqcnLa8KxXYL8tJq882yujWGzs= IBGChatListVC-iPhone.nib hash - s89QOHRRHPpfbX824vYiDsz0wEM= + IX28uZWL7B8Rz4yxApStoYnnykA= hash2 - 0j9MiGBo6OlnN/rNsscrY1wxL5yewXYztwiysuDbWuo= + 3zJ8YmieE5ljEQbWMlsbBsmA7E9ZhEObkCmA4fVj2xU= IBGChatVC-iPhone.nib hash - 5wLcdFx81P0HrdugiD5KJmp5mwE= + +XiGOx3UAY+q2cVxxeltkr1eEQ4= hash2 - J+q6EvCSSLbB2LN++XlmG22ErOkb4XxVIvlxiW1APqI= + aS+ZdJw+wQHvdfpNSGlo/D1lhyn+zpgj2e8HtShFU58= IBGFullScreenImageViewController.nib hash - eAywDxWWGJSK57nBF3xk5CnpYqI= + KswMLCxfsMpQdb7jF2YJXuKxpSs= hash2 - dbOznkpYVvy6mUnNXgF+IkZKs+fsk9d2Gx5JWhZ1+WY= + UXiyENiglsB0frqdcuRzvkct6pJBuar9m7L7nWxD09c= IBGPoweredByView.nib hash - 52Yz66LhupdE8yVoZOaXoY5hrDw= + 9lKoN9cxil0mLxI35BlAFQIvok4= hash2 - iVgOg744c0UGX3FDvlQy5gVXpmDqU18ueEo4piUCaLU= + 8b/eJjPVbkXJ0o+MNOFGWt89n4V32bH4zlNTdCBIH14= IBGPromptCell.nib hash - 3y2rIHXg8ZQX15NSWV/4wADDlT0= + 6W2aeK25WyRVLbqCjcUOnEmcd4E= hash2 - gQFXxWG3tn8hziO2/HjADpbOgZ6XEFLGbxhdp1+MSoc= + q+FAmo0fIMuYkbiIM6sAWcOApU6aDp/L1oG6nlkwEts= IBGPromptVC-iPhone.nib hash - i3UrKlZ6sb1tO47HAPIfaWB61s4= + 44n4dkZGefCM4GLLk6kJwL87/2E= hash2 - Lp7TWICoCTTp0gKFXBGNx0YNx3bsuyHYwPz4VIIlRXE= + JF5wtYKK8EeSoPtnWnfGUh5U24CRQ9iEcYibZ3HVhBg= IBGReplyView-iPhone.nib hash - yg2lPj+GJZt45gL6Y7u2BvXorIA= + IVTf6qrYWPK4RnrG9C1kQf0OmL0= hash2 - yFR7khye8/keRmINmR+T3Q1IFeb7XEq1IdtTo+I7tRU= + P57qWMyRzt7OguwlJA86VMCQZp8W3XnTH6JXFNMqSbM= IBGReportCategoriesVC-iPhone.nib hash - ZlLqosjzXYM/uD8L5n++jhAJpTg= + /DXAD2SeYh6j3kqjGHAEjn2jBeM= hash2 - GNnVhfcPmdb4qQLdcTTF12DQpNH8TlVJfRVKyzFR/es= + 2SHa3BLeH0C5jYXYJj+GPwT1QokYMKKGTGmbXdAXws0= IBGScreenshotVC-iPhone.nib hash - quh4ZrTpRFg5sjCyUx3Cf2KBmx0= + Yx/p2STBwynCGZXRH8Cwhz0wDLw= hash2 - xKDFF6wnAzCgCfpiDqH0dFANp7Q8wm8riWSv0DFOqhQ= + g2ok6H7HOKeTcDauROpvG5f+LItx0uN/WFH2NTtlXX8= IBGVideoPlaybackViewController.nib hash - iCCBacW5QkwaiWZU9WkfOfaZGd4= + 4vmpeYHyODI2//4BZqFOcVfFhW8= hash2 - OvUgeadAJFS40EvlMGTtfXno7mthgDurNYEWlb52Vb4= + esquM9HVhzLRni2Nf+EGkKaoUcIrN08Ja9p0yVQaz4A= IBGVoiceNoteRecordingViewController-iPhone.nib hash - hhFi6UwXnO38Hilq4YcuJR/2fTE= + uw+MuZe/0dpq/H1o0EahUa6J/uw= hash2 - tkFfLtJ3efGypOpYpDAGZUyXAvK5g2bgETiHhxA6FJ8= + 3Bf8dvn0MnFV1E65Ue5O27BtCUqlDRIkQTGkB7W5boo= InAppScreenshotPlaceholder.png @@ -736,33 +766,33 @@ hash - NtIzBzkxwtmIlGVa26zMGx7h9t8= + fCTQP3x1e78pecuXMGSk71wO30Q= hash2 - Sr/Mv/QEnoWJRwX1rFxRmpPboUmRVNIl8e53mZeHaPM= + KBYFIfXBVYh3prnbK+jWNfLWuaBrb80x3bth2niLjig= InstabugDataModel.momd/InstabugDataModel 14.mom hash - aoN5qtELGkeIbL4/Lkh0tj6zrmQ= + T43MHUm2D+VoZ3oj6mrV+EX07H4= hash2 - vCMsSpnkuoLXxyA5Nu4E6kjBepAZzF6jqiX+VyT26mQ= + zAd4V1PDDdy5q8OdWg9V2PPdn5m6JFKbRIpeH9RpGmE= InstabugDataModel.momd/InstabugDataModel 14.omo hash - 307c1WheCh/JIpnx+m8mPp4hnvI= + oA70R+9aXlf7A4O3iYhunSj9hC0= hash2 - ni0428urI76e0SmKWLcMjz1b0k1uStg3I72h5zBShSM= + 5RoEiGNQISR9j/pqjVxyOBRYj6XARkbLAQiTW6gLmJw= InstabugDataModel.momd/InstabugDataModel 2.mom diff --git a/ios/RNInstabug/InstabugReactBridge.m b/ios/RNInstabug/InstabugReactBridge.m index 7537a6c7d..364775148 100644 --- a/ios/RNInstabug/InstabugReactBridge.m +++ b/ios/RNInstabug/InstabugReactBridge.m @@ -6,6 +6,10 @@ #import "InstabugReactBridge.h" #import +#import +#import +#import +#import #import #import #import @@ -20,7 +24,8 @@ @implementation InstabugReactBridge @"IBGpostInvocationHandler", @"IBGonNewMessageHandler", @"IBGWillShowSurvey", - @"IBGDidDismissSurvey" + @"IBGDidDismissSurvey", + @"IBGDidSelectPromptOptionHandler" ]; } @@ -30,11 +35,16 @@ - (dispatch_queue_t)methodQueue { return dispatch_get_main_queue(); } -RCT_EXPORT_METHOD(startWithToken:(NSString *)token invocationEvent:(IBGInvocationEvent)invocationEvent) { - [Instabug startWithToken:token invocationEvent:invocationEvent]; +RCT_EXPORT_METHOD(startWithToken:(NSString *)token invocationEvents:(NSArray*)invocationEventsArray) { + IBGInvocationEvent invocationEvents = 0; + NSLog(@"invocation events: %ld",(long)invocationEvents); + for (NSNumber *boxedValue in invocationEventsArray) { + invocationEvents |= [boxedValue intValue]; + } + [Instabug startWithToken:token invocationEvents:invocationEvents]; RCTAddLogFunction(InstabugReactLogFunction); RCTSetLogThreshold(RCTLogLevelInfo); - [Instabug setNetworkLoggingEnabled:NO]; + IBGNetworkLogger.enabled = NO; SEL setCrossPlatformSEL = NSSelectorFromString(@"setCrossPlatform:"); if ([[Instabug class] respondsToSelector:setCrossPlatformSEL]) { [[Instabug class] performSelector:setCrossPlatformSEL withObject:@(true)]; @@ -42,15 +52,15 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(invoke) { - [Instabug invoke]; + [IBGBugReporting invoke]; } -RCT_EXPORT_METHOD(invokeWithInvocationMode:(IBGInvocationMode)invocationMode) { - [Instabug invokeWithInvocationMode:invocationMode]; +RCT_EXPORT_METHOD(invokeWithInvocationMode:(IBGInvocationMode)invocationMode options:(IBGBugReportingInvocationOption)options) { + [IBGBugReporting invokeWithMode:invocationMode options:options]; } RCT_EXPORT_METHOD(dismiss) { - [Instabug dismiss]; + [IBGBugReporting dismiss]; } RCT_EXPORT_METHOD(setReproStepsMode:(IBGUserStepsMode)reproStepsMode) { @@ -80,15 +90,15 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(IBGLog:(NSString *)log) { - [Instabug IBGLog:log]; + [IBGLog log:log]; } RCT_EXPORT_METHOD(showSurveyWithToken:(NSString *)surveyToken) { - [Instabug showSurveyWithToken:surveyToken]; + [IBGSurveys showSurveyWithToken:surveyToken]; } RCT_EXPORT_METHOD(hasRespondedToSurveyWithToken:(NSString *)surveyToken callback:(RCTResponseSenderBlock)callback) { - callback(@[@([Instabug hasRespondedToSurveyWithToken:surveyToken])]); + callback(@[@([IBGSurveys hasRespondedToSurveyWithToken:surveyToken])]); } RCT_EXPORT_METHOD(setUserStepsEnabled:(BOOL)isUserStepsEnabled) { @@ -97,55 +107,108 @@ - (dispatch_queue_t)methodQueue { RCT_EXPORT_METHOD(setCrashReportingEnabled:(BOOL)enabledCrashReporter) { if(enabledCrashReporter) { - [Instabug setCrashReportingEnabled:YES]; + IBGCrashReporting.enabled = YES; } else { - [Instabug setCrashReportingEnabled:NO]; + IBGCrashReporting.enabled = NO; } } RCT_EXPORT_METHOD(setAutoScreenRecordingEnabled:(BOOL)enabled) { - [Instabug setAutoScreenRecordingEnabled:enabled]; + Instabug.autoScreenRecordingEnabled = enabled; } RCT_EXPORT_METHOD(setAutoScreenRecordingMaxDuration:(CGFloat)duration) { - [Instabug setAutoScreenRecordingDuration:duration]; + Instabug.autoScreenRecordingDuration = duration; } RCT_EXPORT_METHOD(setPreSendingHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { - [Instabug setPreSendingHandler:^{ - [self sendEventWithName:@"IBGpreSendingHandler" body:nil]; - }]; + Instabug.willSendReportHandler = ^(IBGReport* report){ + NSArray *tagsArray = report.tags; + NSArray *instabugLogs= report.instabugLogs; + NSArray *consoleLogs= report.consoleLogs; + NSDictionary *userAttributes= report.userAttributes; + NSArray *fileAttachments= report.fileLocations; + NSDictionary *dict = @{ @"tagsArray" : tagsArray, @"instabugLogs" : instabugLogs, @"consoleLogs" : consoleLogs, @"userAttributes" : userAttributes, @"fileAttachments" : fileAttachments}; + [self sendEventWithName:@"IBGpreSendingHandler" body:dict]; + return report; + }; } else { - [Instabug setPreSendingHandler:nil]; + Instabug.willSendReportHandler = nil; } } RCT_EXPORT_METHOD(setPreInvocationHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { - [Instabug setPreInvocationHandler:^{ + IBGBugReporting.willInvokeHandler = ^{ [self sendEventWithName:@"IBGpreInvocationHandler" body:nil]; - }]; + }; } else { - [Instabug setPreInvocationHandler:nil]; + IBGBugReporting.willInvokeHandler = nil; } } RCT_EXPORT_METHOD(setPostInvocationHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { - [Instabug setPostInvocationHandler:^(IBGDismissType dismissType, IBGReportType reportType) { - [self sendEventWithName:@"IBGpostInvocationHandler" body:@{ - @"dismissType": @(dismissType), - @"reportType": @(reportType) + IBGBugReporting.didDismissHandler = ^(IBGDismissType dismissType, IBGReportType reportType) { + NSLog(@"Dismiss Type: %ld",(long)dismissType); + NSLog(@"Report Type: %ld",(long)reportType); + + //parse dismiss type enum + NSString* dismissTypeString; + if (dismissType == IBGDismissTypeCancel) { + dismissTypeString = @"CANCEL"; + } else if (dismissType == IBGDismissTypeSubmit) { + dismissTypeString = @"SUBMIT"; + } else if (dismissType == IBGDismissTypeAddAttachment) { + dismissTypeString = @"ADD_ATTACHMENT"; + } + + //parse report type enum + NSString* reportTypeString; + if (reportType == IBGReportTypeBug) { + reportTypeString = @"bug"; + } else if (reportType == IBGReportTypeFeedback) { + reportTypeString = @"feedback"; + } else { + reportTypeString = @"other"; + } + NSDictionary *result = @{ @"dismissType": dismissTypeString, + @"reportType": reportTypeString}; + [self sendEventWithName:@"IBGpostInvocationHandler" body: result]; + }; + } else { + IBGBugReporting.didDismissHandler = nil; + } +} + +RCT_EXPORT_METHOD(didSelectPromptOptionHandler:(RCTResponseSenderBlock)callBack) { + if (callBack != nil) { + + IBGBugReporting.didSelectPromptOptionHandler = ^(IBGPromptOption promptOption) { + + NSString *promptOptionString; + if (promptOption == IBGPromptOptionBug) { + promptOptionString = @"bug"; + } else if (promptOption == IBGReportTypeFeedback) { + promptOptionString = @"feedback"; + } else if (promptOption == IBGPromptOptionChat) { + promptOptionString = @"chat"; + } else { + promptOptionString = @"none"; + } + + [self sendEventWithName:@"IBGDidSelectPromptOptionHandler" body:@{ + @"promptOption": promptOptionString }]; - }]; + }; } else { - [Instabug setPostInvocationHandler:nil]; + IBGBugReporting.didSelectPromptOptionHandler = nil; } } RCT_EXPORT_METHOD(showIntroMessage) { - [Instabug showIntroMessage]; +// [IBGBugReporting showIntroMessage]; } RCT_EXPORT_METHOD(setUserEmail:(NSString *)userEmail) { @@ -161,13 +224,31 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(getUnreadMessagesCount:(RCTResponseSenderBlock)callBack) { - callBack(@[@([Instabug getUnreadMessagesCount])]); + callBack(@[@(Instabug.unreadMessagesCount)]); } RCT_EXPORT_METHOD(setInvocationEvent:(IBGInvocationEvent)invocationEvent) { [Instabug setInvocationEvent:invocationEvent]; } +RCT_EXPORT_METHOD(setInvocationEvents:(NSArray*)invocationEventsArray) { + IBGInvocationEvent invocationEvents = 0; + for (NSNumber *boxedValue in invocationEventsArray) { + invocationEvents |= [boxedValue intValue]; + } + IBGBugReporting.invocationEvents = invocationEvents; +} + +RCT_EXPORT_METHOD(setInvocationOptions:(NSArray*)invocationOptionsArray) { + IBGBugReportingInvocationOption invocationOptions = 0; + + for (NSNumber *boxedValue in invocationOptionsArray) { + invocationOptions |= [boxedValue intValue]; + } + + IBGBugReporting.invocationOptions = invocationOptions; +} + RCT_EXPORT_METHOD(setPushNotificationsEnabled:(BOOL)isPushNotificationEnabled) { [Instabug setPushNotificationsEnabled:isPushNotificationEnabled]; } @@ -181,12 +262,21 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(setShakingThresholdForIPhone:(double)iPhoneShakingThreshold forIPad:(double)iPadShakingThreshold) { - [Instabug setShakingThresholdForiPhone:iPadShakingThreshold - foriPad:iPadShakingThreshold]; + [IBGBugReporting setShakingThresholdForiPhone:iPhoneShakingThreshold]; + [IBGBugReporting setShakingThresholdForiPad:iPadShakingThreshold]; +} + +RCT_EXPORT_METHOD(setShakingThresholdForiPhone:(double)iPhoneShakingThreshold) { + IBGBugReporting.shakingThresholdForiPhone = iPhoneShakingThreshold; +} + +RCT_EXPORT_METHOD(setShakingThresholdForiPad:(double)iPadShakingThreshold) { + IBGBugReporting.shakingThresholdForiPad = iPadShakingThreshold; } RCT_EXPORT_METHOD(setFloatingButtonEdge:(CGRectEdge)floatingButtonEdge withTopOffset:(double)floatingButtonOffsetFromTop) { - [Instabug setFloatingButtonEdge:floatingButtonEdge withTopOffset:floatingButtonOffsetFromTop]; + IBGBugReporting.floatingButtonEdge = floatingButtonEdge; + IBGBugReporting.floatingButtonTopOffset = floatingButtonOffsetFromTop; } RCT_EXPORT_METHOD(setLocale:(IBGLocale)locale) { @@ -194,11 +284,11 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(setExtendedBugReportMode:(IBGExtendedBugReportMode)extendedBugReportMode) { - [Instabug setExtendedBugReportMode:extendedBugReportMode]; + IBGBugReporting.extendedBugReportMode = extendedBugReportMode; } RCT_EXPORT_METHOD(setIntroMessageEnabled:(BOOL)isIntroMessageEnabled) { - [Instabug setIntroMessageEnabled:isIntroMessageEnabled]; +// IBGBugReporting.introMessageEnabled = isIntroMessageEnabled; } RCT_EXPORT_METHOD(setColorTheme:(IBGColorTheme)colorTheme) { @@ -206,7 +296,7 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(setPrimaryColor:(UIColor *)color) { - [Instabug setPrimaryColor:color]; + Instabug.tintColor = color; } RCT_EXPORT_METHOD(appendTags:(NSArray *)tags) { @@ -243,29 +333,38 @@ - (dispatch_queue_t)methodQueue { attachmentTypes |= IBGAttachmentTypeScreenRecording; } - [Instabug setEnabledAttachmentTypes:attachmentTypes]; + IBGBugReporting.enabledAttachmentTypes = attachmentTypes; } RCT_EXPORT_METHOD(setChatNotificationEnabled:(BOOL)isChatNotificationEnabled) { - [Instabug setChatNotificationEnabled:isChatNotificationEnabled]; + Instabug.replyNotificationsEnabled = isChatNotificationEnabled; } RCT_EXPORT_METHOD(setOnNewMessageHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { - [Instabug setOnNewMessageHandler:^{ + Instabug.didRecieveReplyHandler = ^{ [self sendEventWithName:@"IBGonNewMessageHandler" body:nil]; - }]; + }; } else { - [Instabug setOnNewMessageHandler:nil]; + Instabug.didRecieveReplyHandler = nil; } } RCT_EXPORT_METHOD(setPromptOptionsEnabled:(BOOL)chatEnabled feedback:(BOOL)bugReportEnabled chat:(BOOL)feedbackEnabled) { - [Instabug setPromptOptionsEnabledWithBug:bugReportEnabled - feedback:feedbackEnabled - chat:chatEnabled]; + IBGPromptOption promptOption = IBGPromptOptionNone; + if (chatEnabled) { + promptOption |= IBGPromptOptionChat; + } + if (bugReportEnabled) { + promptOption |= IBGPromptOptionBug; + } + if (feedbackEnabled) { + promptOption |= IBGPromptOptionFeedback; + } + + [IBGBugReporting setPromptOptions:promptOption]; } RCT_EXPORT_METHOD(isInstabugNotification:(NSDictionary *)notification callback:(RCTResponseSenderBlock)callBack) { @@ -323,7 +422,11 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(setViewHierarchyEnabled:(BOOL)viewHierarchyEnabled) { - [Instabug setViewHierarchyEnabled:viewHierarchyEnabled]; + Instabug.shouldCaptureViewHierarchy = viewHierarchyEnabled; +} + +RCT_EXPORT_METHOD(getAvailableSurveys:(RCTResponseSenderBlock)callback) { + callback(@[[IBGSurveys availableSurveys]]); } RCT_EXPORT_METHOD(logUserEventWithName:(NSString *)name) { @@ -334,55 +437,55 @@ - (dispatch_queue_t)methodQueue { [Instabug logUserEventWithName:name params:params]; } -RCT_EXPORT_METHOD(log:(NSString *)log) { - [Instabug IBGLog:log]; +RCT_EXPORT_METHOD(setIBGLogPrintsToConsole:(BOOL) printsToConsole) { + IBGLog.printsToConsole = printsToConsole; } RCT_EXPORT_METHOD(logVerbose:(NSString *)log) { - [Instabug logVerbose:log]; + [IBGLog logVerbose:log]; } RCT_EXPORT_METHOD(logDebug:(NSString *)log) { - [Instabug logDebug:log]; + [IBGLog logDebug:log]; } RCT_EXPORT_METHOD(logInfo:(NSString *)log) { - [Instabug logInfo:log]; + [IBGLog logInfo:log]; } RCT_EXPORT_METHOD(logWarn:(NSString *)log) { - [Instabug logWarn:log]; + [IBGLog logWarn:log]; } RCT_EXPORT_METHOD(logError:(NSString *)log) { - [Instabug logError:log]; + [IBGLog logError:log]; } RCT_EXPORT_METHOD(setSurveysEnabled:(BOOL)surveysEnabled) { - [Instabug setSurveysEnabled:surveysEnabled]; + IBGSurveys.enabled = surveysEnabled; } RCT_EXPORT_METHOD(showSurveysIfAvailable) { - [Instabug showSurveyIfAvailable]; + [IBGSurveys showSurveyIfAvailable]; } RCT_EXPORT_METHOD(setWillShowSurveyHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { - [Instabug setWillShowSurveyHandler:^{ + IBGSurveys.willShowSurveyHandler = ^{ [self sendEventWithName:@"IBGWillShowSurvey" body:nil]; - }]; + }; } else { - [Instabug setWillShowSurveyHandler:nil]; + IBGSurveys.willShowSurveyHandler = nil; } } RCT_EXPORT_METHOD(setDidDismissSurveyHandler:(RCTResponseSenderBlock)callBack) { if (callBack != nil) { - [Instabug setDidDismissSurveyHandler:^{ + IBGSurveys.didDismissSurveyHandler = ^{ [self sendEventWithName:@"IBGDidDismissSurvey" body:nil]; - }]; + }; } else { - [Instabug setDidDismissSurveyHandler:nil]; + IBGSurveys.didDismissSurveyHandler = nil; } } @@ -391,15 +494,15 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(setAutoShowingSurveysEnabled:(BOOL)autoShowingSurveysEnabled) { - [Instabug setAutoShowingSurveysEnabled:autoShowingSurveysEnabled]; + IBGSurveys.autoShowingEnabled = autoShowingSurveysEnabled; } RCT_EXPORT_METHOD(setVideoRecordingFloatingButtonPosition:(IBGPosition)position) { - [Instabug setVideoRecordingFloatingButtonPosition:position]; +// IBGBugReporting.videoRecordingFloatingButtonPosition = position; } RCT_EXPORT_METHOD(setThresholdForReshowingSurveyAfterDismiss:(NSInteger)sessionCount daysCount:(NSInteger)daysCount) { - [Instabug setThresholdForReshowingSurveyAfterDismiss:sessionCount daysCount:daysCount]; + [IBGSurveys setThresholdForReshowingSurveyAfterDismiss:sessionCount daysCount:daysCount]; } RCT_EXPORT_METHOD(setSessionProfilerEnabled:(BOOL)sessionProfilerEnabled) { @@ -407,23 +510,23 @@ - (dispatch_queue_t)methodQueue { } RCT_EXPORT_METHOD(showFeatureRequests) { - [Instabug showFeatureRequests]; + [IBGFeatureRequests show]; } RCT_EXPORT_METHOD(setShouldShowSurveysWelcomeScreen:(BOOL)shouldShowWelcomeScreen) { - [Instabug setShouldShowSurveysWelcomeScreen:shouldShowWelcomeScreen]; + IBGSurveys.shouldShowWelcomeScreen = shouldShowWelcomeScreen; } RCT_EXPORT_METHOD(setEmailFieldRequiredForActions:(BOOL)isEmailFieldRequired forAction:(NSArray *)actionTypesArray) { - IBGActionType actionTypes = 0; + IBGAction actionTypes = 0; for (NSNumber *boxedValue in actionTypesArray) { actionTypes |= [boxedValue intValue]; } - [Instabug setEmailFieldRequired:isEmailFieldRequired forAction:actionTypes]; -} + [IBGFeatureRequests setEmailFieldRequired:isEmailFieldRequired forAction:actionTypes]; + } RCT_EXPORT_METHOD(showWelcomeMessageWithMode:(IBGWelcomeMessageMode)welcomeMessageMode) { [Instabug showWelcomeMessageWithMode:welcomeMessageMode]; @@ -433,6 +536,18 @@ - (dispatch_queue_t)methodQueue { [Instabug setWelcomeMessageMode:welcomeMessageMode]; } +RCT_EXPORT_METHOD(setEmailFieldRequiredForFeatureRequests:(BOOL)isEmailFieldRequired + forAction:(NSArray *)actionTypesArray) { + IBGAction actionTypes = 0; + + for (NSNumber *boxedValue in actionTypesArray) { + actionTypes |= [boxedValue intValue]; + } + + [IBGFeatureRequests setEmailFieldRequired:false forAction:actionTypes]; +} + + RCT_EXPORT_METHOD(isRunningLive:(RCTResponseSenderBlock)callback) { BOOL result = NO; #if TARGET_OS_SIMULATOR @@ -509,6 +624,12 @@ - (NSDictionary *)constantsToExport @"localeSwedish": @(IBGLocaleSwedish), @"localeTurkish": @(IBGLocaleTurkish), + + @"invocationOptionsEmailFieldHidden": @(IBGBugReportingInvocationOptionEmailFieldHidden), + @"invocationOptionsEmailFieldOptional": @(IBGBugReportingInvocationOptionEmailFieldOptional), + @"invocationOptionsCommentFieldRequired": @(IBGBugReportingInvocationOptionCommentFieldRequired), + @"invocationOptionsDisablePostSendingDialog": @(IBGBugReportingInvocationOptionDisablePostSendingDialog), + @"colorThemeLight": @(IBGColorThemeLight), @"colorThemeDark": @(IBGColorThemeDark), diff --git a/ios/RNInstabug/RCTConvert+InstabugEnums.m b/ios/RNInstabug/RCTConvert+InstabugEnums.m index 2d95a4abe..0aae6afb1 100644 --- a/ios/RNInstabug/RCTConvert+InstabugEnums.m +++ b/ios/RNInstabug/RCTConvert+InstabugEnums.m @@ -28,12 +28,25 @@ @implementation RCTConvert (InstabugEnums) @"invocationModeChatsList": @(IBGInvocationModeChatsList) }), IBGInvocationModeNA, integerValue); +RCT_ENUM_CONVERTER(IBGBugReportingInvocationOption, (@{ + @"invocationOptionsEmailFieldHidden": @(IBGBugReportingInvocationOptionEmailFieldHidden), + @"invocationOptionsEmailFieldOptional": @(IBGBugReportingInvocationOptionEmailFieldOptional), + @"invocationOptionsCommentFieldRequired": @(IBGBugReportingInvocationOptionCommentFieldRequired), + @"invocationOptionsDisablePostSendingDialog": @(IBGBugReportingInvocationOptionDisablePostSendingDialog) + }), 0, integerValue); + RCT_ENUM_CONVERTER(IBGDismissType, (@{ @"dismissTypeSubmit": @(IBGDismissTypeSubmit), @"dismissTypeCancel": @(IBGDismissTypeCancel), @"dismissTypeAddAtttachment": @(IBGDismissTypeAddAttachment) }), IBGDismissTypeSubmit, integerValue) +RCT_ENUM_CONVERTER(IBGPromptOption, (@{ + @"promptOptionChat": @(IBGPromptOptionChat), + @"promptOptionBug": @(IBGPromptOptionBug), + @"promptOptionBugFeedback": @(IBGPromptOptionFeedback) + }), IBGPromptOptionChat, integerValue) + RCT_ENUM_CONVERTER(IBGUserStepsMode, (@{ @"reproStepsEnabled": @(IBGUserStepsModeEnable), @"reproStepsDisabled": @(IBGUserStepsModeDisable), @@ -99,7 +112,7 @@ @implementation RCTConvert (InstabugEnums) }), IBGWelcomeMessageModeLive, integerValue); -RCT_ENUM_CONVERTER(IBGActionType, (@{ +RCT_ENUM_CONVERTER(IBGAction, (@{ @"allActions": @(IBGActionAllActions), @"reportBug": @(IBGActionReportBug), @"requestNewFeature": @(IBGActionRequestNewFeature), diff --git a/modules/BugReporting.js b/modules/BugReporting.js new file mode 100644 index 000000000..9704e9b95 --- /dev/null +++ b/modules/BugReporting.js @@ -0,0 +1,234 @@ +import {NativeModules, NativeAppEventEmitter, DeviceEventEmitter, Platform} from "react-native"; +let {Instabug} = NativeModules; + +/** + * BugReporting + * @exports BugReporting + */ +module.exports = { + + /** + * Sets the events that invoke the feedback form. + * Default is set by `Instabug.startWithToken`. + * @param {invocationEvent} invocationEvent Array of events that invokes the + * feedback form. + */ + setInvocationEvents: function(invocationEvents) { + Instabug.setInvocationEvents(invocationEvents); + }, + + /** + * Invokes the SDK manually with the default invocation mode. + * Shows a view that asks the user whether they want to start a chat, report + * a problem or suggest an improvement. + */ + invoke: function () { + Instabug.invoke(); + }, + + /** + * Sets the invocation options. + * Default is set by `Instabug.startWithToken`. + * @param {invocationOptions} invocationOptions Array of invocation options + */ + setInvocationOptions: function(invocationOptions) { + Instabug.setInvocationOptions(invocationOptions); + }, + + /** + * Invokes the SDK with a specific mode. + * Invokes the SDK and show a specific view, instead of showing a prompt for + * users to choose from. + * @param {invocationMode} invocationMode Specifies which mode the + * SDK is going to start with. + * @param {invocationOptions} invocationOptions Specifies which mode the + * SDK is going to start with. + */ + invokeWithInvocationModeAndOptions: function (invocationMode, invocationOptions) { + Instabug.invokeWithInvocationModeAndOptions(invocationMode, invocationOptions); + }, + + /** + * Sets a block of code to be executed just before the SDK's UI is presented. + * This block is executed on the UI thread. Could be used for performing any + * UI changes before the SDK's UI is shown. + * @param {function} preInvocationHandler - A callback that gets executed before invoking the SDK + */ + onInvokeHandler: function (preInvocationHandler) { + if (Platform.OS === 'ios') { + Instabug.addListener('IBGpreInvocationHandler'); + NativeAppEventEmitter.addListener( + 'IBGpreInvocationHandler', + preInvocationHandler + ); + } else { + DeviceEventEmitter.addListener('IBGpreInvocationHandler', preInvocationHandler); + } + + Instabug.setPreInvocationHandler(preInvocationHandler); + + }, + + /** + * Sets a block of code to be executed before sending each report. + * This block is executed in the background before sending each report. Could + * be used for attaching logs and extra data to reports. + * @param {function} preSendingHandler - A callback that gets executed before sending each bug + * report. + */ + onReportSubmitHandler: function (preSendingHandler) { + if (Platform.OS === 'ios') { + Instabug.addListener('IBGpreSendingHandler'); + NativeAppEventEmitter.addListener( + 'IBGpreSendingHandler', + preSendingHandler + ); + } else { + DeviceEventEmitter.addListener('IBGpreSendingHandler', function(payload) { + preSendingHandler(payload.tagsArray, payload.consoleLogs, payload.userData, + payload.userAttributes, payload.fileAttachments); + }); + } + Instabug.setPreSendingHandler(preSendingHandler); + }, + + /** + * Sets a block of code to be executed right after the SDK's UI is dismissed. + * This block is executed on the UI thread. Could be used for performing any + * UI changes after the SDK's UI is dismissed. + * @param {function} postInvocationHandler - A callback to get executed after + * dismissing the SDK. + */ + onSDKDismissedHandler: function (postInvocationHandler) { + if (Platform.OS === 'ios') { + Instabug.addListener('IBGpostInvocationHandler'); + NativeAppEventEmitter.addListener( + 'IBGpostInvocationHandler', + function (payload) { + postInvocationHandler(payload['dismissType'], payload['reportType']); + } + ); + } else { + DeviceEventEmitter.addListener('IBGpostInvocationHandler', function(payload) { + postInvocationHandler(payload.dismissType, payload.reportType); + }); + } + + Instabug.setPostInvocationHandler(postInvocationHandler); + + }, + + /** + * Dismisses any Instabug views that are currently being shown. + */ + dismiss: function () { + Instabug.dismiss(); + }, + + /** + * Enable/Disable prompt options when SDK invoked. When only a single option is enabled it + * becomes the default + * invocation option that SDK gets invoked with and prompt options screen will not show. When + * none is enabled, Bug + * reporting becomes the default invocation option. + * + * @param {boolean} chat whether Talk to us is enable or not + * @param {boolean} bug whether Report a Problem is enable or not + * @param {boolean} feedback whether General Feedback is enable or not + * */ + setPromptOptionsEnabled: function (chat, bug, feedback) { + Instabug.setPromptOptionsEnabled(chat, bug, feedback); + }, + + /** + * Sets the threshold value of the shake gesture for iPhone/iPod Touch + * Default for iPhone is 2.5. + * @param {number} iPhoneShakingThreshold Threshold for iPhone. + */ + setShakingThresholdForiPhone: function (iPhoneShakingThreshold) { + if (Platform.OS === 'ios') + Instabug.setShakingThresholdForiPhone(iPhoneShakingThreshold); + }, + + /** + * Sets the threshold value of the shake gesture for iPad. + * Default for iPad is 0.6. + * @param {number} iPadShakingThreshold Threshold for iPad. + */ + setShakingThresholdForiPad: function (iPadShakingThreshold) { + if (Platform.OS === 'ios') + Instabug.setShakingThresholdForiPad(iPadShakingThreshold); + }, + + /** + * Sets the threshold value of the shake gesture for android devices. + * Default for android is an integer value equals 350. + * you could increase the shaking difficulty level by + * increasing the `350` value and vice versa + * @param {number} androidThreshold Threshold for android devices. + */ + setShakingThresholdForAndroid: function (androidThreshold) { + if (Platform.OS === 'android') + Instabug.setShakingThresholdForAndroid(androidThreshold); + }, + + /** + * Sets whether the extended bug report mode should be disabled, enabled with + * required fields or enabled with optional fields. + * @param {extendedBugReportMode} extendedBugReportMode An enum to disable + * the extended bug report mode, enable it + * with required or with optional fields. + */ + setExtendedBugReportMode: function (extendedBugReportMode) { + Instabug.setExtendedBugReportMode(extendedBugReportMode); + }, + + /** + * The event used to invoke the feedback form + * @readonly + * @enum {number} + */ + invocationEvent: { + none: Instabug.invocationEventNone, + shake: Instabug.invocationEventShake, + screenshot: Instabug.invocationEventScreenshot, + twoFingersSwipe: Instabug.invocationEventTwoFingersSwipeLeft, + floatingButton: Instabug.invocationEventFloatingButton + }, + + /** + * The mode used upon invocating the SDK + * @readonly + * @enum {number} + */ + invocationMode: { + NA: Instabug.invocationModeNA, + newBug: Instabug.invocationModeNewBug, + newFeedback: Instabug.invocationModeNewFeedback, + newChat: Instabug.invocationModeNewChat, + chatsList: Instabug.invocationModeChatsList + }, + + /** + * The options used upon invocating the SDK + * @readonly + * @enum {number} + */ + invocationOptions: { + emailFieldHidden: Instabug.emailFieldHidden, + emailFieldOptional: Instabug.emailFieldOptional, + commentFieldRequired: Instabug.commentFieldRequired, + disablePostSendingDialog: Instabug.disablePostSendingDialog + }, + + /** + * The extended bug report mode + * @readonly + * @enum {number} + */ + extendedBugReportMode: { + enabledWithRequiredFields: Instabug.enabledWithRequiredFields, + enabledWithOptionalFields: Instabug.enabledWithOptionalFields, + disabled: Instabug.disabled + } +} \ No newline at end of file diff --git a/modules/FeatureRequests.js b/modules/FeatureRequests.js new file mode 100644 index 000000000..44446a4da --- /dev/null +++ b/modules/FeatureRequests.js @@ -0,0 +1,43 @@ +import {NativeModules} from "react-native"; +let {Instabug} = NativeModules; + +/** + * FeatureRequests + * @exports FeatureRequests + */ +module.exports = { + + /** + * Sets whether users are required to enter an email address or not when + * sending reports. + * Defaults to YES. + * @param {boolean} isEmailFieldRequired A boolean to indicate whether email + * field is required or not. + * @param {actionTypes} actionTypes An enum that indicates which action + * types will have the isEmailFieldRequired + */ + + setEmailFieldRequired: function(isEmailFieldRequired, actionTypes) { + Instabug.setEmailFieldRequiredForFeatureRequests(isEmailFieldRequired, actionTypes); + }, + + /** + * Shows the UI for feature requests list + * + */ + show: function() { + Instabug.showFeatureRequests(); + }, + + /** + * Instabug action types. + * @readonly + * @enum {number} + */ + actionTypes: { + allActions: Instabug.allActions, + reportBug: Instabug.reportBugAction, + requestNewFeature: Instabug.requestNewFeature, + addCommentToFeature: Instabug.addCommentToFeature + } +} \ No newline at end of file diff --git a/modules/Surveys.js b/modules/Surveys.js new file mode 100644 index 000000000..dbf597db4 --- /dev/null +++ b/modules/Surveys.js @@ -0,0 +1,129 @@ +import {NativeModules, NativeAppEventEmitter, DeviceEventEmitter, Platform} from "react-native"; +let {Instabug} = NativeModules; + +/** + * Surveys + * @exports Surveys + */ +module.exports = { + + /** + * @summary Shows one of the surveys that were not shown before, that also have conditions + * that match the current device/user. + * Does nothing if there are no available surveys or if a survey has already been shown + * in the current session. + */ + showSurveyIfAvailable: function () { + Instabug.showSurveysIfAvailable() + }, + + /** + * Sets a threshold for numbers of sessions and another for number of days + * required before a survey, that has been dismissed once, would show again. + * @param {number} sessionCount Number of sessions required to be + * initialized before a dismissed survey can be shown again. + * @param {number} daysCount Number of days required to pass before a + * dismissed survey can be shown again. + */ + setThresholdForReshowingSurveyAfterDismiss: function (sessionCount, daysCount) { + Instabug.setThresholdForReshowingSurveyAfterDismiss(sessionCount, daysCount); + }, + + /** + * Returns an array containing the available surveys. + * @param {availableSurveysCallback} availableSurveysCallback callback with + * argument available surveys + * + */ + getAvailableSurveys: function(availableSurveysCallback) { + Instabug.getAvailableSurveys(availableSurveysCallback) + }, + + /** + * Sets whether auto surveys showing are enabled or not. + * @param autoShowingSurveysEnabled A boolean to indicate whether the + * surveys auto showing are enabled or not. + * + */ + setAutoShowingEnabled: function(autoShowingSurveysEnabled) { + Instabug.setAutoShowingSurveysEnabled(autoShowingSurveysEnabled); + }, + + /** + * @summary Sets a block of code to be executed just before the survey's UI is presented. + * This block is executed on the UI thread. Could be used for performing any UI changes before + * the survey's UI is shown. + * @param {function} willShowSurveyHandler - A block of code that gets executed before + * presenting the survey's UI. + */ + onShowCallback: function (willShowSurveyHandler) { + if (Platform.OS === 'ios') { + Instabug.addListener('IBGWillShowSurvey'); + NativeAppEventEmitter.addListener( + 'IBGWillShowSurvey', + willShowSurveyHandler + ); + } else { + DeviceEventEmitter.addListener('IBGWillShowSurvey', willShowSurveyHandler); + } + + Instabug.setWillShowSurveyHandler(willShowSurveyHandler); + + }, + + /** + * @summary Sets a block of code to be executed right after the survey's UI is dismissed. + * This block is executed on the UI thread. Could be used for performing any UI + * changes after the survey's UI is dismissed. + * @param {function} didDismissSurveyHandler - A block of code that gets executed after + * the survey's UI is dismissed. + */ + onDismissCallback: function (didDismissSurveyHandler) { + if (Platform.OS === 'ios') { + Instabug.addListener('IBGDidDismissSurvey'); + NativeAppEventEmitter.addListener( + 'IBGDidDismissSurvey', + didDismissSurveyHandler + ); + } else { + DeviceEventEmitter.addListener('IBGDidDismissSurvey', didDismissSurveyHandler); + } + + Instabug.setDidDismissSurveyHandler(didDismissSurveyHandler); + + }, + + /** + * Shows survey with a specific token. + * Does nothing if there are no available surveys with that specific token. + * Answered and cancelled surveys won't show up again. + * @param {string} surveyToken - A String with a survey token. + * + */ + showSurvey: function (surveyToken) { + Instabug.showSurveyWithToken(surveyToken); + }, + + /** + * Returns true if the survey with a specific token was answered before. + * Will return false if the token does not exist or if the survey was not answered before. + * @param {string} surveyToken - A String with a survey token. + * @param {function} surveyTokenCallback callback with argument as the desired value of the whether + * the survey has been responded to or not. + * + */ + hasRespondedToSurvey: function (surveyToken, surveyTokenCallback) { + Instabug.hasRespondedToSurveyWithToken(surveyToken, surveyTokenCallback); + }, + + /** + * Setting an option for all the surveys to show a welcome screen before + * the user starts taking the survey. + * @param shouldShowWelcomeScreen A boolean for setting whether the + * welcome screen should show. + * + */ + setShouldShowWelcomeScreen: function(shouldShowWelcomeScreen) { + Instabug.setShouldShowSurveysWelcomeScreen(shouldShowWelcomeScreen); + }, +} \ No newline at end of file diff --git a/package.json b/package.json index 3841f8fdc..4f020ef64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "instabug-reactnative", - "version": "2.13.3", + "version": "8.0.0", "description": "React Native plugin for integrating the Instabug SDK", "main": "index.js", "repository": {