mirror of
https://github.com/status-im/instabug-reactnative.git
synced 2025-03-03 14:40:54 +00:00
Enable setting Theme Color in android
This commit is contained in:
parent
57f716367b
commit
5c255c176c
@ -13,6 +13,7 @@ import com.instabug.library.Instabug;
|
|||||||
import com.instabug.library.internal.module.InstabugLocale;
|
import com.instabug.library.internal.module.InstabugLocale;
|
||||||
import com.instabug.library.invocation.InstabugInvocationEvent;
|
import com.instabug.library.invocation.InstabugInvocationEvent;
|
||||||
import com.instabug.library.invocation.InstabugInvocationMode;
|
import com.instabug.library.invocation.InstabugInvocationMode;
|
||||||
|
import com.instabug.library.InstabugColorTheme;
|
||||||
import com.instabug.library.logging.InstabugLog;
|
import com.instabug.library.logging.InstabugLog;
|
||||||
import com.instabug.library.bugreporting.model.ReportCategory;
|
import com.instabug.library.bugreporting.model.ReportCategory;
|
||||||
|
|
||||||
@ -56,6 +57,10 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
private final String LOCALE_SWEDISH = "swedish";
|
private final String LOCALE_SWEDISH = "swedish";
|
||||||
private final String LOCALE_TURKISH = "turkish";
|
private final String LOCALE_TURKISH = "turkish";
|
||||||
|
|
||||||
|
//Theme colors
|
||||||
|
private final String COLOR_THEME_LIGHT = "light";
|
||||||
|
private final String COLOR_THEME_DARK = "dark";
|
||||||
|
|
||||||
private Application androidApplication;
|
private Application androidApplication;
|
||||||
private Instabug mInstabug;
|
private Instabug mInstabug;
|
||||||
private InstabugInvocationEvent invocationEvent;
|
private InstabugInvocationEvent invocationEvent;
|
||||||
@ -627,6 +632,25 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets InstabugSDK theme color.
|
||||||
|
*
|
||||||
|
* @param theme which is a constant String "light" or "dark"
|
||||||
|
*/
|
||||||
|
@ReactMethod
|
||||||
|
public void setColorTheme(String theme) {
|
||||||
|
try {
|
||||||
|
if (theme.equals(COLOR_THEME_LIGHT)) {
|
||||||
|
mInstabug.setTheme(InstabugColorTheme.InstabugColorThemeLight);
|
||||||
|
|
||||||
|
} else if (theme.equals(COLOR_THEME_DARK)) {
|
||||||
|
mInstabug.setTheme(InstabugColorTheme.InstabugColorThemeDark);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to show a predefined set of categories for users to choose
|
* Allows you to show a predefined set of categories for users to choose
|
||||||
* from when reporting a bug or sending feedback. Selected category
|
* from when reporting a bug or sending feedback. Selected category
|
||||||
@ -642,7 +666,8 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
int size = categoriesTitles != null ? categoriesTitles.size() : 0;
|
int size = categoriesTitles != null ? categoriesTitles.size() : 0;
|
||||||
if (size == 0) return;
|
if (size == 0) return;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
bugCategories.add(ReportCategory.getInstance().withLabel(categoriesTitles.getString(i)));
|
bugCategories.add(ReportCategory.getInstance().withLabel(categoriesTitles
|
||||||
|
.getString(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Instabug.setReportCategories(bugCategories);
|
Instabug.setReportCategories(bugCategories);
|
||||||
@ -717,6 +742,9 @@ public class RNInstabugReactnativeModule extends ReactContextBaseJavaModule {
|
|||||||
constants.put("invocationEventTwoFingersSwipe", INVOCATION_EVENT_TWO_FINGERS_SWIPE);
|
constants.put("invocationEventTwoFingersSwipe", INVOCATION_EVENT_TWO_FINGERS_SWIPE);
|
||||||
constants.put("invocationEventFloatingButton", INVOCATION_EVENT_FLOATING_BUTTON);
|
constants.put("invocationEventFloatingButton", INVOCATION_EVENT_FLOATING_BUTTON);
|
||||||
|
|
||||||
|
constants.put("colorThemeLight", COLOR_THEME_LIGHT);
|
||||||
|
constants.put("colorThemeDark", COLOR_THEME_DARK);
|
||||||
|
|
||||||
constants.put("invocationModeNewBug", INVOCATION_MODE_NEW_BUG);
|
constants.put("invocationModeNewBug", INVOCATION_MODE_NEW_BUG);
|
||||||
constants.put("invocationModeNewFeedback", INVOCATION_MODE_NEW_FEEDBACK);
|
constants.put("invocationModeNewFeedback", INVOCATION_MODE_NEW_FEEDBACK);
|
||||||
constants.put("invocationModeNewChat", INVOCATION_MODE_NEW_CHAT);
|
constants.put("invocationModeNewChat", INVOCATION_MODE_NEW_CHAT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user