Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Remove UI #21

Open
ghost opened this issue Nov 30, 2018 · 7 comments
Open

Request: Remove UI #21

ghost opened this issue Nov 30, 2018 · 7 comments

Comments

@ghost
Copy link

ghost commented Nov 30, 2018

It would be great if the UI was removed from the framework target all together. I need very different UI for my project. Would you be interested in taking the project in that direction?

@onato
Copy link
Contributor

onato commented Dec 3, 2018

Yes, I have been meaning to look into a more Swifty API that doesn't rely on inheritance, but haven't had much chance to think it through.

@ghost
Copy link
Author

ghost commented Dec 3, 2018

Let me see if I can put something together. It probably won't be a pull request though.

Be right back.

@ghost
Copy link
Author

ghost commented Dec 3, 2018

Hybrid.zip

@onato
Copy link
Contributor

onato commented Dec 3, 2018

This looks great. Nice work! I'm happy to start moving forward with this. Let's set up a feature branch. I added you as a collaborator.

My ProcessPool singleton still has the old pre-Swift-3 convention of sharedInstance instead of shared.

shouldShowNewScene should receive a WKNavigationAction. This allows you to check if the navigation was, for example, a redirect or a click using the navigationType.

@ghost
Copy link
Author

ghost commented Dec 4, 2018

I'm glad you like the code.

I like how you have built a swift to js / css bridge. It would be very interesting to see your project develop more on this.

I don't know very much about website development so I don't fully understand AtDocumentStart or end. I can't read js or css !

I have no idea what is going on here.

document.documentElement.style.webkitTouchCallout='none';

var root = document.getElementsByTagName( 'html' )[0]
var existingClass = root.getAttribute( 'class' )
root.setAttribute( 'class', 'neeman-hybrid-app neeman-hybrid-app-version-${VERSION} ' + existingClass );

var styleElement = document.createElement('style');
root.appendChild(styleElement);
styleElement.textContent = '${CSS}';

This prevents a highlight happening on touch?

canvas {
    -webkit-tap-highlight-color: transparent;
}

I understand that you are intercepting messages with this. You have taken the link from the button, which is cool. But I can't write javascript and I'm too lazy to learn a new language.

 (function(){
  var buttons = document.getElementsByClassName("header-context-button");
  if(buttons.length > 0) {
  var button = buttons[0];
  webkit.messageHandlers.didGetBarButton.postMessage(button.href);
  }
  
  var metaTags=document.getElementsByTagName("meta");
  
  var username = "";
  for (var i = 0; i < metaTags.length; i++) {
  if (metaTags[i].getAttribute("name") == "octolytics-actor-login") {
  username = metaTags[i].getAttribute("content");
  break;
  }
  }
  webkit.messageHandlers.didGetUserName.postMessage(username);
  })();

🤯

So I'm not sure how I can help you because my understanding of web development is zero.

Regarding a feature branch: I think maybe you should consider removing some of the UI logic before adding another feature.

@onato
Copy link
Contributor

onato commented Dec 4, 2018

AtDocumentStart happens before the WebView begins to load the HTML into memory. Code loaded there won't have access to the DOM until the page loads fully.

I have no idea what is going on here.
This code adds a class attribute to the HTML tag so you can add app specific CSS later. It also inserts the contents of the CSS files into the DOM.

-webkit-tap-highlight-color prevents a canvas element from being highlighted when you tap it. I think I added that to prevent a highlight around an interactive graph when you tap on it.

I would have to get the Hybrid stuff running on a separate branch, port my apps to it making sure everything I need is supported and once it's ready, merge it into the main branch. I have quite a bit of code in a private repo that builds on Neeman, so it might take me a while.

What's your plan for using this? I'd be keen to hear more about your use-case.

@ghost
Copy link
Author

ghost commented Dec 5, 2018

Thanks for the explanation.

I have a new client that wants to build a hybrid web / native App and I'm searching GitHub for clever ways to achieve that. Project starts in January.

I have built stable hybrid Apps before but it wasn't fun.

Sound like you will be busy. I will watch for changes to your repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant