From wiki.ginstr.com
Jump to: navigation, search
(Created page with "<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div> <span STYLE="font-size: xx-large">strings.xml naming convention</span> Category:ginstr_developers_manu...")
 
(List of error codes)
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
 
<div style="float:right; clear:both; margin-left:0.5em;">__TOC__</div>
<span STYLE="font-size: xx-large">strings.xml naming convention</span>
+
<span STYLE="font-size: xx-large">Launcher error codes</span>
 
[[Category:ginstr_developers_manual]]
 
[[Category:ginstr_developers_manual]]
  
This document serves as a set of rules how to form string resources id's for widgets that are used in ginstr apps.
+
This document describes ginstr launcher error codes.
  
=Definitions=
+
=List of error codes=
;<code>${pageName}</code>: defined by android:id attribute of the root screen element, NOT by fileName of file which contains widgets
 
  
;<code>${widgetName}</code>: defined by ginstr app developer or in case of app-composer auto generated
+
{| class="wikitable sortable" style="font-size: 85%; text-align: left;"
 
+
|-
It is strictly forbidden to use one resource in two different places of an app. In this case 2 different resources must be implemented.
+
! scope="col" | Code
 
+
! scope="col" | ResourceId
=Resources folder=
+
! scope="col" | Description
Resources folders are found at each ginstr app on path:
+
|-
 
+
| title="Code" | <code>1001</code>
;default folder:
+
| title="ResourceId" | <code>@string/$msgBoxInvalidUserName</code>
:<code>appId/values/strings.xml</code>
+
| title="Description" | Can be displayed if:
 
+
: the response result from the server while we are trying to retrieve AgUser is "access denied"
;or for English:
+
: retrieved SsoUser has "fail" in SsoUser.getError()
:<code>appId/values-en/strings.xml</code>
+
: retrieved SsoUser has "1" or "3" in SsoUser.getCode()
 
+
|-
;or where LANG is language parameter:
+
| title="Code" | <code>1003</code>
:<code>appId/values-LANG/strings.xml</code>
+
| title="ResourceId" | <code>@string/$msgBoxDisabledUserException</code>
 
+
| title="Description" | Can be displayed if:
=String resource fallback mechanism and overriding rules=
+
: launcher throws an exception while we are trying to retrieve AgUser
If resource is not found in ginstr app ginstr launcher has fallback mechanism to load resources from $defaultApp.
+
: server returns 403 while we are trying to retrieve AgUser and server error output is not "1017", "1018", "1020"
 
+
: retrieved SsoUser is null or SsoUser.getError() is null or SsoUser.getError() is "fail" and SsoUser.getCode() is "4"
All resources that are in '''$defaultApp''' are globally available to all ginstr apps.
+
|-
If certain resource does not exist in any "'''[[Strings.xml|strings.xml]]'''" of a ginstr app but is referenced in "layouts" of ginstr app and exists in '''$defaultApp''' then it will be loaded from '''$defaultApp'''.
+
| title="Code" | <code>1004</code>
If you override a resource id that exists in '''$defaultApp''' in ginstr app '''$defaultApp''' resource will be ignored but this also means if you would change a generic message that is used across multiple ginstr apps for this app where is overridden it would not apply but additional modification of that overridden resource would be required.
+
| title="ResourceId" | <code>@string/$msgBoxLoginIoException</code>
 
+
| title="Description" | Can be displayed if:
There can be 3 situations when using resources in ginstr app:
+
: launcher throws an exception while we are trying to check if server is available
#resource id is loaded from '''$defaultApp''' and is used as is
+
: retrieved SsoUser is null or SsoUser.getError() is null or SsoUser.getError() is "fail" and SsoUser.getCode() is null
#resource id "template" is loaded from '''$defaultApp''' and has parameters which are variable per ginstr app
+
: onHostChecked() server response is not 200
#resource id "template" is not loaded and does not exist in '''$defaultApp'''
+
|-
==$defaultApp resource id's prefix==
+
| title="Code" | <code>1005</code>
All string resource id's in '''$defaultApp''' should start with <code>$</code> symbol:
+
| title="ResourceId" | <code>@string/$msgBoxSerialImeiMissing</code>
 
+
| title="Description" | Can be displayed if:
i.e.
+
: ENAiKOON serial is missing on the device
<syntaxhighlight lang="xml" enclose="div">
+
|-
<string name="$txtAppManagerInstall">install</string>
+
| title="Code" | <code>1006</code>
<string name="$txtAppManagerUninstall">uninstall</string>
+
| title="ResourceId" | <code>@string/$msgBoxErrorReplicationPushDisabled</code>
<string name="$txtAppRecreateShortcuts">create icons&lt;BR/&gt;on the launch screen</string>
+
| title="Description" | Can be displayed if:
</syntaxhighlight>
+
: retrieved SsoUser has "3" in SsoUser.getCode() and internet connection is not available
==Labels: for ginstr app input fields==
+
|-
Label represents text above the input field of a widget.
+
| title="Code" | <code>1007</code>
Resource id "template" is not loaded and does not exist in '''$defaultApp'''
+
| title="ResourceId" | <code>@string/$msgBoxLoginPasswordExpired</code>
Labels should have the resource id formed as:
+
| title="Description" | Can be displayed if:
<syntaxhighlight lang="xml" enclose="div">
+
: retrieved SsoUser has "30" in SsoUser.getCode()
@string/${pageName}_${widgetName}
+
|-
</syntaxhighlight>
+
| title="Code" | <code>1008</code>
which would look like this on widget:
+
| title="ResourceId" | <code>@string/$msgBoxAtLeastOneLogin</code>
<syntaxhighlight lang="xml" enclose="div">
+
| title="Description" | Can be displayed if:
<com.ginstr.widgets.GnTextView
+
: the local user doesn't exist and internet connection is not available
    android:id="..."
+
|-
    android:layout_width="match_parent"  
+
| title="Code" | <code>1009</code>
    android:layout_height="wrap_content"
+
| title="ResourceId" | <code>@string/$msgBoxGinstrServersUnavailable</code>
    android:text="@string/${pageName}_${widgetName}"
+
| title="Description" | Can be displayed if:
    gn:style="..."/>
+
: ginstr launcher is trying to start in offline mode and local user doesn't exist
</syntaxhighlight>
+
|-
 
+
| title="Code" | <code>1010</code>
and in [[Strings.xml|strings]]:
+
| title="ResourceId" | <code>@string/$msgBoxMissingRole</code>
<syntaxhighlight lang="xml" enclose="div">
+
| title="Description" | Can be displayed if:
<string name="${pageName}_${widgetName}">example label</string>
+
: AgUser doesn't have specific rights to run the app
</syntaxhighlight>
+
|-
example if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code>:
+
| title="Code" | <code>1011</code>
<syntaxhighlight lang="xml" enclose="div">
+
| title="ResourceId" | <code>@string/$msgBoxLoginNoResponseServer</code>
<com.ginstr.widgets.GnTextView
+
| title="Description" | Can be displayed if:
    android:id="..."  
+
: AgUser or SsoUSer server response is null or empty
    android:layout_width="..."
+
|-
    android:layout_height="..."
+
| title="Code" | <code>1012</code>
    android:text="@string/pageOne_customerName"  
+
| title="ResourceId" | <code>@string/$msgBoxLoginBadUser</code>
    gn:style="..."/>
+
| title="Description" | Can be displayed if:
</syntaxhighlight>
+
: retrieved AgUser json data is invalid
and example in [[Strings.xml|strings]]:
+
|-
<syntaxhighlight lang="xml" enclose="div">
+
| title="Code" | <code>1013</code>
<string name="pageOne_customerName">example label</string>
+
| title="ResourceId" | <code>@string/$msgBoxLoginBadUserSso</code>
</syntaxhighlight>
+
| title="Description" | Can be displayed if:
==Hints: for ginstr app input fields==
+
: retrieved AgUser json data is invalid
Hint represents text which is shown in input field when it's empty as a suggestion to user.
+
|-
Resource id "template" is not loaded and does not exist in '''$defaultApp'''
+
| title="Code" | <code>1015</code>
 
+
| title="ResourceId" | <code>@string/$msgBoxNotActivatedUserException</code>
Hints should have resource id formed as:
+
| title="Description" | Can be displayed if:
<syntaxhighlight lang="xml" enclose="div">
+
: not used in ginstr launcher
@string/${pageName}_${widgetName}Hint
+
|-
</syntaxhighlight>
+
| title="Code" | <code>1016</code>
which would look like this on widget:
+
| title="ResourceId" | <code>@string/$msgBoxAppNotEnabledForUser</code>
<syntaxhighlight lang="xml" enclose="div">
+
| title="Description" | Can be displayed if:
<com.ginstr.widgets.GnEditText
+
: AgUser is not allowed to use the specific app
    android:id="..."  
+
|}
    android:layout_width="..."  
 
    android:layout_height="..."  
 
    gn:s_hint="@string/${pageName}_${widgetName}Hint"
 
    gn:data_type="..."  
 
    gn:style="..."/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}Hint">example label hint</string>
 
</syntaxhighlight>
 
example if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:s_hint="@string/pageOne_customerNameHint"
 
    gn:data_type="..."
 
    gn:style="..."/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameHint">example label hint</string>
 
</syntaxhighlight>
 
 
 
=Validators for ginstr app widgets=
 
[[Validation|Validators]] are mechanisms that check if user entry is valid and prevent user from typing something that should not be typed in certain input field, i.e. typing text into a kilos field when number is expected.
 
There can be multiple [[Validation|validators]] on a widget. Validation messages can also be loaded from '''$defaultApp'''.
 
There are multiple validators and multiple strings that each validator contains.
 
 
 
'''$defaultApp''' contains predefined validation messages which are used for various purposes, in that case resourceId prefix is:
 
 
 
;PREFIX + SUFFIX:
 
:<code>{PredefinedNameOfValidation} + ValidatorNameKeyValue</code>
 
 
 
;Prefix:is defined by ginstr app developer with purpose of [[Validation|validation]], i.e. <code>"checkIfAllFieldsFilled"</code>
 
 
 
;Suffix: in the validator resourceId defines which validator and which message within validator is targeted:
 
 
 
Validator types <code>"ValidatorName"</code>:
 
*<code>[[TextValidator]]</code>
 
*<code>[[ComparatorValidator]]</code>
 
*<code>[[RequiredValidator]]</code>
 
 
 
Validator messages for override <code>"KeyValue"</code> (see all of them [[Validation|<u>here</u>]]) :
 
<pre>
 
MinLength
 
MaxLength
 
REGEX
 
PhoneErrMsg
 
EmailErrMsg
 
MinLengthErrMsg
 
.... </pre>
 
 
 
The above information should be used in forming rules for different cases.
 
 
 
==Forming rules for different cases:==
 
 
 
===Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)===
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/$PredefinedNameOfValidationValidatorNameKeyValue
 
</syntaxhighlight>
 
which would look like this on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
    <com.ginstr.widgets.GnEditText
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/$PredefinedNameOfValidationValidatorNameKeyValue]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]] at '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$PredefinedNameOfValidationValidatorNameKeyValue">this is a default predefined message for validation</string>
 
</syntaxhighlight>
 
example if <code>predefinedNameOfValidation="checkIfAllFieldsFilled"</code> and <code>validatorName="[[RequiredValidator]]"</code> and <code>KeyValue="message"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/$checkIfAllFieldsFilledRequiredValidatorMessage]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]] at '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="checkIfAllFieldsFilledRequiredValidatorMessage">please fill all fields which have a '*'</string>
 
</syntaxhighlight>
 
===Resource id "template" is loaded from $defaultApp and has parameters which are variable per ginstr app===
 
 
 
In this case resource should be copied from '''$defaultApp''' and variable content should be "replaced" and when done saved into ginstr app '''[[Strings.xml|strings.xml]]'''
 
Rule for forming resource ID in such case:
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/${pageName}_${widgetName}ValidatorNameKeyValue
 
</syntaxhighlight>
 
Content in '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$PredefinedNameOfValidationValidatorNameKeyValue">some value using params, %1$s , %2$s</string>
 
</syntaxhighlight>
 
i.e.
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="checkIfFieldIsFilledRequiredRequiredValidatorMessage">entering the %1$s is required</string>
 
</syntaxhighlight>
 
should be generated in ginstr app as:
 
 
 
on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
    <com.ginstr.widgets.GnEditText 
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}ValidatorNameKeyValue]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]] at ginstr app:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ValidatorNameKeyValue">entering the ${widgetName} is required</string>
 
</syntaxhighlight>
 
example if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code> and <code>validatorName="RequiredValidator"</code> and <code>KeyValue="message"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/$pageOne_customerNameRequiredValidatorMessage]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and example in [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameRequiredValidatorMessage">entering the customerName is required</string>
 
</syntaxhighlight>
 
===Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only===
 
Rule for forming resource ID in such case:
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/${pageName}_${widgetName}ValidatorNameKeyValue
 
</syntaxhighlight>
 
should be generated in ginstr app as:
 
 
 
on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
    <com.ginstr.widgets.GnEditText
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:RequiredValidator],[message=@string/${pageName}_${widgetName}ValidatorNameKeyValue]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
and in [[Strings.xml|strings]] at ginstr app:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ValidatorNameKeyValue">entering this value is required</string>
 
</syntaxhighlight>
 
===Example of decimal numerical validator for english (EN)===
 
Maximum allowed number length is 15 which can be stored into ginstr back-end. For that reason there are 2 validator rules used.
 
 
 
====Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)====
 
resourceId prefix for number decimal is :
 
<code>widgetId + ValidatorName + KeyValue</code>
 
i.e. <code>NumberDecimal + TextValidator + MaxLength</code> (see [[Number#Decimal_variant|NumberDecimal]] for further information)
 
 
 
'''$defaultApp''' contains:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$NumberDecimalTextValidatorMaxLength">maximum allowed number length is 15</string>
 
<string name="$NumberDecimalTextValidatorREGEX">only decimal numbers are allowed</string>
 
<string name="$NumberDecimalTextValidatorPattern">^[-+]?[0-9]*(\.)?[0-9]+\b$</string>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/$NumberDecimalTextValidatorMaxLength]"
 
        gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/$NumberDecimalTextValidatorREGEX],[pattern=@string/NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
====Resource id "template" is loaded from $defaultApp and has parameters which are variable per ginstr app====
 
'''$defaultApp''' contains:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$NumberDecimalTextValidatorMaxLength">maximum allowed %1$s length is %2$s</string>
 
<string name="$NumberDecimalTextValidatorREGEX">only decimal numbers are allowed for %1$s</string>
 
<string name="$NumberDecimalTextValidatorPattern">^[-+]?[0-9]*(\.)?[0-9]+\b$</string>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/$NumberDecimalTextValidatorMaxLength]"
 
        gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/$NumberDecimalTextValidatorREGEX],[pattern=@string/NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
app specific generated:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/${pageName}_${widgetName}NumberDecimalTextValidatorMaxLength]"
 
        gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/${pageName}_${widgetName}NumberDecimalTextValidatorREGEX],[pattern=@string/NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorMaxLength">maximum allowed ${widgetName} length is ${maxLength}</string>
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorREGEX">only decimal numbers are allowed for ${widgetName}</string>
 
</syntaxhighlight>
 
====Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only====
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnEditText
 
    android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        gn:act_validate="[name:TextValidator],[maxLength=15],[maxLengthErrMsg=@string/${pageName}${widgetName}NumberDecimalTextValidatorMaxLength]"
 
        gn:act_validate2="[name:TextValidator],[inputType=REGEX],[REGEXErrMsg=@string/${pageName}_${widgetName}NumberDecimalTextValidatorREGEX],[pattern=@string/$NumberDecimalTextValidatorPattern]"
 
    gn:s_sourceType="input"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorMaxLength">maximum allowed ${widgetName} length is ${maxLength}</string>
 
<string name="${pageName}_${widgetName}NumberDecimalTextValidatorREGEX">only decimal numbers are allowed for ${widgetName}</string>
 
</syntaxhighlight>
 
 
 
=Buttons: execute some logic=
 
Buttons should have the resource id formed as:
 
<code>@string/${pageName}_${widgetName}</code>
 
 
 
which would look like this on widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<Button
 
  android:id="..."
 
  android:layout_width="..."
 
  android:layout_height="..."
 
  android:background="..."
 
  gn:setBackgroundPressed="..."
 
  gn:style="..."
 
  android:text="@string/${pageName}_${widgetName}"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}">button function</string>
 
</syntaxhighlight>
 
 
 
Example if <code>pageName="pageOne"</code> and <code>widgetName="saveCustomerData"</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<Button
 
  android:id="..."
 
  android:layout_width="..."
 
  android:layout_height="..."
 
  android:background="..."
 
  gn:setBackgroundPressed="..."
 
  gn:style="..."
 
  android:text="@string/pageOne_saveCustomerData"/>
 
</syntaxhighlight>
 
in [[Strings.xml|strings.xml]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_saveCustomerData">save customer data</string>
 
</syntaxhighlight>
 
=Actions: actions are basic building blocks of logic=
 
[[Actions]] can simply execute some logic behind the scenes or they have some UI dependency. When there is UI usually some message to the user is shown, in that case we need to provide string resources for it, i.e. toasts, dialogs...
 
 
 
Each action should have individually defined string resourceID. In app composer those IDs should be defined by each app composer widget individually. We can call those IDs ActionSpecificId.
 
 
 
==Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)==
 
Some strings can be default for all ginstr app and in that case their resourceID is unique.
 
 
 
In '''$defaultApp''' action message should have the resource id formed as:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$meaningfulNameBasedOnPurpose">some generic text message</string>
 
</syntaxhighlight>
 
 
 
:where '''<code>meaningfulNameBasedOnPurpose</code>''' is the default message resourceID that is shown across multiple apps
 
 
 
in action it is shown as:
 
 
 
<code>[gn:act_toast]|[@string/$meaningfulNameBasedOnPurpose]</code>
 
 
 
i.e. we show message when screen validation is executed if some fields are not filled and this message is same in all apps:
 
 
 
In '''$defaultApp''' resourceId:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="$toastValidateAllRequiredFields">please filled all required field marked with '*'</string>
 
</syntaxhighlight>
 
in action:
 
 
 
<code>...[gn:act_toast]|[@string/$toastValidateAllRequiredFields]...</code>
 
 
 
==Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only==
 
In case some action message or UI should be shown and it does not relate to some generic message for all apps then resourceID is defined within action definition.
 
 
 
If action is used multiple times on same widget then the SUFFIX +1 is added at end of resourceID starting with 2
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ActionNameActionSpecificId">${widgetName}</string>
 
</syntaxhighlight>
 
i.e. if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code> and action that is used is toast :
 
toast has only single message internally so <code>ActionSpecifiId</code> is not required.
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameToast">customerName</string>
 
</syntaxhighlight>
 
If two toasts would be executed on a widget <code>customerName</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameToast2">${widgetName}</string>
 
</syntaxhighlight>
 
If three toasts would be executed on a widget <code>customerName</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameToast3">${widgetName}</string>
 
</syntaxhighlight>
 
==Yes/No choice dialog example==
 
Example of action which contains multiple text resources
 
<syntaxhighlight lang="xml" enclose="div">
 
[gn:act_showYesNoDialog]|[@string/title,@string/message,@string/yesText,@string/noText]
 
</syntaxhighlight>
 
in this case of this action contains multiple strings and <code>ActionSpecificId</code> is required.
 
 
 
i.e. if <code>pageName="pageOne"</code> and <code>widgetName="customerName"</code> and action that is used is <code>[[gn:act_showYesNoDialog]]</code>:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameShowYesNoDialogTitle">dialog title text</string>
 
<string name="pageOne_customerNameShowYesNoDialogMessage">dialog message text</string>
 
<string name="pageOne_customerNameShowYesNoDialogYesText">dialog yes text</string>
 
<string name="pageOne_customerNameShowYesNoDialogNoText">dialog no text</string>
 
</syntaxhighlight>
 
 
 
=ListViews: display data in rows=
 
Data is displayed in rows and the format of the row recycles each time new row is shown, this means that "design" of row remains while few dynamic contents that depend on data from row, change.
 
 
 
Labels should have the resource id formed as:
 
<code>@string/${pageName}_${widgetName}${columnName}</code>
 
i.e. if <code>pageName="pageOne"<code> and <code>widgetName="customerName"<code> and name of column in listview is <code>customer</code>:
 
 
 
<code><string name="pageOne_customerNameCustomer">customer column label</string></code>
 
 
 
=<code>[[GnMediaAction]]</code> widgets: used to take pictures,video,audio,documents=
 
Consist of two widgets one is "label" which goes above <code>[[GnMediaAction]]</code> and other is <code>[[GnMediaAction]]</code> itself which is shown as icon
 
label describes widget name while <code>[[GnMediaAction]]</code> takes and stores the media.
 
 
 
Labels for <code>[[GnMediaAction]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
=Checkbox widgets: for <code>true</code> or <code>false</code> state=
 
Consist of two widgets one is "label" which goes next to <code>[[GnCheckBox]]</code> widget and other is <code>[[GnCheckBox]]</code> itself which is shown as "square" which is filled with "check" symbol (depending if checked or not checked)
 
Labels for <code>[[GnCheckBox]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
=Dropdown widgets: selection lists=
 
Consists of two widgets one is "label" which goes above <code>[[GnDropDown]]</code> widget and other is <code>[[GnDropDown]]</code> itself which is shown as selection box with text
 
 
 
Labels for <code>[[GnDropDown]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
==Resource id is loaded from $defaultApp and is used as is (no override in ginstr app)==
 
In '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/$GnDropDownZeroItem
 
@string/$GnDropDownNoData
 
</syntaxhighlight>
 
which is then used internally by GnDropdown
 
 
 
==Resource id "template" is not loaded and does not exist in $defaultApp and is used directly in ginstr app only==
 
In '''$defaultApp''':
 
<syntaxhighlight lang="xml" enclose="div">
 
@string/$GnDropDownZeroItem
 
@string/$GnDropDownNoData
 
</syntaxhighlight>
 
On widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnDropDown
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:singleItemMode="..."
 
    gn:s_sourceType="..."
 
    gn:data_source_request="..."
 
    gn:data_source_field="..."
 
    gn:s_ZeroItemText="@string/${pageName}_${widgetName}ZeroItem"
 
    gn:msg_nodata="@string/${pageName}_${widgetName}NoData"
 
    gn:zeroItemEventEnabled="..."/>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="${pageName}_${widgetName}ZeroItem">custom zero item message</string>
 
<string name="${pageName}_${widgetName}NoData">custom no data message</string>
 
</syntaxhighlight>
 
i.e. if <code>pageName="pageOne"<code> and <code>widgetName="customerName"</code>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnDropDown
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:singleItemMode="..."
 
    gn:s_sourceType="..."
 
    gn:data_source_request="..."
 
    gn:data_source_field="..."
 
    gn:s_ZeroItemText="@string/pageOne_customerNameZeroItem"
 
    gn:msg_nodata="@string/pageOne_customerNameNoData"
 
    gn:zeroItemEventEnabled="..."/>
 
</syntaxhighlight>
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_customerNameZeroItem">custom zero item message</string>
 
<string name="pageOne_customerNameNoData">custom no data message</string>
 
</syntaxhighlight>
 
=<code>[[GnRadioGroup]]</code> widgets: multiple choice, single selection=
 
<code>[[GnRadioGroup]]</code> offers set of predefined choices where user can choose only single option (or none depending on business logic).
 
Consists of two widgets one is "label" which goes above <code>[[GnRadioGroup]]</code> widget and other is <code>[[GnRadioGroup]]</code> itself which is shown as group of X <code>[[GnRadioButton|GnRadioButtons]]</code>
 
 
 
Labels for <code>[[GnRadioGroup]]</code> should have the resource id formed as per [[String_Naming_Convention#Labels:_for_ginstr_app_input_fields|Labels: for ginstr app input fields]]
 
 
 
<code>[[GnRadioGroup]]</code> radio buttons should have the resourceID formed as:
 
 
 
<code>@string/${pageName}_${widgetName}${radioButtonName}</code>
 
 
 
On widget:
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnRadioGroup
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:dataType="..."
 
    android:orientation="...">
 
 
 
    <com.ginstr.widgets.GnRadioButton
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        android:text="@string/${pageName}_${widgetName}${radioButtonName}"/>
 
</com.ginstr.widgets.GnRadioGroup>
 
</syntaxhighlight>
 
i.e. if <code>pageName="pageOne"</code> and <code>widgetName="textColor"</code> and <code>radioButtonName="red"</code>
 
<syntaxhighlight lang="xml" enclose="div">
 
<com.ginstr.widgets.GnRadioGroup
 
    android:id="..."
 
    android:layout_width="..."
 
    android:layout_height="..."
 
    gn:dataType="..."
 
    android:orientation="...">
 
 
 
    <com.ginstr.widgets.GnRadioButton
 
        android:id="..."
 
        android:layout_width="..."
 
        android:layout_height="..."
 
        android:text="@string/pageOne_textColorRed"/>
 
</com.ginstr.widgets.GnRadioGroup>
 
</syntaxhighlight>
 
In [[Strings.xml|strings]]:
 
<syntaxhighlight lang="xml" enclose="div">
 
<string name="pageOne_textColorRed">red</string>
 
</syntaxhighlight>
 

Revision as of 13:34, 18 May 2020

Launcher error codes

This document describes ginstr launcher error codes.

List of error codes

Code ResourceId Description
1001 @string/$msgBoxInvalidUserName Can be displayed if:
the response result from the server while we are trying to retrieve AgUser is "access denied"
retrieved SsoUser has "fail" in SsoUser.getError()
retrieved SsoUser has "1" or "3" in SsoUser.getCode()
1003 @string/$msgBoxDisabledUserException Can be displayed if:
launcher throws an exception while we are trying to retrieve AgUser
server returns 403 while we are trying to retrieve AgUser and server error output is not "1017", "1018", "1020"
retrieved SsoUser is null or SsoUser.getError() is null or SsoUser.getError() is "fail" and SsoUser.getCode() is "4"
1004 @string/$msgBoxLoginIoException Can be displayed if:
launcher throws an exception while we are trying to check if server is available
retrieved SsoUser is null or SsoUser.getError() is null or SsoUser.getError() is "fail" and SsoUser.getCode() is null
onHostChecked() server response is not 200
1005 @string/$msgBoxSerialImeiMissing Can be displayed if:
ENAiKOON serial is missing on the device
1006 @string/$msgBoxErrorReplicationPushDisabled Can be displayed if:
retrieved SsoUser has "3" in SsoUser.getCode() and internet connection is not available
1007 @string/$msgBoxLoginPasswordExpired Can be displayed if:
retrieved SsoUser has "30" in SsoUser.getCode()
1008 @string/$msgBoxAtLeastOneLogin Can be displayed if:
the local user doesn't exist and internet connection is not available
1009 @string/$msgBoxGinstrServersUnavailable Can be displayed if:
ginstr launcher is trying to start in offline mode and local user doesn't exist
1010 @string/$msgBoxMissingRole Can be displayed if:
AgUser doesn't have specific rights to run the app
1011 @string/$msgBoxLoginNoResponseServer Can be displayed if:
AgUser or SsoUSer server response is null or empty
1012 @string/$msgBoxLoginBadUser Can be displayed if:
retrieved AgUser json data is invalid
1013 @string/$msgBoxLoginBadUserSso Can be displayed if:
retrieved AgUser json data is invalid
1015 @string/$msgBoxNotActivatedUserException Can be displayed if:
not used in ginstr launcher
1016 @string/$msgBoxAppNotEnabledForUser Can be displayed if:
AgUser is not allowed to use the specific app