Skip to content

[MOB-11561] Add onDimissHandler API #868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 47 additions & 72 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,42 @@
version: 2.1

orbs:
android: circleci/[email protected]
advanced-checkout: vsco/[email protected]

commands:
install_pods:
parameters:
working_directory:
type: string
steps:
- restore_cache:
name: Restore Pods Cache
keys:
- v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
- run:
name: Install Pods
working_directory: << parameters.working_directory >>
command: pod install --deployment
- save_cache:
name: Save Pods Cache
key: v1-pods-{{ checksum "<< parameters.working_directory >>/Podfile.lock" }}
paths:
- << parameters.working_directory >>/Pods
jobs:
danger:
docker:
- image: dantoml/danger:latest
- image: circleci/ruby:2.6.4
steps:
- checkout
- run: danger
- advanced-checkout/shallow-checkout
- run: bundle install
- run: bundle exec danger

lint:
working_directory: ~/project
docker:
- image: cimg/node:16.17.1
steps:
- checkout
- advanced-checkout/shallow-checkout
- run:
name: Install Node Packages
command: yarn
Expand All @@ -26,44 +48,23 @@ jobs:
command: yarn lint:ci

test_module:
working_directory: ~/project
docker:
- image: cimg/node:16.17.1
steps:
- checkout:
path: ~/project

- advanced-checkout/shallow-checkout
- run:
name: Install Node Packages
command: yarn

- run:
name: jest tests
command: |
mkdir -p test-results/jest
yarn run test
environment:
JEST_JUNIT_OUTPUT: test-results/jest/junit.xml

- persist_to_workspace:
root: ~/project
paths:
- node_modules

- store_test_results:
path: test-results

- store_artifacts:
path: test-results
name: Run Tests
command: yarn test

test_android:
executor:
name: android/android-machine
tag: '2022.03.1'
working_directory: ~/project
steps:
- checkout:
path: ~/project
- advanced-checkout/shallow-checkout
- run:
name: Install Yarn
command: npm install -g yarn
Expand All @@ -73,15 +74,13 @@ jobs:
command: yarn
- android/run-tests:
working-directory: ./example/android
test-command: ./gradlew test
test-command: ./gradlew test -PinstabugUploadEnable=false

validate_shell_files:
machine:
image: ubuntu-2004:current
working_directory: ~/project
steps:
- checkout:
path: ~/project
- advanced-checkout/shallow-checkout
- run:
name: Validate Android Script
command: bash -n android/upload_sourcemap.sh
Expand All @@ -95,12 +94,12 @@ jobs:
sync_generated_files:
macos:
xcode: 13.4.1
working_directory: ~/project
steps:
- checkout
- advanced-checkout/shallow-checkout
- run: yarn
- run: cd example && yarn
- run: cd example/ios && pod install
- install_pods:
working_directory: example/ios
- run: git --no-pager diff
- run: git diff-index HEAD --exit-code -p -I EXCLUDED_ARCHS # Ignore Arch Changes

Expand All @@ -109,20 +108,14 @@ jobs:
xcode: 13.4.1
working_directory: ~/project/example
environment:
FL_OUTPUT_DIR: output
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
steps:
- checkout:
path: ~/project
- run:
name: Install CocoaPods
command: sudo gem install cocoapods
- advanced-checkout/shallow-checkout
- run:
name: Install node_modules
command: yarn
- run:
name: Install Pods
- install_pods:
working_directory: ios
command: pod install
- run:
name: Build and run tests
working_directory: ios
Expand All @@ -134,7 +127,6 @@ jobs:
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
test | xcpretty
no_output_timeout: 30m
- run:
name: Convert xcresult into JSON report
working_directory: ios/coverage
Expand All @@ -151,17 +143,10 @@ jobs:
macos:
xcode: 13.4.1
resource_class: large
working_directory: ~/project
environment:
FL_OUTPUT_DIR: output
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
steps:
- checkout
- run:
name: Install CocoaPods
command: sudo gem install cocoapods
- run:
name: Install React Native CLI
command: npm install -g react-native-cli
- advanced-checkout/shallow-checkout
- run:
name: Install Detox CLI
command: npm install -g detox-cli
Expand All @@ -171,17 +156,12 @@ jobs:
- run:
name: Install Node Packages
command: yarn
- run:
name: Build Project
command: yarn build:lib
- run:
name: Install Example's Node Packages
working_directory: example
command: yarn
- run:
name: Install Pods
- install_pods:
working_directory: example/ios
command: pod install
- run:
name: Detox - Build Release App
working_directory: example
Expand All @@ -196,21 +176,17 @@ jobs:
name: android/android-machine
tag: 2022.03.1
resource-class: large
working_directory: ~/project
steps:
- checkout
- advanced-checkout/shallow-checkout
- run:
name: Install Yarn
command: npm install --global yarn
command: npm install -g yarn
- run:
name: Install Detox CLI
command: npm install --global detox-cli
command: npm install -g detox-cli
- run:
name: Install Node Packages
command: yarn
- run:
name: Build Project
command: yarn build:lib
- run:
name: Install Example's Node Packages
working_directory: example
Expand All @@ -237,9 +213,8 @@ jobs:
xcode: 13.4.1
working_directory: '~'
steps:
- checkout:
path: ~/project
- run: git clone https://InstabugCI:[email protected]/Instabug/Escape.git
- advanced-checkout/shallow-checkout
- run: git clone [email protected]:Instabug/Escape.git
- run: cd Escape && swift build -c release
- run: cd Escape/.build/release && cp -f Escape /usr/local/bin/escape
- run: cd project && yarn && yarn build
Expand Down
3 changes: 3 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ closeComment: >
This issue has been automatically closed since we haven't heard back from
you. Please feel free to re-open the issue if you have more information
to add.

