Skip to content

Commit

Permalink
use status-go's hackaton-alt branch
Browse files Browse the repository at this point in the history
  • Loading branch information
rasom committed Jun 2, 2017
1 parent 6921587 commit 6f6849f
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 31 deletions.
5 changes: 4 additions & 1 deletion bots/demo_bot/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ function superSuggestion(params, context) {
return {markup: view};
};

var cnt = 0;

status.addListener("on-message-input-change", superSuggestion);
status.addListener("on-message-send", function (params, context) {
cnt++;
if (isNaN(params.message)) {
return {"text-message": "Seems that you don't want to send money :("};
return {"text-message": "Seems that you don't want to send money :(. cnt = " + cnt};
}

var balance = web3.eth.getBalance(context.from);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@
ReferencedContainer = "container:StatusIm.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disabled"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
Expand Down
2 changes: 1 addition & 1 deletion modules/react-native-status/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ android {
dependencies {
compile 'com.facebook.react:react-native:+'
compile 'com.instabug.library:instabug:3+'
compile(group: 'status-im', name: 'status-go', version: '0.9.8-g311f2b8', ext: 'aar')
compile(group: 'status-im', name: 'status-go', version: 'hackaton-alt-gd3704fa', ext: 'aar')
}
1 change: 0 additions & 1 deletion modules/react-native-status/ios/RCTStatus/RCTStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ static void displayStatusChanged(CFNotificationCenterRef center, void *observer,
NSLog(@"error %@", error);
}else
NSLog(@"folderName: %@", folderName);

char *configChars = GenerateConfig([folderName.path UTF8String], 3);
NSString *config = [NSString stringWithUTF8String: configChars];
NSData *configData = [config dataUsingEncoding:NSUTF8StringEncoding];
Expand Down
2 changes: 1 addition & 1 deletion modules/react-native-status/ios/RCTStatus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<artifactItem>
<groupId>status-im</groupId>
<artifactId>status-go-ios-simulator</artifactId>
<version>0.9.8-g311f2b8</version>
<version>hackaton-alt-gd3704fa</version>
<type>zip</type>
<overWrite>true</overWrite>
<outputDirectory>./</outputDirectory>
Expand Down
6 changes: 5 additions & 1 deletion src/status_im/chat/handlers/commands.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
result)]
(dispatch [:set-in [:message-data data-type message-id] result])
(when on-requested (on-requested result)))]
(status/call-jail jail-id path params callback)))))))
;chat-id path params callback lock? type
(status/call-jail {:jail-id jail-id
:path path
:params params
:callback callback})))))))

(handlers/register-handler :execute-command-immediately
(handlers/side-effect!
Expand Down
17 changes: 9 additions & 8 deletions src/status_im/chat/handlers/input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,15 @@
params {:parameters {:args args}
:context (merge {:data data}
(input-model/command-dependent-context-params command))}]
(status/call-jail jail-id
path
params
#(dispatch [:received-bot-response
{:chat-id current-chat-id
:command command
:parameter-index parameter-index}
%]))))))))
(status/call-jail
{:jail-id jail-id
:path path
:params params
:callback #(dispatch [:received-bot-response
{:chat-id current-chat-id
:command command
:parameter-index parameter-index}
%])})))))))

(handlers/register-handler
::send-message
Expand Down
10 changes: 5 additions & 5 deletions src/status_im/chat/handlers/send_message.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@
[:check-and-load-commands!
identity
#(status/call-jail
identity
path
params
(fn [res]
(dispatch [:command-handler! chat-id parameters res])))])))))
{:jail-id identity
:path path
:params params
:callback (fn [res]
(dispatch [:command-handler! chat-id parameters res]))})])))))

(register-handler :prepare-message
(u/side-effect!
Expand Down
11 changes: 6 additions & 5 deletions src/status_im/chat/handlers/webview_bridge.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,12 @@
parameters {:context context
:parameters {:amount amount
:address address}}]
(s/call-jail c/wallet-chat-id
path
parameters
(fn [data]
(log/debug :webview-send-eth-callback data)))))))
(s/call-jail
{:jail-id c/wallet-chat-id
:path path
:params parameters
:callback (fn [data]
(log/debug :webview-send-eth-callback data))})))))

(register-handler :webview-nfc
(u/side-effect!
Expand Down
17 changes: 9 additions & 8 deletions src/status_im/components/status.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
[cljs.core.async :refer [<! timeout]]
[status-im.utils.js-resources :as js-res]
[status-im.i18n :as i]
[status-im.utils.platform :as p]))
[status-im.utils.platform :as p]
[status-im.utils.scheduler :as scheduler]))

(defn cljs->json [data]
(.stringify js/JSON (clj->js data)))
Expand Down Expand Up @@ -135,11 +136,11 @@
(when status
(call-module #(.parseJail status chat-id file callback))))

(defn call-jail [chat-id path params callback]
(defn call-jail [{:keys [jail-id path params callback]}]
(when status
(call-module
#(do
(log/debug :call-jail :chat-id chat-id)
(log/debug :call-jail :jail-id jail-id)
(log/debug :call-jail :path path)
(log/debug :call-jail :params params)
(let [params' (update params :context assoc
Expand All @@ -152,17 +153,17 @@
(doseq [{:keys [type message]} messages]
(log/debug (str "VM console(" type ") - " message)))
(callback r')))]
(.callJail status chat-id (cljs->json path) (cljs->json params') cb))))))
(.callJail status jail-id (cljs->json path) (cljs->json params') cb))))))

(defn call-function!
[{:keys [chat-id function callback] :as opts}]
(let [path [:functions function]
params (select-keys opts [:parameters :context])]
(call-jail
chat-id
path
params
(or callback #(dispatch [:received-bot-response {:chat-id chat-id} %])))))
{:jail-id chat-id
:path path
:params params
:callback (or callback #(dispatch [:received-bot-response {:chat-id chat-id} %]))})))

(defn set-soft-input-mode [mode]
(when status
Expand Down

0 comments on commit 6f6849f

Please # to comment.