Skip to content

Commit

Permalink
Merge pull request #185 from status-im/feature/profile-screen
Browse files Browse the repository at this point in the history
Editable profile screen

Former-commit-id: 05798fc
  • Loading branch information
rasom authored Aug 8, 2016
2 parents c6d3765 + 1b480a1 commit 8f39f11
Show file tree
Hide file tree
Showing 48 changed files with 786 additions and 397 deletions.
6 changes: 5 additions & 1 deletion .re-natal
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"realm/react-native",
"react-native-action-button",
"react-native-vector-icons/Ionicons",
"react-native-vector-icons/Octicons",
"react-native-circle-checkbox",
"react-native-randombytes",
"dismissKeyboard",
Expand All @@ -21,7 +22,10 @@
"react-native-qrcode",
"react-native-orientation",
"identicon.js",
"react-native-fs"
"react-native-fs",
"react-native-dialogs",
"react-native-image-resizer",
"react-native-image-crop-picker"
],
"imageDirs": [
"images"
Expand Down
5 changes: 4 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ android {

defaultConfig {
applicationId "com.statusim"
minSdkVersion 16
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
Expand Down Expand Up @@ -120,6 +120,8 @@ android {
}

dependencies {
compile project(':react-native-image-resizer')
compile project(':react-native-dialogs')
compile project(':react-native-randombytes')
compile project(':react-native-android-sms-listener')
compile project(':realm')
Expand All @@ -134,6 +136,7 @@ dependencies {
compile project(':react-native-status')
compile project(':react-native-orientation')
compile project(':react-native-fs')
compile project(':react-native-image-crop-picker')
//compile(name:'statusgo-android-16', ext:'aar')
compile(group: 'status-im', name: 'status-go', version: '0.1.0-201607011545-da53ec', ext: 'aar')

Expand Down
8 changes: 7 additions & 1 deletion android/app/src/main/java/com/statusim/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import com.github.yamill.orientation.OrientationPackage;
import com.rnfs.RNFSPackage;
import com.statusim.geth.module.GethPackage;
import com.aakashns.reactnativedialogs.ReactNativeDialogsPackage;
import fr.bamlab.rnimageresizer.ImageResizerPackage;
import com.reactnative.picker.PickerPackage;

import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -46,7 +49,10 @@ protected List<ReactPackage> getPackages() {
new SmsListenerPackage(),
new OrientationPackage(),
new RNFSPackage(),
new GethPackage()
new GethPackage(),
new ReactNativeDialogsPackage(),
new ImageResizerPackage(),
new PickerPackage()
);
}
};
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@





<string name="app_name">Status</string>
<string name="root_warning">Your phone appears to be ROOTED, by pressing CONTINUE you understand and accept the risks in using this software.</string>
<string name="root_okay">Continue</string>
Expand Down
14 changes: 4 additions & 10 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven { url "$rootDir/../node_modules/react-native/android" }
// for geth
flatDir {
dirs 'libs'
}
maven {
url "http://185.90.37.89:8081/artifactory/libs-release-local"
}
flatDir { dirs 'libs' }
maven { url "http://185.90.37.89:8081/artifactory/libs-release-local" }
maven { url "https://jitpack.io" }
}
}
6 changes: 6 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
rootProject.name = 'StatusIm'

include ':app'
include ':react-native-image-resizer'
project(':react-native-image-resizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-resizer/android')
include ':react-native-dialogs'
project(':react-native-dialogs').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dialogs/android')
include ':react-native-randombytes'
project(':react-native-randombytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-randombytes/android')
include ':react-native-android-sms-listener'
Expand All @@ -23,3 +27,5 @@ include ':react-native-orientation', ':app'
project(':react-native-orientation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-orientation/android')
include ':react-native-fs'
project(':react-native-fs').projectDir = new File(settingsDir, '../node_modules/react-native-fs/android')
include ':react-native-image-crop-picker'
project(':react-native-image-crop-picker').projectDir = new File(settingsDir, '../node_modules/react-native-image-crop-picker/android')
12 changes: 11 additions & 1 deletion ios/StatusIm.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
Expand Down Expand Up @@ -49,6 +48,7 @@
D28AEFB4C39548EB80416889 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 52E205D210BC48B7A553BB62 /* Entypo.ttf */; };
EF2B5857B4A34E0C9707FB3F /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B3B19223008342D096AA356E /* Octicons.ttf */; };
FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 674B3D9595A047AB8D518F4E /* libRNFS.a */; };
E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BEE3436791D42248F853999 /* libRCTImageResizer.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -284,6 +284,8 @@
CEB0E2659D1A4F5FA842057A /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = "<group>"; };
F090E261B9854867A728CE4F /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = "<group>"; };
5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */ = {isa = PBXFileReference; name = "RCTImageResizer.xcodeproj"; path = "../node_modules/react-native-image-resizer/ios/RCTImageResizer.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
2BEE3436791D42248F853999 /* libRCTImageResizer.a */ = {isa = PBXFileReference; name = "libRCTImageResizer.a"; path = "libRCTImageResizer.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -323,6 +325,7 @@
BA68A2377A20496EA737000D /* libz.tbd in Frameworks */,
3E15DFEC1F6F4D7CAE088F49 /* libTcpSockets.a in Frameworks */,
AD5063BC2B2A4C52ACE0A0B4 /* libUdpSockets.a in Frameworks */,
E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -581,6 +584,7 @@
38E1A2C8D0734EE99E2B16CE /* TcpSockets.xcodeproj */,
2F0276A9E90843E996A0E762 /* UdpSockets.xcodeproj */,
439B6B4B407A4E2AACAFE5BE /* RCTJail.xcodeproj */,
5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down Expand Up @@ -1074,6 +1078,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StatusIm.app/StatusIm";
Expand Down Expand Up @@ -1107,6 +1112,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StatusIm.app/StatusIm";
Expand Down Expand Up @@ -1140,6 +1146,7 @@
"$(SRCROOT)/../node_modules/react-native-udp/ios/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
);
INFOPLIST_FILE = StatusIm/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -1180,6 +1187,7 @@
"$(SRCROOT)/../node_modules/react-native-udp/ios/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
);
INFOPLIST_FILE = StatusIm/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -1244,6 +1252,7 @@
"$(SRCROOT)/../node_modules/react-native-udp/ios/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
Expand Down Expand Up @@ -1297,6 +1306,7 @@
"$(SRCROOT)/../node_modules/react-native-udp/ios/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-status/ios/RCTJail/RCTJail/**",
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
"react-native-circle-checkbox": "github:paramoshkinandrew/ReactNativeCircleCheckbox",
"react-native-contacts": "^0.2.4",
"react-native-crypto": "^2.0.1",
"react-native-dialogs": "0.0.16",
"react-native-fs": "^1.5.1",
"react-native-http": "github:tradle/react-native-http#834492d",
"react-native-i18n": "0.0.8",
"react-native-image-crop-picker": "^0.5.4",
"react-native-image-resizer": "github:danieldunderfelt/react-native-image-resizer",
"react-native-invertible-scroll-view": "^1.0.0",
"react-native-level-fs": "^2.0.1",
"react-native-linear-gradient": "1.5.7",
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[re-frame "0.7.0"]
[prismatic/schema "1.0.4"]
^{:voom {:repo "git@github.com:status-im/status-lib.git"
:branch "master"}}
:branch "discover-rework"}}
[status-im/protocol "0.1.1-20160706_085008-ge61756a"]
[natal-shell "0.3.0"]
[com.andrewmcveigh/cljs-time "0.4.0"]]
Expand Down
56 changes: 32 additions & 24 deletions src/status_im/accounts/handlers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,64 @@


