-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jobs: Branch18R4 [git-p4: depot-paths = "//depot/4eDimension/18R4/4DComponents/User Components/4D Mobile App Server/": change = 253242]
- Loading branch information
0 parents
commit 4425271
Showing
96 changed files
with
4,773 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Data | ||
Preferences | ||
Logs | ||
userPreferences.* | ||
Mobile Projects | ||
data.* | ||
MobileApps | ||
Project/DerivedData | ||
Settings/4DPop | ||
AuthKey_*.p8 | ||
.DS_Store | ||
Resources/php.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Contributing | ||
|
||
All contributors are welcome to this project in the form of feedback, bug reports and even better - pull requests | ||
|
||
## Issues | ||
|
||
Issues are used to track **bugs** and **feature requests**. | ||
|
||
* Before reporting a bug or requesting a feature, run a few searches to | ||
see if a similar issue has already been opened and ensure you’re not submitting | ||
a duplicate. | ||
|
||
### Bugs | ||
|
||
* Describe steps to reproduce | ||
* Full error message if any | ||
* Your code if relevant | ||
|
||
## Pull Request Guidelines | ||
|
||
* Open a single PR for each subject. | ||
* Prefer to develop in a topic branch, not master (feature/name) | ||
* Update documentation where applicable. | ||
|
||
### Method properties | ||
|
||
* Methods not documented and not for the ginal client must be private ie. set invisible. | ||
* Method must be set preemptive if possible. | ||
|
||
### Naming rules | ||
|
||
* Name of public methods must start with `Mobile App` then category if any (ex: `Action`) and finally a name. | ||
* This rules could be changed | ||
* Create a folder by category | ||
* Create a `Compiler_categoryName` inside each folders for compilation declarations | ||
|
||
### Only touch relevant files | ||
|
||
* Make sure your PR stays focused on a single feature or category. | ||
* Don't change project configs or any files unrelated to the subject you're working. | ||
* Don't reformat code you don't modify. | ||
|
||
## Formatting code | ||
|
||
* To format code use If you can 4DPop Beautifier macro. | ||
* `folders.json` is not yet version source control compliant. | ||
|
||
So sort the key before commit if you want to make minimum diff | ||
``` | ||
cat folders.json | jq --sort-keys . > folders.sorted.json ; rm folders.json; mv folders.sorted.json folders.json | ||
``` | ||
You can install jq using homebrew | ||
``` | ||
brew install jq | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Authentication with email confirmation | ||
|
||
Sending an email is a well-known process to check user identity. | ||
|
||
You can implement its easily following this two steps | ||
- Use [Mobile App Email Checker](Methods/Mobile%20App%20Email%20Checker.md) in [`On Mobile App Authentication`](https://doc.4d.com/4Dv18/4D/18/On-Mobile-App-Authentication-database-method.301-4505016.en.html) to disable the user session and send an email with a validation link. | ||
- and [Mobile App Active Session](Methods/Mobile%20App%20Active%20Session.md) in [`On Web Connection`](https://doc.4d.com/4Dv18/4D/18/On-Web-Connection-database-method.301-4505013.en.html) to validate the session when the user click the link. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!-- $action:=MobileAppServer.Action.new($1) // $1 Informations provided by `On Mobile App Action` --> | ||
# Action | ||
|
||
Utility class to get `dataClass` or `entity` to apply action when inside `On Mobile App Action` database method. | ||
|
||
## Usage | ||
|
||
in `On Mobile App Action` wrap the first input parameters | ||
|
||
```4d | ||
$action:=MobileAppServer.Action.new($1) // $1 Informations provided by mobile application | ||
``` | ||
|
||
Then you can switch as usual on action name and use of the function | ||
|
||
```4d | ||
Case of | ||
//________________________________________ | ||
: ($action.name="purgeAll") // Purge all, action scope is table/dataclass | ||
$dataClass:=$action.getDataClass() | ||
// Insert here the code to purge all entities of this dataClass. | ||
//________________________________________ | ||
: ($action.name="add") // Add a new entitys | ||
$book:=$action.newEntity() | ||
$status:=$book.save() | ||
//________________________________________ | ||
: ($action.name="rate") // Rate a book, action scope is entity | ||
$book:=$action.getEntity() | ||
// Insert here the code for the action "Rate and Review" the book | ||
End case | ||
``` | ||
|
||
### all scope | ||
|
||
#### getDataClass() | ||
|
||
This return the `dataClass` associated to the action. | ||
|
||
```4d | ||
$dataClass:=$action.getDataClass() | ||
``` | ||
|
||
#### newEntity() | ||
|
||
Create a new instance of entity associated to the action data class; same as `getDataClass().new()` | ||
|
||
```4d | ||
$aNewEntity:=$action.newEntity() | ||
``` | ||
|
||
### current record scope | ||
|
||
#### getEntity() | ||
|
||
Get the entity associated to the action. | ||
|
||
```4d | ||
$entityToApplyAction:=$action.getEntity() | ||
``` | ||
|
||
> This return Null if the action scope is not "current record" | ||
#### dropEntity() | ||
|
||
Drop the entity associated to the action; same as `getEntity().drop()` | ||
|
||
```4d | ||
$status:=$action.dropEntity() | ||
``` | ||
|
||
### work with relations | ||
|
||
When navigating in mobile application you need some information about context. | ||
|
||
For instance you are on one parent record/entity of type "company" and then you display the company "employee" list. You need to know the parent "company" to add or remove an "employee" from this list. | ||
|
||
#### getParent() | ||
|
||
You can get the parent entity associated to the action. | ||
|
||
```4d | ||
$parentEntity:=$action.getParent() | ||
``` | ||
|
||
#### unlink() | ||
|
||
You can unlink on entity from its parent. | ||
|
||
```4d | ||
$operationResult:=$action.unlink() | ||
$status:=$operationResult.save() // to save record | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!-- $auth:=MobileAppServer.Authentication.new($1) // $1 Informations provided by `On Mobile App Authentication` --> | ||
# Authentication | ||
|
||
Utility class to get and manipulate session. To use with `On Mobile App Authentication` database method. | ||
|
||
## Usage | ||
|
||
in `On Mobile App Authentication` wrap the first input parameters | ||
|
||
```4d | ||
$auth:=MobileAppServer.Authentication.new($1) // $1 Informations provided by mobile application | ||
```` | ||
Then you can have some information about mobile applications and session or even have a special authentication like sending email | ||
### Get application id | ||
```4d | ||
$myAppId:=$auth.getAppId() | ||
``` | ||
|
||
### Get session information | ||
|
||
#### Get the `File` associated to the session | ||
|
||
```4d | ||
$currentSessionFile:=$auth.getSessionFile() | ||
``` | ||
|
||
#### Get the session information as object | ||
|
||
```4d | ||
$currentSessionObject:=$auth.getSessionObject() | ||
``` | ||
|
||
### Modify current session | ||
|
||
Setting the status to "pending" ie. not validated yet. | ||
|
||
```4d | ||
$currentSessionObject.status:="pending" | ||
$currentSessionObject.save() // save to File on disk | ||
``` | ||
|
||
### Checking authentication using a confirmation email | ||
|
||
```4d | ||
$0:=$auth.confirmEmail() | ||
``` | ||
|
||
You must configure first your SMTP server to send emails - more detail available [here](../Methods/Mobile%20App%20Email%20Checker.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Dev | ||
|
||
Class of tools to provide methods for the development phase. | ||
|
||
## Usage | ||
|
||
Load the tools methods: | ||
|
||
```4d | ||
$o:=MobileAppServer .Dev.new() | ||
``` | ||
|
||
### Use Dev class to update the server structure | ||
### `updateStructure()` | ||
|
||
This method perform, on the server side, the structure adjustments for an optimised mobile data update. It will be especially useful if you create your mobile application from a local database copy and then you want to connect it to your production server. | ||
|
||
Pass as parameter a table name or a collection of table names according to your project definition and the method perform the structure adjustments. | ||
|
||
```4d | ||
$o:=MobileAppServer .Dev.new() | ||
$result:=$o.updateStructure("Table_1") | ||
``` | ||
|
||
or | ||
|
||
```4d | ||
$o:=MobileAppServer .Dev.new() | ||
$result:=$o.updateStructure(New collection("Table_1";"Table_2";...;"table_N")) | ||
``` | ||
|
||
The returned object `$result` contains a boolean property `success` to check if the process has been successfully executed. If so, the `log` property gives, as a collection, the list of actions performed and the results. Otherwise, the `errors` property lists the errors encountered. | ||
|
||
Be careful, the table names are case sensitive | ||
|
||
|
Oops, something went wrong.