Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release-candidate' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Verkoeyen committed Nov 14, 2017
2 parents 003ec84 + 1fffbae commit 1991d50
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 35 deletions.
52 changes: 36 additions & 16 deletions .kokoro
Original file line number Diff line number Diff line change
@@ -1,35 +1,55 @@
#!/bin/bash
#
# Copyright 2017-present The Material Motion Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Fail on any error.
set -e

# Display commands to stderr.
set -x

KOKORO_RUNNER_VERSION="v3.*"

fix_bazel_imports() {
if [ -z "$KOKORO_BUILD_NUMBER" ]; then
repo_prefix=""
else
repo_prefix="github/repo/"
fi

# Fixes a bug in bazel where objc_library targets have a _ prefix.
find "${repo_prefix}tests/unit" -type f -name '*.swift' -exec sed -i '' -E "s/import Motion(.+)/import _Motion\1/" {} + || true
stashed_dir=$(pwd)
reset_imports() {
# Undoes our source changes from above.
find "${stashed_dir}/${tests_dir_prefix}tests/unit" -type f -name '*.swift' -exec sed -i '' -E "s/import _Motion(.+)/import Motion\1/" {} + || true
}
trap reset_imports EXIT
}

if [ ! -d .kokoro-ios-runner ]; then
git clone https://github.com/material-foundation/kokoro-ios-runner.git .kokoro-ios-runner
fi

pushd .kokoro-ios-runner
git fetch > /dev/null
TAG=$(git tag -l "v3*" | sort | tail -n1)
git checkout $TAG > /dev/null
TAG=$(git tag --sort=v:refname -l "$KOKORO_RUNNER_VERSION" | tail -n1)
git checkout "$TAG" > /dev/null
popd

if [ -z "$KOKORO_BUILD_NUMBER" ]; then
tests_dir_prefix=""
else
tests_dir_prefix="github/repo/"
fi

# Fixes a bug in bazel where objc_library targets have a _ prefix.
find ${tests_dir_prefix}tests/unit -type f -name '*.swift' -exec sed -i '' -E "s/import Motion(.+)/import _Motion\1/" {} + || true
stashed_dir=$(pwd)
reset_imports() {
# Undoes our source changes from above.
find ${stashed_dir}/${tests_dir_prefix}tests/unit -type f -name '*.swift' -exec sed -i '' -E "s/import _Motion(.+)/import Motion\1/" {} + || true
}
trap reset_imports EXIT
fix_bazel_imports

./.kokoro-ios-runner/bazel.sh test //:UnitTests 8.1.0

Expand Down
14 changes: 14 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2017-present The Material Motion Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Description:
# Light-weight API for building UIViewController transitions.

Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# 4.0.2

This patch release fixes a bug where the frames of custom presented views would be incorrectly set
to the view controller's frame.

## Source changes

* [Add support for transitions with custom presented views. (#55)](https://github.com/material-motion/motion-transitioning-objc/commit/2564bfdf42a2ba7c550656b95bc7dc98019468bb) (featherless)

## Non-source changes

* [Standardize the kokoro and bazel files. (#51)](https://github.com/material-motion/motion-transitioning-objc/commit/588b63dfae7471f3377041caa08496ef1fa74ced) (featherless)

# 4.0.1

This patch release resolves a build warning and migrates the project's continuous integration to
Expand Down
2 changes: 1 addition & 1 deletion MotionTransitioning.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "MotionTransitioning"
s.summary = "Light-weight API for building UIViewController transitions."
s.version = "4.0.1"
s.version = "4.0.2"
s.authors = "The Material Motion Authors"
s.license = "Apache 2.0"
s.homepage = "https://github.com/material-motion/transitioning-objc"
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- CatalogByConvention (2.1.1)
- MotionTransitioning (4.0.1)
- MotionTransitioning (4.0.2)

DEPENDENCIES:
- CatalogByConvention
Expand All @@ -12,7 +12,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
CatalogByConvention: c3a5319de04250a7cd4649127fcfca5fe3322a43
MotionTransitioning: 277501a1a1e6121c0ab523e6a3e00d64659c3367
MotionTransitioning: 9885e68bd1501f1f8244b2e40081acd8cf3ac461

PODFILE CHECKSUM: 25d5942fb7698339a03667bb46c3fbb77529b92d

Expand Down
16 changes: 15 additions & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# Copyright 2017-present The Material Motion Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
Expand All @@ -7,5 +21,5 @@ git_repository(
git_repository(
name = "bazel_ios_warnings",
remote = "https://github.com/material-foundation/bazel_ios_warnings.git",
commit = "3e61cb5b60f52c8b9c77b5d62364d8b4d25e528f",
tag = "v1.0.1",
)
38 changes: 23 additions & 15 deletions src/private/MDMViewControllerTransitionCoordinator.m
Original file line number Diff line number Diff line change
Expand Up @@ -313,35 +313,43 @@ - (void)initiateTransition {
_root.transitionContext = _transitionContext;

UIViewController *from = [_transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
if (from) {
UIView *fromView = [_transitionContext viewForKey:UITransitionContextFromViewKey];
if (fromView == nil) {
fromView = from.view;
}
if (fromView != nil && fromView == from.view) {
CGRect finalFrame = [_transitionContext finalFrameForViewController:from];
if (!CGRectIsEmpty(finalFrame)) {
from.view.frame = finalFrame;
fromView.frame = finalFrame;
}
}

UIViewController *to = [_transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
if (to) {
UIView *toView = [_transitionContext viewForKey:UITransitionContextToViewKey];
if (toView == nil) {
toView = to.view;
}
if (toView != nil && toView == to.view) {
CGRect finalFrame = [_transitionContext finalFrameForViewController:to];
if (!CGRectIsEmpty(finalFrame)) {
to.view.frame = finalFrame;
toView.frame = finalFrame;
}

switch (_direction) {
case MDMTransitionDirectionForward:
[_transitionContext.containerView addSubview:to.view];
break;
if (toView.superview == nil) {
switch (_direction) {
case MDMTransitionDirectionForward:
[_transitionContext.containerView addSubview:toView];
break;

case MDMTransitionDirectionBackward:
if (!to.view.superview) {
[_transitionContext.containerView insertSubview:to.view atIndex:0];
}
break;
case MDMTransitionDirectionBackward:
[_transitionContext.containerView insertSubview:toView atIndex:0];
break;
}
}

[to.view layoutIfNeeded];
}

[toView layoutIfNeeded];

[_root attemptFallback];
[self anticipateOnlyExplicitAnimations];

Expand Down

0 comments on commit 1991d50

Please sign in to comment.