(defn save-account [_ [_ account]]
(accounts/save-accounts [account]))
(accounts/save-accounts [account] false))

(register-handler :add-account
(register-handler
:add-account
(-> (fn [db [_ {:keys [address] :as account}]]
(update db :accounts assoc address account))
(update db :accounts assoc address account))
((after save-account))))

(defn save-password [password]
(storage/put kv/kv-store :password password))

(defn account-created [db result password]
(let [data (json->clj result)
(let [data (json->clj result)
public-key (:pubkey data)
address (:address data)
account {:public-key public-key
:address address
:name address
:photo-path (identicon address)}
]
address (:address data)
account {:public-key public-key
:address address
:name address
:photo-path (identicon address)}]
(log/debug "account-created: " account)
(when (not (str/blank? public-key))
(do
;(save-password password)
(dispatch-sync [:add-account account])
(dispatch [:login-account address password])))))

(register-handler :create-account
(-> (fn [db [_ password]]
(geth/create-account password (fn [result] (account-created db result password)))
db)))
(register-handler
:create-account
(fn [db [_ password]]
(geth/create-account password (fn [result] (account-created db result password)))
db))

(register-handler
:account-update
(fn [db [_ data]]
(let [current-account-id (get db :current-account-id)
account (-> (get-in db [:accounts current-account-id])
(merge data))]
(accounts/save-accounts [account] true)
(assoc-in db [:accounts current-account-id] account))))

(defn initialize-account [db account]
(defn initialize-account [db address]
(let [is-login-screen? (= (:view-id db) :login)]
(dispatch [:set :login {}])
(dispatch [:set :is-logged-in true])
(dispatch [:set :user-identity account])
(dispatch [:initialize-account account])
(dispatch [:set :current-account-id address])
(dispatch [:initialize-account address])
(when is-login-screen? (dispatch [:navigate-to-clean default-view]))))

(defn logged-in [db address]
(let [account (get-in db [:accounts address])
is-login-screen? (= (:view-id db) :login)
(let [is-login-screen? (= (:view-id db) :login)
new-account? (not is-login-screen?)]
(log/debug "Logged in: " address account)
(log/debug "Logged in: " address)
(realm/change-account-realm address new-account?
#(if (nil? %)
(initialize-account db account)
(initialize-account db address)
(log/debug "Error changing acount realm: " %)))))

(register-handler :login-account
(register-handler
:login-account
(-> (fn [db [_ address password]]
(geth/login address password (fn [result]
(let [data (json->clj result)
Expand Down
32 changes: 16 additions & 16 deletions src/status_im/accounts/login/screen.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
(dispatch [:set-in [:login :error] ""]))}]])

(defview login [{platform-specific :platform-specific}]
[{:keys [address password error]} [:get :login]]
[{:keys [address password error]} [:get :login]
keyboard-height [:get :keyboard-height]]
[view st/screen-container
[linear-gradient {:colors ["rgba(182, 116, 241, 1)" "rgba(107, 147, 231, 1)" "rgba(43, 171, 238, 1)"]
:start [0, 0]
Expand All @@ -79,20 +80,19 @@
[view st/form-container-inner
[address-input (or address "")]
[password-input error]]]
(let [keyboard-height @(subscribe [:get :keyboard-height])]
[view st/bottom-actions-container
(when (= keyboard-height 0)
[view st/recover-button-container
[touchable-highlight
{:on-press #()}
[view st/recover-button
[text {:style st/recover-button-text
:platform-specific platform-specific}
(label :t/recover-access)]]]])
[view st/connect-button-container
[view st/bottom-actions-container
(when (= keyboard-height 0)
[view st/recover-button-container
[touchable-highlight
{:on-press #(dispatch [:login-account address password])}
[view st/connect-button
[text {:style st/connect-button-text
{:on-press #()}
[view st/recover-button
[text {:style st/recover-button-text
:platform-specific platform-specific}
(label :t/connect)]]]]])])
(label :t/recover-access)]]]])
[view st/connect-button-container
[touchable-highlight
{:on-press #(dispatch [:login-account address password])}
[view st/connect-button
[text {:style st/connect-button-text
:platform-specific platform-specific}
(label :t/connect)]]]]]])
2 changes: 1 addition & 1 deletion src/status_im/accounts/views/account.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
(dispatch [:set-in [:login :address] address]))

(defview account-view [{:keys [address photo-path name] :as account}]
[current-account [:get :user-identity]]
[current-account [:get-current-account]]
[touchable-highlight
{:onPress #(on-press address)}
[view st/account-container
Expand Down
Loading

0 comments on commit 8f39f11

Please sign in to comment.