Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
13e30aae
Unverified
Commit
13e30aae
authored
Feb 06, 2020
by
Jenn Magder
Committed by
GitHub
Feb 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove android directory from platform_channel_swift example project (#50213)
parent
a0665aba
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
12 additions
and
379 deletions
+12
-379
analyze.dart
dev/bots/analyze.dart
+1
-1
test.dart
dev/bots/test.dart
+11
-13
build.gradle
examples/platform_channel_swift/android/app/build.gradle
+0
-64
ExampleInstrumentedTest.java
.../com/example/platformchannel/ExampleInstrumentedTest.java
+0
-96
AndroidManifest.xml
...rm_channel_swift/android/app/src/main/AndroidManifest.xml
+0
-33
MainActivity.java
...c/main/java/com/example/platformchannel/MainActivity.java
+0
-102
strings.xml
...channel_swift/android/app/src/main/res/values/strings.xml
+0
-8
build.gradle
examples/platform_channel_swift/android/build.gradle
+0
-33
gradle.properties
examples/platform_channel_swift/android/gradle.properties
+0
-4
gradle-wrapper.properties
...el_swift/android/gradle/wrapper/gradle-wrapper.properties
+0
-6
settings.gradle
examples/platform_channel_swift/android/settings.gradle
+0
-19
No files found.
dev/bots/analyze.dart
View file @
13e30aae
...
...
@@ -225,7 +225,7 @@ String _generateLicense(String prefix) {
Future
<
void
>
verifyNoMissingLicense
(
String
workingDirectory
,
{
bool
checkMinimums
=
true
})
async
{
final
int
overrideMinimumMatches
=
checkMinimums
?
null
:
0
;
await
_verifyNoMissingLicenseForExtension
(
workingDirectory
,
'dart'
,
overrideMinimumMatches
??
2000
,
_generateLicense
(
'// '
));
await
_verifyNoMissingLicenseForExtension
(
workingDirectory
,
'java'
,
overrideMinimumMatches
??
40
,
_generateLicense
(
'// '
));
await
_verifyNoMissingLicenseForExtension
(
workingDirectory
,
'java'
,
overrideMinimumMatches
??
39
,
_generateLicense
(
'// '
));
await
_verifyNoMissingLicenseForExtension
(
workingDirectory
,
'h'
,
overrideMinimumMatches
??
30
,
_generateLicense
(
'// '
));
await
_verifyNoMissingLicenseForExtension
(
workingDirectory
,
'm'
,
overrideMinimumMatches
??
30
,
_generateLicense
(
'// '
));
await
_verifyNoMissingLicenseForExtension
(
workingDirectory
,
'swift'
,
overrideMinimumMatches
??
10
,
_generateLicense
(
'// '
));
...
...
dev/bots/test.dart
View file @
13e30aae
...
...
@@ -282,13 +282,6 @@ Future<void> _runToolTests() async {
await
selectSubshard
(
subshards
);
}
// Example apps that should not be built by _runBuildTests`
const
List
<
String
>
_excludedExampleApplications
=
<
String
>[
// This application contains no platform code and cannot be built, except for
// as a part of a '--fast-start' Android application.
'splash'
,
];
/// Verifies that AOT, APK, and IPA (if on macOS) builds the examples apps
/// without crashing. It does not actually launch the apps. That happens later
/// in the devicelab. This is just a smoke-test. In particular, this will verify
...
...
@@ -300,14 +293,19 @@ Future<void> _runBuildTests() async {
if
(
fileEntity
is
!
Directory
)
{
continue
;
}
if
(
_excludedExampleApplications
.
any
(
fileEntity
.
path
.
endsWith
))
{
continue
;
}
final
String
examplePath
=
fileEntity
.
path
;
await
_flutterBuildAot
(
examplePath
);
await
_flutterBuildApk
(
examplePath
);
if
(
Directory
(
path
.
join
(
examplePath
,
'android'
)).
existsSync
())
{
await
_flutterBuildAot
(
examplePath
);
await
_flutterBuildApk
(
examplePath
);
}
else
{
print
(
'Example project
${path.basename(examplePath)}
has no android directory, skipping aot and apk'
);
}
if
(
Platform
.
isMacOS
)
{
await
_flutterBuildIpa
(
examplePath
);
if
(
Directory
(
path
.
join
(
examplePath
,
'ios'
)).
existsSync
())
{
await
_flutterBuildIpa
(
examplePath
);
}
else
{
print
(
'Example project
${path.basename(examplePath)}
has no ios directory, skipping ipa'
);
}
}
}
...
...
examples/platform_channel_swift/android/app/build.gradle
deleted
100644 → 0
View file @
a0665aba
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
def
localProperties
=
new
Properties
()
def
localPropertiesFile
=
rootProject
.
file
(
'local.properties'
)
if
(
localPropertiesFile
.
exists
())
{
localPropertiesFile
.
withReader
(
'UTF-8'
)
{
reader
->
localProperties
.
load
(
reader
)
}
}
def
flutterRoot
=
localProperties
.
getProperty
(
'flutter.sdk'
)
if
(
flutterRoot
==
null
)
{
throw
new
GradleException
(
"Flutter SDK not found. Define location with flutter.sdk in the local.properties file."
)
}
def
flutterVersionCode
=
localProperties
.
getProperty
(
'flutter.versionCode'
)
if
(
flutterVersionCode
==
null
)
{
flutterVersionCode
=
'1'
}
def
flutterVersionName
=
localProperties
.
getProperty
(
'flutter.versionName'
)
if
(
flutterVersionName
==
null
)
{
flutterVersionName
=
'1.0'
}
apply
plugin:
'com.android.application'
apply
from:
"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android
{
compileSdkVersion
28
lintOptions
{
disable
'InvalidPackage'
}
defaultConfig
{
applicationId
"io.flutter.examples.platform_channel_swift"
minSdkVersion
16
targetSdkVersion
28
versionCode
flutterVersionCode
.
toInteger
()
versionName
flutterVersionName
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes
{
release
{
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig
signingConfigs
.
debug
}
}
}
flutter
{
source
'../..'
}
dependencies
{
testImplementation
'junit:junit:4.12'
androidTestImplementation
'androidx.test:runner:1.1.1'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.1.1'
}
examples/platform_channel_swift/android/app/src/androidTest/java/com/example/platformchannel/ExampleInstrumentedTest.java
deleted
100644 → 0
View file @
a0665aba
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package
com
.
example
.
platformchannel
;
import
static
org
.
junit
.
Assert
.*;
import
android.app.Instrumentation
;
import
android.graphics.Bitmap
;
import
android.support.test.InstrumentationRegistry
;
import
android.support.test.rule.ActivityTestRule
;
import
android.support.test.runner.AndroidJUnit4
;
import
io.flutter.view.FlutterView
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.TimeUnit
;
import
org.junit.Rule
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
@RunWith
(
AndroidJUnit4
.
class
)
public
class
ExampleInstrumentedTest
{
@Rule
public
ActivityTestRule
<
MainActivity
>
activityRule
=
new
ActivityTestRule
<>(
MainActivity
.
class
);
@Test
public
void
testBitmap
()
{
final
Instrumentation
instr
=
InstrumentationRegistry
.
getInstrumentation
();
final
BitmapPoller
poller
=
new
BitmapPoller
(
5
);
instr
.
runOnMainSync
(
new
Runnable
()
{
public
void
run
()
{
final
FlutterView
flutterView
=
activityRule
.
getActivity
().
getFlutterView
();
// Call onPostResume to start the engine's renderer even if the activity
// is paused in the test environment.
flutterView
.
onPostResume
();
poller
.
start
(
flutterView
);
}
});
Bitmap
bitmap
=
null
;
try
{
bitmap
=
poller
.
waitForBitmap
();
}
catch
(
InterruptedException
e
)
{
fail
(
e
.
getMessage
());
}
assertNotNull
(
bitmap
);
assertTrue
(
bitmap
.
getWidth
()
>
0
);
assertTrue
(
bitmap
.
getHeight
()
>
0
);
// Check that a pixel matches the default Material background color.
assertTrue
(
bitmap
.
getPixel
(
bitmap
.
getWidth
()
-
1
,
bitmap
.
getHeight
()
-
1
)
==
0xFFFAFAFA
);
}
// Waits on a FlutterView until it is able to produce a bitmap.
private
class
BitmapPoller
{
private
int
triesPending
;
private
int
waitMsec
;
private
FlutterView
flutterView
;
private
Bitmap
bitmap
;
private
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
private
final
int
delayMsec
=
1000
;
BitmapPoller
(
int
tries
)
{
triesPending
=
tries
;
waitMsec
=
delayMsec
*
tries
+
100
;
}
void
start
(
FlutterView
flutterView
)
{
this
.
flutterView
=
flutterView
;
flutterView
.
postDelayed
(
checkBitmap
,
delayMsec
);
}
Bitmap
waitForBitmap
()
throws
InterruptedException
{
latch
.
await
(
waitMsec
,
TimeUnit
.
MILLISECONDS
);
return
bitmap
;
}
private
Runnable
checkBitmap
=
new
Runnable
()
{
public
void
run
()
{
bitmap
=
flutterView
.
getBitmap
();
triesPending
--;
if
(
bitmap
!=
null
||
triesPending
==
0
)
{
latch
.
countDown
();
}
else
{
flutterView
.
postDelayed
(
checkBitmap
,
delayMsec
);
}
}
};
}
}
examples/platform_channel_swift/android/app/src/main/AndroidManifest.xml
deleted
100644 → 0
View file @
a0665aba
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.example.platformchannel"
>
<!-- The INTERNET permission is required for development. Specifically,
flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<application
android:name=
"io.flutter.app.FlutterApplication"
android:label=
"@string/app_name"
>
<activity
android:name=
".MainActivity"
android:launchMode=
"singleTop"
android:theme=
"@android:style/Theme.Black.NoTitleBar"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated=
"true"
android:windowSoftInputMode=
"adjustResize"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name=
"flutterEmbedding"
android:value=
"2"
/>
</application>
</manifest>
examples/platform_channel_swift/android/app/src/main/java/com/example/platformchannel/MainActivity.java
deleted
100644 → 0
View file @
a0665aba
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package
com
.
example
.
platformchannel
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.ContextWrapper
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.os.BatteryManager
;
import
android.os.Build.VERSION
;
import
android.os.Build.VERSION_CODES
;
import
android.os.Bundle
;
import
androidx.annotation.NonNull
;
import
io.flutter.embedding.android.FlutterActivity
;
import
io.flutter.embedding.engine.FlutterEngine
;
import
io.flutter.plugin.common.EventChannel
;
import
io.flutter.plugin.common.EventChannel.EventSink
;
import
io.flutter.plugin.common.EventChannel.StreamHandler
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.MethodChannel.MethodCallHandler
;
import
io.flutter.plugin.common.MethodChannel.Result
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
public
class
MainActivity
extends
FlutterActivity
{
private
static
final
String
BATTERY_CHANNEL
=
"samples.flutter.io/battery"
;
private
static
final
String
CHARGING_CHANNEL
=
"samples.flutter.io/charging"
;
@Override
public
void
configureFlutterEngine
(
@NonNull
FlutterEngine
flutterEngine
)
{
GeneratedPluginRegistrant
.
registerWith
(
flutterEngine
);
new
EventChannel
(
flutterEngine
.
getDartExecutor
(),
CHARGING_CHANNEL
).
setStreamHandler
(
new
StreamHandler
()
{
private
BroadcastReceiver
chargingStateChangeReceiver
;
@Override
public
void
onListen
(
Object
arguments
,
EventSink
events
)
{
chargingStateChangeReceiver
=
createChargingStateChangeReceiver
(
events
);
registerReceiver
(
chargingStateChangeReceiver
,
new
IntentFilter
(
Intent
.
ACTION_BATTERY_CHANGED
));
}
@Override
public
void
onCancel
(
Object
arguments
)
{
unregisterReceiver
(
chargingStateChangeReceiver
);
chargingStateChangeReceiver
=
null
;
}
}
);
new
MethodChannel
(
flutterEngine
.
getDartExecutor
(),
BATTERY_CHANNEL
).
setMethodCallHandler
(
new
MethodCallHandler
()
{
@Override
public
void
onMethodCall
(
MethodCall
call
,
Result
result
)
{
if
(
call
.
method
.
equals
(
"getBatteryLevel"
))
{
int
batteryLevel
=
getBatteryLevel
();
if
(
batteryLevel
!=
-
1
)
{
result
.
success
(
batteryLevel
);
}
else
{
result
.
error
(
"UNAVAILABLE"
,
"Battery level not available."
,
null
);
}
}
else
{
result
.
notImplemented
();
}
}
}
);
}
private
BroadcastReceiver
createChargingStateChangeReceiver
(
final
EventSink
events
)
{
return
new
BroadcastReceiver
()
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
int
status
=
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_STATUS
,
-
1
);
if
(
status
==
BatteryManager
.
BATTERY_STATUS_UNKNOWN
)
{
events
.
error
(
"UNAVAILABLE"
,
"Charging status unavailable"
,
null
);
}
else
{
boolean
isCharging
=
status
==
BatteryManager
.
BATTERY_STATUS_CHARGING
||
status
==
BatteryManager
.
BATTERY_STATUS_FULL
;
events
.
success
(
isCharging
?
"charging"
:
"discharging"
);
}
}
};
}
private
int
getBatteryLevel
()
{
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
LOLLIPOP
)
{
BatteryManager
batteryManager
=
(
BatteryManager
)
getSystemService
(
BATTERY_SERVICE
);
return
batteryManager
.
getIntProperty
(
BatteryManager
.
BATTERY_PROPERTY_CAPACITY
);
}
else
{
Intent
intent
=
new
ContextWrapper
(
getApplicationContext
()).
registerReceiver
(
null
,
new
IntentFilter
(
Intent
.
ACTION_BATTERY_CHANGED
));
return
(
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_LEVEL
,
-
1
)
*
100
)
/
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_SCALE
,
-
1
);
}
}
}
examples/platform_channel_swift/android/app/src/main/res/values/strings.xml
deleted
100644 → 0
View file @
a0665aba
<!-- Copyright 2014 The Flutter Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<resources>
<string
name=
"app_name"
>
Platform Channel
</string>
<string
name=
"title"
>
Flutter Application
</string>
</resources>
examples/platform_channel_swift/android/build.gradle
deleted
100644 → 0
View file @
a0665aba
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
buildscript
{
repositories
{
google
()
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:3.2.1'
}
}
allprojects
{
repositories
{
google
()
jcenter
()
}
}
rootProject
.
buildDir
=
'../build'
subprojects
{
project
.
buildDir
=
"${rootProject.buildDir}/${project.name}"
}
subprojects
{
project
.
evaluationDependsOn
(
':app'
)
}
task
clean
(
type:
Delete
)
{
delete
rootProject
.
buildDir
}
examples/platform_channel_swift/android/gradle.properties
deleted
100644 → 0
View file @
a0665aba
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.enableJetifier
=
true
android.enableR8
=
true
\ No newline at end of file
examples/platform_channel_swift/android/gradle/wrapper/gradle-wrapper.properties
deleted
100644 → 0
View file @
a0665aba
#Fri Jun 23 08:50:38 CEST 2017
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-4.10.2-all.zip
examples/platform_channel_swift/android/settings.gradle
deleted
100644 → 0
View file @
a0665aba
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
include
':app'
def
flutterProjectRoot
=
rootProject
.
projectDir
.
parentFile
.
toPath
()
def
plugins
=
new
Properties
()
def
pluginsFile
=
new
File
(
flutterProjectRoot
.
toFile
(),
'.flutter-plugins'
)
if
(
pluginsFile
.
exists
())
{
pluginsFile
.
withInputStream
{
stream
->
plugins
.
load
(
stream
)
}
}
plugins
.
each
{
name
,
path
->
def
pluginDirectory
=
flutterProjectRoot
.
resolve
(
path
).
resolve
(
'android'
).
toFile
()
include
":$name"
project
(
":$name"
).
projectDir
=
pluginDirectory
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment