Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit c3149e1

Browse files
[shared_preferences] Federate mobile implementations (#4505)
Fully federates the plugin by moving the existing mobile implementations to their own packages, per planned repo structure. Temporarily marks shared_preferences as unpublishable to allow the implementations to be moved, rather than copied and deleted, in order to better preserve git history. A follow-up PR will restore it to publishable form. Part of flutter/flutter#68498
1 parent 39b75d2 commit c3149e1

File tree

113 files changed

+2385
-200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2385
-200
lines changed

packages/shared_preferences/shared_preferences/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## NEXT
22

33
* Fixes newly enabled analyzer options.
4+
* Moved Android and iOS implementations to federated packages.
45

56
## 2.0.8
67

packages/shared_preferences/shared_preferences/android/settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/shared_preferences/shared_preferences/example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ android {
3333
}
3434

3535
defaultConfig {
36-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
37-
applicationId "io.flutter.plugins.example"
36+
applicationId "io.flutter.plugins.sharedpreferencesexample"
3837
minSdkVersion 16
3938
targetSdkVersion 30
4039
versionCode flutterVersionCode.toInteger()
4140
versionName flutterVersionName
41+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
4242
}
4343

4444
buildTypes {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
package io.flutter.plugins;
6+
7+
import java.lang.annotation.ElementType;
8+
import java.lang.annotation.Retention;
9+
import java.lang.annotation.RetentionPolicy;
10+
import java.lang.annotation.Target;
11+
12+
@Retention(RetentionPolicy.RUNTIME)
13+
@Target(ElementType.TYPE)
14+
public @interface DartIntegrationTest {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
package io.flutter.plugins.sharedpreferencesexample;
6+
7+
import androidx.test.rule.ActivityTestRule;
8+
import dev.flutter.plugins.integration_test.FlutterTestRunner;
9+
import io.flutter.embedding.android.FlutterActivity;
10+
import io.flutter.plugins.DartIntegrationTest;
11+
import org.junit.Rule;
12+
import org.junit.runner.RunWith;
13+
14+
@DartIntegrationTest
15+
@RunWith(FlutterTestRunner.class)
16+
public class MainActivityTest {
17+
@Rule
18+
public ActivityTestRule<FlutterActivity> rule = new ActivityTestRule<>(FlutterActivity.class);
19+
}

packages/shared_preferences/shared_preferences/example/android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="io.flutter.plugins.example">
2+
package="io.flutter.plugins.sharedpreferencesexample">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->

packages/shared_preferences/shared_preferences/example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="io.flutter.plugins.example">
2+
package="io.flutter.plugins.sharedpreferencesexample">
33
<application
44
android:label="example"
55
android:icon="@mipmap/ic_launcher">
66
<activity
7-
android:name=".MainActivity"
7+
android:name="io.flutter.embedding.android.FlutterActivity"
88
android:launchMode="singleTop"
99
android:theme="@style/LaunchTheme"
1010
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"

packages/shared_preferences/shared_preferences/example/android/app/src/profile/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="io.flutter.plugins.example">
2+
package="io.flutter.plugins.sharedpreferencesexample">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->

packages/shared_preferences/shared_preferences/example/integration_test/shared_preferences_test.dart

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import 'dart:async';
6-
import 'dart:io';
7-
8-
import 'package:flutter/services.dart';
95
import 'package:flutter_test/flutter_test.dart';
106
import 'package:integration_test/integration_test.dart';
117
import 'package:shared_preferences/shared_preferences.dart';
@@ -101,33 +97,5 @@ void main() {
10197
// The last write should win.
10298
expect(preferences.getInt('int'), writeCount);
10399
});
104-
105-
testWidgets(
106-
'string clash with lists, big integers and doubles (Android only)',
107-
(WidgetTester _) async {
108-
await preferences.clear();
109-
// special prefixes plus a string value
110-
expect(
111-
// prefix for lists
112-
preferences.setString('String',
113-
'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBhIGxpc3Qu' + testString),
114-
throwsA(isA<PlatformException>()));
115-
await preferences.reload();
116-
expect(preferences.getString('String'), null);
117-
expect(
118-
// prefix for big integers
119-
preferences.setString('String',
120-
'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBCaWdJbnRlZ2Vy' + testString),
121-
throwsA(isA<PlatformException>()));
122-
await preferences.reload();
123-
expect(preferences.getString('String'), null);
124-
expect(
125-
// prefix for doubles
126-
preferences.setString('String',
127-
'VGhpcyBpcyB0aGUgcHJlZml4IGZvciBEb3VibGUu' + testString),
128-
throwsA(isA<PlatformException>()));
129-
await preferences.reload();
130-
expect(preferences.getString('String'), null);
131-
}, skip: !Platform.isAndroid);
132100
});
133101
}

packages/shared_preferences/shared_preferences/example/ios/Podfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32-
target 'RunnerTests' do
33-
inherit! :search_paths
34-
end
3532
end
3633

3734
post_install do |installer|

0 commit comments

Comments
 (0)