tidev / hyperloop.next

Hyperloop Next version (we forgot the version number at this point)
Other
7 stars 4 forks source link

fix(ios): whenever xcodeTargetOS is 'maccatalyst' pass along 'iphoneos' for any commnds need sdk value #342

Closed sgtcoolguy closed 3 years ago

sgtcoolguy commented 3 years ago

This appears to make macOS support "magically" work. Basically we're setting builder.xcodeTargetOS to 'maccatalyst' in the iOS CLI, and hyperloop tries to use that to refer to the sdk under the hood. It should use 'iphoneos' in that case.

I tested the following app.js with these changes via ti build -p ios -T macos:

import { UIView, UIColor } from 'UIKit';
import { CoreGraphics } from 'CoreGraphics';

const CGRectMake = CoreGraphics.CGRectMake;
const CGAffineTransformRotate = CoreGraphics.CGAffineTransformRotate;
const CGAffineTransformScale = CoreGraphics.CGAffineTransformScale;
const CGAffineTransformIdentity = CoreGraphics.CGAffineTransformIdentity;

const win = Ti.UI.createWindow({ title: 'View Animation' });
const scrollView = Ti.UI.createScrollView();
const container = Ti.UI.createView({});
const button = Ti.UI.createButton({
    title: 'Animate'
});
const notice = Ti.UI.createLabel({});
scrollView.add(container);
scrollView.add(button);
scrollView.add(notice);
win.add(scrollView);

// create a view box we're going to animate when you click the button
const view = UIView.alloc().initWithFrame(CGRectMake(10, 10, 50, 50));
view.backgroundColor = UIColor.redColor;
container.add(view);

let flag = false;

button.addEventListener('click', () => {
    flag = !flag;
    notice.text = '';
    // animate the UIView
    UIView.animateWithDurationAnimationsCompletion(1.0, () => {
        // this function will be called to handle the animation
        // any changes done in this function will be animated
        if (flag) {
            view.frame = CGRectMake(100, 100, 200, 200);
            view.layer.opacity = 0.8;
            view.layer.cornerRadius = view.frame.size.width / 2;
            view.transform = CGAffineTransformScale(CGAffineTransformRotate(view.transform, Math.PI), 1.5, 1.5);
            view.backgroundColor = UIColor.blueColor;
        } else {
            view.frame = CGRectMake(10, 10, 50, 50);
            view.layer.opacity = 1;
            view.layer.cornerRadius = 0;
            view.transform = CGAffineTransformIdentity;
            view.backgroundColor = UIColor.redColor;
        }
    }, (_done) => {
        // this function is called after the animation completes
        notice.text = 'Animation completed!';
        setTimeout(() => notice.text = '', 2000);
    });
});

win.open();
sgtcoolguy commented 3 years ago

Spoke w/ @janvennemann on Teams - this probably is better fixed in the SDK itself - see https://github.com/appcelerator/titanium_mobile/pull/12118