diff --git a/CHANGELOG.md b/CHANGELOG.md index bfdfad359..4aa8cf79f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [Unreleased](https://github.com/Instabug/Instabug-Flutter/compare/v11.14.0...dev) + +### Changed + +- **BREAKING** Remove deprecated APIs ([#385](https://github.com/Instabug/Instabug-Flutter/pull/385)). See migration guide for more details. + ## [11.14.0](https://github.com/Instabug/Instabug-Flutter/compare/v11.13.0...v11.14.0) (September 13, 2023) ### Added diff --git a/android/src/main/java/com/instabug/flutter/modules/ApmApi.java b/android/src/main/java/com/instabug/flutter/modules/ApmApi.java index 65e88a05e..c0a4a81e8 100644 --- a/android/src/main/java/com/instabug/flutter/modules/ApmApi.java +++ b/android/src/main/java/com/instabug/flutter/modules/ApmApi.java @@ -8,7 +8,6 @@ import com.instabug.apm.model.ExecutionTrace; import com.instabug.apm.networking.APMNetworkLogger; import com.instabug.flutter.generated.ApmPigeon; -import com.instabug.flutter.util.ArgsRegistry; import com.instabug.flutter.util.Reflection; import com.instabug.flutter.util.ThreadManager; @@ -41,7 +40,7 @@ public void setEnabled(@NonNull Boolean isEnabled) { @Override public void setColdAppLaunchEnabled(@NonNull Boolean isEnabled) { try { - APM.setAppLaunchEnabled(isEnabled); + APM.setColdAppLaunchEnabled(isEnabled); } catch (Exception e) { e.printStackTrace(); } @@ -56,16 +55,6 @@ public void setAutoUITraceEnabled(@NonNull Boolean isEnabled) { } } - @Override - public void setLogLevel(@NonNull String level) { - try { - final int resolvedLevel = ArgsRegistry.logLevels.get(level); - APM.setLogLevel(resolvedLevel); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Override public void startExecutionTrace(@NonNull String id, @NonNull String name, ApmPigeon.Result result) { ThreadManager.runOnBackground( diff --git a/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java b/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java index c5292b9c4..d10434b22 100644 --- a/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java +++ b/android/src/main/java/com/instabug/flutter/modules/InstabugApi.java @@ -275,28 +275,6 @@ public void run() { ); } - @Override - public void setDebugEnabled(@NonNull Boolean enabled) { - Instabug.setDebugEnabled(enabled); - } - - @Override - public void setSdkDebugLogsLevel(@NonNull String level) { - // iOS Only - } - - @SuppressWarnings("deprecation") - @Override - @Deprecated() - public void setReproStepsMode(@NonNull String mode) { - try { - final State resolvedMode = ArgsRegistry.reproStates.get(mode); - Instabug.setReproStepsState(resolvedMode); - } catch (Exception e) { - e.printStackTrace(); - } - } - @Override public void setReproStepsConfig(@Nullable String bugMode, @Nullable String crashMode) { try { @@ -394,16 +372,6 @@ public void clearFileAttachments() { Instabug.clearFileAttachment(); } - @Override - public void enableAndroid() { - Instabug.enable(); - } - - @Override - public void disableAndroid() { - Instabug.disable(); - } - @Override public void networkLog(@NonNull Map data) { try { diff --git a/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java b/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java index 6beba4d52..a94485952 100644 --- a/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java +++ b/android/src/main/java/com/instabug/flutter/util/ArgsRegistry.java @@ -16,7 +16,6 @@ import com.instabug.library.invocation.util.InstabugFloatingButtonEdge; import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition; import com.instabug.library.ui.onboarding.WelcomeMessage; -import com.instabug.library.visualusersteps.State; import java.util.HashMap; import java.util.Objects; @@ -34,23 +33,10 @@ public T get(Object key) { public static final ArgsMap sdkLogLevels = new ArgsMap() {{ put("LogLevel.none", LogLevel.NONE); put("LogLevel.error", LogLevel.ERROR); - put("LogLevel.warning", LogLevel.ERROR); // Deprecated - put("LogLevel.info", LogLevel.DEBUG); // Deprecated put("LogLevel.debug", LogLevel.DEBUG); put("LogLevel.verbose", LogLevel.VERBOSE); }}; - @SuppressWarnings("DeprecatedIsStillUsed") - @Deprecated() - public static final ArgsMap logLevels = new ArgsMap() {{ - put("LogLevel.none", com.instabug.apm.model.LogLevel.NONE); - put("LogLevel.error", com.instabug.apm.model.LogLevel.ERROR); - put("LogLevel.warning", com.instabug.apm.model.LogLevel.WARNING); - put("LogLevel.info", com.instabug.apm.model.LogLevel.INFO); - put("LogLevel.debug", com.instabug.apm.model.LogLevel.DEBUG); - put("LogLevel.verbose", com.instabug.apm.model.LogLevel.VERBOSE); - }}; - public static ArgsMap invocationEvents = new ArgsMap() {{ put("InvocationEvent.none", InstabugInvocationEvent.NONE); put("InvocationEvent.shake", InstabugInvocationEvent.SHAKE); @@ -112,13 +98,6 @@ public T get(Object key) { put("ExtendedBugReportMode.disabled", ExtendedBugReport.State.DISABLED); }}; - @Deprecated() - public static final ArgsMap reproStates = new ArgsMap() {{ - put("ReproStepsMode.enabledWithNoScreenshots", State.ENABLED_WITH_NO_SCREENSHOTS); - put("ReproStepsMode.enabled", State.ENABLED); - put("ReproStepsMode.disabled", State.DISABLED); - }}; - public static final ArgsMap reproModes = new ArgsMap() {{ put("ReproStepsMode.enabledWithNoScreenshots", ReproMode.EnableWithNoScreenshots); put("ReproStepsMode.enabled", ReproMode.EnableWithScreenshots); @@ -158,7 +137,6 @@ public T get(Object key) { put("CustomTextPlaceHolderKey.shakeHint", Key.SHAKE_HINT); put("CustomTextPlaceHolderKey.swipeHint", Key.SWIPE_HINT); put("CustomTextPlaceHolderKey.invalidEmailMessage", Key.INVALID_EMAIL_MESSAGE); - put("CustomTextPlaceHolderKey.invalidCommentMessage", Key.INVALID_COMMENT_MESSAGE); put("CustomTextPlaceHolderKey.emailFieldHint", Key.EMAIL_FIELD_HINT); put("CustomTextPlaceHolderKey.commentFieldHintForBugReport", Key.COMMENT_FIELD_HINT_FOR_BUG_REPORT); put("CustomTextPlaceHolderKey.commentFieldHintForFeedback", Key.COMMENT_FIELD_HINT_FOR_FEEDBACK); diff --git a/android/src/test/java/com/instabug/flutter/ApmApiTest.java b/android/src/test/java/com/instabug/flutter/ApmApiTest.java index b1e59097e..42182ecfc 100644 --- a/android/src/test/java/com/instabug/flutter/ApmApiTest.java +++ b/android/src/test/java/com/instabug/flutter/ApmApiTest.java @@ -18,7 +18,6 @@ import com.instabug.flutter.modules.ApmApi; import com.instabug.flutter.util.GlobalMocks; import com.instabug.flutter.util.MockReflected; -import com.instabug.library.LogLevel; import org.json.JSONObject; import org.junit.After; @@ -82,14 +81,13 @@ public void testSetEnabled() { mAPM.verify(() -> APM.setEnabled(isEnabled)); } - @SuppressWarnings("deprecation") @Test public void testSetColdAppLaunchEnabled() { boolean isEnabled = false; api.setColdAppLaunchEnabled(isEnabled); - mAPM.verify(() -> APM.setAppLaunchEnabled(isEnabled)); + mAPM.verify(() -> APM.setColdAppLaunchEnabled(isEnabled)); } @Test @@ -101,16 +99,6 @@ public void testSetAutoUITraceEnabled() { mAPM.verify(() -> APM.setAutoUITraceEnabled(isEnabled)); } - @SuppressWarnings("deprecation") - @Test - public void testSetLogLevel() { - String logLevel = "LogLevel.none"; - - api.setLogLevel(logLevel); - - mAPM.verify(() -> APM.setLogLevel(LogLevel.NONE)); - } - @Test public void testStartExecutionTraceWhenTraceNotNull() { String expectedId = "trace-id"; diff --git a/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java b/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java index ef1b9c21c..04082b07e 100644 --- a/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java +++ b/android/src/test/java/com/instabug/flutter/ArgsRegistryTest.java @@ -17,7 +17,6 @@ import com.instabug.library.invocation.util.InstabugFloatingButtonEdge; import com.instabug.library.invocation.util.InstabugVideoRecordingButtonPosition; import com.instabug.library.ui.onboarding.WelcomeMessage; -import com.instabug.library.visualusersteps.State; import org.junit.Test; @@ -36,22 +35,6 @@ public void testSdkLogLevels() { } } - @Test - public void testLogLevels() { - Integer[] values = { - com.instabug.apm.model.LogLevel.NONE, - com.instabug.apm.model.LogLevel.ERROR, - com.instabug.apm.model.LogLevel.WARNING, - com.instabug.apm.model.LogLevel.INFO, - com.instabug.apm.model.LogLevel.DEBUG, - com.instabug.apm.model.LogLevel.VERBOSE, - }; - - for (Integer value : values) { - assertTrue(ArgsRegistry.logLevels.containsValue(value)); - } - } - @Test public void testInvocationEvents() { InstabugInvocationEvent[] values = { @@ -183,21 +166,6 @@ public void testExtendedBugReportStates() { } } - - @SuppressWarnings("deprecation") - @Test - public void testReproStates() { - State[] values = { - State.ENABLED_WITH_NO_SCREENSHOTS, - State.ENABLED, - State.DISABLED, - }; - - for (State value : values) { - assertTrue(ArgsRegistry.reproStates.containsValue(value)); - } - } - @Test public void testReproModes() { Integer[] values = { @@ -255,7 +223,6 @@ public void testPlaceholder() { Key.SHAKE_HINT, Key.SWIPE_HINT, Key.INVALID_EMAIL_MESSAGE, - Key.INVALID_COMMENT_MESSAGE, Key.EMAIL_FIELD_HINT, Key.COMMENT_FIELD_HINT_FOR_BUG_REPORT, Key.COMMENT_FIELD_HINT_FOR_FEEDBACK, diff --git a/android/src/test/java/com/instabug/flutter/InstabugApiTest.java b/android/src/test/java/com/instabug/flutter/InstabugApiTest.java index 14ce73325..82b92e3c3 100644 --- a/android/src/test/java/com/instabug/flutter/InstabugApiTest.java +++ b/android/src/test/java/com/instabug/flutter/InstabugApiTest.java @@ -7,7 +7,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -39,7 +38,6 @@ import com.instabug.library.invocation.InstabugInvocationEvent; import com.instabug.library.model.NetworkLog; import com.instabug.library.ui.onboarding.WelcomeMessage; -import com.instabug.library.visualusersteps.State; import org.json.JSONObject; import org.junit.After; @@ -377,26 +375,6 @@ public void testGetUserAttributes() { mInstabug.verify(Instabug::getAllUserAttributes); } - @SuppressWarnings("deprecation") - @Test - public void testSetDebugEnabled() { - boolean isEnabled = true; - - api.setDebugEnabled(isEnabled); - - mInstabug.verify(() -> Instabug.setDebugEnabled(isEnabled)); - } - - @SuppressWarnings("deprecation") - @Test - public void testSetReproStepsMode() { - String mode = "ReproStepsMode.enabled"; - - api.setReproStepsMode(mode); - - mInstabug.verify(() -> Instabug.setReproStepsState(State.ENABLED)); - } - @Test public void testSetReproStepsConfig() { String bug = "ReproStepsMode.enabled"; diff --git a/example/ios/InstabugTests/ApmApiTests.m b/example/ios/InstabugTests/ApmApiTests.m index c5a8862dd..f853295d1 100644 --- a/example/ios/InstabugTests/ApmApiTests.m +++ b/example/ios/InstabugTests/ApmApiTests.m @@ -44,7 +44,7 @@ - (void)testSetColdAppLaunchEnabled { [self.api setColdAppLaunchEnabledIsEnabled:isEnabled error:&error]; - OCMVerify([self.mAPM setAppLaunchEnabled:YES]); + OCMVerify([self.mAPM setColdAppLaunchEnabled:YES]); } - (void)testSetAutoUITraceEnabled { @@ -56,15 +56,6 @@ - (void)testSetAutoUITraceEnabled { OCMVerify([self.mAPM setAutoUITraceEnabled:YES]); } -- (void)testSetLogLevel { - NSString *level = @"LogLevel.warning"; - FlutterError *error; - - [self.api setLogLevelLevel:level error:&error]; - - OCMVerify([self.mAPM setLogLevel:IBGLogLevelWarning]); -} - - (void)testStartExecutionTraceWhenTraceNotNil { NSString *expectedId = @"trace-id"; NSString *name = @"trace-name"; diff --git a/example/ios/InstabugTests/ArgsRegistryTests.m b/example/ios/InstabugTests/ArgsRegistryTests.m index f3790f407..bded153fd 100644 --- a/example/ios/InstabugTests/ArgsRegistryTests.m +++ b/example/ios/InstabugTests/ArgsRegistryTests.m @@ -19,21 +19,6 @@ - (void)testSdkLogLevels { } } -- (void)testLogLevels { - NSArray *values = @[ - @(IBGLogLevelNone), - @(IBGLogLevelError), - @(IBGLogLevelWarning), - @(IBGLogLevelInfo), - @(IBGLogLevelDebug), - @(IBGLogLevelVerbose) - ]; - - for (NSNumber *value in values) { - XCTAssertTrue([[ArgsRegistry.logLevels allValues] containsObject:value]); - } -} - - (void)testInvocationEvents { NSArray *values = @[ @(IBGInvocationEventNone), @@ -208,7 +193,6 @@ - (void)testPlaceholders { kIBGShakeStartAlertTextStringName, kIBGEdgeSwipeStartAlertTextStringName, kIBGInvalidEmailMessageStringName, - kIBGInvalidCommentMessageStringName, kIBGInvocationTitleStringName, kIBGAskAQuestionStringName, kIBGReportBugStringName, diff --git a/example/ios/InstabugTests/InstabugApiTests.m b/example/ios/InstabugTests/InstabugApiTests.m index 0fd431260..2e61a8175 100644 --- a/example/ios/InstabugTests/InstabugApiTests.m +++ b/example/ios/InstabugTests/InstabugApiTests.m @@ -282,24 +282,6 @@ - (void)testGetUserAttributes { [self waitForExpectations:@[expectation] timeout:5.0]; } -- (void)testSetSdkDebugLogsLevel { - NSString *level = @"IBGSDKDebugLogsLevel.error"; - FlutterError *error; - - [self.api setSdkDebugLogsLevelLevel:level error:&error]; - - OCMVerify([self.mInstabug setSdkDebugLogsLevel:IBGSDKDebugLogsLevelError]); -} - -- (void)testSetReproStepsMode { - NSString *mode = @"ReproStepsMode.enabled"; - FlutterError *error; - - [self.api setReproStepsModeMode:mode error:&error]; - - OCMVerify([self.mInstabug setReproStepsMode:IBGUserStepsModeEnable]); -} - - (void)testSetReproStepsConfig { NSString *bugMode = @"ReproStepsMode.enabled"; NSString *crashMode = @"ReproStepsMode.disabled"; diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index a414ee9d5..4e76bab21 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -30,4 +30,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 637e800c0a0982493b68adb612d2dd60c15c8e5c -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/ios/Classes/Modules/ApmApi.m b/ios/Classes/Modules/ApmApi.m index dbf78b048..a849df1ec 100644 --- a/ios/Classes/Modules/ApmApi.m +++ b/ios/Classes/Modules/ApmApi.m @@ -22,18 +22,13 @@ - (void)setEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable } - (void)setColdAppLaunchEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { - IBGAPM.appLaunchEnabled = [isEnabled boolValue]; + IBGAPM.coldAppLaunchEnabled = [isEnabled boolValue]; } - (void)setAutoUITraceEnabledIsEnabled:(NSNumber *)isEnabled error:(FlutterError *_Nullable *_Nonnull)error { IBGAPM.autoUITraceEnabled = [isEnabled boolValue]; } -- (void)setLogLevelLevel:(NSString *)level error:(FlutterError *_Nullable *_Nonnull)error { - IBGLogLevel resolvedLevel = (ArgsRegistry.logLevels[level]).integerValue; - IBGAPM.logLevel = resolvedLevel; -} - - (void)startExecutionTraceId:(NSString *)id name:(NSString *)name completion:(void(^)(NSString *_Nullable, FlutterError *_Nullable))completion { IBGExecutionTrace *trace = [IBGAPM startExecutionTraceWithName:name]; diff --git a/ios/Classes/Modules/InstabugApi.m b/ios/Classes/Modules/InstabugApi.m index 97a7ab020..a9736275a 100644 --- a/ios/Classes/Modules/InstabugApi.m +++ b/ios/Classes/Modules/InstabugApi.m @@ -149,20 +149,6 @@ - (void)getUserAttributesWithCompletion:(nonnull void (^)(NSDictionary *)data error:(FlutterError *_Nullable *_Nonnull)error { NSString *url = data[@"url"]; NSString *method = data[@"method"]; diff --git a/ios/Classes/Util/ArgsRegistry.h b/ios/Classes/Util/ArgsRegistry.h index 5d9fb6263..d97b3fd23 100644 --- a/ios/Classes/Util/ArgsRegistry.h +++ b/ios/Classes/Util/ArgsRegistry.h @@ -6,7 +6,6 @@ typedef NSDictionary ArgsDictionary; @interface ArgsRegistry : NSObject + (ArgsDictionary *)sdkLogLevels; -+ (ArgsDictionary *)logLevels __deprecated_msg("Use sdkLogLevels instead."); + (ArgsDictionary *)invocationEvents; + (ArgsDictionary *)invocationOptions; + (ArgsDictionary *)colorThemes; diff --git a/ios/Classes/Util/ArgsRegistry.m b/ios/Classes/Util/ArgsRegistry.m index dd13f46fc..2181a72e6 100644 --- a/ios/Classes/Util/ArgsRegistry.m +++ b/ios/Classes/Util/ArgsRegistry.m @@ -4,28 +4,10 @@ @implementation ArgsRegistry + (ArgsDictionary *)sdkLogLevels { return @{ - @"LogLevel.none" : @(IBGLogLevelNone), + @"LogLevel.none" : @(IBGSDKDebugLogsLevelNone), @"LogLevel.error" : @(IBGSDKDebugLogsLevelError), - @"LogLevel.warning" : @(IBGSDKDebugLogsLevelError), // Deprecated - @"LogLevel.info" : @(IBGSDKDebugLogsLevelDebug), // Deprecated @"LogLevel.debug" : @(IBGSDKDebugLogsLevelDebug), @"LogLevel.verbose" : @(IBGSDKDebugLogsLevelVerbose), - - @"IBGSDKDebugLogsLevel.verbose" : @(IBGSDKDebugLogsLevelVerbose), // Deprecated - @"IBGSDKDebugLogsLevel.debug" : @(IBGSDKDebugLogsLevelDebug), // Deprecated - @"IBGSDKDebugLogsLevel.error" : @(IBGSDKDebugLogsLevelError), // Deprecated - @"IBGSDKDebugLogsLevel.none" : @(IBGSDKDebugLogsLevelNone), // Deprecated - }; -} - -+ (ArgsDictionary *)logLevels { - return @{ - @"LogLevel.none" : @(IBGLogLevelNone), - @"LogLevel.error" : @(IBGLogLevelError), - @"LogLevel.warning" : @(IBGLogLevelWarning), - @"LogLevel.info" : @(IBGLogLevelInfo), - @"LogLevel.debug" : @(IBGLogLevelDebug), - @"LogLevel.verbose" : @(IBGLogLevelVerbose) }; } @@ -155,7 +137,6 @@ + (ArgsDictionary *)locales { @"CustomTextPlaceHolderKey.shakeHint" : kIBGShakeStartAlertTextStringName, @"CustomTextPlaceHolderKey.swipeHint" : kIBGEdgeSwipeStartAlertTextStringName, @"CustomTextPlaceHolderKey.invalidEmailMessage" : kIBGInvalidEmailMessageStringName, - @"CustomTextPlaceHolderKey.invalidCommentMessage" : kIBGInvalidCommentMessageStringName, @"CustomTextPlaceHolderKey.invocationHeader" : kIBGInvocationTitleStringName, @"CustomTextPlaceHolderKey.reportQuestion" : kIBGAskAQuestionStringName, @"CustomTextPlaceHolderKey.reportBug" : kIBGReportBugStringName, @@ -210,7 +191,7 @@ + (ArgsDictionary *)locales { @"CustomTextPlaceHolderKey.reproStepsListDescription" : kIBGReproStepsListHeader, @"CustomTextPlaceHolderKey.reproStepsListEmptyStateDescription" : kIBGReproStepsListEmptyStateLabel, @"CustomTextPlaceHolderKey.reproStepsListItemTitle" : kIBGReproStepsListItemName, - + @"CustomTextPlaceHolderKey.okButtonText" : kIBGOkButtonTitleStringName, @"CustomTextPlaceHolderKey.audio" : kIBGAudioStringName, @"CustomTextPlaceHolderKey.image" : kIBGImageStringName, diff --git a/lib/src/modules/apm.dart b/lib/src/modules/apm.dart index a2aacd6eb..6f71a9db4 100644 --- a/lib/src/modules/apm.dart +++ b/lib/src/modules/apm.dart @@ -5,7 +5,6 @@ import 'dart:async'; import 'package:instabug_flutter/src/generated/apm.api.g.dart'; import 'package:instabug_flutter/src/models/network_data.dart'; import 'package:instabug_flutter/src/models/trace.dart'; -import 'package:instabug_flutter/src/modules/instabug.dart'; import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; import 'package:instabug_flutter/src/utils/ibg_date_time.dart'; import 'package:meta/meta.dart'; @@ -26,13 +25,6 @@ class APM { return _host.setEnabled(isEnabled); } - /// Sets log Level to determine level of details in a log - /// [logLevel] Enum value to determine the level - @Deprecated("Use [Instabug.init]'s [debugLogsLevel] parameter instead.") - static Future setLogLevel(LogLevel logLevel) async { - return _host.setLogLevel(logLevel.toString()); - } - /// Enables or disables cold app launch tracking. /// [boolean] isEnabled static Future setColdAppLaunchEnabled(bool isEnabled) async { diff --git a/lib/src/modules/instabug.dart b/lib/src/modules/instabug.dart index ac62c509d..eab0fe54d 100644 --- a/lib/src/modules/instabug.dart +++ b/lib/src/modules/instabug.dart @@ -58,24 +58,16 @@ enum IBGLocale { enum LogLevel { none, error, - @Deprecated('Use [LogLevel.error] instead.') - warning, - @Deprecated('Use [LogLevel.debug] instead.') - info, debug, verbose, } -@Deprecated("Use [LogLevel] instead.") -enum IBGSDKDebugLogsLevel { verbose, debug, error, none } - enum ColorTheme { dark, light } enum CustomTextPlaceHolderKey { shakeHint, swipeHint, invalidEmailMessage, - invalidCommentMessage, invocationHeader, reportQuestion, reportBug, @@ -179,19 +171,6 @@ class Instabug { ); } - @Deprecated( - "Use [Instabug.init] instead.", - ) - static Future start( - String token, - List invocationEvents, - ) async { - return init( - token: token, - invocationEvents: invocationEvents, - ); - } - /// Shows the welcome message in a specific mode. /// [welcomeMessageMode] is an enum to set the welcome message mode to live, or beta. static Future showWelcomeMessageWithMode( @@ -222,15 +201,6 @@ class Instabug { return _host.setLocale(locale.toString()); } - /// Sets the verbosity level of logs used to debug The SDK. The default value in debug - /// mode is sdkDebugLogsLevelVerbose and in production is sdkDebugLogsLevelError. - @Deprecated("Use [Instabug.init]'s [debugLogsLevel] parameter instead.") - static Future setSdkDebugLogsLevel( - IBGSDKDebugLogsLevel sdkDebugLogsLevel, - ) async { - return _host.setSdkDebugLogsLevel(sdkDebugLogsLevel.toString()); - } - /// Sets the color theme of the SDK's whole UI to the [colorTheme] given. /// It should be of type [ColorTheme]. static Future setColorTheme(ColorTheme colorTheme) async { @@ -320,16 +290,6 @@ class Instabug { return _host.setSessionProfilerEnabled(sessionProfilerEnabled); } - /// Android only - /// Enable/disable SDK logs - /// [debugEnabled] desired state of debug mode. - @Deprecated("Use [Instabug.init]'s [debugLogsLevel] parameter instead.") - static Future setDebugEnabled(bool debugEnabled) async { - if (IBGBuildInfo.instance.isAndroid) { - return _host.setDebugEnabled(debugEnabled); - } - } - /// Sets the primary color of the SDK's UI. /// Sets the color of UI elements indicating interactivity or call to action. /// [color] primaryColor A color to set the UI elements of the SDK to. @@ -391,13 +351,6 @@ class Instabug { } } - /// Sets the repro steps mode - /// [mode] repro steps mode - @Deprecated('Use [setReproStepsConfig] instead.') - static Future setReproStepsMode(ReproStepsMode reproStepsMode) async { - return _host.setReproStepsMode(reproStepsMode.toString()); - } - /// Sets the repro steps mode for bugs and crashes. /// /// [bug] repro steps mode for bug reports. @@ -457,26 +410,4 @@ class Instabug { final darkKey = await dark.obtainKey(configuration); return _host.setCustomBrandingImage(lightKey.name, darkKey.name); } - - /// Android Only - /// Enables all Instabug functionality - @Deprecated( - "Use [Instabug.setEnabled(true)] instead. This will work on both Android and iOS. ", - ) - static Future enableAndroid() async { - if (IBGBuildInfo.I.isAndroid) { - return _host.enableAndroid(); - } - } - - /// Android Only - /// Disables all Instabug functionality - @Deprecated( - "Use [Instabug.setEnabled(false)] instead. This will work on both Android and iOS. ", - ) - static Future disableAndroid() async { - if (IBGBuildInfo.I.isAndroid) { - return _host.disableAndroid(); - } - } } diff --git a/lib/src/modules/replies.dart b/lib/src/modules/replies.dart index 467deed99..95bfca636 100644 --- a/lib/src/modules/replies.dart +++ b/lib/src/modules/replies.dart @@ -6,18 +6,8 @@ import 'package:instabug_flutter/src/generated/replies.api.g.dart'; import 'package:instabug_flutter/src/utils/ibg_build_info.dart'; import 'package:meta/meta.dart'; -@Deprecated( - "Use [Replies.hasChats] return value instead of callback.", -) -typedef HasChatsCallback = void Function(bool); - typedef OnNewReplyReceivedCallback = void Function(); -@Deprecated( - "Use [Replies.getUnreadRepliesCount] return value instead of callback.", -) -typedef UnreadRepliesCountCallback = void Function(int); - class Replies implements RepliesFlutterApi { static var _host = RepliesHostApi(); static final _instance = Replies(); @@ -57,15 +47,9 @@ class Replies implements RepliesFlutterApi { /// Tells whether the user has chats already or not. /// [callback] - callback that is invoked if chats exist - static Future hasChats([ - @Deprecated( - 'Use return value instead of callback: `final count = await Replies.hasChats();`', - ) - // ignore: deprecated_member_use_from_same_package - HasChatsCallback? callback, - ]) async { + static Future hasChats() async { final hasChats = await _host.hasChats(); - callback?.call(hasChats); + return hasChats; } @@ -83,15 +67,9 @@ class Replies implements RepliesFlutterApi { /// has, then possibly notify them about it with your own UI. /// [function] callback with argument /// Notifications count, or -1 in case the SDK has not been initialized. - static Future getUnreadRepliesCount([ - @Deprecated( - 'Use return value instead of callback: `final count = await Replies.getUnreadRepliesCount();`', - ) - // ignore: deprecated_member_use_from_same_package - UnreadRepliesCountCallback? callback, - ]) async { + static Future getUnreadRepliesCount() async { final count = await _host.getUnreadRepliesCount(); - callback?.call(count); + return count; } diff --git a/lib/src/modules/surveys.dart b/lib/src/modules/surveys.dart index daa09c4cd..eb92b5d96 100644 --- a/lib/src/modules/surveys.dart +++ b/lib/src/modules/surveys.dart @@ -9,16 +9,6 @@ import 'package:meta/meta.dart'; typedef OnShowSurveyCallback = void Function(); typedef OnDismissSurveyCallback = void Function(); -@Deprecated( - "Use [Surveys.getAvailableSurveys] return value instead of callback.", -) -typedef AvailableSurveysCallback = void Function(List); - -@Deprecated( - "Use [Surveys.hasRespondedToSurvey] return value instead of callback.", -) -typedef HasRespondedToSurveyCallback = void Function(bool); - class Surveys implements SurveysFlutterApi { static var _host = SurveysHostApi(); static final _instance = Surveys(); @@ -74,15 +64,9 @@ class Surveys implements SurveysFlutterApi { /// Returns an array containing the available surveys. /// [callback] availableSurveysCallback callback with /// argument available surveys - static Future> getAvailableSurveys([ - @Deprecated( - 'Use return value instead of callback: `final surveys = await Surveys.getAvailableSurveys();`', - ) - // ignore: deprecated_member_use_from_same_package - AvailableSurveysCallback? callback, - ]) async { + static Future> getAvailableSurveys() async { final titles = await _host.getAvailableSurveys(); - callback?.call(titles.cast()); + return titles.cast(); } @@ -136,16 +120,9 @@ class Surveys implements SurveysFlutterApi { /// This block is executed on the UI thread. Could be used for performing any /// UI changes after the survey's UI is dismissed. /// [callback] A callback that gets executed after the survey's UI is dismissed. - static Future hasRespondedToSurvey( - String surveyToken, [ - @Deprecated( - 'Use return value instead of callback: `final responded = await Surveys.hasRespondedToSurvey("");`', - ) - // ignore: deprecated_member_use_from_same_package - HasRespondedToSurveyCallback? callback, - ]) async { + static Future hasRespondedToSurvey(String surveyToken) async { final hasResponded = await _host.hasRespondedToSurvey(surveyToken); - callback?.call(hasResponded); + return hasResponded; } diff --git a/pigeons/apm.api.dart b/pigeons/apm.api.dart index b4cb83550..573aad192 100644 --- a/pigeons/apm.api.dart +++ b/pigeons/apm.api.dart @@ -5,7 +5,6 @@ abstract class ApmHostApi { void setEnabled(bool isEnabled); void setColdAppLaunchEnabled(bool isEnabled); void setAutoUITraceEnabled(bool isEnabled); - void setLogLevel(String level); @async String? startExecutionTrace(String id, String name); diff --git a/pigeons/instabug.api.dart b/pigeons/instabug.api.dart index fe56c0ccf..2ed666f2c 100644 --- a/pigeons/instabug.api.dart +++ b/pigeons/instabug.api.dart @@ -39,11 +39,6 @@ abstract class InstabugHostApi { @async Map? getUserAttributes(); - void setDebugEnabled(bool enabled); - void setSdkDebugLogsLevel(String level); - - @Deprecated('Use [setReproStepsConfig] instead') - void setReproStepsMode(String mode); void setReproStepsConfig(String? bugMode, String? crashMode); void reportScreenChange(String screenName); @@ -54,8 +49,5 @@ abstract class InstabugHostApi { void addFileAttachmentWithData(Uint8List data, String fileName); void clearFileAttachments(); - void enableAndroid(); - void disableAndroid(); - void networkLog(Map data); } diff --git a/test/apm_test.dart b/test/apm_test.dart index fdbfa85ad..72d4bcf2a 100644 --- a/test/apm_test.dart +++ b/test/apm_test.dart @@ -58,17 +58,6 @@ void main() { ).called(1); }); - test('[setLogLevel] should call host method', () async { - const level = LogLevel.debug; - - // ignore: deprecated_member_use_from_same_package - await APM.setLogLevel(level); - - verify( - mHost.setLogLevel(level.toString()), - ).called(1); - }); - test('[startExecutionTrace] should call host method', () async { final id = DateTime.now(); const name = "trace"; diff --git a/test/instabug_test.dart b/test/instabug_test.dart index d54863e72..ee10d3c2e 100644 --- a/test/instabug_test.dart +++ b/test/instabug_test.dart @@ -273,41 +273,6 @@ void main() { ).called(1); }); - test('[setDebugEnabled] should call host method', () async { - const enabled = true; - when(mBuildInfo.isAndroid).thenReturn(true); - - // ignore: deprecated_member_use_from_same_package - await Instabug.setDebugEnabled(enabled); - - verify( - mHost.setDebugEnabled(enabled), - ).called(1); - }); - - test('[setSdkDebugLogsLevel] should call host method', () async { - // ignore: deprecated_member_use_from_same_package - const level = IBGSDKDebugLogsLevel.error; - - // ignore: deprecated_member_use_from_same_package - await Instabug.setSdkDebugLogsLevel(level); - - verify( - mHost.setSdkDebugLogsLevel(level.toString()), - ).called(1); - }); - - test('[setReproStepsMode] should call host method', () async { - const mode = ReproStepsMode.enabled; - - // ignore: deprecated_member_use_from_same_package - await Instabug.setReproStepsMode(mode); - - verify( - mHost.setReproStepsMode(mode.toString()), - ).called(1); - }); - test('[setReproStepsConfig] should call host method', () async { const bug = ReproStepsMode.enabled; const crash = ReproStepsMode.enabledWithNoScreenshots; @@ -400,26 +365,4 @@ void main() { mHost.clearFileAttachments(), ).called(1); }); - - test('[enableAndroid] should call host method', () async { - when(mBuildInfo.isAndroid).thenReturn(true); - - // ignore: deprecated_member_use_from_same_package - await Instabug.enableAndroid(); - - verify( - mHost.enableAndroid(), - ).called(1); - }); - - test('[disableAndroid] should call host method', () async { - when(mBuildInfo.isAndroid).thenReturn(true); - - // ignore: deprecated_member_use_from_same_package - await Instabug.disableAndroid(); - - verify( - mHost.disableAndroid(), - ).called(1); - }); }