Skip to content

Commit a6e58fc

Browse files
add hybrid app
1 parent 38971ab commit a6e58fc

File tree

40 files changed

+1824
-21
lines changed

40 files changed

+1824
-21
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ android/gradlew.bat
6363
**/ios/**/DerivedData/
6464
**/ios/**/Icon?
6565
**/ios/**/Pods/
66+
**/ios/**/Pods/
67+
6668
**/ios/**/.symlinks/
6769
**/ios/**/profile
6870
**/ios/**/xcuserdata

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ analyzer:
44
exclude:
55
- "packages/**/*.g.dart"
66
- "packages/**/example/**"
7+
- "packages/instabug_private_views/example-hybrid-ios-app/**/**"
78

89

910
linter:

init.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
if [ -d "android" ]; then
4+
rm -rf "android"
5+
echo "Folder android and its contents removed"
6+
fi
7+
8+
if [ -d "ios" ]; then
9+
rm -rf "ios"
10+
echo "Folder ios and its contents removed"
11+
fi
12+
13+
14+
if [ -d "build" ]; then
15+
rm -rf "build"
16+
echo "Folder build and its contents removed"
17+
fi
18+
19+
if [ -d "lib" ]; then
20+
rm -rf "lib"
21+
echo "Folder lib and its contents removed"
22+
fi
23+
24+
if [ -d "test" ]; then
25+
rm -rf "test"
26+
echo "Folder test and its contents removed"
27+
fi
28+
29+
30+
if command -v melos &> /dev/null
31+
then
32+
echo "Melos found"
33+
else
34+
echo "Melos not found"
35+
dart pub global activate melos && echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> $BASH_ENV
36+
fi
37+
38+
39+
melos bootstrap
40+
melos dart_bootstrap
41+
melos pigeon --no-select
42+
melos generate --no-select
43+
melos pods --no-select

melos.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ scripts:
5959
flutter: true
6060
dependsOn: pana
6161
private: false
62+
pods:
63+
run: cd ios && pod install --repo-update
64+
description: running pod install
65+
exec:
66+
concurrency: 1
67+
orderDependents: true
68+
packageFilters:
69+
fileExists: 'ios/PodFile'
6270
score:
6371
run: dart run pana --no-warning --exit-code-threshold 0
6472
exec:

packages/instabug_flutter/example/android/build.gradle

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,30 @@ allprojects {
1515
repositories {
1616
google()
1717
mavenCentral()
18+
maven {
19+
name "Private Snapshots"
20+
url "https://mvn.instabug.com/nexus/repository/instabug-internal/"
21+
credentials {
22+
username "instabug"
23+
password "yUawaYwPXB7._.mfyTfjhEvyGAC4"
24+
}
25+
}
1826
}
1927
}
2028

2129
rootProject.buildDir = '../build'
2230
subprojects {
2331
project.buildDir = "${rootProject.buildDir}/${project.name}"
32+
2433
}
2534
subprojects {
2635
project.evaluationDependsOn(':app')
36+
tasks.withType(Test) {
37+
// Prevent tests in moduleA from running
38+
if (project.name == 'video_player_android') {
39+
exclude '**/*'
40+
}
41+
}
2742
}
2843