# Limit to only `issues` or `pulls`
only: issues
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gem 'danger', '~> 8.6', '>= 8.6.1'
84 changes: 84 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
claide (1.1.0)
claide-plugins (0.9.2)
cork
nap
open4 (~> 1.3)
colored2 (3.1.2)
cork (0.3.0)
colored2 (~> 3.1)
danger (8.6.1)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
cork (~> 0.1)
faraday (>= 0.9.0, < 2.0)
faraday-http-cache (~> 2.0)
git (~> 1.7)
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
no_proxy_fix
octokit (~> 4.7)
terminal-table (>= 1, < 4)
faraday (1.10.2)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-http-cache (2.4.1)
faraday (>= 0.8)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
git (1.12.0)
addressable (~> 2.8)
rchardet (~> 1.8)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
multipart-post (2.2.3)
nap (1.1.0)
no_proxy_fix (0.1.2)
octokit (4.25.1)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
public_suffix (5.0.0)
rchardet (1.8.0)
rexml (3.2.5)
ruby2_keywords (0.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.3.0)

PLATFORMS
ruby

DEPENDENCIES
danger (~> 8.6, >= 8.6.1)

BUNDLED WITH
1.17.2
7 changes: 5 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ task upload_sourcemap(type: Exec) {
}

tasks.whenTaskAdded { task ->
if (task.name == 'preReleaseBuild' &&
(rootProject.hasProperty("instabugUploadEnable") ? rootProject.instabugUploadEnable : true)) {
def isEnabled = rootProject.hasProperty('instabugUploadEnable')
? new Boolean(rootProject.property('instabugUploadEnable'))
: true

if (task.name == 'preReleaseBuild' && isEnabled) {
task.dependsOn upload_sourcemap
}
}
20 changes: 20 additions & 0 deletions android/src/main/java/com/instabug/reactlibrary/ArgsRegistry.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.instabug.reactlibrary;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.instabug.apm.model.LogLevel;
import com.instabug.bug.BugReporting;
Expand Down Expand Up @@ -41,6 +42,17 @@ public ArrayList<T> getAll(ArrayList<String> keys) {
}
return values;
}

@Nullable
public String getKey(T value) {
for (Entry<String, T> entry : this.entrySet()) {
if (entry.getValue().equals(value)) {
return entry.getKey();
}
}

return null;
}
}

static Map<String, Object> getAll() {
Expand All @@ -53,6 +65,7 @@ static Map<String, Object> getAll() {
putAll(recordButtonPositions);
putAll(welcomeMessageStates);
putAll(reportTypes);
putAll(sdkDismissReportTypes);
putAll(dismissTypes);
putAll(actionTypes);
putAll(extendedBugReportStates);
Expand Down Expand Up @@ -121,6 +134,13 @@ static Map<String, Object> getAll() {
put("bugReportingReportTypeQuestion", BugReporting.ReportType.QUESTION);
}};

static final ArgsMap<OnSdkDismissCallback.ReportType> sdkDismissReportTypes = new ArgsMap<OnSdkDismissCallback.ReportType>() {{
put("bugReportingReportTypeBug", OnSdkDismissCallback.ReportType.BUG);
put("bugReportingReportTypeFeedback", OnSdkDismissCallback.ReportType.FEEDBACK);
put("bugReportingReportTypeQuestion", OnSdkDismissCallback.ReportType.QUESTION);
put("bugReportingReportTypeOther", OnSdkDismissCallback.ReportType.OTHER);
}};

static final ArgsMap<DismissType> dismissTypes = new ArgsMap<DismissType>() {{
put("dismissTypeSubmit", DismissType.SUBMIT);
put("dismissTypeCancel", DismissType.CANCEL);
Expand Down
Loading