Skip to content

Refactor: merge private-views package into mono-repo #527

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

Merged
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
e0c0fd2
feat: add private view
ahmedAlaaInstabug Oct 2, 2024
c38dead
feat: add private view
ahmedAlaaInstabug Oct 2, 2024
23d3912
Merge remote-tracking branch 'refs/remotes/origin/dev' into feat/priv…
ahmedAlaaInstabug Oct 2, 2024
1af3598
feat: add private view
ahmedAlaaInstabug Oct 2, 2024
0476bcd
feat: add private view
ahmedAlaaInstabug Oct 2, 2024
9b8ec64
feat: add private view
ahmedAlaaInstabug Oct 2, 2024
cedc297
feat: add private view
ahmedAlaaInstabug Oct 7, 2024
59c1ffa
feat: add private view
ahmedAlaaInstabug Oct 9, 2024
f7f8f08
feat: add private view android integration
ahmedAlaaInstabug Oct 10, 2024
c9bb481
feat: add private view android integration
ahmedAlaaInstabug Oct 10, 2024
52bced3
feat: add private view android integration
ahmedAlaaInstabug Oct 10, 2024
d0f334f
fix PR comments
ahmedAlaaInstabug Oct 27, 2024
ae524a2
fix: android test cases
ahmedAlaaInstabug Oct 27, 2024
ddead7f
fix: android test cases
ahmedAlaaInstabug Oct 27, 2024
7414132
fix PR comments
ahmedAlaaInstabug Oct 27, 2024
476c29e
doc:comment why not use const constructor
ahmedAlaaInstabug Oct 31, 2024
5b94581
feat(ios): handle private views (#524)
ahmedAlaaInstabug Oct 31, 2024
6dcdffb
feat: add private view example page (#525)
ahmedAlaaInstabug Oct 31, 2024
a142b7b
init
ahmedAlaaInstabug Nov 2, 2024
92201a1
Merge branch 'refs/heads/refactor/monorepo' into refactor/monorepo-pr…
ahmedAlaaInstabug Nov 2, 2024
422e21f
init
ahmedAlaaInstabug Nov 2, 2024
53abf96
init
ahmedAlaaInstabug Nov 2, 2024
c8b944d
init
ahmedAlaaInstabug Nov 2, 2024
96e128a
init
ahmedAlaaInstabug Nov 2, 2024
38971ab
init
ahmedAlaaInstabug Nov 3, 2024
837e133
add hybrid app
ahmedAlaaInstabug Nov 10, 2024
d157d4e
add hybrid app
ahmedAlaaInstabug Nov 10, 2024
e9d124a
add hybrid app
ahmedAlaaInstabug Nov 10, 2024
a6789c2
add more example in private view oage
ahmedAlaaInstabug Nov 12, 2024
0370666
add more example in private view oage
ahmedAlaaInstabug Nov 12, 2024
5f0af4c
add more example in private view oage
ahmedAlaaInstabug Nov 12, 2024
4dcf75f
chore: add build files
ahmedAlaaInstabug Nov 13, 2024
e4b6c3a
chore: add animation
ahmedAlaaInstabug Nov 14, 2024
89d0de1
fix: private view time
ahmedAlaaInstabug Nov 21, 2024
7763743
fix: private view time
ahmedAlaaInstabug Nov 22, 2024
dc50a5c
Merge remote-tracking branch 'refs/remotes/origin/refactor/monorepo' …
ahmedAlaaInstabug Dec 2, 2024
838a434
chore: update to latest version
ahmedAlaaInstabug Dec 2, 2024
86ba310
chore: update to latest version
ahmedAlaaInstabug Dec 2, 2024
48b1132
chore: update to latest version
ahmedAlaaInstabug Dec 12, 2024
c50bc61
Merge remote-tracking branch 'refs/remotes/origin/refactor/monorepo-p…
ahmedAlaaInstabug Dec 12, 2024
cdb8017
chore: update to latest version
ahmedAlaaInstabug Dec 12, 2024
2215874
chore: update to latest version
ahmedAlaaInstabug Dec 12, 2024
be76a07
chore: update to latest version
ahmedAlaaInstabug Dec 15, 2024
4ac9541
Merge branch 'refs/heads/refactor/monorepo' into refactor/monorepo-pr…
ahmedAlaaInstabug Jan 8, 2025
05fac1f
monorepo
ahmedAlaaInstabug Jan 8, 2025
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
35 changes: 29 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ commands:
steps:
- run:
name: Generate Pigeons
command: melos pigeon
command: melos pigeon --no-select
- run:
name: Build Pigeons
command: melos generate
command: melos generate --no-select
- when:
condition:
equal:
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
- setup_flutter:
version: <<parameters.version>>
use_melos: true
- run: melos test-coverage
- run: melos test-coverage --no-select
- persist_to_workspace:
root: ~/project
paths:
Expand Down Expand Up @@ -307,8 +307,17 @@ jobs:
- setup_flutter
- run:
name: Check Package Score
command: melos score
- run: melos dryPublish
command: melos score --no-select
- run: melos dryPublish --no-select

release_instabug_private_views_plugin:
executor: flutter-executor
steps:
- advanced-checkout/shallow-checkout
- setup_flutter
- run: chmod +x packages/instabug_private_views/release.sh
- run: ./packages/instabug_private_views/release.sh


release_instabug_flutter:
macos:
Expand All @@ -332,7 +341,7 @@ jobs:
- run:
name: Generate Pigeons
working_directory: project
command: melos pigeon
command: melos pigeon --no-select
- run:
name: Clone Escape
command: git clone [email protected]:Instabug/Escape.git
Expand Down Expand Up @@ -388,6 +397,20 @@ workflows:
filters:
branches:
only: master
- hold_release_instabug_private_views_plugin:
type: approval
requires:
- test_flutter-stable
filters:
branches:
only: master
- release_instabug_private_views_plugin:
requires:
- hold_release_instabug_private_views_plugin
- verify_pub
filters:
branches:
only: master
- release_instabug_flutter:
requires:
- hold_release_instabug_flutter
Expand Down
6 changes: 5 additions & 1 deletion packages/instabug_flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
if (project.android.hasProperty("namespace")) {
namespace = "com.instabug.flutter"
}

compileSdkVersion 28

compileOptions {
Expand All @@ -41,7 +45,7 @@ android {
}

dependencies {
api 'com.instabug.library:instabug:13.4.1'
api 'com.instabug.library:instabug:13.4.1.6295791-SNAPSHOT'

testImplementation 'junit:junit:4.13.2'
testImplementation "org.mockito:mockito-inline:3.12.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.instabug.flutter.modules.RepliesApi;
import com.instabug.flutter.modules.SessionReplayApi;
import com.instabug.flutter.modules.SurveysApi;
import com.instabug.library.internal.crossplatform.InternalCore;

import java.util.concurrent.Callable;

Expand All @@ -35,6 +36,7 @@ public class InstabugFlutterPlugin implements FlutterPlugin, ActivityAware {
@SuppressLint("StaticFieldLeak")
private static Activity activity;


/**
* Embedding v1
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.util.Log;

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

import com.instabug.flutter.generated.InstabugPigeon;
import com.instabug.flutter.util.ArgsRegistry;
import com.instabug.flutter.util.Reflection;
import com.instabug.flutter.util.ThreadManager;
import com.instabug.flutter.util.privateViews.ScreenshotCaptor;
import com.instabug.library.Feature;
import com.instabug.library.Instabug;
import com.instabug.library.InstabugColorTheme;
Expand All @@ -21,13 +24,17 @@
import com.instabug.library.Platform;
import com.instabug.library.ReproConfigurations;
import com.instabug.library.featuresflags.model.IBGFeatureFlag;
import com.instabug.library.internal.crossplatform.InternalCore;
import com.instabug.library.internal.module.InstabugLocale;
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.library.model.NetworkLog;
import com.instabug.library.screenshot.instacapture.ScreenshotRequest;
import com.instabug.library.ui.onboarding.WelcomeMessage;

import io.flutter.FlutterInjector;
import io.flutter.embedding.engine.loader.FlutterLoader;
import io.flutter.plugin.common.BinaryMessenger;

import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

Expand Down Expand Up @@ -92,7 +99,9 @@ public Boolean isEnabled() {

@NotNull
@Override
public Boolean isBuilt() { return Instabug.isBuilt(); }
public Boolean isBuilt() {
return Instabug.isBuilt();
}

@Override
public void init(@NonNull String token, @NonNull List<String> invocationEvents, @NonNull String debugLogsLevel) {
Expand Down Expand Up @@ -441,4 +450,24 @@ public void networkLog(@NonNull Map<String, Object> data) {
public void willRedirectToStore() {
Instabug.willRedirectToStore();
}

public static void setScreenshotCaptor(ScreenshotCaptor screenshotCaptor,InternalCore internalCore) {
internalCore._setScreenshotCaptor(new com.instabug.library.screenshot.ScreenshotCaptor() {
@Override
public void capture(@NonNull ScreenshotRequest screenshotRequest) {
screenshotCaptor.capture(new ScreenshotCaptor.CapturingCallback() {
@Override
public void onCapturingFailure(Throwable throwable) {
screenshotRequest.getListener().onCapturingFailure(throwable);
}

@Override
public void onCapturingSuccess(Bitmap bitmap) {
screenshotRequest.getListener().onCapturingSuccess(bitmap);
}
});
}
});
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.instabug.flutter.util.privateViews;

import android.graphics.Bitmap;

public interface ScreenshotCaptor {
public void capture(CapturingCallback listener);

public interface CapturingCallback {
public void onCapturingFailure(Throwable throwable);

public void onCapturingSuccess(Bitmap bitmap);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@
import com.instabug.library.ReproConfigurations;
import com.instabug.library.ReproMode;
import com.instabug.library.featuresflags.model.IBGFeatureFlag;
import com.instabug.library.internal.crossplatform.InternalCore;
import com.instabug.library.invocation.InstabugInvocationEvent;
import com.instabug.library.model.NetworkLog;
import com.instabug.library.screenshot.ScreenshotCaptor;
import com.instabug.library.ui.onboarding.WelcomeMessage;

import org.json.JSONObject;
Expand All @@ -59,6 +61,7 @@
import java.util.concurrent.Callable;

import io.flutter.plugin.common.BinaryMessenger;

import org.mockito.verification.VerificationMode;

public class InstabugApiTest {
Expand Down Expand Up @@ -349,11 +352,11 @@ public void testClearAllExperiments() {

@Test
public void testAddFeatureFlags() {
Map<String,String > featureFlags = new HashMap<>();
featureFlags.put("key1","variant1");
Map<String, String> featureFlags = new HashMap<>();
featureFlags.put("key1", "variant1");
api.addFeatureFlags(featureFlags);
List<IBGFeatureFlag> flags=new ArrayList<IBGFeatureFlag>();
flags.add(new IBGFeatureFlag("key1","variant1"));
List<IBGFeatureFlag> flags = new ArrayList<IBGFeatureFlag>();
flags.add(new IBGFeatureFlag("key1", "variant1"));
mInstabug.verify(() -> Instabug.addFeatureFlags(flags));
}

Expand Down Expand Up @@ -598,4 +601,12 @@ public void testWillRedirectToStore() {
api.willRedirectToStore();
mInstabug.verify(Instabug::willRedirectToStore);
}

@Test
public void testSetScreenshotCaptor() {
InternalCore internalCore = spy(InternalCore.INSTANCE);

InstabugApi.setScreenshotCaptor(any(), internalCore);
verify(internalCore)._setScreenshotCaptor(any(ScreenshotCaptor.class));
}
}
1 change: 1 addition & 0 deletions packages/instabug_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
namespace = "com.instabug.flutter.example"

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
2 changes: 1 addition & 1 deletion packages/instabug_flutter/example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!

pod 'Instabug', :podspec => 'https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/13.4.2/Instabug.podspec'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

Expand Down
8 changes: 5 additions & 3 deletions packages/instabug_flutter/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,28 @@ PODS:

DEPENDENCIES:
- Flutter (from `Flutter`)
- Instabug (from `https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/13.4.2/Instabug.podspec`)
- instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`)
- OCMock (= 3.6)

SPEC REPOS:
trunk:
- Instabug
- OCMock

EXTERNAL SOURCES:
Flutter:
:path: Flutter
Instabug:
:podspec: https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/13.4.2/Instabug.podspec
instabug_flutter:
:path: ".symlinks/plugins/instabug_flutter/ios"

SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
Instabug: 7a71890217b97b1e32dbca96661845396b66da2f
Instabug: 7aacd5099c11ce96bc49dda40eba0963c06acccc
instabug_flutter: a2df87e3d4d9e410785e0b1ffef4bc64d1f4b787
OCMock: 5ea90566be239f179ba766fd9fbae5885040b992

PODFILE CHECKSUM: 8f7552fd115ace1988c3db54a69e4a123c448f84
PODFILE CHECKSUM: 02e3295e1482e04d2cbd38390c8ea91a5c0c2ff1

COCOAPODS: 1.14.3
1 change: 0 additions & 1 deletion packages/instabug_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ void main() {
FlutterError.onError = (FlutterErrorDetails details) {
Zone.current.handleUncaughtError(details.exception, details.stack!);
};

runApp(const MyApp());
},
CrashReporting.reportCrash,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ extern void InitInstabugApi(id<FlutterBinaryMessenger> messenger);

- (UIImage *)getImageForAsset:(NSString *)assetName;
- (UIFont *)getFontForAsset:(NSString *)assetName error:(FlutterError *_Nullable *_Nonnull)error;
+ (void)setScreenshotMaskingHandler:(nullable void (^)(UIImage *_Nonnull, void (^_Nonnull)(UIImage *_Nonnull)))maskingHandler;

@end
6 changes: 5 additions & 1 deletion packages/instabug_flutter/ios/Classes/Modules/InstabugApi.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#import "IBGNetworkLogger+CP.h"
#import "InstabugApi.h"
#import "ArgsRegistry.h"

#import "../Util/Instabug+CP.h"
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:((float)((rgbValue & 0xFF000000) >> 24)) / 255.0];

extern void InitInstabugApi(id<FlutterBinaryMessenger> messenger) {
Expand Down Expand Up @@ -349,4 +349,8 @@ - (void)removeFeatureFlagsFeatureFlags:(nonnull NSArray<NSString *> *)featureFla
}
}

+ (void)setScreenshotMaskingHandler:(nullable void (^)(UIImage * _Nonnull __strong, void (^ _Nonnull __strong)(UIImage * _Nonnull __strong)))maskingHandler {
[Instabug setScreenshotMaskingHandler:maskingHandler];
}

@end
8 changes: 8 additions & 0 deletions packages/instabug_flutter/ios/Classes/Util/Instabug+CP.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#import <Foundation/Foundation.h>

@interface Instabug (CP)

+ (void)setScreenshotMaskingHandler:(nullable void (^)(UIImage *, void (^)(UIImage *)))maskingHandler;

@end
33 changes: 33 additions & 0 deletions packages/instabug_private_views/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "603104015dd692ea3403755b55d07813d5cf8965"
channel: "stable"

project_type: plugin

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 603104015dd692ea3403755b55d07813d5cf8965
base_revision: 603104015dd692ea3403755b55d07813d5cf8965
- platform: android
create_revision: 603104015dd692ea3403755b55d07813d5cf8965
base_revision: 603104015dd692ea3403755b55d07813d5cf8965
- platform: ios
create_revision: 603104015dd692ea3403755b55d07813d5cf8965
base_revision: 603104015dd692ea3403755b55d07813d5cf8965

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
7 changes: 7 additions & 0 deletions packages/instabug_private_views/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## [UnReleased](https://github.com/Instabug/)

### Added

- Add support for masking private views during screen capturing ([#527](https://github.com/Instabug/Instabug-Flutter/pull/527)).
21 changes: 21 additions & 0 deletions packages/instabug_private_views/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Instabug

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading