Staffjoy is shutting down, so we are open-sourcing our code. These applications use React Native to create a simple webview around Staffjoy V1's applications. The mobile applications look for a mobile-config.json on the server, which provides a regex for determining which URLs are considered the "app, which hides a navbar with the URL and back button. The repos also includes some other functionality, such as a loading screen and error handling. Thanks to @JBaller for helping us with this last year in his spare time.
Note: Skip the react-native upgrade step from the docs. We aren't using their templates, and it would attempt to overwrite important native code.
iOS: run pod install from the /ios directory
Android: updated dynamically during the build process
Debug & Build
Note: For iOS, because we're using Cocoapods, you must open the workspace file, (StaffjoyMobile.xcworkspace), not the project file (.xcodeproj).
Debugging
Platform
Type
iOS
Debug
react-native run-ios from project root (as of React v0.22, you need a simulator titled "iPhone 6")
iOS
Debug
In Xcode: Build and Run the StaffjoyMobile target onto a device or simulator
Android
Debug
react-native run-android while emulator is running or device is connected )
While debugging, shake the device to access the React Native Developer menu (CMD+D on iOS simulator, F2 on Android emulator)
Loading JavaScript
Note: Release builds always load from the app binary
Platform
Notes
iOS Simulator
Automatically loads latest version via packager
iOS Device
Loads from app binary; need to rebuild to get updated JS
Android
Loads from server* when __DEV__ enabled (toggle at top of debug menu after shaking device)
* For Android devices or emulators running Anroid 5 or later, it's easiest to link to the packager over USB by running adb reverse tcp:8081 tcp:8081. To link over WiFi, shake the device, tap the last settings option in the debug menu, and enter the address of your machine and port number of packager (default 8081)
Building
iOS
Target
Properties
StaffjoyMobile
Includes a page for the system's Settings app that allows you to change root domain (i.e. to point at dev.staffjoy.com). For realistic testing, deploy to TestFlight and test on a dev server.
Staffjoy Release
Release build
Open ios/StaffjoyMobile.xcworkspace in Xcode
Select the desired target
Choose Generic iOS Device from the device list.
Select Product -> Archive
Once archvied, the Organizer will open (access later via Window -> Organizer)
Select the latest build, and choose "Upload to App Store"
Manage TestFlight and App Store release via iTunes Connect
To test an archive on a device without waiting for TestFlight, go to Window -> Organizer, choose Export, then Ad Hoc, and install by dragging the exported file to your device via Window -> Devices
Android
via shell
(One time only) Set up Gradle variables for signing with the Staffjoy certificate (credentials are excluded from git for security)
a. Look up Android Keystore in Staffjoy's "Mobile" vault in 1Password
a. Copy staffjoy_android_keystore.jks from 1Password into your project's android/app directory
a. Copy gradle.properties into the ~/.gradle directory
Run ./gradlew assembleRelease (or installRelease, assembleDebug, installDebug)
The APK will be built to android/app/build/outputs/apk/app-release.apk (or app-debug.apk)
Via IDE
Open the project in Android Studio
Go to Build -> Generate Signed APK
Choose the app module
Enter key store info
a. path: point to a local copy the .jks file from 1Password
b. password: from 1Password
c. alias: staffjoy_android_keystore
d. key password: the second password from 1Password (under "key info")
请发表评论