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
902b0124
Unverified
Commit
902b0124
authored
Jul 14, 2022
by
Callum Moffat
Committed by
GitHub
Jul 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `UIApplicationSupportsIndirectInputEvents` migration (#106889)
parent
2987d9e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
9 deletions
+81
-9
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+2
-2
host_app_info_plist_migration.dart
...lib/src/ios/migrations/host_app_info_plist_migration.dart
+67
-0
ios_project_migration_test.dart
...ls/test/general.shard/ios/ios_project_migration_test.dart
+12
-7
No files found.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
902b0124
...
...
@@ -26,7 +26,7 @@ import 'application_package.dart';
import
'code_signing.dart'
;
import
'iproxy.dart'
;
import
'migrations/deployment_target_migration.dart'
;
import
'migrations/
minimum_frame_duration
_migration.dart'
;
import
'migrations/
host_app_info_plist
_migration.dart'
;
import
'migrations/project_base_configuration_migration.dart'
;
import
'migrations/project_build_location_migration.dart'
;
import
'migrations/project_object_version_migration.dart'
;
...
...
@@ -125,7 +125,7 @@ Future<XcodeBuildResult> buildXcodeProject({
ProjectBuildLocationMigration
(
app
.
project
,
globals
.
logger
),
DeploymentTargetMigration
(
app
.
project
,
globals
.
logger
),
ProjectObjectVersionMigration
(
app
.
project
,
globals
.
logger
),
MinimumFrameDuration
Migration
(
app
.
project
,
globals
.
logger
),
HostAppInfoPlist
Migration
(
app
.
project
,
globals
.
logger
),
];
final
ProjectMigration
migration
=
ProjectMigration
(
migrators
);
...
...
packages/flutter_tools/lib/src/ios/migrations/
minimum_frame_duration
_migration.dart
→
packages/flutter_tools/lib/src/ios/migrations/
host_app_info_plist
_migration.dart
View file @
902b0124
...
...
@@ -7,10 +7,11 @@ import '../../base/project_migrator.dart';
import
'../../xcode_project.dart'
;
const
String
_kDisableMinimumFrameDurationKey
=
'CADisableMinimumFrameDurationOnPhone'
;
const
String
_kIndirectInputEventsKey
=
'UIApplicationSupportsIndirectInputEvents'
;
///
Add "CADisableMinimumFrameDurationOnPhone: true" to th
e Info.plist.
class
MinimumFrameDuration
Migration
extends
ProjectMigrator
{
MinimumFrameDuration
Migration
(
///
Updat
e Info.plist.
class
HostAppInfoPlist
Migration
extends
ProjectMigrator
{
HostAppInfoPlist
Migration
(
IosProject
project
,
super
.
logger
,
)
:
_infoPlist
=
project
.
defaultHostInfoPlist
;
...
...
@@ -20,7 +21,7 @@ class MinimumFrameDurationMigration extends ProjectMigrator {
@override
bool
migrate
()
{
if
(!
_infoPlist
.
existsSync
())
{
logger
.
printTrace
(
'Info.plist not found, skipping
minimum frame duration
migration.'
);
logger
.
printTrace
(
'Info.plist not found, skipping
host app Info.plist
migration.'
);
return
true
;
}
...
...
@@ -30,22 +31,37 @@ class MinimumFrameDurationMigration extends ProjectMigrator {
@override
String
migrateFileContents
(
String
fileContents
)
{
if
(
fileContents
.
contains
(
_kDisableMinimumFrameDurationKey
))
{
// No migration needed if the key already exits.
return
fileContents
;
}
logger
.
printTrace
(
'Adding
$_kDisableMinimumFrameDurationKey
to Info.plist'
);
const
String
plistEnd
=
'''
String
newContents
=
fileContents
;
if
(!
newContents
.
contains
(
_kDisableMinimumFrameDurationKey
))
{
logger
.
printTrace
(
'Adding
$_kDisableMinimumFrameDurationKey
to Info.plist'
);
const
String
plistEnd
=
'''
</dict>
</plist>
'''
;
const
String
plistWithKey
=
'''
const
String
plistWithKey
=
'''
<key>
$_kDisableMinimumFrameDurationKey
</key>
<true/>
</dict>
</plist>
'''
;
newContents
=
newContents
.
replaceAll
(
plistEnd
,
plistWithKey
);
}
if
(!
newContents
.
contains
(
_kIndirectInputEventsKey
))
{
logger
.
printTrace
(
'Adding
$_kIndirectInputEventsKey
to Info.plist'
);
const
String
plistEnd
=
'''
</dict>
</plist>
'''
;
const
String
plistWithKey
=
'''
<key>
$_kIndirectInputEventsKey
</key>
<true/>
</dict>
</plist>
'''
;
newContents
=
newContents
.
replaceAll
(
plistEnd
,
plistWithKey
);
}
return
fileContents
.
replaceAll
(
plistEnd
,
plistWithKey
)
;
return
newContents
;
}
}
packages/flutter_tools/test/general.shard/ios/ios_project_migration_test.dart
View file @
902b0124
...
...
@@ -7,7 +7,7 @@ import 'package:file/memory.dart';
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/base/project_migrator.dart'
;
import
'package:flutter_tools/src/ios/migrations/deployment_target_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/
minimum_frame_duration
_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/
host_app_info_plist
_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_base_configuration_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_build_location_migration.dart'
;
import
'package:flutter_tools/src/ios/migrations/project_object_version_migration.dart'
;
...
...
@@ -738,7 +738,7 @@ platform :ios, '11.0'
});
});
group
(
'
add CADisableMinimumFrameDurationOnPhone key to
info.plist migration'
,
()
{
group
(
'
update
info.plist migration'
,
()
{
late
MemoryFileSystem
memoryFileSystem
;
late
BufferLogger
testLogger
;
late
FakeIosProject
project
;
...
...
@@ -753,14 +753,14 @@ platform :ios, '11.0'
});
testWithoutContext
(
'skipped if files are missing'
,
()
{
final
MinimumFrameDurationMigration
iosProjectMigration
=
MinimumFrameDuration
Migration
(
final
HostAppInfoPlistMigration
iosProjectMigration
=
HostAppInfoPlist
Migration
(
project
,
testLogger
,
);
expect
(
iosProjectMigration
.
migrate
(),
isTrue
);
expect
(
infoPlistFile
.
existsSync
(),
isFalse
);
expect
(
testLogger
.
traceText
,
contains
(
'Info.plist not found, skipping
minimum frame duration
migration.'
));
expect
(
testLogger
.
traceText
,
contains
(
'Info.plist not found, skipping
host app Info.plist
migration.'
));
expect
(
testLogger
.
statusText
,
isEmpty
);
});
...
...
@@ -772,12 +772,14 @@ platform :ios, '11.0'
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
'''
;
infoPlistFile
.
writeAsStringSync
(
infoPlistFileContent
);
final
MinimumFrameDurationMigration
iosProjectMigration
=
MinimumFrameDuration
Migration
(
final
HostAppInfoPlistMigration
iosProjectMigration
=
HostAppInfoPlist
Migration
(
project
,
testLogger
,
);
...
...
@@ -788,7 +790,7 @@ platform :ios, '11.0'
expect
(
testLogger
.
statusText
,
isEmpty
);
});
testWithoutContext
(
'info.plist is migrated
to use CADisableMinimumFrameDurationOnPhone
'
,
()
{
testWithoutContext
(
'info.plist is migrated'
,
()
{
const
String
infoPlistFileContent
=
'''
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
...
...
@@ -799,7 +801,7 @@ platform :ios, '11.0'
'''
;
infoPlistFile
.
writeAsStringSync
(
infoPlistFileContent
);
final
MinimumFrameDurationMigration
iosProjectMigration
=
MinimumFrameDuration
Migration
(
final
HostAppInfoPlistMigration
iosProjectMigration
=
HostAppInfoPlist
Migration
(
project
,
testLogger
,
);
...
...
@@ -811,12 +813,15 @@ platform :ios, '11.0'
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
'''
));
});
});
});
}
class
FakeIosProject
extends
Fake
implements
IosProject
{
...
...
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