Skip to content

Commit

Permalink
Add lgmp path to configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
czystyl committed Feb 9, 2019
1 parent 9f525cc commit 6c390f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
4 changes: 2 additions & 2 deletions examples/components-macos/app/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ targets:
- Sources
settings:
HEADER_SEARCH_PATHS: '$(STDLIB_PATH)'
LIBRARY_SEARCH_PATHS: '$(STDLIB_PATH)'
OTHER_LDFLAGS: ' -framework Cocoa'
LIBRARY_SEARCH_PATHS: '$(STDLIB_PATH) /usr/local/lib/'
OTHER_LDFLAGS: ' -framework Cocoa -lgmp'
configFiles:
Debug: Resources/env.xcconfig
Release: Resources/env.xcconfig
Expand Down
30 changes: 8 additions & 22 deletions renderer-macos/lib/components/Image.re
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,24 @@ let measure = (node, _, _, _, _) => {
{width, height};
};

let getUserDate = (id: int) => {
let https_url = "https://api.github.com/user/" ++ string_of_int(id);
/* Logs.app(m => m("Requesting: %s", https_url)); */

let getImage = (~url: string) => {
switch (
Httpkit_lwt.Client.(
Httpkit.Client.Request.create(
~headers=[("User-Agent", "Reason HttpKit")],
`GET,
https_url |> Uri.of_string,
Uri.of_string(url),
)
|> Https.send
>>= Response.body
|> Lwt_main.run
)
) {
| exception _e =>
/* Logs.err(m => m("%s", Printexc.to_string(e))); */
"asdasd"
| exception _e => "Error"
| Ok(body) =>
let json = Yojson.Basic.from_string(body);
open Yojson.Basic.Util;
let login = json |> member("login") |> to_string;
/* let id = to_int(member("id", json)); */

/* Logs.app(m => m("login: %s", login)); */
/* Logs.app(m => m("id: %d", id)); */

/* Logs.app(m => m("Response: %s", body)); */
login;
| Error(_) =>
Logs.err(m => m("Something went wrong!!!"));
"error";
/* get image instead of random string */
Yojson.Basic.(from_string(body) |> Util.member("login") |> to_string)
| Error(_) => "error"
};
};

Expand All @@ -60,7 +45,8 @@ let make = (~style=[], ~source, ~url, children) =>
make: () => {
let view = BriskImage.make(~source, ());

print_string(url);
/* TODO: handle user image */
print_string(getImage(~url));

{view, layoutNode: Layout.Node.make(~measure, ~style, view)};
},
Expand Down

0 comments on commit 6c390f8

Please sign in to comment.