Skip to content

Commit 4425271

Browse files
committed
branching 18R4
Jobs: Branch18R4 [git-p4: depot-paths = "//depot/4eDimension/18R4/4DComponents/User Components/4D Mobile App Server/": change = 253242]
0 parents  commit 4425271

File tree

96 files changed

+4773
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+4773
-0
lines changed

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Data
2+
Preferences
3+
Logs
4+
userPreferences.*
5+
Mobile Projects
6+
data.*
7+
MobileApps
8+
Project/DerivedData
9+
Settings/4DPop
10+
AuthKey_*.p8
11+
.DS_Store
12+
Resources/php.ini

CONTRIBUTING.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Contributing
2+
3+
All contributors are welcome to this project in the form of feedback, bug reports and even better - pull requests
4+
5+
## Issues
6+
7+
Issues are used to track **bugs** and **feature requests**.
8+
9+
* Before reporting a bug or requesting a feature, run a few searches to
10+
see if a similar issue has already been opened and ensure you’re not submitting
11+
a duplicate.
12+
13+
### Bugs
14+
15+
* Describe steps to reproduce
16+
* Full error message if any
17+
* Your code if relevant
18+
19+
## Pull Request Guidelines
20+
21+
* Open a single PR for each subject.
22+
* Prefer to develop in a topic branch, not master (feature/name)
23+
* Update documentation where applicable.
24+
25+
### Method properties
26+
27+
* Methods not documented and not for the ginal client must be private ie. set invisible.
28+
* Method must be set preemptive if possible.
29+
30+
### Naming rules
31+
32+
* Name of public methods must start with `Mobile App` then category if any (ex: `Action`) and finally a name.
33+
* This rules could be changed
34+
* Create a folder by category
35+
* Create a `Compiler_categoryName` inside each folders for compilation declarations
36+
37+
### Only touch relevant files
38+
39+
* Make sure your PR stays focused on a single feature or category.
40+
* Don't change project configs or any files unrelated to the subject you're working.
41+
* Don't reformat code you don't modify.
42+
43+
## Formatting code
44+
45+
* To format code use If you can 4DPop Beautifier macro.
46+
* `folders.json` is not yet version source control compliant.
47+
48+
So sort the key before commit if you want to make minimum diff
49+
```
50+
cat folders.json | jq --sort-keys . > folders.sorted.json ; rm folders.json; mv folders.sorted.json folders.json
51+
```
52+
You can install jq using homebrew
53+
```
54+
brew install jq
55+
```
17.4 KB
Loading
17.6 KB
Loading
25.6 KB
Loading
70 KB
Loading
62.8 KB
Loading
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Authentication with email confirmation
2+
3+
Sending an email is a well-known process to check user identity.
4+
5+
You can implement its easily following this two steps
6+
- 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.
7+
- 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.

Documentation/Classes/Action.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<!-- $action:=MobileAppServer.Action.new($1) // $1 Informations provided by `On Mobile App Action` -->
2+
# Action
3+
4+
Utility class to get `dataClass` or `entity` to apply action when inside `On Mobile App Action` database method.
5+
6+
## Usage
7+
8+
in `On Mobile App Action` wrap the first input parameters
9+
10+
```4d
11+
$action:=MobileAppServer.Action.new($1) // $1 Informations provided by mobile application
12+
```
13+
14+
Then you can switch as usual on action name and use of the function
15+
16+
```4d
17+
Case of
18+
//________________________________________
19+
: ($action.name="purgeAll") // Purge all, action scope is table/dataclass
20+
21+
$dataClass:=$action.getDataClass()
22+
// Insert here the code to purge all entities of this dataClass.
23+
24+
//________________________________________
25+
: ($action.name="add") // Add a new entitys
26+
27+
$book:=$action.newEntity()
28+
$status:=$book.save()
29+
//________________________________________
30+
: ($action.name="rate") // Rate a book, action scope is entity
31+
32+
$book:=$action.getEntity()
33+
// Insert here the code for the action "Rate and Review" the book
34+
35+
End case
36+
```
37+
38+
### all scope
39+
40+
#### getDataClass()
41+
42+
This return the `dataClass` associated to the action.
43+
44+
```4d
45+
$dataClass:=$action.getDataClass()
46+
```
47+
48+
#### newEntity()
49+
50+
Create a new instance of entity associated to the action data class; same as `getDataClass().new()`
51+
52+
```4d
53+
$aNewEntity:=$action.newEntity()
54+
```
55+
56+
### current record scope
57+
58+
#### getEntity()
59+
60+
Get the entity associated to the action.
61+
62+
```4d
63+
$entityToApplyAction:=$action.getEntity()
64+
```
65+
66+
> This return Null if the action scope is not "current record"
67+
68+
#### dropEntity()
69+
70+
Drop the entity associated to the action; same as `getEntity().drop()`
71+
72+
```4d
73+
$status:=$action.dropEntity()
74+
```
75+
76+
### work with relations
77+
78+
When navigating in mobile application you need some information about context.
79+
80+
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.
81+
82+
#### getParent()
83+
84+
You can get the parent entity associated to the action.
85+
86+
```4d
87+
$parentEntity:=$action.getParent()
88+
```
89+
90+
#### unlink()
91+
92+
You can unlink on entity from its parent.
93+
94+
```4d
95+
$operationResult:=$action.unlink()
96+
$status:=$operationResult.save() // to save record
97+
```
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!-- $auth:=MobileAppServer.Authentication.new($1) // $1 Informations provided by `On Mobile App Authentication` -->
2+
# Authentication
3+
4+
Utility class to get and manipulate session. To use with `On Mobile App Authentication` database method.
5+
6+
## Usage
7+
8+
in `On Mobile App Authentication` wrap the first input parameters
9+
10+
```4d
11+
$auth:=MobileAppServer.Authentication.new($1) // $1 Informations provided by mobile application
12+
````
13+
14+
Then you can have some information about mobile applications and session or even have a special authentication like sending email
15+
16+
### Get application id
17+
18+
```4d
19+
$myAppId:=$auth.getAppId()
20+
```
21+
22+
### Get session information
23+
24+
#### Get the `File` associated to the session
25+
26+
```4d
27+
$currentSessionFile:=$auth.getSessionFile()
28+
```
29+
30+
#### Get the session information as object
31+
32+
```4d
33+
$currentSessionObject:=$auth.getSessionObject()
34+
```
35+
36+
### Modify current session
37+
38+
Setting the status to "pending" ie. not validated yet.
39+
40+
```4d
41+
$currentSessionObject.status:="pending"
42+
$currentSessionObject.save() // save to File on disk
43+
```
44+
45+
### Checking authentication using a confirmation email
46+
47+
```4d
48+
$0:=$auth.confirmEmail()
49+
```
50+
51+
You must configure first your SMTP server to send emails - more detail available [here](../Methods/Mobile%20App%20Email%20Checker.md)

0 commit comments

Comments
 (0)