Skip to content

Commit e2b5b1c

Browse files
Added support to mock camera and image picker (#22)
added support mock camera and image picker for android
1 parent 7eb7db4 commit e2b5b1c

20 files changed

+1515
-15
lines changed

demo-app/android/app/src/debug/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
7+
<uses-permission android:name="android.permission.CAMERA" />
8+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
9+
<uses-feature android:name="android.hardware.camera" android:required="false"/>
10+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
11+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
712
</manifest>

demo-app/android/app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
22
<uses-permission android:name="android.permission.READ_CONTACTS"/>
3+
<uses-permission android:name="android.permission.CAMERA" />
4+
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
5+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
6+
<uses-feature android:name="android.hardware.camera" android:required="false"/>
7+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
8+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
39
<queries>
410
<intent>
511
<action android:name="android.intent.action.VIEW" />
@@ -9,6 +15,7 @@
915
<application
1016
android:label="appium_testing_app"
1117
android:name="${applicationName}"
18+
android:requestLegacyExternalStorage="true"
1219
android:icon="@mipmap/ic_launcher">
1320
<activity
1421
android:name=".MainActivity"

demo-app/android/app/src/profile/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,9 @@
33
the Flutter tool needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
6+
<uses-permission android:name="android.permission.CAMERA" />
7+
8+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
9+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
610
<uses-permission android:name="android.permission.INTERNET"/>
711
</manifest>

demo-app/lib/screens/home_screen.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:appium_testing_app/components/custom_app_bar.dart';
22
import 'package:appium_testing_app/models/feature_model.dart';
3+
import 'package:appium_testing_app/screens/image_picker.dart';
34
import 'package:appium_testing_app/screens/lazy_loading.dart';
45
import 'package:appium_testing_app/screens/loader_screen.dart';
56
import 'package:appium_testing_app/screens/native_screen.dart';
@@ -63,6 +64,8 @@ class _HomeScreenState extends State<HomeScreen> {
6364
title: "Loader Screen", subtitle: "Page with loader and a button"));
6465
featureModels.add(FeatureModel(
6566
title: "Contact permission", subtitle: "Asks for contact permission with native popup"));
67+
featureModels.add(FeatureModel(
68+
title: "Image Picker", subtitle: "Mock Camera Image Picker"));
6669
}
6770

6871
@override
@@ -153,6 +156,9 @@ class _HomeScreenState extends State<HomeScreen> {
153156
case 14:
154157
page = ContactPermissionScreen(title: featureModels[index].title,);
155158
break;
159+
case 15:
160+
page = ImagePickerScreen(title: featureModels[index].title,);
161+
break;
156162
default:
157163
page = NativeScreen(title: featureModels[index].title);
158164
break;

0 commit comments

Comments
 (0)