2944
tasks.register("clean", Delete) {
Loading

packages/instabug_flutter/example/ios/Podfile.lock

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ PODS:
44
- instabug_flutter (13.4.0):
55
- Flutter
66
- Instabug (= 13.4.2)
7+
- instabug_private_views (0.0.1):
8+
- Flutter
9+
- instabug_flutter
710
- OCMock (3.6)
11+
- video_player_avfoundation (0.0.1):
12+
- Flutter
13+
- FlutterMacOS
814

915
DEPENDENCIES:
1016
- Flutter (from `Flutter`)
1117
- Instabug (from `https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/13.4.2/Instabug.podspec`)
1218
- instabug_flutter (from `.symlinks/plugins/instabug_flutter/ios`)
19+
- instabug_private_views (from `.symlinks/plugins/instabug_private_views/ios`)
1320
- OCMock (= 3.6)
21+
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
1422

1523
SPEC REPOS:
1624
trunk:
@@ -23,13 +31,19 @@ EXTERNAL SOURCES:
2331
:podspec: https://ios-releases.instabug.com/custom/feature-flutter-private-views-base/13.4.2/Instabug.podspec
2432
instabug_flutter:
2533
:path: ".symlinks/plugins/instabug_flutter/ios"
34+
instabug_private_views:
35+
:path: ".symlinks/plugins/instabug_private_views/ios"
36+
video_player_avfoundation:
37+
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
2638

2739
SPEC CHECKSUMS:
2840
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
2941
Instabug: 7aacd5099c11ce96bc49dda40eba0963c06acccc
3042
instabug_flutter: a2df87e3d4d9e410785e0b1ffef4bc64d1f4b787
43+
instabug_private_views: df53ff3f1cc842cb686d43e077099d3b36426a7f
3144
OCMock: 5ea90566be239f179ba766fd9fbae5885040b992
45+
video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
3246

3347
PODFILE CHECKSUM: 02e3295e1482e04d2cbd38390c8ea91a5c0c2ff1
3448

35-
COCOAPODS: 1.14.3
49+
COCOAPODS: 1.16.0

packages/instabug_flutter/example/ios/Runner/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import UIKit
22
import Flutter
33

4-
@UIApplicationMain
4+
@main
55
@objc class AppDelegate: FlutterAppDelegate {
66
override func application(
77
_ application: UIApplication,

packages/instabug_flutter/example/lib/main.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import 'dart:convert';
55

66
import 'package:flutter/material.dart';
77
import 'package:instabug_flutter/instabug_flutter.dart';
8+
import 'package:instabug_flutter_example/src/screens/private_view_page.dart';
89
import 'package:instabug_http_client/instabug_http_client.dart';
910
import 'package:instabug_flutter_example/src/app_routes.dart';
1011
import 'package:instabug_flutter_example/src/widget/nested_view.dart';
12+
import 'package:instabug_private_views/instabug_private_view.dart';
1113

1214
import 'src/native/instabug_flutter_example_method_channel.dart';
1315
import 'src/widget/instabug_button.dart';
@@ -55,6 +57,9 @@ void main() {
5557
FlutterError.onError = (FlutterErrorDetails details) {
5658
Zone.current.handleUncaughtError(details.exception, details.stack!);
5759
};
60+
61+
enableInstabugMaskingPrivateViews();
62+
5863
runApp(const MyApp());
5964
},
6065
CrashReporting.reportCrash,

packages/instabug_flutter/example/lib/src/screens/my_home_page.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,16 @@ class _MyHomePageState extends State<MyHomePage> {
161161
);
162162
}
163163

164+
void _navigateToPrivateViewPage() {
165+
Navigator.push(
166+
context,
167+
MaterialPageRoute(
168+
builder: (context) => const PrivateViewPage(),
169+
settings: const RouteSettings(name: ComplexPage.screenName),
170+
),
171+
);
172+
}
173+
164174
@override
165175
Widget build(BuildContext context) {
166176
return Page(
@@ -306,6 +316,10 @@ class _MyHomePageState extends State<MyHomePage> {
306316
onPressed: _navigateToComplex,
307317
text: 'Complex',
308318
),
319+
InstabugButton(
320+
onPressed: _navigateToPrivateViewPage,
321+
text: 'Private views',
322+
),
309323
const SectionTitle('Sessions Replay'),
310324
InstabugButton(
311325
onPressed: getCurrentSessionReplaylink,
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:instabug_private_views/instabug_private_view.dart';
3+
import 'package:video_player/video_player.dart';
4+
5+
class PrivateViewPage extends StatefulWidget {
6+
const PrivateViewPage({Key? key}) : super(key: key);
7+
8+
@override
9+
_PrivateViewPageState createState() => _PrivateViewPageState();
10+
}
11+
12+
class _PrivateViewPageState extends State<PrivateViewPage> {
13+
late VideoPlayerController _controller;
14+
15+
@override
16+
void initState() {
17+
super.initState();
18+
_controller = VideoPlayerController.networkUrl(
19+
Uri.parse(
20+
'https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'),
21+
)..initialize().then((_) {
22+
setState(() {});
23+
});
24+
}
25+
26+
@override
27+
void dispose() {
28+
_controller.dispose();
29+
super.dispose();
30+
}
31+
32+
@override
33+
Widget build(BuildContext context) {
34+
return MaterialApp(
35+
debugShowCheckedModeBanner: false,
36+
home: Scaffold(
37+
appBar: AppBar(title: const Text("Private Views page")),
38+
body: SingleChildScrollView(
39+
child: Padding(
40+
padding: const EdgeInsets.all(8.0),
41+
child: Column(
42+
crossAxisAlignment: CrossAxisAlignment.center,
43+
children: [
44+
const SizedBox(height: 16),
45+
InstabugPrivateView(
46+
child: const Text(
47+
'Private TextView',
48+
style: TextStyle(fontSize: 18),
49+
textAlign: TextAlign.center,
50+
),
51+
),
52+
const SizedBox(height: 16),
53+
InstabugPrivateView(
54+
child: ElevatedButton(
55+
onPressed: () {
56+
const snackBar = SnackBar(
57+
content: Text('Hello, you clicked on a private button'),
58+
);
59+
ScaffoldMessenger.of(context).showSnackBar(snackBar);
60+
},
61+
child: const Text('I am a private button'),
62+
),
63+
),
64+
const SizedBox(height: 16),
65+
InstabugPrivateView(
66+
child: Image.asset(
67+
'assets/img.png',
68+
// Add this image to your assets folder
69+
height: 100,
70+
),
71+
),
72+
const SizedBox(height: 33),
73+
InstabugPrivateView(
74+
child: const TextField(
75+
obscureText: true,
76+
decoration: InputDecoration(
77+
hintText: 'password',
78+
labelText: 'Password',
79+
border: OutlineInputBorder(),
80+
),
81+
),
82+
),
83+
const SizedBox(height: 16),
84+
const TextField(
85+
keyboardType: TextInputType.emailAddress,
86+
decoration: InputDecoration(
87+
hintText: 'Email',
88+
labelText: 'Email',
89+
border: OutlineInputBorder(),
90+
),
91+
),
92+
const SizedBox(height: 24),
93+
InstabugPrivateView(
94+
child: Container(
95+
height: 300,
96+
child: _controller.value.isInitialized
97+
? AspectRatio(
98+
aspectRatio: _controller.value.aspectRatio,
99+
child: VideoPlayer(_controller),
100+
)
101+
: const Center(child: CircularProgressIndicator()),
102+
),
103+
),
104+
const SizedBox(height: 24),
105+
const SizedBox(height: 24),
106+
const SizedBox(height: 24),
107+
SizedBox(
108+
height: 200,
109+
child: CustomScrollView(
110+
slivers: [
111+
InstabugSliverPrivateView(
112+
sliver: SliverToBoxAdapter(
113+
child: Container(
114+
color: Colors.red,
115+
child: const Text(
116+
"Private Sliver Widget",
117+
style: TextStyle(fontSize: 18),
118+
textAlign: TextAlign.center,
119+
),
120+
),
121+
),
122+
)
123+
],
124+
),
125+
)
126+
],
127+
),
128+
),
129+
),
130+
),
131+
);
132+
}
133+
}

0 commit comments

Comments
 (0)