Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66bed8c89f | ||
|
|
07e85b6f32 | ||
|
|
50c17ab504 | ||
|
|
735fc4191a | ||
|
|
1a8d471b3f | ||
|
|
3885c13007 | ||
|
|
d01cbd2d81 | ||
|
|
096d960c76 | ||
|
|
b681b0fa11 | ||
|
|
42a1e4b530 | ||
|
|
1eec320528 | ||
|
|
3efa42facb | ||
|
|
f2ba86687a | ||
|
|
92873bed80 | ||
|
|
cfaab5263e | ||
|
|
b083863b08 | ||
|
|
9e5b70fe70 | ||
|
|
5d5f1b7f1c | ||
|
|
aae820834b | ||
|
|
2635ee890d | ||
|
|
136b969add | ||
|
|
54a455ea24 | ||
|
|
9f938ef016 | ||
|
|
8a924840dd | ||
|
|
a5cfabbfd2 | ||
|
|
89487dd6ec | ||
|
|
fb8518fcb0 | ||
|
|
31e7af3097 | ||
|
|
373748cb9c | ||
|
|
1827b964ed | ||
|
|
b1e144df73 | ||
|
|
6bdc8fe3ea | ||
|
|
018287ee6b | ||
|
|
49d6925da8 | ||
|
|
0932fdd0b8 | ||
|
|
094f98b46b | ||
|
|
968d827fc2 | ||
|
|
82bd2fc466 | ||
|
|
9ca8a38360 | ||
|
|
ddef7184b8 | ||
|
|
91238440f7 | ||
|
|
9cb8bfe2f0 | ||
|
|
5f8cca15fa | ||
|
|
128c01e68d | ||
|
|
0f42047f50 | ||
|
|
2f58a3d287 | ||
|
|
b0252b1676 | ||
|
|
da424dc70b | ||
|
|
348462a10c | ||
|
|
b4cc029716 | ||
|
|
9fef73eb7a | ||
|
|
cc0f95af91 | ||
|
|
1d6e0cc64c | ||
|
|
bd838657e4 | ||
|
|
af9f3f63fe | ||
|
|
9b5ee375b9 | ||
|
|
149de17617 | ||
|
|
fc9c0e7b55 | ||
|
|
9094db9df9 | ||
|
|
1ce515ed9f | ||
|
|
ee26a8180b | ||
|
|
85a250bcf4 | ||
|
|
6bfc0c8de0 | ||
|
|
ef5ea9391d | ||
|
|
ee5435ae3d | ||
|
|
c5c711a28a | ||
|
|
0087b6263c | ||
|
|
0c8607112c | ||
|
|
073bc0bb94 | ||
|
|
002589e54d | ||
|
|
11ee74fa2e | ||
|
|
6f9a22c517 | ||
|
|
de7da597a4 | ||
|
|
2e8871d22e | ||
|
|
eb60289066 | ||
|
|
687eb76d4f | ||
|
|
57ee5e1748 | ||
|
|
8f7d88bcdd | ||
|
|
3544e31198 | ||
|
|
9ee69a56ac | ||
|
|
63b23ef902 | ||
|
|
fa88d592cb | ||
|
|
9a06bb2630 | ||
|
|
f18dbb57bd | ||
|
|
d3e56e9e0f | ||
|
|
2e5d06d9af | ||
|
|
4d21dea4cd | ||
|
|
e4603a231e | ||
|
|
316df58af6 | ||
|
|
35516af52b | ||
|
|
3bded2af7a | ||
|
|
2c788e3329 | ||
|
|
af2409a16d | ||
|
|
7e390ed56f | ||
|
|
756a816abb | ||
|
|
1e174f77f7 | ||
|
|
ae8e1ddb82 | ||
|
|
9381065cf2 | ||
|
|
98b4ee71ae | ||
|
|
1b84c6fc15 | ||
|
|
ad9fb99205 | ||
|
|
4fdbf10054 | ||
|
|
3505c379cf | ||
|
|
6322022f47 | ||
|
|
adf60f289b | ||
|
|
27ccac205b | ||
|
|
664a7d4cea | ||
|
|
49137e111b | ||
|
|
c834551c52 | ||
|
|
91d5a7be50 | ||
|
|
552c2215c3 | ||
|
|
2e9597f34d | ||
|
|
ec6f25e11b | ||
|
|
f871761e48 | ||
|
|
60bbfceb7e |
@@ -1,485 +0,0 @@
|
||||
<code_scheme name="DefaultIntelliJCodeStyleCST" version="173">
|
||||
<option name="OTHER_INDENT_OPTIONS">
|
||||
<value>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LINE_SEPARATOR" value="
" />
|
||||
<option name="GENERATE_FINAL_PARAMETERS" value="true" />
|
||||
<option name="RIGHT_MARGIN" value="200" />
|
||||
<option name="HTML_KEEP_LINE_BREAKS" value="false" />
|
||||
<option name="HTML_KEEP_LINE_BREAKS_IN_TEXT" value="false" />
|
||||
<option name="HTML_INLINE_ELEMENTS" value="a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,kbd,label,q,s,samp,select,span,strike,strong,sub,sup,textarea,tt,u,var" />
|
||||
<AndroidXmlCodeStyleSettings>
|
||||
<option name="USE_CUSTOM_SETTINGS" value="true" />
|
||||
</AndroidXmlCodeStyleSettings>
|
||||
<CssCodeStyleSettings>
|
||||
<option name="HEX_COLOR_LOWER_CASE" value="true" />
|
||||
<option name="HEX_COLOR_LONG_FORMAT" value="true" />
|
||||
</CssCodeStyleSettings>
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_KEEP_LINE_BREAKS" value="false" />
|
||||
<option name="HTML_KEEP_LINE_BREAKS_IN_TEXT" value="false" />
|
||||
<option name="HTML_INLINE_ELEMENTS" value="abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,kbd,q,s,samp,span,strike,strong,sub,sup,textarea,tt,u,var" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JavaeeCodeStyleSettings>
|
||||
<option name="ENTITY_VO_SUFFIX" value="DTO" />
|
||||
</JavaeeCodeStyleSettings>
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="hpp" fileNamingConvention="LOWERCASE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
<Properties>
|
||||
<option name="KEEP_BLANK_LINES" value="true" />
|
||||
</Properties>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||
<option name="OBJECT_LITERAL_WRAP" value="1" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<XML>
|
||||
<option name="XML_TEXT_WRAP" value="0" />
|
||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||
</XML>
|
||||
<codeStyleSettings language="CFML">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="CMake">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="CSS">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="CoffeeScript">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="DB2">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Derby">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="ECMA Script Level 4">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="GSP">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Gherkin">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Groovy">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="H2">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="HAML">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="HSQLDB">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Haml">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JAVA">
|
||||
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="WHILE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
|
||||
<option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true" />
|
||||
<option name="METHOD_CALL_CHAIN_WRAP" value="5" />
|
||||
<option name="WRAP_COMMENTS" value="true" />
|
||||
<option name="ENUM_CONSTANTS_WRAP" value="1" />
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
<arrangement>
|
||||
<groups>
|
||||
<group>
|
||||
<type>GETTERS_AND_SETTERS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
<group>
|
||||
<type>OVERRIDDEN_METHODS</type>
|
||||
<order>KEEP</order>
|
||||
</group>
|
||||
<group>
|
||||
<type>DEPENDENT_METHODS</type>
|
||||
<order>DEPTH_FIRST</order>
|
||||
</group>
|
||||
</groups>
|
||||
<rules>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD>true</FIELD>
|
||||
<FINAL>true</FINAL>
|
||||
<STATIC>true</STATIC>
|
||||
<visibility />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD>true</FIELD>
|
||||
<STATIC>true</STATIC>
|
||||
<visibility />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD>true</FIELD>
|
||||
<FINAL>true</FINAL>
|
||||
<visibility />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<FIELD>true</FIELD>
|
||||
<visibility />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<INITIALIZER_BLOCK>true</INITIALIZER_BLOCK>
|
||||
<STATIC>true</STATIC>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<INITIALIZER_BLOCK>true</INITIALIZER_BLOCK>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<CONSTRUCTOR>true</CONSTRUCTOR>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<METHOD>true</METHOD>
|
||||
<NAME>main</NAME>
|
||||
<PUBLIC>true</PUBLIC>
|
||||
<STATIC>true</STATIC>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<ABSTRACT>true</ABSTRACT>
|
||||
<METHOD>true</METHOD>
|
||||
<visibility />
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<ABSTRACT>false</ABSTRACT>
|
||||
<METHOD>true</METHOD>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<METHOD>true</METHOD>
|
||||
<STATIC>true</STATIC>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<ENUM>true</ENUM>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<INTERFACE>true</INTERFACE>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<CLASS>true</CLASS>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
<section>
|
||||
<rule>
|
||||
<match>
|
||||
<AND>
|
||||
<CLASS>true</CLASS>
|
||||
<STATIC>true</STATIC>
|
||||
</AND>
|
||||
</match>
|
||||
</rule>
|
||||
</section>
|
||||
</rules>
|
||||
</arrangement>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JSON">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JSP">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JSPX">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="LESS">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="MySQL">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="ObjectiveC">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Oracle">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="PostgreSQL">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Puppet">
|
||||
<indentOptions>
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="RHTML">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="SASS">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="SCSS">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="SQL">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="SQLite">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Stylus">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Sybase">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TSQL">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="ELSE_ON_NEW_LINE" value="true" />
|
||||
<option name="CATCH_ON_NEW_LINE" value="true" />
|
||||
<option name="FINALLY_ON_NEW_LINE" value="true" />
|
||||
<option name="TERNARY_OPERATION_WRAP" value="1" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
|
||||
<option name="IF_BRACE_FORCE" value="1" />
|
||||
<option name="DOWHILE_BRACE_FORCE" value="1" />
|
||||
<option name="WHILE_BRACE_FORCE" value="1" />
|
||||
<option name="FOR_BRACE_FORCE" value="1" />
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<indentOptions>
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="ruby">
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="4" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="8" />
|
||||
<option name="TAB_SIZE" value="4" />
|
||||
<option name="USE_TAB_CHARACTER" value="true" />
|
||||
<option name="KEEP_INDENTS_ON_EMPTY_LINES" value="true" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
@@ -5,7 +5,7 @@ node {
|
||||
|
||||
// set environment variables
|
||||
env.ANDROID_SDK_ROOT = '/var/lib/android-sdk'
|
||||
env.JAVA_HOME = '/opt/openjdk-bin-11'
|
||||
env.JAVA_HOME = '/opt/openjdk-bin-17'
|
||||
env.PATH = "${env.JAVA_HOME}/bin:${env.PATH}"
|
||||
|
||||
// checkout code from scm
|
||||
@@ -26,7 +26,7 @@ node {
|
||||
// build the source code with gradle
|
||||
stage('Build') {
|
||||
withCredentials([string(credentialsId: 'mowesta-keystore-password', variable: 'PASSWD')]) {
|
||||
sh(script: './gradlew -Djenkins.build.number=' + env.BUILD_NUMBER + ' -Dandroid.keystore.password=$PASSWD clean build', label: "Building project.")
|
||||
sh(script: './gradlew -Djenkins.build.number=' + env.BUILD_NUMBER + ' -Dandroid.keystore.password=$PASSWD clean build -x test', label: "Building project.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,19 +45,21 @@ node {
|
||||
|
||||
// deploy the build output on the server
|
||||
stage ('Deploy') {
|
||||
// release = true; // uncomment to temporary enable snapshot deployments
|
||||
// release = true; // uncomment to temporary enable snapshot deployments
|
||||
if (env.BRANCH_NAME == "master" && release) {
|
||||
echo "Deploying to production server ..."
|
||||
withCredentials([sshUserPrivateKey(credentialsId: "mowesta-server-key", keyFileVariable: "KEYFILE")]) {
|
||||
sh 'scp -i $KEYFILE site-ear/build/libs/site-ear-' + version + '.ear wildfly@apps-pro.nes.uni-due.de:/opt/wildfly-21-mowesta/standalone/deployments/mowesta.ear'
|
||||
sh 'scp -i $KEYFILE android-app/build/outputs/apk/prod/release/*.apk wildfly@apps-pro.nes.uni-due.de:/opt/android/mowesta/'
|
||||
sh 'scp -i $KEYFILE android-app/build/outputs/bundle/prodRelease/*.aab wildfly@apps-pro.nes.uni-due.de:/opt/android/mowesta/'
|
||||
sh 'scp -i $KEYFILE service-war/build/libs/service-war-' + version + '.war wildfly@apps-pro.nes.uni-due.de:/opt/wildfly-31-mowesta/standalone/deployments/service-war.war'
|
||||
sh 'scp -i $KEYFILE web-war/build/libs/web-war-' + version + '.war wildfly@apps-pro.nes.uni-due.de:/opt/wildfly-31-mowesta/standalone/deployments/web-war.war'
|
||||
// sh 'scp -i $KEYFILE android-app/build/outputs/apk/prod/release/*.apk wildfly@apps-pro.nes.uni-due.de:/opt/android/mowesta/'
|
||||
// sh 'scp -i $KEYFILE android-app/build/outputs/bundle/prodRelease/*.aab wildfly@apps-pro.nes.uni-due.de:/opt/android/mowesta/'
|
||||
}
|
||||
} else if (env.BRANCH_NAME == "master") {
|
||||
/* echo "Deploying to beta server ..."
|
||||
echo "Deploying to beta server ..."
|
||||
withCredentials([sshUserPrivateKey(credentialsId: "mowesta-server-key", keyFileVariable: "KEYFILE")]) {
|
||||
sh 'scp -i $KEYFILE site-ear/build/libs/site-ear-' + version + '.ear wildfly@apps-dev.nes.uni-due.de:/opt/wildfly-21-beta/standalone/deployments/mowesta.ear'
|
||||
} */
|
||||
sh 'scp -i $KEYFILE service-war/build/libs/service-war-' + version + '.war mowesta@apps-dev.nes.uni-due.de:/home/mowesta/wildfly/standalone/deployments/service-war.war'
|
||||
sh 'scp -i $KEYFILE web-war/build/libs/web-war-' + version + '.war mowesta@apps-dev.nes.uni-due.de:/home/mowesta/wildfly/standalone/deployments/web-war.war'
|
||||
}
|
||||
} else {
|
||||
echo "Skipping deployment for non-master branch."
|
||||
}
|
||||
|
||||
@@ -14,3 +14,10 @@ To build the project, you will have to install [Java](http://www.oracle.com/tech
|
||||
|
||||
Pull requests and new commits to any branch are automatically built by a Jenkins service. A Gitea webhook informs the service about changes to the repository. In addition, the service will automatically scan the lbs Gitea organization for new repositories every hour. Successful builds of new commits are indicated by a green tick on the commit page. The build status of pull requests is currently not shown in Gitea. However, you can go to the [Jenkins](https://project.nes.uni-due.de/jenkins/job/LocationBasedServices/job/mowesta/) service to view the result of builds including the console output. To modify the build process, you can change the Jenkinsfile groovy script in the root of the repository, if necessary.
|
||||
|
||||
# Configuration
|
||||
|
||||
The MoWeSta backend uses a number of system properties to configure the location of input and output folders, the base url of videos and the forecast downlods. You can set them when starting wildfly by passing a ```-DpropretyName=propertyValue``` switch to the standalone.sh. The configurations are:
|
||||
|
||||
- *baseDirectory*: Defines where the input and output folders are placed. Default is working directory.
|
||||
- *limitedMode*: Defines whether to limit the forecast download to cosmo europe. Default is false.
|
||||
- *videoUrl*: Define the url to prefix the file names with. Default is https://www.mowesta.com/data/video.
|
||||
|
||||
@@ -1,45 +1,63 @@
|
||||
plugins {
|
||||
id 'org.hidetake.swagger.generator' version '2.18.2'
|
||||
id 'org.openapi.generator' version '6.0.0'
|
||||
}
|
||||
|
||||
description = "MoWeSta Android Api"
|
||||
|
||||
// downgrade jackson for Android, since versions > 2.9
|
||||
// will contain module-info.class files that will result
|
||||
// in a large number of android lint warnings
|
||||
versionJackson = "2.9.10"
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.24"
|
||||
jackson_version = "2.10.3"
|
||||
jackson_databind_version = "2.10.3"
|
||||
jackson_databind_nullable_version = "0.2.2"
|
||||
jakarta_annotation_version = "1.3.5"
|
||||
feign_version = "10.11"
|
||||
feign_form_version = "3.8.0"
|
||||
junit_version = "5.7.0"
|
||||
scribejava_version = "8.0.0"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
implementation "com.google.code.findbugs:jsr305:3.0.2"
|
||||
api "io.github.openfeign:feign-core:$feign_version"
|
||||
implementation "io.github.openfeign:feign-jackson:$feign_version"
|
||||
implementation "io.github.openfeign:feign-slf4j:$feign_version"
|
||||
implementation "io.github.openfeign:feign-okhttp:$feign_version"
|
||||
implementation "io.github.openfeign.form:feign-form:$feign_form_version"
|
||||
api "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
api "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
api "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
|
||||
implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
|
||||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version"
|
||||
implementation "com.github.scribejava:scribejava-core:$scribejava_version"
|
||||
implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
|
||||
api "de.grundid.opendatalab:geojson-jackson:${versionGeojson}"
|
||||
api "io.swagger:swagger-annotations:${versionSwagger}"
|
||||
api "com.fasterxml.jackson.core:jackson-core:${versionJackson}"
|
||||
api "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
|
||||
api "com.fasterxml.jackson.core:jackson-databind:${versionJackson}"
|
||||
api "com.fasterxml.jackson.datatype:jackson-datatype-joda:${versionJackson}"
|
||||
api "javax.annotation:javax.annotation-api:${versionAnnotation}"
|
||||
api "io.github.openfeign:feign-core:9.4.0"
|
||||
api "io.github.openfeign:feign-jackson:9.4.0"
|
||||
compileOnly "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.1"
|
||||
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.9'
|
||||
}
|
||||
|
||||
sourceSets.main.java.srcDirs = ['src/main/java', 'build/swagger/src/main/java']
|
||||
|
||||
swaggerSources {
|
||||
mowesta {
|
||||
inputFile = file(project(':common-api:').buildDir.path + '/swagger/mowesta.json')
|
||||
code {
|
||||
outputDir = file("${project.buildDir}/swagger")
|
||||
language = 'java'
|
||||
configFile = file('config.json')
|
||||
components = [ models: true, apis: 'Default']
|
||||
rawOptions = [ '--import-mappings', 'Geometry=org.geojson.Geometry']
|
||||
}
|
||||
}
|
||||
compileJava {
|
||||
dependsOn 'generateClient'
|
||||
}
|
||||
|
||||
task generateClient(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
|
||||
dependsOn ':service-api:resolve'
|
||||
generatorName = "java"
|
||||
inputSpec = "$projectDir/../service-api/build/swagger/mowesta.json"
|
||||
outputDir = "$projectDir/build/swagger/"
|
||||
typeMappings.putAll(["Geometry":"org.geojson.Geometry"])
|
||||
generateModelTests = false
|
||||
generateModelDocumentation = false
|
||||
generateApiTests = false
|
||||
generateApiDocumentation = false
|
||||
configOptions = [
|
||||
invokerPackage: 'com.mowesta.android.feign',
|
||||
modelPackage: 'com.mowesta.android.feign.model',
|
||||
apiPackage: 'com.mowesta.android.feign.api',
|
||||
library: "feign",
|
||||
dateLibrary: "java8",
|
||||
importMappings: 'Geometry=org.geojson.Geometry',
|
||||
annotationLibrary: "none"
|
||||
]
|
||||
}
|
||||
|
||||
// require api build to access swagger definition
|
||||
tasks['resolveSwaggerTemplate'].dependsOn(project(':common-api').tasks['build'])
|
||||
// require swagger code gen before compilation
|
||||
compileJava.dependsOn('generateSwaggerCode')
|
||||
|
||||
@@ -1,325 +0,0 @@
|
||||
package com.mowesta.android.feign;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.joda.JodaModule;
|
||||
import com.mowesta.android.feign.auth.*;
|
||||
import com.mowesta.android.feign.auth.OAuth.AccessTokenListener;
|
||||
|
||||
import feign.Feign;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.jackson.JacksonDecoder;
|
||||
import feign.jackson.JacksonEncoder;
|
||||
|
||||
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-10-20T17:10:12.901+02:00")
|
||||
public class ApiClient {
|
||||
public interface Api {}
|
||||
|
||||
protected ObjectMapper objectMapper;
|
||||
private String basePath = "https://www.mowesta.com/api";
|
||||
private Map<String, RequestInterceptor> apiAuthorizations;
|
||||
private Feign.Builder feignBuilder;
|
||||
|
||||
public ApiClient() {
|
||||
objectMapper = createObjectMapper();
|
||||
apiAuthorizations = new LinkedHashMap<String, RequestInterceptor>();
|
||||
feignBuilder = Feign.builder()
|
||||
.requestInterceptor(request -> {
|
||||
Map<String, Collection<String>> headers = request.request().headers();
|
||||
if (!headers.containsKey("Content-Type" ) && request.method().equals("DELETE") ) {
|
||||
request.header("Content-Type", "application/json");
|
||||
}
|
||||
})
|
||||
.encoder(new JacksonEncoder(objectMapper))
|
||||
.decoder(new JacksonDecoder(objectMapper));
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public ApiClient(String[] authNames) {
|
||||
this();
|
||||
for(String authName : authNames) {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Basic constructor for single auth name
|
||||
* @param authName
|
||||
*/
|
||||
public ApiClient(String authName) {
|
||||
this(new String[]{authName});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper constructor for single api key
|
||||
* @param authName
|
||||
* @param apiKey
|
||||
*/
|
||||
public ApiClient(String authName, String apiKey) {
|
||||
this(authName);
|
||||
this.setApiKey(apiKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper constructor for single basic auth or password oauth2
|
||||
* @param authName
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
public ApiClient(String authName, String username, String password) {
|
||||
this(authName);
|
||||
this.setCredentials(username, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper constructor for single password oauth2
|
||||
* @param authName
|
||||
* @param clientId
|
||||
* @param secret
|
||||
* @param username
|
||||
* @param password
|
||||
*/
|
||||
public ApiClient(String authName, String clientId, String secret, String username, String password) {
|
||||
this(authName);
|
||||
this.getTokenEndPoint()
|
||||
.setClientId(clientId)
|
||||
.setClientSecret(secret)
|
||||
.setUsername(username)
|
||||
.setPassword(password);
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public ApiClient setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Map<String, RequestInterceptor> getApiAuthorizations() {
|
||||
return apiAuthorizations;
|
||||
}
|
||||
|
||||
public void setApiAuthorizations(Map<String, RequestInterceptor> apiAuthorizations) {
|
||||
this.apiAuthorizations = apiAuthorizations;
|
||||
}
|
||||
|
||||
public Feign.Builder getFeignBuilder() {
|
||||
return feignBuilder;
|
||||
}
|
||||
|
||||
public ApiClient setFeignBuilder(Feign.Builder feignBuilder) {
|
||||
this.feignBuilder = feignBuilder;
|
||||
return this;
|
||||
}
|
||||
|
||||
private ObjectMapper createObjectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||
objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
|
||||
objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE);
|
||||
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
objectMapper.registerModule(new JodaModule());
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
public ObjectMapper getObjectMapper(){
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a feign client for given API interface.
|
||||
*
|
||||
* Usage:
|
||||
* ApiClient apiClient = new ApiClient();
|
||||
* apiClient.setBasePath("http://localhost:8080");
|
||||
* XYZApi api = apiClient.buildClient(XYZApi.class);
|
||||
* XYZResponse response = api.someMethod(...);
|
||||
* @param <T> Type
|
||||
* @param clientClass Client class
|
||||
* @return The Client
|
||||
*/
|
||||
public <T extends Api> T buildClient(Class<T> clientClass) {
|
||||
return feignBuilder.target(clientClass, basePath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Accept header's value from the given accepts array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use all of them (joining into a string)
|
||||
*
|
||||
* @param accepts The accepts array to select from
|
||||
* @return The Accept header to use. If the given array is empty,
|
||||
* null will be returned (not to set the Accept header explicitly).
|
||||
*/
|
||||
public String selectHeaderAccept(String[] accepts) {
|
||||
if (accepts.length == 0) return null;
|
||||
if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json";
|
||||
return StringUtil.join(accepts, ",");
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the Content-Type header's value from the given array:
|
||||
* if JSON exists in the given array, use it;
|
||||
* otherwise use the first one of the array.
|
||||
*
|
||||
* @param contentTypes The Content-Type array to select from
|
||||
* @return The Content-Type header to use. If the given array is empty,
|
||||
* JSON will be used.
|
||||
*/
|
||||
public String selectHeaderContentType(String[] contentTypes) {
|
||||
if (contentTypes.length == 0) return "application/json";
|
||||
if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json";
|
||||
return contentTypes[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the first api key found
|
||||
* @param apiKey API key
|
||||
*/
|
||||
public void setApiKey(String apiKey) {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof ApiKeyAuth) {
|
||||
ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization;
|
||||
keyAuth.setApiKey(apiKey);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No API key authentication configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the username/password for basic auth or password OAuth
|
||||
* @param username Username
|
||||
* @param password Password
|
||||
*/
|
||||
public void setCredentials(String username, String password) {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof HttpBasicAuth) {
|
||||
HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization;
|
||||
basicAuth.setCredentials(username, password);
|
||||
return;
|
||||
}
|
||||
if (apiAuthorization instanceof OAuth) {
|
||||
OAuth oauth = (OAuth) apiAuthorization;
|
||||
oauth.getTokenRequestBuilder().setUsername(username).setPassword(password);
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("No Basic authentication or OAuth configured!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one)
|
||||
* @return Token request builder
|
||||
*/
|
||||
public TokenRequestBuilder getTokenEndPoint() {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof OAuth) {
|
||||
OAuth oauth = (OAuth) apiAuthorization;
|
||||
return oauth.getTokenRequestBuilder();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one)
|
||||
* @return Authentication request builder
|
||||
*/
|
||||
public AuthenticationRequestBuilder getAuthorizationEndPoint() {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof OAuth) {
|
||||
OAuth oauth = (OAuth) apiAuthorization;
|
||||
return oauth.getAuthenticationRequestBuilder();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one)
|
||||
* @param accessToken Access Token
|
||||
* @param expiresIn Validity period in seconds
|
||||
*/
|
||||
public void setAccessToken(String accessToken, Long expiresIn) {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof OAuth) {
|
||||
OAuth oauth = (OAuth) apiAuthorization;
|
||||
oauth.setAccessToken(accessToken, expiresIn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to configure the oauth accessCode/implicit flow parameters
|
||||
* @param clientId Client ID
|
||||
* @param clientSecret Client secret
|
||||
* @param redirectURI Redirect URI
|
||||
*/
|
||||
public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof OAuth) {
|
||||
OAuth oauth = (OAuth) apiAuthorization;
|
||||
oauth.getTokenRequestBuilder()
|
||||
.setClientId(clientId)
|
||||
.setClientSecret(clientSecret)
|
||||
.setRedirectURI(redirectURI);
|
||||
oauth.getAuthenticationRequestBuilder()
|
||||
.setClientId(clientId)
|
||||
.setRedirectURI(redirectURI);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures a listener which is notified when a new access token is received.
|
||||
* @param accessTokenListener Acesss token listener
|
||||
*/
|
||||
public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
|
||||
for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) {
|
||||
if (apiAuthorization instanceof OAuth) {
|
||||
OAuth oauth = (OAuth) apiAuthorization;
|
||||
oauth.registerAccessTokenListener(accessTokenListener);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets request interceptor based on authentication name
|
||||
* @param authName Authentiation name
|
||||
* @return Request Interceptor
|
||||
*/
|
||||
public RequestInterceptor getAuthorization(String authName) {
|
||||
return apiAuthorizations.get(authName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an authorization to be used by the client
|
||||
* @param authName Authentication name
|
||||
* @param authorization Request interceptor
|
||||
*/
|
||||
public void addAuthorization(String authName, RequestInterceptor authorization) {
|
||||
if (apiAuthorizations.containsKey(authName)) {
|
||||
throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations");
|
||||
}
|
||||
apiAuthorizations.put(authName, authorization);
|
||||
feignBuilder.requestInterceptor(authorization);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.mowesta.android.feign;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utilities to support Swagger encoding formats in Feign.
|
||||
*/
|
||||
public final class EncodingUtils {
|
||||
|
||||
/**
|
||||
* Private constructor. Do not construct this class.
|
||||
*/
|
||||
private EncodingUtils() {}
|
||||
|
||||
/**
|
||||
* <p>Encodes a collection of query parameters according to the Swagger
|
||||
* collection format.</p>
|
||||
*
|
||||
* <p>Of the various collection formats defined by Swagger ("csv", "tsv",
|
||||
* etc), Feign only natively supports "multi". This utility generates the
|
||||
* other format types so it will be properly processed by Feign.</p>
|
||||
*
|
||||
* <p>Note, as part of reformatting, it URL encodes the parameters as
|
||||
* well.</p>
|
||||
* @param parameters The collection object to be formatted. This object will
|
||||
* not be changed.
|
||||
* @param collectionFormat The Swagger collection format (eg, "csv", "tsv",
|
||||
* "pipes"). See the
|
||||
* <a href="http://swagger.io/specification/#parameter-object-44">
|
||||
* Swagger Spec</a> for more details.
|
||||
* @return An object that will be correctly formatted by Feign.
|
||||
*/
|
||||
public static Object encodeCollection(Collection<?> parameters,
|
||||
String collectionFormat) {
|
||||
if (parameters == null) {
|
||||
return parameters;
|
||||
}
|
||||
List<String> stringValues = new ArrayList<>(parameters.size());
|
||||
for (Object parameter : parameters) {
|
||||
// ignore null values (same behavior as Feign)
|
||||
if (parameter != null) {
|
||||
stringValues.add(encode(parameter));
|
||||
}
|
||||
}
|
||||
// Feign natively handles single-element lists and the "multi" format.
|
||||
if (stringValues.size() < 2 || "multi".equals(collectionFormat)) {
|
||||
return stringValues;
|
||||
}
|
||||
// Otherwise return a formatted String
|
||||
String[] stringArray = stringValues.toArray(new String[0]);
|
||||
switch (collectionFormat) {
|
||||
case "csv":
|
||||
default:
|
||||
return StringUtil.join(stringArray, ",");
|
||||
case "ssv":
|
||||
return StringUtil.join(stringArray, " ");
|
||||
case "tsv":
|
||||
return StringUtil.join(stringArray, "\t");
|
||||
case "pipes":
|
||||
return StringUtil.join(stringArray, "|");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* URL encode a single query parameter.
|
||||
* @param parameter The query parameter to encode. This object will not be
|
||||
* changed.
|
||||
* @return The URL encoded string representation of the parameter. If the
|
||||
* parameter is null, returns null.
|
||||
*/
|
||||
public static String encode(Object parameter) {
|
||||
if (parameter == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return URLEncoder.encode(parameter.toString(), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
// Should never happen, UTF-8 is always supported
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mowesta.android.feign;
|
||||
|
||||
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2017-10-20T17:10:12.901+02:00")
|
||||
public class StringUtil {
|
||||
/**
|
||||
* Check if the given array contains the given value (with case-insensitive comparison).
|
||||
*
|
||||
* @param array The array
|
||||
* @param value The value to search
|
||||
* @return true if the array contains the value
|
||||
*/
|
||||
public static boolean containsIgnoreCase(String[] array, String value) {
|
||||
for (String str : array) {
|
||||
if (value == null && str == null) return true;
|
||||
if (value != null && value.equalsIgnoreCase(str)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Join an array of strings with the given separator.
|
||||
* <p>
|
||||
* Note: This might be replaced by utility method from commons-lang or guava someday
|
||||
* if one of those libraries is added as dependency.
|
||||
* </p>
|
||||
*
|
||||
* @param array The array of strings
|
||||
* @param separator The separator
|
||||
* @return the resulting string
|
||||
*/
|
||||
public static String join(String[] array, String separator) {
|
||||
int len = array.length;
|
||||
if (len == 0) return "";
|
||||
|
||||
StringBuilder out = new StringBuilder();
|
||||
out.append(array[0]);
|
||||
for (int i = 1; i < len; i++) {
|
||||
out.append(separator).append(array[i]);
|
||||
}
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mowesta.android.feign.auth;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
|
||||
public class ApiKeyAuth implements RequestInterceptor {
|
||||
private final String location;
|
||||
private final String paramName;
|
||||
|
||||
private String apiKey;
|
||||
|
||||
public ApiKeyAuth(String location, String paramName) {
|
||||
this.location = location;
|
||||
this.paramName = paramName;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
return paramName;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
if ("query".equals(location)) {
|
||||
template.query(paramName, apiKey);
|
||||
} else if ("header".equals(location)) {
|
||||
template.header(paramName, apiKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.mowesta.android.feign.auth;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import feign.auth.BasicAuthRequestInterceptor;
|
||||
|
||||
/**
|
||||
* An interceptor that adds the request header needed to use HTTP basic authentication.
|
||||
*/
|
||||
public class HttpBasicAuth implements RequestInterceptor {
|
||||
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public void setCredentials(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password);
|
||||
requestInterceptor.apply(template);
|
||||
}
|
||||
}
|
||||
@@ -1,198 +0,0 @@
|
||||
package com.mowesta.android.feign.auth;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.oltu.oauth2.client.HttpClient;
|
||||
import org.apache.oltu.oauth2.client.OAuthClient;
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest;
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder;
|
||||
import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder;
|
||||
import org.apache.oltu.oauth2.client.response.OAuthClientResponse;
|
||||
import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory;
|
||||
import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse;
|
||||
import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
|
||||
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
|
||||
import org.apache.oltu.oauth2.common.message.types.GrantType;
|
||||
import org.apache.oltu.oauth2.common.token.BasicOAuthToken;
|
||||
|
||||
import com.mowesta.android.feign.StringUtil;
|
||||
|
||||
import feign.Client;
|
||||
import feign.Request.Options;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import feign.Response;
|
||||
import feign.RetryableException;
|
||||
import feign.Util;
|
||||
|
||||
|
||||
public class OAuth implements RequestInterceptor {
|
||||
|
||||
static final int MILLIS_PER_SECOND = 1000;
|
||||
|
||||
public interface AccessTokenListener {
|
||||
void notify(BasicOAuthToken token);
|
||||
}
|
||||
|
||||
private volatile String accessToken;
|
||||
private Long expirationTimeMillis;
|
||||
private OAuthClient oauthClient;
|
||||
private TokenRequestBuilder tokenRequestBuilder;
|
||||
private AuthenticationRequestBuilder authenticationRequestBuilder;
|
||||
private AccessTokenListener accessTokenListener;
|
||||
|
||||
public OAuth(Client client, TokenRequestBuilder requestBuilder) {
|
||||
this.oauthClient = new OAuthClient(new OAuthFeignClient(client));
|
||||
this.tokenRequestBuilder = requestBuilder;
|
||||
}
|
||||
|
||||
public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||
this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes));
|
||||
|
||||
switch(flow) {
|
||||
case accessCode:
|
||||
case implicit:
|
||||
tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE);
|
||||
break;
|
||||
case password:
|
||||
tokenRequestBuilder.setGrantType(GrantType.PASSWORD);
|
||||
break;
|
||||
case application:
|
||||
tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl);
|
||||
}
|
||||
|
||||
public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) {
|
||||
this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(RequestTemplate template) {
|
||||
// If the request already have an authorization (eg. Basic auth), do nothing
|
||||
if (template.headers().containsKey("Authorization")) {
|
||||
return;
|
||||
}
|
||||
// If first time, get the token
|
||||
if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) {
|
||||
updateAccessToken();
|
||||
}
|
||||
if (getAccessToken() != null) {
|
||||
template.header("Authorization", "Bearer " + getAccessToken());
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void updateAccessToken() {
|
||||
OAuthJSONAccessTokenResponse accessTokenResponse;
|
||||
try {
|
||||
accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage());
|
||||
} catch (Exception e) {
|
||||
throw new RetryableException(e.getMessage(), e,null);
|
||||
}
|
||||
if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) {
|
||||
setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn());
|
||||
if (accessTokenListener != null) {
|
||||
accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
|
||||
this.accessTokenListener = accessTokenListener;
|
||||
}
|
||||
|
||||
public synchronized String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
|
||||
public synchronized void setAccessToken(String accessToken, Long expiresIn) {
|
||||
this.accessToken = accessToken;
|
||||
this.expirationTimeMillis = System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND;
|
||||
}
|
||||
|
||||
public TokenRequestBuilder getTokenRequestBuilder() {
|
||||
return tokenRequestBuilder;
|
||||
}
|
||||
|
||||
public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) {
|
||||
this.tokenRequestBuilder = tokenRequestBuilder;
|
||||
}
|
||||
|
||||
public AuthenticationRequestBuilder getAuthenticationRequestBuilder() {
|
||||
return authenticationRequestBuilder;
|
||||
}
|
||||
|
||||
public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) {
|
||||
this.authenticationRequestBuilder = authenticationRequestBuilder;
|
||||
}
|
||||
|
||||
public OAuthClient getOauthClient() {
|
||||
return oauthClient;
|
||||
}
|
||||
|
||||
public void setOauthClient(OAuthClient oauthClient) {
|
||||
this.oauthClient = oauthClient;
|
||||
}
|
||||
|
||||
public void setOauthClient(Client client) {
|
||||
this.oauthClient = new OAuthClient( new OAuthFeignClient(client));
|
||||
}
|
||||
|
||||
public static class OAuthFeignClient implements HttpClient {
|
||||
|
||||
private Client client;
|
||||
|
||||
public OAuthFeignClient() {
|
||||
this.client = new Client.Default(null, null);
|
||||
}
|
||||
|
||||
public OAuthFeignClient(Client client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public <T extends OAuthClientResponse> T execute(OAuthClientRequest request, Map<String, String> headers,
|
||||
String requestMethod, Class<T> responseClass)
|
||||
throws OAuthSystemException, OAuthProblemException {
|
||||
|
||||
RequestTemplate req = new RequestTemplate()
|
||||
.append(request.getLocationUri())
|
||||
.method(requestMethod)
|
||||
.body(request.getBody());
|
||||
|
||||
for (Entry<String, String> entry : headers.entrySet()) {
|
||||
req.header(entry.getKey(), entry.getValue());
|
||||
}
|
||||
Response feignResponse;
|
||||
String body = "";
|
||||
try {
|
||||
feignResponse = client.execute(req.request(), new Options());
|
||||
body = Util.toString(feignResponse.body().asReader());
|
||||
} catch (IOException e) {
|
||||
throw new OAuthSystemException(e);
|
||||
}
|
||||
|
||||
String contentType = null;
|
||||
Collection<String> contentTypeHeader = feignResponse.headers().get("Content-Type");
|
||||
if(contentTypeHeader != null) {
|
||||
contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";");
|
||||
}
|
||||
|
||||
return OAuthClientResponseFactory.createCustomResponse(
|
||||
body,
|
||||
contentType,
|
||||
feignResponse.status(),
|
||||
responseClass
|
||||
);
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
// Nothing to do here
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.mowesta.android.feign.auth;
|
||||
|
||||
public enum OAuthFlow {
|
||||
accessCode, implicit, password, application
|
||||
}
|
||||
@@ -14,16 +14,16 @@ ext {
|
||||
versionAndroidXPaging = '2.1.2'
|
||||
versionAndroidXCard = '1.0.0'
|
||||
versionAndroidXCoordinator = '1.2.0'
|
||||
versionAndroidXConstraint = '2.1.3'
|
||||
versionAndroidXNavigation = '2.3.5'
|
||||
versionAndroidXLifecycle = '2.4.1'
|
||||
versionAndroidXConstraint = '2.1.4'
|
||||
versionAndroidXNavigation = '2.5.3'
|
||||
versionAndroidXLifecycle = '2.5.1'
|
||||
versionAndroidXSecurity = '1.0.0'
|
||||
versionAndroidXViewpager = '1.0.0'
|
||||
versionAndroidXWork = '2.7.1'
|
||||
versionGoogleMaterial = '1.6.0'
|
||||
versionGoogleMaterial = '1.7.0'
|
||||
versionAndroidXSwipeRefresh = '1.1.0'
|
||||
versionAndroidXWebkit = '1.4.0'
|
||||
versionExoPlayer = '2.17.1'
|
||||
versionAndroidXWebkit = '1.5.0'
|
||||
versionExoPlayer = '2.18.1'
|
||||
versionApp = project.version
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation project(":android-sdk")
|
||||
|
||||
implementation "javax.xml.bind:jaxb-api:${versionJaxb}"
|
||||
implementation "jakarta.xml.bind:jakarta.xml.bind-api:${versionJaxb}"
|
||||
implementation "androidx.appcompat:appcompat:${versionAndroidXAppcompat}"
|
||||
implementation "androidx.work:work-runtime:${versionAndroidXWork}"
|
||||
implementation "com.google.android.material:material:${versionGoogleMaterial}"
|
||||
@@ -95,12 +95,12 @@ configurations {
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
compileSdkVersion 33
|
||||
defaultConfig {
|
||||
applicationId "com.mowesta.android.app"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
versionCode 25
|
||||
targetSdkVersion 33
|
||||
versionCode 30
|
||||
versionName "${versionApp}"
|
||||
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
@@ -174,8 +174,14 @@ android {
|
||||
}
|
||||
namespace 'com.mowesta.android.app'
|
||||
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += "META-INF/*.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// enable unchecked and deprecation warning during compilation
|
||||
gradle.projectsEvaluated {
|
||||
tasks.withType(JavaCompile) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK"/>
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
@@ -28,7 +29,7 @@
|
||||
android:supportsRtl="true"
|
||||
android:fullBackupContent="@xml/backup">
|
||||
<activity
|
||||
android:launchMode="singleTask"
|
||||
android:launchMode="singleTop"
|
||||
android:name=".MowestaActivity"
|
||||
android:windowSoftInputMode="adjustResize"
|
||||
android:exported="true">
|
||||
@@ -79,5 +80,6 @@
|
||||
<meta-data android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_measure" />
|
||||
</receiver>
|
||||
<service android:name=".MowestaService" android:exported="true"/>
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.net.Uri;
|
||||
import android.net.http.HttpResponseCache;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PersistableBundle;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -20,8 +21,10 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.navigation.NavBackStackEntry;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.NavOptionsBuilder;
|
||||
import androidx.navigation.Navigation;
|
||||
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
@@ -32,6 +35,7 @@ import com.mowesta.android.app.task.DatabaseTask;
|
||||
import com.mowesta.android.app.task.RefreshTask;
|
||||
import com.mowesta.android.app.task.SyncTask;
|
||||
import com.mowesta.android.app.util.PermissionUtil;
|
||||
import com.mowesta.android.app.widget.PeriodicWidgetWorker;
|
||||
import com.mowesta.android.feign.api.DefaultApi;
|
||||
import com.mowesta.android.sdk.SdkRepository;
|
||||
import com.mowesta.android.sdk.task.ClearTask;
|
||||
@@ -58,6 +62,10 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
*/
|
||||
private static final int DELAY_REFRESH = 15 * 60 * 1000;
|
||||
|
||||
/**
|
||||
* Requests the permission to issue notifications.
|
||||
*/
|
||||
public static final int CODE_REQUEST_POST_NOTIFICATION = 3333;
|
||||
/**
|
||||
* The code used to request the permission for localizing in the foreground.
|
||||
*/
|
||||
@@ -113,7 +121,9 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
private OnSharedPreferenceChangeListener preferenceListener = (prefs, key) -> {
|
||||
if (MowestaSettings.PRIVACY_MEASURE.equals(key)) {
|
||||
if (settings.isPrivacyMeasure()) {
|
||||
if (!PermissionUtil.hasBackgroundPermissions(this)) requestPermissions();
|
||||
if (!PermissionUtil.hasBackgroundPermissions(this) ||
|
||||
!PermissionUtil.hasNotificationPermission(this))
|
||||
requestPermissions(false);
|
||||
else MowestaService.startService(this);
|
||||
} else {
|
||||
MowestaService.stopService(this);
|
||||
@@ -139,7 +149,6 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
|
||||
}
|
||||
|
||||
// got to navigation drawer when user presses notification
|
||||
@@ -152,7 +161,17 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
if (controller.getGraph().getId() == R.id.navigation_core) {
|
||||
controller.navigate(R.id.action_drawer);
|
||||
} else {
|
||||
controller.navigate(R.id.action_core);
|
||||
boolean hasDrawer = false;
|
||||
for (NavBackStackEntry entry: controller.getBackQueue()) {
|
||||
if (entry.getDestination().getId() == R.id.destination_drawer) {
|
||||
hasDrawer = true;
|
||||
}
|
||||
}
|
||||
if (hasDrawer) {
|
||||
controller.navigate(R.id.action_drawer);
|
||||
} else {
|
||||
controller.navigate(R.id.action_core);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,6 +184,12 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
handleNotificationIntent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostResume() {
|
||||
super.onPostResume();
|
||||
MowestaService.startService(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
@@ -205,9 +230,11 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
/**
|
||||
* Method to request location permission for the app.
|
||||
*/
|
||||
public void requestPermissions() {
|
||||
public void requestPermissions(boolean skipNotification) {
|
||||
Log.d(TAG, "Requesting permissions.");
|
||||
if (!PermissionUtil.hasPermissions(this, PermissionUtil.getForegroundPermissions(this))) {
|
||||
if (!skipNotification && Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && !PermissionUtil.hasNotificationPermission(this)) {
|
||||
ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.POST_NOTIFICATIONS }, CODE_REQUEST_POST_NOTIFICATION);
|
||||
} else if (!PermissionUtil.hasPermissions(this, PermissionUtil.getForegroundPermissions(this))) {
|
||||
ActivityCompat.requestPermissions(this, PermissionUtil.getForegroundPermissions(this), CODE_REQUEST_BACKGROUND_PERMISSIONS);
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
|
||||
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.ACCESS_BACKGROUND_LOCATION }, CODE_REQUEST_BACKGROUND_PERMISSIONS);
|
||||
@@ -225,6 +252,12 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
switch (requestCode) {
|
||||
case CODE_REQUEST_POST_NOTIFICATION: {
|
||||
if (!PermissionUtil.hasBackgroundPermissions(this))
|
||||
requestPermissions(true);
|
||||
else MowestaService.startService(this);
|
||||
break;
|
||||
}
|
||||
case CODE_REQUEST_BACKGROUND_PERMISSIONS:
|
||||
case CODE_REQUEST_FOREGROUND_PERMISSIONS: {
|
||||
boolean granted = true;
|
||||
@@ -238,8 +271,9 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
if (!granted) {
|
||||
settings.setPrivacyMeasure(false);
|
||||
showMissingPermission(requestCode == CODE_REQUEST_FOREGROUND_PERMISSIONS);
|
||||
} else if (requestCode == CODE_REQUEST_BACKGROUND_PERMISSIONS){
|
||||
if (!PermissionUtil.hasBackgroundPermissions(this)) requestPermissions();
|
||||
} else {
|
||||
if (!PermissionUtil.hasBackgroundPermissions(this))
|
||||
settings.setPrivacyMeasure(false);
|
||||
else MowestaService.startService(this);
|
||||
}
|
||||
break;
|
||||
@@ -257,8 +291,6 @@ public class MowestaActivity extends AppCompatActivity {
|
||||
pdf.show(getSupportFragmentManager(), "permissions");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* A dialog fragment to explain the need for permissions.
|
||||
*
|
||||
|
||||
@@ -86,7 +86,6 @@ public class MowestaApp extends Application implements IApp {
|
||||
deviceRepository = new DeviceRepository.Builder().setTrace(false).build(this);
|
||||
favoriteRepository = new FavoriteRepository(this);
|
||||
widgetRepository = new WidgetRepository(this);
|
||||
MowestaService.startService(this);
|
||||
PeriodicWidgetWorker.updateWidgets(this);
|
||||
PeriodicWidgetWorker.scheduleUpdates(this);
|
||||
//if(BuildConfig.DEBUG)
|
||||
|
||||
@@ -235,7 +235,7 @@ public class BindingAdapters {
|
||||
res = R.string.city_type_village;
|
||||
break;
|
||||
}
|
||||
if (city.isCapital()) {
|
||||
if (city.getCapital()) {
|
||||
res = R.string.city_type_capital;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mowesta.android.app.IApp;
|
||||
@@ -41,7 +43,6 @@ public abstract class AbstractDiagramFragment extends AbstractNetworkFragment {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
settings = ((IApp)getContext().getApplicationContext()).getSettings();
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,25 +65,29 @@ public abstract class AbstractDiagramFragment extends AbstractNetworkFragment {
|
||||
public abstract void onRefreshDiagram();
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_unit, menu);
|
||||
}
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
getActivity().addMenuProvider(new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_unit, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_unit_system) {
|
||||
UnitSystemDialogFragment system = new UnitSystemDialogFragment();
|
||||
system.show(getChildFragmentManager(), "system");
|
||||
return true;
|
||||
} else if (itemId == R.id.action_temperature_unit) {
|
||||
TemperatureUnitDialogFragment unit = new TemperatureUnitDialogFragment();
|
||||
unit.show(getChildFragmentManager(), "unit");
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_unit_system) {
|
||||
UnitSystemDialogFragment system = new UnitSystemDialogFragment();
|
||||
system.show(getChildFragmentManager(), "system");
|
||||
return true;
|
||||
} else if (itemId == R.id.action_temperature_unit) {
|
||||
TemperatureUnitDialogFragment unit = new TemperatureUnitDialogFragment();
|
||||
unit.show(getChildFragmentManager(), "unit");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, getViewLifecycleOwner());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
@@ -44,12 +45,6 @@ public abstract class AbstractPlaceFragment extends AbstractNetworkFragment {
|
||||
*/
|
||||
protected abstract AbstractPlaceViewModel getPlaceViewModel();
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -58,45 +53,46 @@ public abstract class AbstractPlaceFragment extends AbstractNetworkFragment {
|
||||
model.getCoordinate().observe(getViewLifecycleOwner(), (v) -> getActivity().invalidateOptionsMenu());
|
||||
model.getFavorite().observe(getViewLifecycleOwner(), (v) -> getActivity().invalidateOptionsMenu());
|
||||
model.getWikipedia().observe(getViewLifecycleOwner() ,(v) -> getActivity().invalidateOptionsMenu());
|
||||
}
|
||||
getActivity().addMenuProvider(new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_place, menu);
|
||||
AbstractPlaceViewModel model = getPlaceViewModel();
|
||||
Boolean favorite = model.getFavorite().getValue();
|
||||
if (favorite == null || favorite) {
|
||||
menu.removeItem(R.id.action_favorite_add);
|
||||
}
|
||||
if (favorite == null || !favorite) {
|
||||
menu.removeItem(R.id.action_favorite_remove);
|
||||
}
|
||||
if (model.getWikipedia().getValue() == null) {
|
||||
menu.removeItem(R.id.action_wikipedia);
|
||||
}
|
||||
if (model.getCoordinate().getValue() == null) {
|
||||
menu.removeItem(R.id.action_google_maps);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_place, menu);
|
||||
AbstractPlaceViewModel model = getPlaceViewModel();
|
||||
Boolean favorite = model.getFavorite().getValue();
|
||||
if (favorite == null || favorite) {
|
||||
menu.removeItem(R.id.action_favorite_add);
|
||||
}
|
||||
if (favorite == null || !favorite) {
|
||||
menu.removeItem(R.id.action_favorite_remove);
|
||||
}
|
||||
if (model.getWikipedia().getValue() == null) {
|
||||
menu.removeItem(R.id.action_wikipedia);
|
||||
}
|
||||
if (model.getCoordinate().getValue() == null) {
|
||||
menu.removeItem(R.id.action_google_maps);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_favorite_add) {
|
||||
getPlaceViewModel().addFavorite();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_favorite_remove) {
|
||||
getPlaceViewModel().removeFavorite();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_wikipedia) {
|
||||
openWikipedia();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_google_maps) {
|
||||
openGoogleMaps();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, getViewLifecycleOwner());
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_favorite_add) {
|
||||
getPlaceViewModel().addFavorite();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_favorite_remove) {
|
||||
getPlaceViewModel().removeFavorite();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_wikipedia) {
|
||||
openWikipedia();
|
||||
return true;
|
||||
} else if (itemId == R.id.action_google_maps) {
|
||||
openGoogleMaps();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -18,6 +19,9 @@ import com.mowesta.android.app.adapter.CityEntryPagedListAdapter;
|
||||
import com.mowesta.android.app.model.AbstractNetworkViewModel;
|
||||
import com.mowesta.android.app.model.CitiesViewModel;
|
||||
import com.mowesta.android.app.model.StateViewModel;
|
||||
import com.mowesta.android.app.util.TabletUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,6 +30,7 @@ import com.mowesta.android.app.model.StateViewModel;
|
||||
* @author Marcus
|
||||
*/
|
||||
public class CitiesFragment extends AbstractNetworkFragment {
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
@Override
|
||||
protected AbstractNetworkViewModel getNetworkViewModel() {
|
||||
@@ -38,10 +43,27 @@ public class CitiesFragment extends AbstractNetworkFragment {
|
||||
return inflater.inflate(R.layout.fragment_cities, container, false);
|
||||
}
|
||||
|
||||
private void applyGridWidth() {
|
||||
if (!TabletUtil.isTablet(requireContext())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = requireContext().getResources().getInteger(R.integer.RecyclerWidth);
|
||||
TabletUtil.setGridLayout(recyclerView, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(@NotNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
applyGridWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler);
|
||||
recyclerView = view.findViewById(R.id.recycler);
|
||||
applyGridWidth();
|
||||
|
||||
NavController controller = Navigation.findNavController(getActivity(), R.id.navigation_app);
|
||||
CityEntryPagedListAdapter adapter = new CityEntryPagedListAdapter(getViewLifecycleOwner(), (city) -> {
|
||||
if (city != null) {
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
@@ -71,30 +72,6 @@ public class CityFragment extends AbstractPlaceFragment {
|
||||
return getView().findViewById(R.id.bottom_navigation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_customize, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_customize) {
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(new CustomizeDialogFragment(), "customize")
|
||||
.commit();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -126,5 +103,26 @@ public class CityFragment extends AbstractPlaceFragment {
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
getActivity().addMenuProvider(new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_customize, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_customize) {
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.add(new CustomizeDialogFragment(), "customize")
|
||||
.commit();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, getViewLifecycleOwner());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,11 +55,6 @@ public class CityGradientFragment extends CityFragment.ChildFragment {
|
||||
*/
|
||||
private TimeUtils timeUtils = new TimeUtils(System.currentTimeMillis(), null);
|
||||
|
||||
/**
|
||||
* The view pager of the parent.
|
||||
*/
|
||||
private ViewPager2 pager;
|
||||
|
||||
/**
|
||||
* The date formatter.
|
||||
*/
|
||||
@@ -94,8 +89,6 @@ public class CityGradientFragment extends CityFragment.ChildFragment {
|
||||
dateFormatter = new DateFormatter(getContext());
|
||||
binding = DataBindingUtil.inflate(inflater, R.layout.fragment_gradient, container, false);
|
||||
// this is quite ugly, but we need to disable the view pager and collapse the toolbar
|
||||
pager = getActivity().findViewById(R.id.pager);
|
||||
AppBarLayout layout = getActivity().findViewById(R.id.layout_appbar);
|
||||
binding.gradientProgress1.setMax(TIMEOUT_REMOVER);
|
||||
binding.gradientProgress2.setMax(TIMEOUT_REMOVER);
|
||||
animator = ValueAnimator.ofInt(TIMEOUT_REMOVER, 0);
|
||||
@@ -110,34 +103,7 @@ public class CityGradientFragment extends CityFragment.ChildFragment {
|
||||
binding.gradientText.setAlpha(Math.min(1, Math.max(0, value / 1000f)));
|
||||
}
|
||||
});
|
||||
binding.gradientScroll.setOnTouchListener(binding.gradientTouch.createOnTouchListener(new TimeView.OnSlideListener() {
|
||||
@Override
|
||||
public void onSlide(float relative) {
|
||||
if (!hasData()) return;
|
||||
animator.cancel();
|
||||
binding.gradientProgress1.setProgress(TIMEOUT_REMOVER);
|
||||
binding.gradientProgress2.setProgress(TIMEOUT_REMOVER);
|
||||
binding.gradientText.setAlpha(1);
|
||||
handler.removeCallbacks(remover);
|
||||
if (!closed) {
|
||||
layout.setExpanded(false, true);
|
||||
closed = true;
|
||||
}
|
||||
pager.setUserInputEnabled(false);
|
||||
updateSelection(relative);
|
||||
updateCondition(relative);
|
||||
binding.gradientText.setVisibility(View.VISIBLE);
|
||||
updateGuide(relative);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlideEnd() {
|
||||
pager.setUserInputEnabled(true);
|
||||
closed = false;
|
||||
animator.start();
|
||||
handler.postDelayed(remover, TIMEOUT_REMOVER);
|
||||
}
|
||||
}));
|
||||
|
||||
binding.setLifecycleOwner(getViewLifecycleOwner());
|
||||
binding.gradientText.setVisibility(View.GONE);
|
||||
@@ -278,7 +244,53 @@ public class CityGradientFragment extends CityFragment.ChildFragment {
|
||||
public void onPause() {
|
||||
handler.removeCallbacks(remover);
|
||||
remover.run();
|
||||
binding.gradientScroll.setOnTouchListener(null);
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
AppBarLayout layout = getActivity().findViewById(R.id.layout_appbar);
|
||||
ViewPager2 pager = getActivity().findViewById(R.id.pager);
|
||||
binding.gradientScroll.setOnTouchListener(binding.gradientTouch.createOnTouchListener(new TimeView.OnSlideListener() {
|
||||
@Override
|
||||
public void onSlide(float relative) {
|
||||
if (!hasData()) return;
|
||||
animator.cancel();
|
||||
binding.gradientProgress1.setProgress(TIMEOUT_REMOVER);
|
||||
binding.gradientProgress2.setProgress(TIMEOUT_REMOVER);
|
||||
binding.gradientText.setAlpha(1);
|
||||
handler.removeCallbacks(remover);
|
||||
if (!closed) {
|
||||
if (layout != null)
|
||||
layout.setExpanded(false, true);
|
||||
closed = true;
|
||||
}
|
||||
if (pager != null)
|
||||
pager.setUserInputEnabled(false);
|
||||
updateSelection(relative);
|
||||
updateCondition(relative);
|
||||
binding.gradientText.setVisibility(View.VISIBLE);
|
||||
updateGuide(relative);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlideEnd() {
|
||||
if (pager != null)
|
||||
pager.setUserInputEnabled(true);
|
||||
closed = false;
|
||||
animator.start();
|
||||
handler.postDelayed(remover, TIMEOUT_REMOVER);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
binding.gradientTouch.setOnTouchListener(null);
|
||||
super.onDestroyView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavController;
|
||||
@@ -39,12 +40,6 @@ public class DevicesFragment extends AbstractNetworkFragment {
|
||||
return new ViewModelProvider(this).get(DevicesViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
@@ -55,6 +50,22 @@ public class DevicesFragment extends AbstractNetworkFragment {
|
||||
Bundle bundle = new Bundle();
|
||||
controller.navigate(R.id.destination_setup, bundle, opts.build());
|
||||
});
|
||||
getActivity().addMenuProvider(new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_refresh, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_refresh) {
|
||||
DevicesViewModel model = new ViewModelProvider(DevicesFragment.this).get(DevicesViewModel.class);
|
||||
model.reload();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, getViewLifecycleOwner());
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@@ -84,21 +95,6 @@ public class DevicesFragment extends AbstractNetworkFragment {
|
||||
swipeRefreshLayout.setOnRefreshListener(() -> model.reload());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_refresh, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_refresh) {
|
||||
DevicesViewModel model = new ViewModelProvider(this).get(DevicesViewModel.class);
|
||||
model.reload();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SearchView;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.cursoradapter.widget.CursorAdapter;
|
||||
import androidx.customview.widget.Openable;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
@@ -78,32 +79,12 @@ public class DrawerFragment extends AbstractNetworkFragment {
|
||||
return new ViewModelProvider(this).get(DrawerViewModel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (!preventSplashScreen()) {
|
||||
handleNotificationIntent();
|
||||
}
|
||||
handleNotificationIntent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent going back to the splash screen if opened through deep link.
|
||||
*/
|
||||
private boolean preventSplashScreen() {
|
||||
NavController nav = Navigation.findNavController(getActivity().findViewById(R.id.navigation_app));
|
||||
if (nav.getGraph().getId() != R.id.navigation_core) {
|
||||
nav.setGraph(R.navigation.navigation_core);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the intent was generated by the background service and
|
||||
@@ -127,48 +108,52 @@ public class DrawerFragment extends AbstractNetworkFragment {
|
||||
Toolbar toolbar = view.findViewById(R.id.toolbar);
|
||||
((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
|
||||
loadingProgressBar = view.findViewById(R.id.progress_bar);
|
||||
getActivity().addMenuProvider(new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
|
||||
menuInflater.inflate(R.menu.menu_search, menu);
|
||||
SearchView search = (SearchView)menu.findItem(R.id.action_search).getActionView();
|
||||
search.setQueryHint(getString(R.string.action_search));
|
||||
SearchView.SearchAutoComplete complete = search.findViewById(androidx.appcompat.R.id.search_src_text);
|
||||
complete.setDropDownBackgroundResource(R.color.bg_search);
|
||||
final DrawerViewModel model = new ViewModelProvider(DrawerFragment.this).get(DrawerViewModel.class);
|
||||
search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
model.setTerm(newText);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
search.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
|
||||
@Override
|
||||
public boolean onSuggestionSelect(int position) {
|
||||
showLocation(model, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSuggestionClick(int position) {
|
||||
showLocation(model, position);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
search.setSuggestionsAdapter(new LocationCursorAdapter(getContext(), model.getResults()));
|
||||
AppBarLayout appbar = getView().findViewById(R.id.layout_appbar);
|
||||
search.setOnSearchClickListener((v)->appbar.setExpanded(false, true));
|
||||
}
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
|
||||
return false;
|
||||
}
|
||||
}, getViewLifecycleOwner());
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_search, menu);
|
||||
SearchView search = (SearchView)menu.findItem(R.id.action_search).getActionView();
|
||||
search.setQueryHint(getString(R.string.action_search));
|
||||
SearchView.SearchAutoComplete complete = search.findViewById(androidx.appcompat.R.id.search_src_text);
|
||||
complete.setDropDownBackgroundResource(R.color.bg_search);
|
||||
final DrawerViewModel model = new ViewModelProvider(this).get(DrawerViewModel.class);
|
||||
search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||
@Override
|
||||
public boolean onQueryTextSubmit(String query) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onQueryTextChange(String newText) {
|
||||
model.setTerm(newText);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
search.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
|
||||
@Override
|
||||
public boolean onSuggestionSelect(int position) {
|
||||
showLocation(model, position);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSuggestionClick(int position) {
|
||||
showLocation(model, position);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
search.setSuggestionsAdapter(new LocationCursorAdapter(getContext(), model.getResults()));
|
||||
AppBarLayout appbar = getView().findViewById(R.id.layout_appbar);
|
||||
search.setOnSearchClickListener((v)->appbar.setExpanded(false, true));
|
||||
}
|
||||
|
||||
private void showLocation(DrawerViewModel model, int position) {
|
||||
LocationHierarchyPage page = model.getResults().getValue();
|
||||
LocationHierarchy dest = page.getElements().get(position);
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.view.MenuProvider;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
@@ -45,7 +46,6 @@ public class FavoritesFragment extends Fragment {
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
// possibly show the ad for eiszeit
|
||||
AdvertiseDialogFragment adf = new AdvertiseDialogFragment();
|
||||
if (adf.shouldShow(getContext()) && getChildFragmentManager().findFragmentByTag(TAG_ADVERTISEMENT) == null) {
|
||||
@@ -56,14 +56,38 @@ public class FavoritesFragment extends Fragment {
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.fragment_favorites, container, false);
|
||||
View view = inflater.inflate(R.layout.fragment_favorites, container, false);
|
||||
getActivity().addMenuProvider(new MenuProvider() {
|
||||
@Override
|
||||
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
inflater.inflate(R.menu.menu_unit, menu);
|
||||
inflater.inflate(R.menu.menu_refresh, menu);
|
||||
// remove this item, since it would not have an effect here
|
||||
MenuItem item = menu.findItem(R.id.action_unit_system);
|
||||
if (item != null) item.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_refresh) {
|
||||
FavoritesViewModel model = new ViewModelProvider(getActivity()).get(FavoritesViewModel.class);
|
||||
model.refresh();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.action_temperature_unit) {
|
||||
TemperatureUnitDialogFragment unit = new TemperatureUnitDialogFragment();
|
||||
unit.show(getChildFragmentManager(), "unit");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, getViewLifecycleOwner());
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler);
|
||||
TabletUtil.setGridLayout(recyclerView, 300);
|
||||
TabletUtil.setGridLayout(recyclerView, 350);
|
||||
SwipeRefreshLayout swipeRefreshLayout = view.findViewById(R.id.swipe_refresh);
|
||||
FavoritesViewModel model = new ViewModelProvider(getActivity()).get(FavoritesViewModel.class);
|
||||
model.getRefreshing().observe(getViewLifecycleOwner(), (refreshing) -> {
|
||||
@@ -147,29 +171,6 @@ public class FavoritesFragment extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.menu_unit, menu);
|
||||
inflater.inflate(R.menu.menu_refresh, menu);
|
||||
// remove this item, since it would not have an effect here
|
||||
MenuItem item = menu.findItem(R.id.action_unit_system);
|
||||
if (item != null) item.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_refresh) {
|
||||
FavoritesViewModel model = new ViewModelProvider(getActivity()).get(FavoritesViewModel.class);
|
||||
model.refresh();
|
||||
return true;
|
||||
} else if (item.getItemId() == R.id.action_temperature_unit) {
|
||||
TemperatureUnitDialogFragment unit = new TemperatureUnitDialogFragment();
|
||||
unit.show(getChildFragmentManager(), "unit");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The view holder for favorites.
|
||||
*
|
||||
|
||||
@@ -26,6 +26,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
@@ -200,8 +201,6 @@ public class SettingsFragment extends PreferenceFragmentCompat {
|
||||
*/
|
||||
private void updateBuild() {
|
||||
try {
|
||||
ApplicationInfo ai = getActivity().getPackageManager().getApplicationInfo(getActivity().getPackageName(), 0);
|
||||
PackageInfo pi = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0);
|
||||
String summary = getResources().getString(R.string.setting_about_build_summary);
|
||||
summary = summary.replace("$version$", BuildConfig.VERSION_NAME);
|
||||
summary = summary.replace("$code$", "" + BuildConfig.VERSION_CODE);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mowesta.android.app.fragment;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -23,14 +24,33 @@ import com.mowesta.android.app.databinding.FragmentStationsBinding;
|
||||
import com.mowesta.android.app.databinding.ViewStationEntryBinding;
|
||||
import com.mowesta.android.app.model.AbstractNetworkViewModel;
|
||||
import com.mowesta.android.app.model.StationsViewModel;
|
||||
import com.mowesta.android.app.util.TabletUtil;
|
||||
import com.mowesta.android.feign.model.WeatherStation;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Shows a list of the available stations.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public class StationsFragment extends AbstractNetworkFragment {
|
||||
private RecyclerView recyclerView;
|
||||
|
||||
private void applyGridWidth() {
|
||||
if (!TabletUtil.isTablet(requireContext())) {
|
||||
return;
|
||||
}
|
||||
|
||||
int width = requireContext().getResources().getInteger(R.integer.RecyclerWidth);
|
||||
TabletUtil.setGridLayout(recyclerView, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(@NotNull Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
applyGridWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractNetworkViewModel getNetworkViewModel() {
|
||||
@@ -50,7 +70,9 @@ public class StationsFragment extends AbstractNetworkFragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
RecyclerView recycler = view.findViewById(R.id.recycler);
|
||||
recyclerView = view.findViewById(R.id.recycler);
|
||||
applyGridWidth();
|
||||
|
||||
StationsViewModel model = new ViewModelProvider(this).get(StationsViewModel.class);
|
||||
NavController controller = Navigation.findNavController(getActivity(), R.id.navigation_app);
|
||||
StationEntryPagedListAdapter adapter = new StationEntryPagedListAdapter(getViewLifecycleOwner(), (station) -> {
|
||||
@@ -65,7 +87,7 @@ public class StationsFragment extends AbstractNetworkFragment {
|
||||
model.getStations().observe(getViewLifecycleOwner(), (list) -> {
|
||||
adapter.submitList(list);
|
||||
});
|
||||
recycler.setAdapter(adapter);
|
||||
recyclerView.setAdapter(adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +163,7 @@ public class StationsFragment extends AbstractNetworkFragment {
|
||||
* Creates a new paged list adapter that will inform
|
||||
* the listener about click events.
|
||||
*
|
||||
* @param owner The lifecycle owner.
|
||||
* @param owner The lifecycle owner.
|
||||
* @param listener The listener.
|
||||
*/
|
||||
public StationEntryPagedListAdapter(@NonNull LifecycleOwner owner, @NonNull StationsViewModel.OnStationSelectedListener listener) {
|
||||
|
||||
@@ -150,7 +150,7 @@ public class TermsFragment extends Fragment {
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
public static class BrowserFragment extends CityFragment.ChildFragment {
|
||||
public static class BrowserFragment extends Fragment {
|
||||
|
||||
/**
|
||||
* The web view to show the contents.
|
||||
|
||||
@@ -57,7 +57,7 @@ public class DrawerViewModel extends AbstractNetworkViewModel {
|
||||
* The task to perform the search.
|
||||
*/
|
||||
private ApiTask<RequestParameter<String>, LocationHierarchyPage> searchTask = new ApiTask<>((input, client) -> {
|
||||
return client.searchLocations(getLanguage(), input.getValue(), null,0, 10);
|
||||
return client.searchLocations(getLanguage(), input.getValue(), 0, 10, null);
|
||||
}, (input, result) -> {
|
||||
completeRequest(input, () -> {
|
||||
results.setValue(result);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ForecastWidgetViewModel extends AbstractNetworkViewModel {
|
||||
|
||||
private ApiTask<RequestParameter<String>, CityPage> searchTask = new ApiTask<>(
|
||||
(input, client) -> {
|
||||
CityPage cities = client.searchCities(getApplication().getString(R.string.language_code), input.getValue(), null, 0, 20);
|
||||
CityPage cities = client.searchCities(getApplication().getString(R.string.language_code), input.getValue(), 0, 20, null);
|
||||
return cities;
|
||||
},
|
||||
(input, result) -> {
|
||||
|
||||
@@ -150,7 +150,7 @@ public class StationsViewModel extends AbstractNetworkViewModel {
|
||||
|
||||
@Override
|
||||
public void loadInitial(@NonNull LoadInitialParams params, @NonNull LoadInitialCallback<WeatherStation> callback) {
|
||||
ApiTask<Void, WeatherStationPage> task = new ApiTask<>((v, client) -> { return client.getStations(0, params.requestedLoadSize, term); },
|
||||
ApiTask<Void, WeatherStationPage> task = new ApiTask<>((v, client) -> { return client.getStations(term, 0, params.requestedLoadSize); },
|
||||
(v, page) -> { completeRequest(requestCode, () -> callback.onResult(page.getElements(), 0, page.getTotal())); },
|
||||
(v, status) -> { finishRequest(requestCode, true); });
|
||||
if (isCurrentRequest(requestCode)) {
|
||||
@@ -161,7 +161,7 @@ public class StationsViewModel extends AbstractNetworkViewModel {
|
||||
|
||||
@Override
|
||||
public void loadRange(@NonNull LoadRangeParams params, @NonNull LoadRangeCallback<WeatherStation> callback) {
|
||||
ApiTask<Void, WeatherStationPage> task = new ApiTask<>((v, client) -> { return client.getStations(params.startPosition, params.loadSize, term); },
|
||||
ApiTask<Void, WeatherStationPage> task = new ApiTask<>((v, client) -> { return client.getStations(term, params.startPosition, params.loadSize); },
|
||||
(v, page) -> { completeRequest(requestCode, () -> callback.onResult(page.getElements())); },
|
||||
(v, status) -> { finishRequest(requestCode, true);});
|
||||
if (isCurrentRequest(requestCode)) {
|
||||
|
||||
@@ -196,7 +196,7 @@ public class DeviceRepository extends Repository {
|
||||
d.setId(handle.getId());
|
||||
d.setDevice(handle.getDevice());
|
||||
d.setCreationTime(handle.getCreationTime());
|
||||
d.setDeleted(handle.isDeleted());
|
||||
d.setDeleted(handle.getDeleted());
|
||||
d.setManufacturer(handle.getManufacturer());
|
||||
d.setModificationTime(handle.getModificationTime());
|
||||
d.setModel(handle.getModel());
|
||||
|
||||
@@ -96,4 +96,18 @@ public class PermissionUtil {
|
||||
return new String[] { Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION };
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether the app has the post notification permission.
|
||||
*
|
||||
* @param context The context.
|
||||
* @return True if the app may post notifications.
|
||||
*/
|
||||
public static boolean hasNotificationPermission(@NonNull Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
return hasPermissions(context, new String[] { Manifest.permission.POST_NOTIFICATIONS });
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.mowesta.android.app.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.os.ConfigurationCompat;
|
||||
|
||||
import com.mowesta.android.app.R;
|
||||
@@ -17,7 +13,7 @@ import java.util.List;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
* A utiltiy class to comptue times when aggregating weather
|
||||
* A utility class to computes times when aggregating weather
|
||||
* conditions into weather summaries.
|
||||
*
|
||||
* @author Marcus
|
||||
@@ -44,15 +40,15 @@ public class TimeUtils {
|
||||
* @param tz The time zone.
|
||||
*/
|
||||
public TimeUtils(long now, String tz) {
|
||||
if (tz != null) {
|
||||
c.setTimeZone(TimeZone.getTimeZone(tz));
|
||||
}
|
||||
c.setTimeInMillis(now);
|
||||
update(today);
|
||||
c.add(Calendar.DAY_OF_MONTH, -1);
|
||||
update(yesterday);
|
||||
c.add(Calendar.DAY_OF_MONTH, 2);
|
||||
update(tomorrow);
|
||||
if (tz != null) {
|
||||
c.setTimeZone(TimeZone.getTimeZone(tz));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/navigation_view"
|
||||
android:layout_width="210dp"
|
||||
android:layout_width="240dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:itemTextAppearance="?attr/textAppearanceBody1"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Sony Xperia Foo"
|
||||
android:gravity="end"
|
||||
android:lines="1"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:id="@+id/view_header_device"
|
||||
android:textAppearance="?android:attr/textAppearanceSmallInverse" />
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="match_parent_limit">
|
||||
<item name="android:layout_width">390dp</item>
|
||||
<item name="android:layout_width">340dp</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<integer name="RecyclerWidth">375</integer>
|
||||
|
||||
<declare-styleable name="DataView">
|
||||
<attr name="direction" format="enum">
|
||||
<enum name="HORIZONTAL" value="0" />
|
||||
|
||||
@@ -10,11 +10,11 @@ description = "MoWeSta Android SDK"
|
||||
project.version = "unspecified"
|
||||
|
||||
android {
|
||||
compileSdkVersion 31
|
||||
compileSdkVersion 33
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 30
|
||||
targetSdkVersion 33
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
@@ -132,7 +132,11 @@ public abstract class SdkService extends Service {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent != null && WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(intent.getAction())) {
|
||||
setScan(wifiManager.getScanResults());
|
||||
try {
|
||||
setScan(wifiManager.getScanResults());
|
||||
} catch (SecurityException e) {
|
||||
// will never happen
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -757,14 +761,16 @@ public abstract class SdkService extends Service {
|
||||
* @return The pending intent.
|
||||
*/
|
||||
public static PendingIntent createIntent(SdkService service) {
|
||||
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(service, service.getClass().getName());
|
||||
intent.putExtra(EXTRA_ALARM, true);
|
||||
int code = service.getResources().getInteger(R.integer.mowesta_sdk_alarm_request_code);
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
return PendingIntent.getService(service, code, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
return PendingIntent.getService(service, code, intent, flags);
|
||||
} else {
|
||||
return PendingIntent.getForegroundService(service, code, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) flags |= PendingIntent.FLAG_MUTABLE;
|
||||
return PendingIntent.getForegroundService(service, code, intent, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,17 +91,18 @@ public class ChannelManager {
|
||||
* @return The notification.
|
||||
*/
|
||||
public Notification createNotification(int res) {
|
||||
int flags = PendingIntent.FLAG_UPDATE_CURRENT;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) flags |= PendingIntent.FLAG_MUTABLE;
|
||||
NotificationCompat.Builder builder = new NotificationCompat.Builder(application, getChannelId())
|
||||
.setContentTitle(application.getString(R.string.mowesta_sdk_notification_title))
|
||||
.setContentText(application.getString(res))
|
||||
.setOngoing(true)
|
||||
.setContentIntent(PendingIntent.getActivity(application, getNotificationRequestCode(), createNotificationIntent(), PendingIntent.FLAG_UPDATE_CURRENT))
|
||||
.setContentIntent(PendingIntent.getActivity(application, getNotificationRequestCode(), createNotificationIntent(), flags))
|
||||
.setSmallIcon(R.drawable.mowesta_sdk_ic_notification_small)
|
||||
.setLargeIcon(BitmapFactory.decodeResource(application.getResources(), R.drawable.mowesta_sdk_ic_notification_large));
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the request code used for the pending intent.
|
||||
*
|
||||
|
||||
@@ -10,14 +10,12 @@
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
// Hardware setup
|
||||
#define BUTTON_PIN D5
|
||||
#define VOLTAGE_PIN A0
|
||||
#define VOLTAGE_MULTIPLIER 11
|
||||
#define VOLTAGE_DIVIDER 255.0
|
||||
#define EEPROM_SIZE 512
|
||||
#define BUTTON_OUT D7
|
||||
#define BME_OUT D6
|
||||
#define VOLTAGE_OUT D8
|
||||
#define BUTTON_PIN D5
|
||||
|
||||
//Credentials for the Access Point
|
||||
#define WLAN_AP_SSID "MoWeSta - WiFi"
|
||||
@@ -124,12 +122,6 @@ void setup() {
|
||||
while (!Serial);
|
||||
Serial.println();
|
||||
|
||||
// power the voltage divider
|
||||
pinMode(VOLTAGE_OUT, OUTPUT);
|
||||
digitalWrite(VOLTAGE_OUT, LOW);
|
||||
// power the bme sensor
|
||||
pinMode(BME_OUT, OUTPUT);
|
||||
digitalWrite(BME_OUT, LOW);
|
||||
// power the button
|
||||
pinMode(BUTTON_OUT, OUTPUT);
|
||||
digitalWrite(BUTTON_OUT, LOW);
|
||||
|
||||
@@ -9,13 +9,12 @@
|
||||
#include "ArduinoJson.h"
|
||||
|
||||
// Hardware setup
|
||||
#define BUTTON_PIN D5
|
||||
#define VOLTAGE_PIN A0
|
||||
#define VOLTAGE_MULTIPLIER 11
|
||||
#define VOLTAGE_DIVIDER 255.0
|
||||
#define EEPROM_SIZE 512
|
||||
#define BUTTON_PIN D5
|
||||
#define BUTTON_OUT D7
|
||||
#define EXTERNAL_OUT D8
|
||||
|
||||
//Credentials for the Access Point
|
||||
#define WLAN_AP_SSID "MoWeSta - WiFi"
|
||||
@@ -124,8 +123,6 @@ void setup() {
|
||||
// power the button, voltage divider and sensor
|
||||
pinMode(BUTTON_OUT, OUTPUT);
|
||||
digitalWrite(BUTTON_OUT, LOW);
|
||||
// set out to in, since it is connected directly to GND
|
||||
pinMode(EXTERNAL_OUT, INPUT);
|
||||
// Initialize EEPROM with complete size
|
||||
// Configure the button to enter setup
|
||||
pinMode(BUTTON_PIN, INPUT_PULLUP);
|
||||
|
||||
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 265 KiB |
|
After Width: | Height: | Size: 240 KiB |
|
After Width: | Height: | Size: 78 KiB |
@@ -1,14 +1,12 @@
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.concurrent.locks.ReentrantLock
|
||||
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.2.0'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
|
||||
classpath 'org.handte.gradle:gradle-android-eclipse:1.0.0'
|
||||
classpath "gradle.plugin.org.openbakery:plugin:0.21.0"
|
||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
|
||||
classpath 'org.handte.gradle:gradle-android-eclipse:1.0.0'
|
||||
classpath "gradle.plugin.org.openbakery:plugin:0.21.0"
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
@@ -19,54 +17,65 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'maven-publish'
|
||||
plugins.withType(JavaPlugin) {
|
||||
afterEvaluate {
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
// set version for our project
|
||||
group = 'com.mowesta'
|
||||
version = '1.0.25'
|
||||
version = '1.1.1'
|
||||
|
||||
// set versions for our libraries
|
||||
ext {
|
||||
// api dependencies
|
||||
versionJavaee = '8.0.0'
|
||||
versionJaxb = '2.3.1'
|
||||
versionJavaee = '10.0.0'
|
||||
versionJaxb = '4.0.1'
|
||||
versionAnnotation = '1.3.2'
|
||||
versionSwagger = '1.5.22'
|
||||
versionSwagger = '2.2.16'
|
||||
versionGeojson = '1.8.1'
|
||||
// wildfly dependencies, keep in sync
|
||||
versionJackson = '2.10.5'
|
||||
versionResteasy = '3.13.2.Final'
|
||||
versionWildfly = '21.0.0.Final'
|
||||
versionPicketbox = '5.0.3.Final'
|
||||
versionHibernate = '5.3.18.Final'
|
||||
versionHibernateSearch = '5.10.7.Final'
|
||||
// built-in infinispan dependency
|
||||
versionInfinispan = '9.4.20.Final'
|
||||
// testing dependencies
|
||||
versionJackson = '2.14.3'
|
||||
versionResteasy = '6.2.7.Final'
|
||||
versionWildfly = '31.0.1.Final'
|
||||
versionHibernate = '6.4.4.Final'
|
||||
versionHibernateSearch = '7.0.0.Final'
|
||||
versionLucene = '9.8.0'
|
||||
// other frameworks and libraries
|
||||
versionGalleon = '5.2.2.Final'
|
||||
versionMapDB = '3.1.0'
|
||||
versionCommonsNet = '3.5'
|
||||
versionCommonsCompress = '1.20'
|
||||
versionJunit = '4.13.2'
|
||||
versionArquillianContainer = '2.2.0.Final'
|
||||
versionArquillianJunit = '1.5.0.Final'
|
||||
// thorntail dependencies
|
||||
versionH2database = '1.4.196'
|
||||
versionThorntail = '2.6.0.Final'
|
||||
// other frameworks
|
||||
mapstructVersion = '1.3.1.Final'
|
||||
versionArquillianContainer = '5.0.1.Final'
|
||||
versionArquillianJunit = '1.8.0.Final'
|
||||
versionArquillianProtocol = '1.7.2.Final'
|
||||
versionPostgres = '42.7.1'
|
||||
versionMapstruct = '1.5.5.Final'
|
||||
// shared android dependencies
|
||||
versionAndroidXTest = '1.4.0'
|
||||
versionAndroidXAppcompat = '1.4.1'
|
||||
versionAndroidXRoom = '2.4.2'
|
||||
versionAndroidXAppcompat = '1.5.1'
|
||||
versionAndroidXRoom = '2.4.3'
|
||||
versionAndroidXPreference = '1.2.0'
|
||||
versionRobolectric = '4.5'
|
||||
// locoslab libraries and code
|
||||
versionGeometry = '1.1.4'
|
||||
versionCarta = '1.1.4'
|
||||
versionRobolectric = '4.9'
|
||||
// locoslab libraries and code
|
||||
versionGeometry = '1.4.0'
|
||||
versionCarta = '1.3.0'
|
||||
versionGrib2 = '1.0.0'
|
||||
versionAuth = '1.1.0'
|
||||
// tools
|
||||
versionCli = '1.4'
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
if (name.equals('android-app')) {
|
||||
@@ -75,7 +84,7 @@ subprojects {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
groupId = 'com.mowesta'
|
||||
version = project.version
|
||||
version = project.version
|
||||
artifact file('build/outputs/apk/prod/release/android-app-prod-release.apk')
|
||||
}
|
||||
}
|
||||
@@ -85,7 +94,7 @@ subprojects {
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
groupId = 'com.mowesta'
|
||||
groupId = 'com.mowesta'
|
||||
artifact file('build/outputs/aar/android-sdk-release.aar')
|
||||
version = project.version
|
||||
}
|
||||
@@ -103,7 +112,6 @@ subprojects {
|
||||
} else {
|
||||
// standard java configration
|
||||
apply plugin: 'java-library'
|
||||
sourceCompatibility = '1.8'
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
classifier = 'sources'
|
||||
@@ -147,40 +155,6 @@ subprojects {
|
||||
|
||||
// rename subprojects in eclipse to avoid collisions with other projects
|
||||
eclipse.project.name = 'mowesta-' + project.name
|
||||
|
||||
}
|
||||
|
||||
tasks.register("generatePomFileForMavenPublication") { }
|
||||
|
||||
tasks.register("build") { }
|
||||
|
||||
|
||||
// aquire locks to ensure that service-ejb and service-war are not running tests in parallel
|
||||
def lock = new ReentrantLock()
|
||||
def available = lock.newCondition()
|
||||
def busy = new AtomicBoolean()
|
||||
def serializedTasks = []
|
||||
def sequentialProjects = [ 'service-ejb', 'service-war' ]
|
||||
|
||||
gradle.taskGraph.beforeTask {
|
||||
if (it.name == 'test' && it.project.name in sequentialProjects) {
|
||||
serializedTasks << it
|
||||
it.doFirst {
|
||||
lock.lock()
|
||||
while (busy.get()) {
|
||||
available.await()
|
||||
}
|
||||
busy.set(true)
|
||||
lock.unlock()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gradle.taskGraph.afterTask {
|
||||
if (it in serializedTasks) {
|
||||
lock.lock()
|
||||
busy.set(false)
|
||||
available.signal()
|
||||
lock.unlock()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
plugins {
|
||||
id 'com.benjaminsproule.swagger' version '1.0.14'
|
||||
}
|
||||
|
||||
description = 'MoWeSta Common Api'
|
||||
|
||||
dependencies {
|
||||
api "javax.xml.bind:jaxb-api:${versionJaxb}"
|
||||
api "de.grundid.opendatalab:geojson-jackson:${versionGeojson}"
|
||||
|
||||
testImplementation "junit:junit:${versionJunit}"
|
||||
testImplementation "org.glassfish.jaxb:jaxb-runtime:${versionJaxb}"
|
||||
|
||||
compileClasspath "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
|
||||
compileClasspath "io.swagger:swagger-annotations:${versionSwagger}"
|
||||
compileClasspath "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
|
||||
}
|
||||
|
||||
// add compile only dependencies to testCompile without duplicating them
|
||||
sourceSets {
|
||||
//test.compileClasspath += configurations.compileOnly
|
||||
}
|
||||
|
||||
// generate swagger documenation from api using a plugin
|
||||
swagger {
|
||||
apiSource {
|
||||
attachSwaggerArtifact = true
|
||||
locations = [
|
||||
'com.mowesta.api.device.IDeviceService',
|
||||
'com.mowesta.api.location.ILocationService',
|
||||
'com.mowesta.api.log.ILogService',
|
||||
'com.mowesta.api.measurement.IMeasurementService',
|
||||
'com.mowesta.api.settings.ISettingsService',
|
||||
'com.mowesta.api.user.IUserService',
|
||||
'com.mowesta.api.version.IVersionService',
|
||||
'com.mowesta.api.weather.IWeatherService',
|
||||
]
|
||||
schemes = ['https']
|
||||
host = 'www.mowesta.com'
|
||||
basePath = '/api'
|
||||
info {
|
||||
title = 'Mowesta Service'
|
||||
version = project.version
|
||||
description = 'The application programming '
|
||||
termsOfService = 'https://mowesta.com/terms-of-service'
|
||||
contact {
|
||||
email = 'nes-admin@uni-due.de'
|
||||
name = 'Networked Embedded Systems'
|
||||
url = 'https://www.nes.uni-due.de'
|
||||
}
|
||||
license {
|
||||
url = 'https://www.mowesta.com/license'
|
||||
name = 'Mowesta License'
|
||||
}
|
||||
}
|
||||
swaggerFileName = 'mowesta'
|
||||
swaggerDirectory = "${project.buildDir}/swagger"
|
||||
securityDefinition {
|
||||
name = 'device'
|
||||
description = 'Operations requiring device privileges.'
|
||||
type = 'apiKey'
|
||||
keyLocation = 'header'
|
||||
keyName = 'Authorization'
|
||||
}
|
||||
securityDefinition {
|
||||
name = 'user'
|
||||
description = 'Operations requiring a valid user.'
|
||||
type = 'basic'
|
||||
}
|
||||
securityDefinition {
|
||||
name = 'admin'
|
||||
description = 'Operations requiring admin privileges.'
|
||||
type = 'basic'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn("generateSwaggerDocumentation")
|
||||
publish.dependsOn("generateSwaggerDocumentation")
|
||||
|
||||
// add the swagger defintion to the artifacts published by this module
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
artifact source: "${project.buildDir}/swagger/mowesta.json", extension: "swagger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mowesta.api.device;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import com.mowesta.api.Page;
|
||||
|
||||
/**
|
||||
* A page containing devices.
|
||||
*
|
||||
* @author Ole
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlSeeAlso(Device.class)
|
||||
@ApiModel(description = "Represents a page of devices.", parent = Page.class)
|
||||
public class DevicePage extends Page<Device> {
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
package com.mowesta.api.device;
|
||||
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.ws.rs.BeanParam;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.PageConfig;
|
||||
import com.mowesta.api.Tags;
|
||||
import com.mowesta.api.access.Authorizations;
|
||||
import com.mowesta.api.access.Roles;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
|
||||
/**
|
||||
* A service to manage devices.
|
||||
*
|
||||
* @author Ole
|
||||
*/
|
||||
@Api
|
||||
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Path("/")
|
||||
public interface IDeviceService {
|
||||
|
||||
// device functions (for the mobile app)
|
||||
|
||||
/**
|
||||
* Creates and returns a new device.
|
||||
*
|
||||
* @param info The device info to create the device.
|
||||
* @return The newly created device.
|
||||
*/
|
||||
@POST
|
||||
@Path("devices")
|
||||
@ApiOperation(value = "Creates a new device and returns its handle.",
|
||||
notes = "The response will include the auth token to be stored on the device and supplied as authentication " +
|
||||
"on all subsequent api calls. Note that the auth token can not be requested after creation, " +
|
||||
"so when losing the auth token you may lose access to the device data.",
|
||||
tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_CREATED, message = "The device was created successfully.", response = DeviceHandle.class)
|
||||
})
|
||||
@PermitAll
|
||||
Response createDevice(@ApiParam(value = "Necessary data from to create a device.", required = true) @NotNull @Valid DeviceInfo info);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the user account for a previously registered device.
|
||||
*
|
||||
* @param device The device to associate with the user.
|
||||
* @return A response.
|
||||
*/
|
||||
@POST
|
||||
@Path("devices/current/user")
|
||||
@ApiOperation(value = "Connects a device created without user account with a user account.",
|
||||
notes = "Executing this is operation requires a valid device and a valid user authentication to be transmitted simultaneously. ",
|
||||
tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "The device or user credentials are missing or incorrect."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_CONFLICT, message = "The device is already connected to a user account.", response=Device.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The device has been connected to the user account.", response=Device.class),
|
||||
})
|
||||
@PermitAll
|
||||
@RolesAllowed({Roles.DEVICE, Roles.USER})
|
||||
Response setCurrentDeviceUser(@ApiParam(value = "The device data.", required = true)@NotNull @Valid Device device);
|
||||
|
||||
/**
|
||||
* Returns the current device.
|
||||
*
|
||||
* @return The current device.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices/current")
|
||||
@ApiOperation(value = "Returns the current device.", authorizations = {@Authorization(Authorizations.DEVICE)}, tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The operation was successful.", response= Device.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The device was not found."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for executing this method.")
|
||||
})
|
||||
@RolesAllowed({Roles.DEVICE})
|
||||
Response getCurrentDevice();
|
||||
|
||||
/**
|
||||
* Deletes the current device.
|
||||
*
|
||||
* @return A response code to indicate the success.
|
||||
*/
|
||||
@DELETE
|
||||
@Path("devices/current")
|
||||
@ApiOperation(value = "Deletes the current device.", authorizations = {@Authorization(Authorizations.DEVICE)}, tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The device was deleted successfully."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The device was not found."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for executing this method.")
|
||||
})
|
||||
@RolesAllowed({Roles.DEVICE})
|
||||
Response deleteCurrentDevice();
|
||||
|
||||
// user functions (for the web app)
|
||||
|
||||
/**
|
||||
* Returns a page of devices of the current user.
|
||||
*
|
||||
* @param config The page configuration.
|
||||
* @return The list of devices.
|
||||
*/
|
||||
@GET
|
||||
@Path("users/current/devices")
|
||||
@ApiOperation(value = "Returns the list of devices for the current user.", authorizations = {@Authorization(Authorizations.USER)}, tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The list of devices of the current user", response=DevicePage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The device was not found."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for executing this method.")
|
||||
})
|
||||
@RolesAllowed({Roles.USER})
|
||||
Response getCurrentUserDevices(@BeanParam @Valid PageConfig config);
|
||||
|
||||
// mixed admin and user functions
|
||||
|
||||
/**
|
||||
* This method deletes a specific device, including all visits made by the device.
|
||||
*
|
||||
* @param id The id of the device.
|
||||
* @return A response code to indicate the success.
|
||||
*/
|
||||
@DELETE
|
||||
@Path("devices/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Deletes a device and it's visits.", authorizations = {@Authorization(Authorizations.USER), @Authorization(Authorizations.ADMIN)}, tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The device was deleted successfully."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The device does not exists."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for executing this method.")
|
||||
})
|
||||
@RolesAllowed({Roles.USER, Roles.ADMIN})
|
||||
Response deleteDevice(@ApiParam(value = "The device id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a particular device.
|
||||
*
|
||||
* @param id The id of the device.
|
||||
* @return The device, if allowed and available.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Gets a device.", authorizations = {@Authorization(Authorizations.ADMIN), @Authorization(Authorizations.USER)}, tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The device returned successfully.", response=Device.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The device does not exists."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for executing this method.")
|
||||
})
|
||||
@RolesAllowed({Roles.USER, Roles.ADMIN})
|
||||
Response getDevice(@ApiParam(value = "The device id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
// admin functions
|
||||
|
||||
/**
|
||||
* Returns all currently registered devices
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @return A list of devices.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices")
|
||||
@ApiOperation(value = "Returns all devices.", authorizations = @Authorization(Authorizations.ADMIN), tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The request was successful.", response = DevicePage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for retrieval."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_BAD_REQUEST, message = "Invalid request parameter.")
|
||||
})
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
Response getDevices(@BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the values of a particular device.
|
||||
*
|
||||
* @param id The id of the device.
|
||||
* @param device The device data.
|
||||
* @return The modified device.
|
||||
*/
|
||||
@PUT
|
||||
@Path("devices/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Sets the values of a device.", authorizations = {@Authorization(Authorizations.ADMIN)}, tags = {Tags.DEFAULT, Tags.DEVICE})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The device returned successfully.", response=Device.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The device does not exists."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_CONFLICT, message = "The device has been updated in parallel."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges for executing this method.")
|
||||
})
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
Response setDevice(@ApiParam(value = "The device id.", required = true) @PathParam("id") @Valid @Min(0) long id, @ApiParam("The device values.") @Valid @NotNull Device device);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mowesta.api.location;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
import com.mowesta.api.Page;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* A page of cities.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlSeeAlso(City.class)
|
||||
@ApiModel(description = "Represents a page of cities.", parent = Page.class)
|
||||
public class CityPage extends Page<City> {
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mowesta.api.location;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
/**
|
||||
* Represents a country.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@XmlRootElement
|
||||
@ApiModel(description = "Represents a country with all details.", parent = Location.class)
|
||||
public class Country extends Location {
|
||||
|
||||
}
|
||||
@@ -1,312 +0,0 @@
|
||||
package com.mowesta.api.location;
|
||||
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.ws.rs.BeanParam;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import org.geojson.Geometry;
|
||||
|
||||
import com.mowesta.api.PageConfig;
|
||||
import com.mowesta.api.SearchContext;
|
||||
import com.mowesta.api.Tags;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
|
||||
/**
|
||||
* The api to query and fetch locations.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@Api
|
||||
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
||||
@Path("/")
|
||||
public interface ILocationService {
|
||||
|
||||
/**
|
||||
* Returns a page of locations that match the query.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @param context The search context.
|
||||
* @param term The search term.
|
||||
* @return A page of hierarchically organized locations that match
|
||||
* the query.
|
||||
*/
|
||||
@GET
|
||||
@Path("locations/search")
|
||||
@ApiOperation(value = "Returns a page of locations whose name matches the term.", tags = { Tags.DEFAULT, Tags.LOCATION })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Location hierarchy page retrieved successfully.", response=LocationHierarchyPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response searchLocations(@BeanParam @Valid PageConfig pageConfig, @BeanParam @Valid SearchContext context,
|
||||
@ApiParam(value="The search term.", required=true) @QueryParam("term") @NotNull @Valid String term);
|
||||
|
||||
/**
|
||||
* Searches for a particular city by name.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @param context The search context.
|
||||
* @param term The search term.
|
||||
* @return The page of cities.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/search")
|
||||
@ApiOperation(value = "Returns a page of cities that match the specified search term.", tags = { Tags.DEFAULT, Tags.LOCATION })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="The page of cities.", response=CityPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response searchCities(@BeanParam @Valid PageConfig pageConfig, @BeanParam @Valid SearchContext context,
|
||||
@ApiParam(value="The search term.", required=true) @QueryParam("term") @NotNull @Valid String term);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page of cities that are inside a particular area defined by two coordinates.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @param longitude1 The longitude of the first coordinate.
|
||||
* @param latitude1 The latitude of the first coordinate.
|
||||
* @param longitude2 The longitude of the second coordinate.
|
||||
* @param latitude2 The latitude of the second coordinate.
|
||||
* @return The page of cities.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/resolve")
|
||||
@ApiOperation(value = "Returns a page of cities within a certain area defined by two coordiantes.", tags = { Tags.DEFAULT, Tags.LOCATION })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="The page of cities.", response=CityPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response resolveCities(@BeanParam @Valid PageConfig pageConfig,
|
||||
@ApiParam(value = "The longitude of the first coordinate.", required = true) @QueryParam("longitude1") double longitude1,
|
||||
@ApiParam(value = "The latitude of the first coordinate.", required = true) @QueryParam("latitude1") double latitude1,
|
||||
@ApiParam(value = "The longitude of the second coordinate.", required = true) @QueryParam("longitude2") double longitude2,
|
||||
@ApiParam(value = "The latitude of the second coordinate.", required = true) @QueryParam("latitude2") double latitude2);
|
||||
|
||||
/**
|
||||
* Returns a page of cities.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @return A page of cities.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities")
|
||||
@ApiOperation(value = "Returns a page of cities.", tags = { Tags.DEFAULT, Tags.LOCATION })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="City page retrieved successfully.", response=CityPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getCities(@BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a particular city.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @return The city, if exits.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Gets a city with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "City retrieved successfully.", response=City.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The city does not exists."),
|
||||
})
|
||||
@PermitAll
|
||||
Response getCity(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
/**
|
||||
* Returns a geojson representation of the city boundaries.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @return The boundaries of geojson or an error code.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}/boundary")
|
||||
@ApiOperation(value = "Gets the city boundary for a city with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "City boundary retrieved successfully.", response=Geometry.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "The city boundary are not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The city does not exist."),
|
||||
})
|
||||
@PermitAll
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
Response getCityBoundary(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page of states.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @return A page of states.
|
||||
*/
|
||||
@GET
|
||||
@Path("states")
|
||||
@ApiOperation(value = "Returns a page of states.", tags = { Tags.DEFAULT, Tags.LOCATION })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="State page retrieved successfully.", response=StatePage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getStates(@BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a particular state.
|
||||
*
|
||||
* @param id The id of the state.
|
||||
* @return The state, if exits.
|
||||
*/
|
||||
@GET
|
||||
@Path("states/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Gets a state with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "State retrieved successfully.", response=State.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The state does not exists."),
|
||||
})
|
||||
@PermitAll
|
||||
Response getState(@ApiParam(value = "The state id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
/**
|
||||
* Returns a geojson representation of the state boundaries.
|
||||
*
|
||||
* @param id The id of the state.
|
||||
* @return The boundaries as geojson or an error code.
|
||||
*/
|
||||
@GET
|
||||
@Path("states/{id: [0-9]+}/boundary")
|
||||
@ApiOperation(value = "Gets the state boundary for a state with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "State boundary retrieved successfully.", response=Geometry.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "The state boundary are not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The state does not exist."),
|
||||
})
|
||||
@PermitAll
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
Response getStateBoundary(@ApiParam(value = "The state id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
/**
|
||||
* The deprecated version of the method that has a typo in the path name (state instead of states).
|
||||
* To be removed, if Android Apps < V14 are no longer present.
|
||||
*
|
||||
* @param id The id of the state.
|
||||
* @return The boundaries as geojson or an error code.
|
||||
*/
|
||||
@GET
|
||||
@Path("state/{id: [0-9]+}/boundary")
|
||||
@ApiOperation(value = "Deprecated: Gets the state boundary for a state with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "State boundary retrieved successfully.", response=Geometry.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "The state boundary are not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The state does not exist."),
|
||||
})
|
||||
@PermitAll
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
@Deprecated
|
||||
Response getStateBoundaryDeprecated(@ApiParam(value = "The state id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page of cities for a state ordered by importance.
|
||||
*
|
||||
* @param id The id of the state.
|
||||
* @param pageConfig The page configuration.
|
||||
* @return The page of cities.
|
||||
*/
|
||||
@GET
|
||||
@Path("states/{id: [0-9]+}/cities")
|
||||
@ApiOperation(value = "Gets a page of cities for a particular state ordered by importance.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Cities retrieved successfully.", response=CityPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The state does not exists."),
|
||||
})
|
||||
@PermitAll
|
||||
Response getStateCities(@ApiParam(value = "The state id.", required = true) @PathParam("id") @Valid @Min(0) long id, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a page of countries.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @return A page of countries.
|
||||
*/
|
||||
@GET
|
||||
@Path("countries")
|
||||
@ApiOperation(value = "Returns a page of countries.", tags = { Tags.DEFAULT, Tags.LOCATION })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Country page retrieved successfully.", response=CountryPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getCountries(@BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a particular country.
|
||||
*
|
||||
* @param id The id of the country.
|
||||
* @return The country, if exits.
|
||||
*/
|
||||
@GET
|
||||
@Path("countries/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Gets a country with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Country retrieved successfully.", response=Country.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The country does not exists."),
|
||||
})
|
||||
@PermitAll
|
||||
Response getCountry(@ApiParam(value = "The country id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
/**
|
||||
* Returns a geojson representation of the country boundaries.
|
||||
*
|
||||
* @param id The id of the country.
|
||||
* @return The boundaries of geojson or an error code.
|
||||
*/
|
||||
@GET
|
||||
@Path("countries/{id: [0-9]+}/boundary")
|
||||
@ApiOperation(value = "Gets the country boundary for a country with a particular id.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Country boundary retrieved successfully.", response=Geometry.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "The country boundary are not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The country does not exist."),
|
||||
})
|
||||
@PermitAll
|
||||
@Produces({MediaType.APPLICATION_JSON})
|
||||
Response getCountryBoundary(@ApiParam(value = "The country id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
/**
|
||||
* Returns a page of cities for a country ordered by importance.
|
||||
*
|
||||
* @param id The id of the country.
|
||||
* @param pageConfig The page configuration.
|
||||
* @return The page of cities.
|
||||
*/
|
||||
@GET
|
||||
@Path("countries/{id: [0-9]+}/cities")
|
||||
@ApiOperation(value = "Gets a page of cities for a particular country ordered by importance.", tags = {Tags.DEFAULT, Tags.LOCATION})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Cities retrieved successfully.", response=CityPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The country does not exists."),
|
||||
})
|
||||
@PermitAll
|
||||
Response getCountryCities(@ApiParam(value = "The country id.", required = true) @PathParam("id") @Valid @Min(0) long id, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mowesta.api.location;
|
||||
|
||||
import com.mowesta.api.Page;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
||||
|
||||
/**
|
||||
* A page of states.
|
||||
*
|
||||
* @author Sebastian, Tobias
|
||||
*/
|
||||
@XmlRootElement
|
||||
@XmlSeeAlso(State.class)
|
||||
@ApiModel(description = "Represents a page of states.", parent = Page.class)
|
||||
public class StatePage extends Page<State> {
|
||||
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.mowesta.api.log;
|
||||
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.ws.rs.DefaultValue;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.Tags;
|
||||
import com.mowesta.api.access.Authorizations;
|
||||
import com.mowesta.api.access.Roles;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
|
||||
/**
|
||||
* A service that allows polling for log messages. A more
|
||||
* efficient implementation based on websockets is provided
|
||||
* via the "/log/stream" endpoint.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@Api
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Path("/")
|
||||
public interface ILogService {
|
||||
|
||||
/**
|
||||
* Returns a list of log messages starting from a particular id.
|
||||
*
|
||||
* @param from The id to start from.
|
||||
* @return The list of log messages, which might be empty.
|
||||
*/
|
||||
@GET
|
||||
@Path("log/messages")
|
||||
@ApiOperation(value = "Returns a list of log messages starting from a particular id.", authorizations= { @Authorization(value=Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.SERVICE })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Log messages retrieved successfully.", response=LogMessage.class, responseContainer="List"),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges for retrieval."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
Response getLogMessages(@QueryParam("from") @DefaultValue("0")
|
||||
@ApiParam(value="The id of the first message to retrieve.") @Valid @Min(0) long from);
|
||||
|
||||
/**
|
||||
* Returns a list of entity statistics for all entities.
|
||||
*
|
||||
* @return The list of entity statistics.
|
||||
*/
|
||||
@GET
|
||||
@Path("log/entities")
|
||||
@ApiOperation(value = "Returns a list of entity statistics.", authorizations= { @Authorization(value=Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.SERVICE })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Entity statistics retrieved successfully.", response=EntityStatistic.class, responseContainer="List"),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges for retrieval.")
|
||||
})
|
||||
Response getEntityStatistics();
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current load statistic.
|
||||
*
|
||||
* @return The load statistic.
|
||||
*/
|
||||
@GET
|
||||
@Path("log/load")
|
||||
@ApiOperation(value = "Returns the current load statistic.", authorizations= { @Authorization(value=Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.SERVICE })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Load statistic retrieved successfully.", response=LoadStatistic.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges for retrieval.")
|
||||
})
|
||||
Response getLoadStatistic();
|
||||
|
||||
/**
|
||||
* Returns the system statistic.
|
||||
*
|
||||
* @return The system statistic.
|
||||
*/
|
||||
@GET
|
||||
@Path("log/system")
|
||||
@ApiOperation(value = "Returns the system statistic.", authorizations= { @Authorization(value=Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.SERVICE }) @RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="System statistic retrieved successfully.", response=SystemStatistic.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges for retrieval.")
|
||||
})
|
||||
Response getSystemStatistic();
|
||||
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
package com.mowesta.api.measurement;
|
||||
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.ws.rs.BeanParam;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.PageConfig;
|
||||
import com.mowesta.api.Tags;
|
||||
import com.mowesta.api.TimeRange;
|
||||
import com.mowesta.api.access.Authorizations;
|
||||
import com.mowesta.api.access.Roles;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
|
||||
/**
|
||||
* A service to manage measurements.
|
||||
*
|
||||
* @author Sebastian
|
||||
*/
|
||||
@Api
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Path("/")
|
||||
public interface IMeasurementService {
|
||||
|
||||
/**
|
||||
* Adds one or more measurement for device. By supporting multiple
|
||||
* measurements, we can allow batch processing which reduces the
|
||||
* communication overhead when supporting offline synchronization.
|
||||
*
|
||||
* @param measurements The list of measurements to add.
|
||||
* @return An batch with the measurements that has been accepted.
|
||||
*/
|
||||
@POST
|
||||
@Path("devices/current/measurements")
|
||||
@ApiOperation(value = "Adds a number of measurements for the current device.", authorizations = {
|
||||
@Authorization(Authorizations.DEVICE) }, tags = { Tags.DEFAULT, Tags.DEVICE })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Measurements added successfully."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "No valid authorization found.") })
|
||||
@RolesAllowed({ Roles.DEVICE })
|
||||
Response addCurrentDeviceMeasurements(@ApiParam(value = "The new measurements to add.", required = true) @Valid @NotNull List<Measurement> measurements);
|
||||
|
||||
/**
|
||||
* Adds a single measurement for a device that has been captured now. In contrast
|
||||
* to the batch method, this method will automatically set the measurement's time
|
||||
* stamp to the server time.
|
||||
*
|
||||
* @param measurement The measurement to add.
|
||||
* @return The measurement, if successful.
|
||||
*/
|
||||
@POST
|
||||
@Path("devices/current/measurements/now")
|
||||
@ApiOperation(value = "Adds a single measurement for the device that has been captured recently.", authorizations = {
|
||||
@Authorization(Authorizations.DEVICE) }, tags = { Tags.DEFAULT, Tags.DEVICE })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Measurement added successfully.", response = Measurement.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "No valid authorization found.") })
|
||||
@RolesAllowed({ Roles.DEVICE })
|
||||
Response addCurrentDeviceMeasurement(@ApiParam(value = "The new measurement to add.", required = true) @Valid @NotNull Measurement measurement);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page with measurements of the current device from a certain time range.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @param timeRange The time range.
|
||||
* @return The page of measurements.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices/current/measurements")
|
||||
@ApiOperation(value = "Returns a page of measurements of the current device from a certain time range.", authorizations = {
|
||||
@Authorization(Authorizations.DEVICE) }, tags = { Tags.DEFAULT, Tags.DEVICE })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Measurements retrieved successfully.", response = MeasurementPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges to retrieve the measurements.") })
|
||||
@RolesAllowed({ Roles.DEVICE })
|
||||
Response getCurrentDeviceMeasurements(@BeanParam @Valid TimeRange timeRange, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a page of measurements of the specified device from a certain time range.
|
||||
*
|
||||
* @param id The id of the device.
|
||||
* @param timeRange The time range.
|
||||
* @param pageConfig The page config.
|
||||
* @return The page of measurements.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices/{id: ([0-9])+}/measurements")
|
||||
@ApiOperation(value = "Returns a page of measurements of a specific device from a certain time range.",authorizations = {
|
||||
@Authorization(Authorizations.USER), @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.DEVICE })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Measurements retrieved successfully.", response = MeasurementPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "The measurements were not found."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges to retrieve the measurements.") })
|
||||
@RolesAllowed({ Roles.USER, Roles.ADMIN })
|
||||
Response getDeviceMeasurements(@ApiParam(value = "The device id.", required = true) @PathParam("id") long id, @BeanParam @Valid TimeRange timeRange, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page of measurements of all devices within a certain time range.
|
||||
*
|
||||
* @param timeRange The time range.
|
||||
* @param pageConfig The page config.
|
||||
* @return The page of measurements.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices/measurements")
|
||||
@ApiOperation(value = "Returns a page of measurements of all devices within a certain time range.",
|
||||
authorizations = { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.DEVICE })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Measurements retrieved successfully.", response = MeasurementPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges to retrieve the measurements.") })
|
||||
@RolesAllowed({ Roles.ADMIN })
|
||||
Response getAllMeasurementsByRange(@BeanParam @Valid TimeRange timeRange, @BeanParam @Valid PageConfig pageConfig);
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.mowesta.api.settings;
|
||||
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.Tags;
|
||||
import com.mowesta.api.access.Authorizations;
|
||||
import com.mowesta.api.access.Roles;
|
||||
import com.mowesta.api.location.LocationHierarchy;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
|
||||
/**
|
||||
* A service to manage shared settings.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@Api
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Path("/")
|
||||
public interface ISettingsService {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the settings of the user.
|
||||
*
|
||||
* @return The settings of the user.
|
||||
*/
|
||||
@GET
|
||||
@Path("users/current/settings")
|
||||
@ApiOperation(value = "Returns the setting of the current user.", authorizations = { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.SETTINGS })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The request was successful.", response = Settings.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges to access the user's settings."),
|
||||
})
|
||||
@RolesAllowed({Roles.USER})
|
||||
Response getCurrentUserSettings();
|
||||
|
||||
/**
|
||||
* Returns the favorite locations of the user.
|
||||
*
|
||||
* @return The favorite locations of the user.
|
||||
*/
|
||||
@GET
|
||||
@Path("users/current/locations")
|
||||
@ApiOperation(value = "Returns the favorite locations of the current user.", authorizations = { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.SETTINGS })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "The request was successful.", response = LocationHierarchy.class, responseContainer = "List"),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges to access the user's locations."),
|
||||
})
|
||||
@RolesAllowed({Roles.USER})
|
||||
Response getCurrentUserLocations();
|
||||
|
||||
/**
|
||||
* Sets a user's settings.
|
||||
*
|
||||
* @param settings The settings to set.
|
||||
* @return The updated settings.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/current/settings")
|
||||
@ApiOperation(value = "Updates the settings of the current user.", authorizations = { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.SETTINGS })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "User settings updated succesfully.", response=Settings.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_CONFLICT, message = "Conflict due to parallel update.", response=Settings.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_BAD_REQUEST, message = "Invalid request parameters."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_FORBIDDEN, message = "Insufficient privileges to access the user's settings.")
|
||||
})
|
||||
@RolesAllowed({Roles.USER})
|
||||
Response setCurrentUserSettings(@Valid @NotNull @ApiParam(value = "The settings to set.") Settings settings);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,309 +0,0 @@
|
||||
package com.mowesta.api.user;
|
||||
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.BeanParam;
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.PageConfig;
|
||||
import com.mowesta.api.Tags;
|
||||
import com.mowesta.api.access.Authorizations;
|
||||
import com.mowesta.api.access.Roles;
|
||||
import com.mowesta.api.validation.EmailGroup;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import io.swagger.annotations.Authorization;
|
||||
|
||||
/**
|
||||
* A service to manage users.
|
||||
*
|
||||
* @author Marcus
|
||||
*/
|
||||
@Api
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Path("/")
|
||||
public interface IUserService {
|
||||
|
||||
// login functions
|
||||
|
||||
/**
|
||||
* Returns the user that is associated with a device.
|
||||
*
|
||||
* @return The user that is associated with a device.
|
||||
*/
|
||||
@GET
|
||||
@Path("devices/current/user")
|
||||
@ApiOperation(value = "Returns the user that is associated with a device.", authorizations= { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User retrieved successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_NO_CONTENT, message="Device is not associated with a user."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="No valid authorization found.")
|
||||
})
|
||||
@RolesAllowed({Roles.DEVICE})
|
||||
Response getCurrentDeviceUser();
|
||||
|
||||
/**
|
||||
* Returns the user that is authorized.
|
||||
*
|
||||
* @return The user that is currently authorized.
|
||||
*/
|
||||
@GET
|
||||
@Path("users/current")
|
||||
@ApiOperation(value = "Returns the user currently authorized.", authorizations= { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User retrieved successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="No valid authorization found.")
|
||||
})
|
||||
@RolesAllowed({Roles.USER})
|
||||
Response getCurrentUser();
|
||||
|
||||
/**
|
||||
* Updates the current user. A regular user can add and delete an email, change the
|
||||
* correspondence email to any of the verified emails and change the name.
|
||||
*
|
||||
* @param user The user to modify.
|
||||
* @return The updated user, if successful.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/current")
|
||||
@ApiOperation(value = "Updates the currently authorized user.", authorizations= { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User updated successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_CONFLICT, message="User modified in parallel.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="No valid authorization found."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid user.")
|
||||
})
|
||||
@RolesAllowed({Roles.USER})
|
||||
Response setCurrentUser(@ApiParam(value="The new user values to set.", required=true) @Valid @EmailGroup(requireVerifiedCorrespondence=true) User user);
|
||||
|
||||
/**
|
||||
* Changes the password of the user that is currently
|
||||
* logged in.
|
||||
*
|
||||
* @param password The password.
|
||||
* @return The user if successful, an error code otherwise.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/current/password")
|
||||
@ApiOperation(value="Sets the password of the currently authorized user.", authorizations= { @Authorization(Authorizations.USER) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.USER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Password updated successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="No valid authorization found."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid password.")
|
||||
})
|
||||
Response setCurrentPassword(@ApiParam(value="The new password to set.", required=true) @Valid UserPassword password);
|
||||
|
||||
|
||||
// admin functions
|
||||
|
||||
/**
|
||||
* Adds a particular user.
|
||||
*
|
||||
* @param user The new data of the user.
|
||||
* @return The updated user, if successful.
|
||||
*/
|
||||
@POST
|
||||
@Path("users")
|
||||
@ApiOperation(value = "Adds a user account with the specified roles and emails.", authorizations= { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_CREATED, message="User added successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_CONFLICT, message="User login exists already."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid user."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges to add the user.")
|
||||
})
|
||||
Response addUser(@ApiParam(value="The data for the new user.", required=true) @Valid @EmailGroup User user);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the user with the specified id. This method requires admin
|
||||
* privileges.
|
||||
*
|
||||
* @param id The id to retrieve.
|
||||
* @return The user with the specified id.
|
||||
*/
|
||||
@GET
|
||||
@Path("users/{id: ([0-9])+}")
|
||||
@ApiOperation(value = "Returns the user account with the specified id.", authorizations= { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User retrieved successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges to retrieve the user.")
|
||||
})
|
||||
Response getUser(@ApiParam(value="The id of the user to retrieve.", required=true) @PathParam("id") long id);
|
||||
|
||||
/**
|
||||
* Updates a user. This method is only accessible to admins.
|
||||
* In addition to the modifications allowed by setCurrentUser,
|
||||
* this method will also allow the manual verification of
|
||||
* emails.
|
||||
*
|
||||
* @param id The id of the user.
|
||||
* @param user The new data of the user.
|
||||
* @return The updated user, if successful.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/{id: ([0-9])+}")
|
||||
@ApiOperation(value = "Updates the values of a particular user account.", authorizations= { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User updated successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_CONFLICT, message="User modified in parallel.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges to retrieve the user."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid user.")
|
||||
})
|
||||
Response setUser(@ApiParam(value="The id of the user to set.", required=true) @PathParam("id") long id, @ApiParam(value="The new user data to set.", required=true) @Valid @EmailGroup User user);
|
||||
|
||||
/**
|
||||
* Changes the password of a user. The accessible users
|
||||
* depend on the role of the user. This method is only
|
||||
* accessible to admins.
|
||||
*
|
||||
* @param id The user id.
|
||||
* @param password The credentials.
|
||||
* @return The user if successful, an error code otherwise.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/{id: ([0-9])+}/password")
|
||||
@ApiOperation(value="Sets the password of a user.", authorizations= { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Password updated successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Password modification not allowed."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid password.")
|
||||
})
|
||||
Response setUserPassword(@ApiParam(value="The id of the user to change.", required=true) @PathParam("id") long id, @ApiParam(value="The new password.", required=true) @Valid UserPassword password);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of users as a page.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @return The list of users as page.
|
||||
*/
|
||||
@GET
|
||||
@Path("users")
|
||||
@ApiOperation(value = "Returns a list of users.", authorizations= { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User page retrieved successfully.", response=UserPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges for retrieval."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
Response getUsers(@BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a list of users whose name or login contains the search term.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @param term The search term.
|
||||
* @return A page of users whose name or login contains the search term.
|
||||
*/
|
||||
@GET
|
||||
@Path("users/search")
|
||||
@ApiOperation(value = "Returns a list of users whose login name or name contains the term.", authorizations= { @Authorization(Authorizations.ADMIN) }, tags = { Tags.DEFAULT, Tags.USER })
|
||||
@RolesAllowed({Roles.ADMIN})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User page retrieved successfully.", response=UserPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Insufficient privileges for retrieval."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
Response searchUsers(@BeanParam @Valid PageConfig pageConfig, @ApiParam(value="The search term.", required=true) @QueryParam("term") @NotNull @Valid String term);
|
||||
|
||||
// registration work-flow
|
||||
|
||||
/**
|
||||
* Registers a new user and sends an email to verify the account.
|
||||
*
|
||||
* @param user The new user to register.
|
||||
* @return Success or failure, if login is taken already.
|
||||
*/
|
||||
@POST
|
||||
@Path("users/register")
|
||||
@ApiOperation(value = "Registers a new user and sends an email account verification.", tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="User registered successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_CONFLICT, message="User login already registered."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid user registration.")
|
||||
})
|
||||
@PermitAll
|
||||
// TODO consider using 201 CREATED response with no body and location header.
|
||||
Response registerUser(@ApiParam(value="The data of the new user.", required=true) @Valid UserRegistration user);
|
||||
|
||||
/**
|
||||
* Sends an email with a password to the user.
|
||||
*
|
||||
* @param login The login to reset the password.
|
||||
* @return A success or error code with an empty body.
|
||||
*/
|
||||
@POST
|
||||
@Path("users/reset")
|
||||
@ApiOperation(value = "Sends a password reset email to the correspondence email account of a user.", tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Reset email sent successfully."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "Login does not exist."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_BAD_REQUEST, message = "User email has not been verified.")
|
||||
})
|
||||
@PermitAll
|
||||
// TODO consider returning error response when sending email has been ignored because minimum time between mails has not passed. + add test
|
||||
Response resetUser(@ApiParam(value="The login of the user to reset.", required=true) @QueryParam("login") @Valid @NotNull String login);
|
||||
|
||||
|
||||
/**
|
||||
* Sets the password of the user account using the secret token
|
||||
* received via email as part of the password reset.
|
||||
*
|
||||
* @param token The secret token received via email.
|
||||
* @param password The new password to set.
|
||||
* @return The account, if successful. An error otherwise.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/password/{token}")
|
||||
@ApiOperation(value = "Sets the password of a user account using a token received via email.", tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Password updated successfully.", response=User.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Password modification not allowed."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid token or password.")
|
||||
})
|
||||
@PermitAll
|
||||
// TODO return better status codes for: code expired, deleted, etc. Forbidden should be for authentication errors only.
|
||||
Response resetUserPassword(@ApiParam(value="The secret token received via email.", required=true) @PathParam("token") @Valid @NotNull String token,
|
||||
@ApiParam(value="The new user password.", required=true) @Valid UserPassword password);
|
||||
|
||||
|
||||
/**
|
||||
* Verifies an email address using a token sent via email.
|
||||
*
|
||||
* @param token The token received via email.
|
||||
* @return An error code to indicate success or failure.
|
||||
*/
|
||||
@PUT
|
||||
@Path("users/verify/{token}")
|
||||
@ApiOperation(value = "Verifies an email address using a token received via email.", tags = { Tags.DEFAULT, Tags.USER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_NO_CONTENT, message="Email verified successfully."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_FORBIDDEN, message="Email verification is not valid."),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid token.")
|
||||
})
|
||||
@PermitAll
|
||||
Response verifyUserEmail(@ApiParam(value="The secret token received via email.", required=true) @PathParam("token") @Valid @NotNull String token);
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.mowesta.api.version;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.Tags;
|
||||
|
||||
/**
|
||||
* An api to retrieve the build version.
|
||||
*
|
||||
* @author Marcus
|
||||
*
|
||||
*/
|
||||
@Api
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Path("/")
|
||||
public interface IVersionService {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the build version of the service.
|
||||
*
|
||||
* @return The build version of the service.
|
||||
*/
|
||||
@GET
|
||||
@Path("versions/build")
|
||||
@ApiOperation(value = "Returns the build version.", tags = { Tags.DEFAULT, Tags.SERVICE })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Build version retrieved successfully.", response=BuildVersion.class)
|
||||
})
|
||||
@PermitAll
|
||||
Response getBuildVersion();
|
||||
|
||||
}
|
||||
@@ -1,304 +0,0 @@
|
||||
package com.mowesta.api.weather;
|
||||
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.ws.rs.BeanParam;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import com.mowesta.api.PageConfig;
|
||||
import com.mowesta.api.Tags;
|
||||
import com.mowesta.api.TimeRange;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
|
||||
/**
|
||||
* An api to access weather information.
|
||||
*
|
||||
* @author Marcus
|
||||
*
|
||||
*/
|
||||
@Api
|
||||
@Path("/")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public interface IWeatherService {
|
||||
|
||||
|
||||
/**
|
||||
* Returns the weather forecast for a particular city.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @return The weather forecast for the city.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}/forecast")
|
||||
@ApiOperation(value = "Gets the weather forecast for a city with a particular id.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather forecast retrieved successfully.", response=WeatherForecast.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather forecast not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "City does not exist.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getCityForecast(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the forecast with a particular id.
|
||||
*
|
||||
* @param id The id of the forecast.
|
||||
* @return The forecast with the id, if it exists.
|
||||
*/
|
||||
@GET
|
||||
@Path("forecasts/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Gets the weather forecast with a particular id.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather forecast retrieved successfully.", response=WeatherForecast.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "Weather forecast does not exist.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getForecast(@ApiParam(value = "The forecast id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the weather forecast for a particular location.
|
||||
*
|
||||
* @param longitude The longitude of the location.
|
||||
* @param latitude The latitude of the location.
|
||||
* @return The weather forecast for the location.
|
||||
*/
|
||||
@GET
|
||||
@Path("forecasts/resolve")
|
||||
@ApiOperation(value = "Searches the (closest) weather forecast for a particular location.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather forecast retrieved successfully.", response=WeatherForecast.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather forecast not available.")
|
||||
})
|
||||
@PermitAll
|
||||
Response resolveForecast(@ApiParam(value = "The longitude.", required = true) @QueryParam("longitude") double longitude, @ApiParam(value = "The latitude.", required = true) @QueryParam("latitude") double latitude);
|
||||
|
||||
/**
|
||||
* Returns a page of weather reports of the specified station from a certain time range.
|
||||
*
|
||||
* @param id The id of the station.
|
||||
* @param timeRange The time range.
|
||||
* @param pageConfig The page config.
|
||||
* @return The page of reports.
|
||||
*/
|
||||
@GET
|
||||
@Path("stations/{id}/reports")
|
||||
@ApiOperation(value = "Returns a page of weather reports of a particular staton in a certain time range.", tags = { Tags.DEFAULT, Tags.WEATHER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather reports retrieved successfully.", response = WeatherReportPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "Weather station not found.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getStationReports(@ApiParam(value = "The station id.", required = true) @PathParam("id") long id, @BeanParam @Valid TimeRange timeRange, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the latest report of the station.
|
||||
*
|
||||
* @param id The id of the station.
|
||||
* @return The page of reports.
|
||||
*/
|
||||
@GET
|
||||
@Path("stations/{id}/reports/latest")
|
||||
@ApiOperation(value = "Returns the latest weather report of a particular station.", tags = { Tags.DEFAULT, Tags.WEATHER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather report retrieved successfully.", response = WeatherReport.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "No weather report for station available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "Weather station not found.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getLatestStationReport(@ApiParam(value = "The station id.", required = true) @PathParam("id") long id);
|
||||
|
||||
/**
|
||||
* Returns the closest weather station for a particular location.
|
||||
*
|
||||
* @param longitude The longitude of the location.
|
||||
* @param latitude The latitude of the location.
|
||||
* @return The weather station for the location.
|
||||
*/
|
||||
@GET
|
||||
@Path("stations/resolve")
|
||||
@ApiOperation(value = "Searches the (closest) weather station for a particular location.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather station retrieved successfully.", response=WeatherStation.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather station not available.")
|
||||
})
|
||||
@PermitAll
|
||||
Response resolveStation(@ApiParam(value = "The longitude.", required = true) @QueryParam("longitude") double longitude, @ApiParam(value = "The latitude.", required = true) @QueryParam("latitude") double latitude);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the weather station for a particular city.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @return The weather station for the city.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}/station")
|
||||
@ApiOperation(value = "Gets the weather station for a city with a particular id.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather station retrieved successfully.", response=WeatherStation.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather station not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "City does not exist.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getCityStation(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page of stations whose name matches the specified search term. If the
|
||||
* search term is null or an empty string, all stations will be returned.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @param term An optional search term to filter the list by station name.
|
||||
* @return A page of weather stations matching the search term.
|
||||
*/
|
||||
@GET
|
||||
@Path("stations")
|
||||
@ApiOperation(value = "Returns a page of weather stations, possibly filtered by name.", tags = { Tags.DEFAULT, Tags.WEATHER })
|
||||
@ApiResponses({
|
||||
@ApiResponse(code=HttpServletResponse.SC_OK, message="Weather station page retrieved successfully.", response=WeatherStationPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getStations(@ApiParam(value = "An optional search term to filter the result by name.", required = false) @QueryParam("term") String term, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Returns a particular station.
|
||||
*
|
||||
* @param id The id of the station.
|
||||
* @return The station, if exits.
|
||||
*/
|
||||
@GET
|
||||
@Path("stations/{id: [0-9]+}")
|
||||
@ApiOperation(value = "Gets a weather station with a particular id.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather station retrieved successfully.", response=WeatherStation.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "Weather station does not exist."),
|
||||
})
|
||||
@PermitAll
|
||||
Response getStation(@ApiParam(value = "The station id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Returns the weather condition for a particular city.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @return The weather condition for the city.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}/condition")
|
||||
@ApiOperation(value = "Gets the current weather condition for a city with a particular id.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather condition retrieved successfully.", response=WeatherCondition.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather condition not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "City does not exist.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getCityCondition(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves a page of weather videos.
|
||||
*
|
||||
* @param pageConfig The page configuration.
|
||||
* @return The weather video page.
|
||||
*/
|
||||
@GET
|
||||
@Path("videos")
|
||||
@ApiOperation(value = "Returns a page of weather videos.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather video page retrieved successfully.", response=WeatherVideoPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getVideos(@BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
/**
|
||||
* Retrieves a page of weather videos for a particular location.
|
||||
*
|
||||
* @param longitude The longitude.
|
||||
* @param latitude The latitude.
|
||||
* @param pageConfig The page configuration.
|
||||
* @return The weather video page.
|
||||
*/
|
||||
@GET
|
||||
@Path("videos/resolve")
|
||||
@ApiOperation(value = "Returns a page of weather videos relevant for a location.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather video page retrieved successfully.", response=WeatherVideoPage.class),
|
||||
@ApiResponse(code=HttpServletResponse.SC_BAD_REQUEST, message="Invalid request parameter.")
|
||||
})
|
||||
@PermitAll
|
||||
Response resolveVideos(@ApiParam(value = "The longitude.", required = true) @QueryParam("longitude") double longitude, @ApiParam(value = "The latitude.", required = true) @QueryParam("latitude") double latitude, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of the latest weather videos.
|
||||
*
|
||||
* @return The list of the latest weather videos.
|
||||
*/
|
||||
@GET
|
||||
@Path("videos/latest")
|
||||
@ApiOperation(value = "Returns the latest of weather videos.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather video list retrieved successfully.", response=WeatherVideo.class, responseContainer = "List"),
|
||||
})
|
||||
@PermitAll
|
||||
Response getLatestVideos();
|
||||
|
||||
|
||||
/**
|
||||
* Returns a page of videos that is relevant for a city.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @param pageConfig The page configuration.
|
||||
* @return A page of videos for the city.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}/videos")
|
||||
@ApiOperation(value = "Returns the all videos for the city.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather videos retrieved successfully.", response=WeatherVideoPage.class),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather videos not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "City does not exist.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getCityVideos(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id, @BeanParam @Valid PageConfig pageConfig);
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of the latest videos that is relevant for a city.
|
||||
*
|
||||
* @param id The id of the city.
|
||||
* @return The list of videos for the city.
|
||||
*/
|
||||
@GET
|
||||
@Path("cities/{id: [0-9]+}/videos/latest")
|
||||
@ApiOperation(value = "Returns the latest videos for the city.", tags = {Tags.DEFAULT, Tags.WEATHER})
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = HttpServletResponse.SC_OK, message = "Weather videos retrieved successfully.", response=WeatherVideo.class, responseContainer = "List"),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NO_CONTENT, message = "Weather videos not available."),
|
||||
@ApiResponse(code = HttpServletResponse.SC_NOT_FOUND, message = "City does not exist.")
|
||||
})
|
||||
@PermitAll
|
||||
Response getLatestCityVideos(@ApiParam(value = "The city id.", required = true) @PathParam("id") @Valid @Min(0) long id);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"admin" : {
|
||||
"description" : "Operations requiring admin privileges.",
|
||||
"type" : "basic"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"device" : {
|
||||
"description" : "Operations requiring device privileges.",
|
||||
"type" : "apiKey",
|
||||
"in": "header",
|
||||
"name": "Authorization"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"user" : {
|
||||
"description" : "Operations requiring a valid user.",
|
||||
"type" : "basic"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#Mon May 23 12:33:06 CEST 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "MoWeSta",
|
||||
name: "MoWeStaApi",
|
||||
products: [
|
||||
.library(name: "MoWeSta", targets: ["MoWeSta"]),
|
||||
.library(name: "MoWeStaApi", targets: ["MoWeStaApi"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/Flight-School/AnyCodable", from: "0.6.1"),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "MoWeSta",
|
||||
path: "./"
|
||||
name: "MoWeStaApi",
|
||||
dependencies: ["AnyCodable", ],
|
||||
path: "./build/swagger/OpenAPIClient/Classes/OpenAPIs"
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
@@ -1,25 +1,43 @@
|
||||
plugins {
|
||||
id 'org.hidetake.swagger.generator' version '2.19.2'
|
||||
id 'org.openapi.generator' version '6.0.1'
|
||||
}
|
||||
|
||||
description = "MoWeSta iOS Api"
|
||||
|
||||
dependencies {
|
||||
swaggerCodegen 'io.swagger.codegen.v3:swagger-codegen-cli:3.0.33'
|
||||
openApiGenerate {
|
||||
generatorName = "swift5"
|
||||
inputSpec = project(':service-api:').buildDir.path + '/swagger/mowesta.json'
|
||||
outputDir = "${project.buildDir}/swagger"
|
||||
configOptions = [
|
||||
removeMigrationProjectNameClass: "true",
|
||||
useClasses: "true"
|
||||
]
|
||||
}
|
||||
|
||||
swaggerSources {
|
||||
mowesta {
|
||||
inputFile = file(project(':common-api:').buildDir.path + '/swagger/mowesta.json')
|
||||
code {
|
||||
outputDir = file("${project.buildDir}/swagger")
|
||||
language = 'swift5'
|
||||
}
|
||||
}
|
||||
task clean(type: Delete) {
|
||||
delete "${project.buildDir}"
|
||||
}
|
||||
|
||||
|
||||
task fixApiClient() {
|
||||
doLast {
|
||||
ant.replaceregexp(match:'Optional<T>.none as! T', replace:'E.init(nilLiteral: ()) as! T', flags:'g', byline:true) {
|
||||
fileset(dir: 'build/swagger/OpenAPIClient/Classes/OpenAPIs', includes: 'URLSessionImplementations.swift')
|
||||
}
|
||||
ant.replaceregexp(match:'if T.self is ExpressibleByNilLiteral.Type', replace:'if let E = T.self as? ExpressibleByNilLiteral.Type', flags:'g', byline:true) {
|
||||
fileset(dir: 'build/swagger/OpenAPIClient/Classes/OpenAPIs', includes: 'URLSessionImplementations.swift')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// require api build to access swagger definition
|
||||
tasks.register("build") { }
|
||||
tasks['resolveSwaggerTemplate'].dependsOn(project(':common-api').tasks['build'])
|
||||
tasks['openApiGenerate'].dependsOn(project(':service-api').tasks['build'])
|
||||
// require swagger code gen before compilation
|
||||
build.dependsOn('generateSwaggerCode')
|
||||
build.dependsOn('openApiGenerate')
|
||||
fixApiClient.dependsOn('openApiGenerate')
|
||||
build.dependsOn('fixApiClient')
|
||||
|
||||
@@ -7,15 +7,75 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2C16330B283A27D300F78CEE /* AppApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C16330A283A27D300F78CEE /* AppApp.swift */; };
|
||||
2C16330B283A27D300F78CEE /* Application.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C16330A283A27D300F78CEE /* Application.swift */; };
|
||||
2C16330D283A27D300F78CEE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C16330C283A27D300F78CEE /* ContentView.swift */; };
|
||||
2C16330F283A27D600F78CEE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C16330E283A27D600F78CEE /* Assets.xcassets */; };
|
||||
2C163312283A27D600F78CEE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C163311283A27D600F78CEE /* Preview Assets.xcassets */; };
|
||||
2C163314283A27D600F78CEE /* Persistence.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C163313283A27D600F78CEE /* Persistence.swift */; };
|
||||
2C163317283A27D600F78CEE /* App.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 2C163315283A27D600F78CEE /* App.xcdatamodeld */; };
|
||||
2C163321283A27D600F78CEE /* AppTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C163320283A27D600F78CEE /* AppTests.swift */; };
|
||||
2C16332B283A27D600F78CEE /* AppUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C16332A283A27D600F78CEE /* AppUITests.swift */; };
|
||||
2C16332D283A27D600F78CEE /* AppUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C16332C283A27D600F78CEE /* AppUITestsLaunchTests.swift */; };
|
||||
2C369C6628888E6800B5AFB2 /* StationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C369C6528888E6800B5AFB2 /* StationView.swift */; };
|
||||
2C369C6828889EAE00B5AFB2 /* ErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C369C6728889EAE00B5AFB2 /* ErrorView.swift */; };
|
||||
2C369C6A2889592500B5AFB2 /* StationsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C369C692889592500B5AFB2 /* StationsView.swift */; };
|
||||
2C369C6C2889719C00B5AFB2 /* MeasurementView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C369C6B2889719C00B5AFB2 /* MeasurementView.swift */; };
|
||||
2C369C6E2889D42700B5AFB2 /* DevicesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C369C6D2889D42700B5AFB2 /* DevicesView.swift */; };
|
||||
2C369C702889D44100B5AFB2 /* DeviceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C369C6F2889D44100B5AFB2 /* DeviceView.swift */; };
|
||||
2C865E3B284271C800F1A89A /* MoWeStaApi in Frameworks */ = {isa = PBXBuildFile; productRef = 2C865E3A284271C800F1A89A /* MoWeStaApi */; };
|
||||
2C865E3D2842850800F1A89A /* HideableTabView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C865E3C2842850800F1A89A /* HideableTabView.swift */; };
|
||||
2C865E3F28428ED600F1A89A /* TextBindings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C865E3E28428ED600F1A89A /* TextBindings.swift */; };
|
||||
2C865E412842999600F1A89A /* CityView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C865E402842999600F1A89A /* CityView.swift */; };
|
||||
2C865E43284393DA00F1A89A /* CityInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C865E42284393DA00F1A89A /* CityInfoView.swift */; };
|
||||
2CA281FF283E1D2F00D4A05A /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA281FE283E1D2F00D4A05A /* AppState.swift */; };
|
||||
2CA28203283E201B00D4A05A /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA28200283E201B00D4A05A /* KeyChain.swift */; };
|
||||
2CA28204283E201B00D4A05A /* UserDefault.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA28201283E201B00D4A05A /* UserDefault.swift */; };
|
||||
2CA28205283E201B00D4A05A /* AppInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA28202283E201B00D4A05A /* AppInfo.swift */; };
|
||||
2CA4E74F2885E62500B901ED /* LocosLabLeafles in Frameworks */ = {isa = PBXBuildFile; productRef = 2CA4E74E2885E62500B901ED /* LocosLabLeafles */; };
|
||||
2CA4E7512887CB9800B901ED /* CountryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA4E7502887CB9800B901ED /* CountryView.swift */; };
|
||||
2CA4E7532887CBA300B901ED /* StateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA4E7522887CBA300B901ED /* StateView.swift */; };
|
||||
2CA4E7552887D18D00B901ED /* GeojsonConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA4E7542887D18D00B901ED /* GeojsonConverter.swift */; };
|
||||
2CA4E757288826DA00B901ED /* PlaceMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA4E756288826DA00B901ED /* PlaceMapView.swift */; };
|
||||
2CAC431B287F1C8F0088C9FD /* ApiHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC431A287F1C8F0088C9FD /* ApiHeader.swift */; };
|
||||
2CAC431D287F399F0088C9FD /* CollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CAC431C287F399F0088C9FD /* CollectionView.swift */; };
|
||||
2CB84A35288B1D5B00DB8F41 /* Background.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A34288B1D5B00DB8F41 /* Background.swift */; };
|
||||
2CB84A38288B1F2B00DB8F41 /* BaseTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A37288B1F2B00DB8F41 /* BaseTask.swift */; };
|
||||
2CB84A3A288B206600DB8F41 /* RefreshTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A39288B206600DB8F41 /* RefreshTask.swift */; };
|
||||
2CB84A3C288B20A200DB8F41 /* SyncTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A3B288B20A200DB8F41 /* SyncTask.swift */; };
|
||||
2CB84A3E288C0E9200DB8F41 /* Favorites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A3D288C0E9200DB8F41 /* Favorites.swift */; };
|
||||
2CB84A40288C563D00DB8F41 /* GradientViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A3F288C563D00DB8F41 /* GradientViews.swift */; };
|
||||
2CB84A42288C578500DB8F41 /* DataColorSchemes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A41288C578500DB8F41 /* DataColorSchemes.swift */; };
|
||||
2CB84A44288C585000DB8F41 /* Interpolations.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A43288C584F00DB8F41 /* Interpolations.swift */; };
|
||||
2CB84A46288DA48500DB8F41 /* CityGradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB84A45288DA48500DB8F41 /* CityGradientView.swift */; };
|
||||
2CB9AA532881AC0C00E9B888 /* FavoriteExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CB9AA522881AC0C00E9B888 /* FavoriteExtensions.swift */; };
|
||||
2CC38B052911A728002E4DB0 /* ArduinoConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC38B042911A728002E4DB0 /* ArduinoConfig.swift */; };
|
||||
2CC38B07291245AF002E4DB0 /* ArduinoTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC38B06291245AF002E4DB0 /* ArduinoTask.swift */; };
|
||||
2CC38B0A29128196002E4DB0 /* SetupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CC38B0929128196002E4DB0 /* SetupView.swift */; };
|
||||
2CD7E0BF2884402500F9CE57 /* WeatherViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0BE2884402500F9CE57 /* WeatherViews.swift */; };
|
||||
2CD7E0C12884415A00F9CE57 /* CityForecastView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0C02884415A00F9CE57 /* CityForecastView.swift */; };
|
||||
2CD7E0C328849FF900F9CE57 /* WeatherAggregates.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0C228849FF900F9CE57 /* WeatherAggregates.swift */; };
|
||||
2CD7E0C528856C3500F9CE57 /* PageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0C428856C3500F9CE57 /* PageView.swift */; };
|
||||
2CD7E0C728857A7900F9CE57 /* CustomizeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0C628857A7900F9CE57 /* CustomizeView.swift */; };
|
||||
2CD7E0C92885A0F700F9CE57 /* CityVideoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0C82885A0F700F9CE57 /* CityVideoView.swift */; };
|
||||
2CD7E0CD2885AD7D00F9CE57 /* RemoteImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CD7E0CC2885AD7D00F9CE57 /* RemoteImageView.swift */; };
|
||||
2CE5E860287ECB98006B8CDF /* ProgressViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CE5E85F287ECB98006B8CDF /* ProgressViews.swift */; };
|
||||
2CEB0281283EB09B00DF3151 /* Database.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 2CEB027F283EB09B00DF3151 /* Database.xcdatamodeld */; };
|
||||
2CEB02862840C50700DF3151 /* TermsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEB02822840C50700DF3151 /* TermsView.swift */; };
|
||||
2CEB02872840C50700DF3151 /* ButtonStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEB02832840C50700DF3151 /* ButtonStyles.swift */; };
|
||||
2CEB02882840C50700DF3151 /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEB02842840C50700DF3151 /* WebView.swift */; };
|
||||
2CEB02892840C50700DF3151 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEB02852840C50700DF3151 /* SettingsView.swift */; };
|
||||
2CEB028B2840C54000DF3151 /* StartScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2CEB028A2840C54000DF3151 /* StartScreen.storyboard */; };
|
||||
2CEB029A2840CD3200DF3151 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2CEB029C2840CD3200DF3151 /* Localizable.strings */; };
|
||||
2CEB029F2840E7FA00DF3151 /* ViewExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CEB029E2840E7FA00DF3151 /* ViewExtensions.swift */; };
|
||||
2CEB02A02840EAEB00DF3151 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2C16330E283A27D600F78CEE /* Assets.xcassets */; };
|
||||
2CF8D6262843D0DB008FB7D0 /* ImageBindings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8D6252843D0DB008FB7D0 /* ImageBindings.swift */; };
|
||||
2CF8D62828440E05008FB7D0 /* DataBindings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8D62728440E05008FB7D0 /* DataBindings.swift */; };
|
||||
2CF8D62A28440FE4008FB7D0 /* UnitConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF8D62928440FE4008FB7D0 /* UnitConverter.swift */; };
|
||||
2CFC0F142841201E00E597DC /* Html in Resources */ = {isa = PBXBuildFile; fileRef = 2CFC0F132841201E00E597DC /* Html */; };
|
||||
2CFC0F162842197C00E597DC /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFC0F152842197C00E597DC /* LoginView.swift */; };
|
||||
2CFC0F18284219C600E597DC /* DrawerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFC0F17284219C600E597DC /* DrawerView.swift */; };
|
||||
2CFC0F1A284219D400E597DC /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFC0F19284219D400E597DC /* SearchView.swift */; };
|
||||
2CFC0F1C28421A0300E597DC /* FavoritesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFC0F1B28421A0300E597DC /* FavoritesView.swift */; };
|
||||
2CFCF22B291385A5000D0683 /* ArduinoLocator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFCF22A291385A5000D0683 /* ArduinoLocator.swift */; };
|
||||
2CFCF22D2913C957000D0683 /* ArduinoState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CFCF22C2913C957000D0683 /* ArduinoState.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -36,18 +96,81 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2C163307283A27D300F78CEE /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2C16330A283A27D300F78CEE /* AppApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppApp.swift; sourceTree = "<group>"; };
|
||||
2C163307283A27D300F78CEE /* MoWeSta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoWeSta.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2C16330A283A27D300F78CEE /* Application.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = "<group>"; };
|
||||
2C16330C283A27D300F78CEE /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
2C16330E283A27D600F78CEE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
2C163311283A27D600F78CEE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||
2C163313283A27D600F78CEE /* Persistence.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
|
||||
2C163316283A27D600F78CEE /* App.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = App.xcdatamodel; sourceTree = "<group>"; };
|
||||
2C16331C283A27D600F78CEE /* AppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2C163320283A27D600F78CEE /* AppTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppTests.swift; sourceTree = "<group>"; };
|
||||
2C163326283A27D600F78CEE /* AppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
2C16332A283A27D600F78CEE /* AppUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUITests.swift; sourceTree = "<group>"; };
|
||||
2C16332C283A27D600F78CEE /* AppUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppUITestsLaunchTests.swift; sourceTree = "<group>"; };
|
||||
2C369C6528888E6800B5AFB2 /* StationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StationView.swift; sourceTree = "<group>"; };
|
||||
2C369C6728889EAE00B5AFB2 /* ErrorView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorView.swift; sourceTree = "<group>"; };
|
||||
2C369C692889592500B5AFB2 /* StationsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StationsView.swift; sourceTree = "<group>"; };
|
||||
2C369C6B2889719C00B5AFB2 /* MeasurementView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeasurementView.swift; sourceTree = "<group>"; };
|
||||
2C369C6D2889D42700B5AFB2 /* DevicesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DevicesView.swift; sourceTree = "<group>"; };
|
||||
2C369C6F2889D44100B5AFB2 /* DeviceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceView.swift; sourceTree = "<group>"; };
|
||||
2C865E392842719F00F1A89A /* ios-api */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "ios-api"; path = "../ios-api"; sourceTree = "<group>"; };
|
||||
2C865E3C2842850800F1A89A /* HideableTabView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HideableTabView.swift; sourceTree = "<group>"; };
|
||||
2C865E3E28428ED600F1A89A /* TextBindings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextBindings.swift; sourceTree = "<group>"; };
|
||||
2C865E402842999600F1A89A /* CityView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityView.swift; sourceTree = "<group>"; };
|
||||
2C865E42284393DA00F1A89A /* CityInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityInfoView.swift; sourceTree = "<group>"; };
|
||||
2CA281FE283E1D2F00D4A05A /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
|
||||
2CA28200283E201B00D4A05A /* KeyChain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyChain.swift; sourceTree = "<group>"; };
|
||||
2CA28201283E201B00D4A05A /* UserDefault.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserDefault.swift; sourceTree = "<group>"; };
|
||||
2CA28202283E201B00D4A05A /* AppInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppInfo.swift; sourceTree = "<group>"; };
|
||||
2CA4E7502887CB9800B901ED /* CountryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryView.swift; sourceTree = "<group>"; };
|
||||
2CA4E7522887CBA300B901ED /* StateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateView.swift; sourceTree = "<group>"; };
|
||||
2CA4E7542887D18D00B901ED /* GeojsonConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeojsonConverter.swift; sourceTree = "<group>"; };
|
||||
2CA4E756288826DA00B901ED /* PlaceMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlaceMapView.swift; sourceTree = "<group>"; };
|
||||
2CAC431A287F1C8F0088C9FD /* ApiHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApiHeader.swift; sourceTree = "<group>"; };
|
||||
2CAC431C287F399F0088C9FD /* CollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CollectionView.swift; sourceTree = "<group>"; };
|
||||
2CB84A33288AFD3400DB8F41 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
|
||||
2CB84A34288B1D5B00DB8F41 /* Background.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Background.swift; sourceTree = "<group>"; };
|
||||
2CB84A37288B1F2B00DB8F41 /* BaseTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseTask.swift; sourceTree = "<group>"; };
|
||||
2CB84A39288B206600DB8F41 /* RefreshTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RefreshTask.swift; sourceTree = "<group>"; };
|
||||
2CB84A3B288B20A200DB8F41 /* SyncTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncTask.swift; sourceTree = "<group>"; };
|
||||
2CB84A3D288C0E9200DB8F41 /* Favorites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Favorites.swift; sourceTree = "<group>"; };
|
||||
2CB84A3F288C563D00DB8F41 /* GradientViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GradientViews.swift; sourceTree = "<group>"; };
|
||||
2CB84A41288C578500DB8F41 /* DataColorSchemes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataColorSchemes.swift; sourceTree = "<group>"; };
|
||||
2CB84A43288C584F00DB8F41 /* Interpolations.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Interpolations.swift; sourceTree = "<group>"; };
|
||||
2CB84A45288DA48500DB8F41 /* CityGradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityGradientView.swift; sourceTree = "<group>"; };
|
||||
2CB9AA522881AC0C00E9B888 /* FavoriteExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteExtensions.swift; sourceTree = "<group>"; };
|
||||
2CB9AA552882CD3600E9B888 /* lib-leafless */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = "lib-leafless"; path = "../ios-locoslab/lib-leafless"; sourceTree = "<group>"; };
|
||||
2CC38B042911A728002E4DB0 /* ArduinoConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ArduinoConfig.swift; path = app/Arduino/ArduinoConfig.swift; sourceTree = SOURCE_ROOT; };
|
||||
2CC38B06291245AF002E4DB0 /* ArduinoTask.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ArduinoTask.swift; path = app/Arduino/ArduinoTask.swift; sourceTree = SOURCE_ROOT; };
|
||||
2CC38B082912463F002E4DB0 /* App.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = App.entitlements; sourceTree = "<group>"; };
|
||||
2CC38B0929128196002E4DB0 /* SetupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SetupView.swift; path = app/View/SetupView.swift; sourceTree = SOURCE_ROOT; };
|
||||
2CD7E0BE2884402500F9CE57 /* WeatherViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherViews.swift; sourceTree = "<group>"; };
|
||||
2CD7E0C02884415A00F9CE57 /* CityForecastView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityForecastView.swift; sourceTree = "<group>"; };
|
||||
2CD7E0C228849FF900F9CE57 /* WeatherAggregates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WeatherAggregates.swift; sourceTree = "<group>"; };
|
||||
2CD7E0C428856C3500F9CE57 /* PageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageView.swift; sourceTree = "<group>"; };
|
||||
2CD7E0C628857A7900F9CE57 /* CustomizeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomizeView.swift; sourceTree = "<group>"; };
|
||||
2CD7E0C82885A0F700F9CE57 /* CityVideoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CityVideoView.swift; sourceTree = "<group>"; };
|
||||
2CD7E0CC2885AD7D00F9CE57 /* RemoteImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteImageView.swift; sourceTree = "<group>"; };
|
||||
2CE5E85F287ECB98006B8CDF /* ProgressViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressViews.swift; sourceTree = "<group>"; };
|
||||
2CEB0280283EB09B00DF3151 /* Database.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Database.xcdatamodel; sourceTree = "<group>"; };
|
||||
2CEB02822840C50700DF3151 /* TermsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TermsView.swift; sourceTree = "<group>"; };
|
||||
2CEB02832840C50700DF3151 /* ButtonStyles.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ButtonStyles.swift; sourceTree = "<group>"; };
|
||||
2CEB02842840C50700DF3151 /* WebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
|
||||
2CEB02852840C50700DF3151 /* SettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
|
||||
2CEB028A2840C54000DF3151 /* StartScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = StartScreen.storyboard; sourceTree = "<group>"; };
|
||||
2CEB029B2840CD3200DF3151 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
2CEB029D2840CEA200DF3151 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
2CEB029E2840E7FA00DF3151 /* ViewExtensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = "<group>"; };
|
||||
2CF8D6252843D0DB008FB7D0 /* ImageBindings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageBindings.swift; sourceTree = "<group>"; };
|
||||
2CF8D62728440E05008FB7D0 /* DataBindings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataBindings.swift; sourceTree = "<group>"; };
|
||||
2CF8D62928440FE4008FB7D0 /* UnitConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitConverter.swift; sourceTree = "<group>"; };
|
||||
2CFC0F132841201E00E597DC /* Html */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Html; sourceTree = "<group>"; };
|
||||
2CFC0F152842197C00E597DC /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
|
||||
2CFC0F17284219C600E597DC /* DrawerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DrawerView.swift; sourceTree = "<group>"; };
|
||||
2CFC0F19284219D400E597DC /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
|
||||
2CFC0F1B28421A0300E597DC /* FavoritesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesView.swift; sourceTree = "<group>"; };
|
||||
2CFCF22A291385A5000D0683 /* ArduinoLocator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ArduinoLocator.swift; path = app/Arduino/ArduinoLocator.swift; sourceTree = SOURCE_ROOT; };
|
||||
2CFCF22C2913C957000D0683 /* ArduinoState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ArduinoState.swift; path = app/Arduino/ArduinoState.swift; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -55,6 +178,8 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2CA4E74F2885E62500B901ED /* LocosLabLeafles in Frameworks */,
|
||||
2C865E3B284271C800F1A89A /* MoWeStaApi in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -78,17 +203,20 @@
|
||||
2C1632FE283A27D300F78CEE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CB9AA552882CD3600E9B888 /* lib-leafless */,
|
||||
2C865E392842719F00F1A89A /* ios-api */,
|
||||
2C163309283A27D300F78CEE /* App */,
|
||||
2C16331F283A27D600F78CEE /* AppTests */,
|
||||
2C163329283A27D600F78CEE /* AppUITests */,
|
||||
2C163308283A27D300F78CEE /* Products */,
|
||||
2C865E322842620500F1A89A /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2C163308283A27D300F78CEE /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2C163307283A27D300F78CEE /* App.app */,
|
||||
2C163307283A27D300F78CEE /* MoWeSta.app */,
|
||||
2C16331C283A27D600F78CEE /* AppTests.xctest */,
|
||||
2C163326283A27D600F78CEE /* AppUITests.xctest */,
|
||||
);
|
||||
@@ -98,12 +226,24 @@
|
||||
2C163309283A27D300F78CEE /* App */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2C16330A283A27D300F78CEE /* AppApp.swift */,
|
||||
2CC38B082912463F002E4DB0 /* App.entitlements */,
|
||||
2CB84A33288AFD3400DB8F41 /* Info.plist */,
|
||||
2CEB027F283EB09B00DF3151 /* Database.xcdatamodeld */,
|
||||
2CFC0F132841201E00E597DC /* Html */,
|
||||
2CC38B032911A706002E4DB0 /* Arduino */,
|
||||
2CEB028C2840C96D00DF3151 /* Ui */,
|
||||
2CA281FD283E1D1300D4A05A /* Model */,
|
||||
2CA281FC283E1D0400D4A05A /* View */,
|
||||
2CB84A36288B1EE900DB8F41 /* Task */,
|
||||
2CA281FB283E1CEB00D4A05A /* Util */,
|
||||
2C16330A283A27D300F78CEE /* Application.swift */,
|
||||
2CB84A34288B1D5B00DB8F41 /* Background.swift */,
|
||||
2C16330C283A27D300F78CEE /* ContentView.swift */,
|
||||
2C16330E283A27D600F78CEE /* Assets.xcassets */,
|
||||
2C163313283A27D600F78CEE /* Persistence.swift */,
|
||||
2C163315283A27D600F78CEE /* App.xcdatamodeld */,
|
||||
2C16330E283A27D600F78CEE /* Assets.xcassets */,
|
||||
2C163310283A27D600F78CEE /* Preview Content */,
|
||||
2CEB028A2840C54000DF3151 /* StartScreen.storyboard */,
|
||||
2CEB029C2840CD3200DF3151 /* Localizable.strings */,
|
||||
);
|
||||
path = App;
|
||||
sourceTree = "<group>";
|
||||
@@ -133,6 +273,109 @@
|
||||
path = AppUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2C865E322842620500F1A89A /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2CA281FB283E1CEB00D4A05A /* Util */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CA28202283E201B00D4A05A /* AppInfo.swift */,
|
||||
2CA28200283E201B00D4A05A /* KeyChain.swift */,
|
||||
2CA28201283E201B00D4A05A /* UserDefault.swift */,
|
||||
2CF8D62928440FE4008FB7D0 /* UnitConverter.swift */,
|
||||
2CAC431A287F1C8F0088C9FD /* ApiHeader.swift */,
|
||||
2CA4E7542887D18D00B901ED /* GeojsonConverter.swift */,
|
||||
);
|
||||
path = Util;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2CA281FC283E1D0400D4A05A /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CEB02852840C50700DF3151 /* SettingsView.swift */,
|
||||
2CEB02822840C50700DF3151 /* TermsView.swift */,
|
||||
2CEB02842840C50700DF3151 /* WebView.swift */,
|
||||
2CFC0F152842197C00E597DC /* LoginView.swift */,
|
||||
2CFC0F17284219C600E597DC /* DrawerView.swift */,
|
||||
2CFC0F19284219D400E597DC /* SearchView.swift */,
|
||||
2CFC0F1B28421A0300E597DC /* FavoritesView.swift */,
|
||||
2C865E402842999600F1A89A /* CityView.swift */,
|
||||
2C865E42284393DA00F1A89A /* CityInfoView.swift */,
|
||||
2CD7E0C02884415A00F9CE57 /* CityForecastView.swift */,
|
||||
2CB84A45288DA48500DB8F41 /* CityGradientView.swift */,
|
||||
2CD7E0C82885A0F700F9CE57 /* CityVideoView.swift */,
|
||||
2CA4E7502887CB9800B901ED /* CountryView.swift */,
|
||||
2CA4E7522887CBA300B901ED /* StateView.swift */,
|
||||
2CAC431C287F399F0088C9FD /* CollectionView.swift */,
|
||||
2CD7E0BE2884402500F9CE57 /* WeatherViews.swift */,
|
||||
2CD7E0C628857A7900F9CE57 /* CustomizeView.swift */,
|
||||
2CA4E756288826DA00B901ED /* PlaceMapView.swift */,
|
||||
2C369C6528888E6800B5AFB2 /* StationView.swift */,
|
||||
2C369C692889592500B5AFB2 /* StationsView.swift */,
|
||||
2C369C6B2889719C00B5AFB2 /* MeasurementView.swift */,
|
||||
2C369C6F2889D44100B5AFB2 /* DeviceView.swift */,
|
||||
2C369C6D2889D42700B5AFB2 /* DevicesView.swift */,
|
||||
2CC38B0929128196002E4DB0 /* SetupView.swift */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2CA281FD283E1D1300D4A05A /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CA281FE283E1D2F00D4A05A /* AppState.swift */,
|
||||
2C865E3E28428ED600F1A89A /* TextBindings.swift */,
|
||||
2CF8D6252843D0DB008FB7D0 /* ImageBindings.swift */,
|
||||
2CF8D62728440E05008FB7D0 /* DataBindings.swift */,
|
||||
2CB9AA522881AC0C00E9B888 /* FavoriteExtensions.swift */,
|
||||
2CD7E0C228849FF900F9CE57 /* WeatherAggregates.swift */,
|
||||
2CB84A3D288C0E9200DB8F41 /* Favorites.swift */,
|
||||
2CB84A41288C578500DB8F41 /* DataColorSchemes.swift */,
|
||||
2CB84A43288C584F00DB8F41 /* Interpolations.swift */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2CB84A36288B1EE900DB8F41 /* Task */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CB84A37288B1F2B00DB8F41 /* BaseTask.swift */,
|
||||
2CB84A3B288B20A200DB8F41 /* SyncTask.swift */,
|
||||
2CB84A39288B206600DB8F41 /* RefreshTask.swift */,
|
||||
);
|
||||
path = Task;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2CC38B032911A706002E4DB0 /* Arduino */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CC38B042911A728002E4DB0 /* ArduinoConfig.swift */,
|
||||
2CC38B06291245AF002E4DB0 /* ArduinoTask.swift */,
|
||||
2CFCF22A291385A5000D0683 /* ArduinoLocator.swift */,
|
||||
2CFCF22C2913C957000D0683 /* ArduinoState.swift */,
|
||||
);
|
||||
path = Arduino;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2CEB028C2840C96D00DF3151 /* Ui */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2CEB029E2840E7FA00DF3151 /* ViewExtensions.swift */,
|
||||
2CEB02832840C50700DF3151 /* ButtonStyles.swift */,
|
||||
2C865E3C2842850800F1A89A /* HideableTabView.swift */,
|
||||
2CE5E85F287ECB98006B8CDF /* ProgressViews.swift */,
|
||||
2CD7E0C428856C3500F9CE57 /* PageView.swift */,
|
||||
2CD7E0CC2885AD7D00F9CE57 /* RemoteImageView.swift */,
|
||||
2C369C6728889EAE00B5AFB2 /* ErrorView.swift */,
|
||||
2CB84A3F288C563D00DB8F41 /* GradientViews.swift */,
|
||||
);
|
||||
path = Ui;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@@ -149,8 +392,12 @@
|
||||
dependencies = (
|
||||
);
|
||||
name = App;
|
||||
packageProductDependencies = (
|
||||
2C865E3A284271C800F1A89A /* MoWeStaApi */,
|
||||
2CA4E74E2885E62500B901ED /* LocosLabLeafles */,
|
||||
);
|
||||
productName = App;
|
||||
productReference = 2C163307283A27D300F78CEE /* App.app */;
|
||||
productReference = 2C163307283A27D300F78CEE /* MoWeSta.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
2C16331B283A27D600F78CEE /* AppTests */ = {
|
||||
@@ -212,13 +459,14 @@
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 2C163302283A27D300F78CEE /* Build configuration list for PBXProject "App" */;
|
||||
buildConfigurationList = 2C163302283A27D300F78CEE /* Build configuration list for PBXProject "app" */;
|
||||
compatibilityVersion = "Xcode 13.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
de,
|
||||
);
|
||||
mainGroup = 2C1632FE283A27D300F78CEE;
|
||||
productRefGroup = 2C163308283A27D300F78CEE /* Products */;
|
||||
@@ -237,8 +485,11 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2CEB028B2840C54000DF3151 /* StartScreen.storyboard in Resources */,
|
||||
2C163312283A27D600F78CEE /* Preview Assets.xcassets in Resources */,
|
||||
2C16330F283A27D600F78CEE /* Assets.xcassets in Resources */,
|
||||
2CFC0F142841201E00E597DC /* Html in Resources */,
|
||||
2CEB029A2840CD3200DF3151 /* Localizable.strings in Resources */,
|
||||
2CEB02A02840EAEB00DF3151 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -263,10 +514,65 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2C865E3F28428ED600F1A89A /* TextBindings.swift in Sources */,
|
||||
2CB84A35288B1D5B00DB8F41 /* Background.swift in Sources */,
|
||||
2CB84A44288C585000DB8F41 /* Interpolations.swift in Sources */,
|
||||
2CB9AA532881AC0C00E9B888 /* FavoriteExtensions.swift in Sources */,
|
||||
2C369C702889D44100B5AFB2 /* DeviceView.swift in Sources */,
|
||||
2C865E412842999600F1A89A /* CityView.swift in Sources */,
|
||||
2CA4E7512887CB9800B901ED /* CountryView.swift in Sources */,
|
||||
2CA4E757288826DA00B901ED /* PlaceMapView.swift in Sources */,
|
||||
2C163314283A27D600F78CEE /* Persistence.swift in Sources */,
|
||||
2C163317283A27D600F78CEE /* App.xcdatamodeld in Sources */,
|
||||
2CFCF22B291385A5000D0683 /* ArduinoLocator.swift in Sources */,
|
||||
2CB84A46288DA48500DB8F41 /* CityGradientView.swift in Sources */,
|
||||
2CB84A3C288B20A200DB8F41 /* SyncTask.swift in Sources */,
|
||||
2CF8D6262843D0DB008FB7D0 /* ImageBindings.swift in Sources */,
|
||||
2CA4E7552887D18D00B901ED /* GeojsonConverter.swift in Sources */,
|
||||
2CFCF22D2913C957000D0683 /* ArduinoState.swift in Sources */,
|
||||
2CAC431B287F1C8F0088C9FD /* ApiHeader.swift in Sources */,
|
||||
2C369C6628888E6800B5AFB2 /* StationView.swift in Sources */,
|
||||
2CD7E0C528856C3500F9CE57 /* PageView.swift in Sources */,
|
||||
2CD7E0C12884415A00F9CE57 /* CityForecastView.swift in Sources */,
|
||||
2CEB02862840C50700DF3151 /* TermsView.swift in Sources */,
|
||||
2CA28204283E201B00D4A05A /* UserDefault.swift in Sources */,
|
||||
2CD7E0C728857A7900F9CE57 /* CustomizeView.swift in Sources */,
|
||||
2CFC0F18284219C600E597DC /* DrawerView.swift in Sources */,
|
||||
2CEB0281283EB09B00DF3151 /* Database.xcdatamodeld in Sources */,
|
||||
2CB84A40288C563D00DB8F41 /* GradientViews.swift in Sources */,
|
||||
2C369C6A2889592500B5AFB2 /* StationsView.swift in Sources */,
|
||||
2CD7E0CD2885AD7D00F9CE57 /* RemoteImageView.swift in Sources */,
|
||||
2CC38B07291245AF002E4DB0 /* ArduinoTask.swift in Sources */,
|
||||
2CD7E0C92885A0F700F9CE57 /* CityVideoView.swift in Sources */,
|
||||
2CC38B052911A728002E4DB0 /* ArduinoConfig.swift in Sources */,
|
||||
2CD7E0C328849FF900F9CE57 /* WeatherAggregates.swift in Sources */,
|
||||
2CA28203283E201B00D4A05A /* KeyChain.swift in Sources */,
|
||||
2C369C6E2889D42700B5AFB2 /* DevicesView.swift in Sources */,
|
||||
2CC38B0A29128196002E4DB0 /* SetupView.swift in Sources */,
|
||||
2CA281FF283E1D2F00D4A05A /* AppState.swift in Sources */,
|
||||
2CB84A38288B1F2B00DB8F41 /* BaseTask.swift in Sources */,
|
||||
2C369C6828889EAE00B5AFB2 /* ErrorView.swift in Sources */,
|
||||
2CA28205283E201B00D4A05A /* AppInfo.swift in Sources */,
|
||||
2C865E3D2842850800F1A89A /* HideableTabView.swift in Sources */,
|
||||
2CB84A3A288B206600DB8F41 /* RefreshTask.swift in Sources */,
|
||||
2CEB029F2840E7FA00DF3151 /* ViewExtensions.swift in Sources */,
|
||||
2CB84A3E288C0E9200DB8F41 /* Favorites.swift in Sources */,
|
||||
2CFC0F162842197C00E597DC /* LoginView.swift in Sources */,
|
||||
2C16330D283A27D300F78CEE /* ContentView.swift in Sources */,
|
||||
2C16330B283A27D300F78CEE /* AppApp.swift in Sources */,
|
||||
2CF8D62A28440FE4008FB7D0 /* UnitConverter.swift in Sources */,
|
||||
2CEB02872840C50700DF3151 /* ButtonStyles.swift in Sources */,
|
||||
2CA4E7532887CBA300B901ED /* StateView.swift in Sources */,
|
||||
2CB84A42288C578500DB8F41 /* DataColorSchemes.swift in Sources */,
|
||||
2CAC431D287F399F0088C9FD /* CollectionView.swift in Sources */,
|
||||
2CFC0F1A284219D400E597DC /* SearchView.swift in Sources */,
|
||||
2CD7E0BF2884402500F9CE57 /* WeatherViews.swift in Sources */,
|
||||
2C865E43284393DA00F1A89A /* CityInfoView.swift in Sources */,
|
||||
2CFC0F1C28421A0300E597DC /* FavoritesView.swift in Sources */,
|
||||
2CF8D62828440E05008FB7D0 /* DataBindings.swift in Sources */,
|
||||
2C369C6C2889719C00B5AFB2 /* MeasurementView.swift in Sources */,
|
||||
2CEB02892840C50700DF3151 /* SettingsView.swift in Sources */,
|
||||
2C16330B283A27D300F78CEE /* Application.swift in Sources */,
|
||||
2CE5E860287ECB98006B8CDF /* ProgressViews.swift in Sources */,
|
||||
2CEB02882840C50700DF3151 /* WebView.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -302,11 +608,24 @@
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
2CEB029C2840CD3200DF3151 /* Localizable.strings */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
2CEB029B2840CD3200DF3151 /* en */,
|
||||
2CEB029D2840CEA200DF3151 /* de */,
|
||||
);
|
||||
name = Localizable.strings;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
2C16332E283A27D600F78CEE /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
@@ -353,7 +672,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
@@ -367,6 +686,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
@@ -407,7 +727,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.5;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -422,24 +742,31 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
CURRENT_PROJECT_VERSION = 5;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"App/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 2KS4Z77UGE;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = MoWeSta;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.weather";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = StartScreen;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mowesta.ios.App;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
MARKETING_VERSION = 1.3;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mowesta.app;
|
||||
PRODUCT_NAME = MoWeSta;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -451,24 +778,31 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
CURRENT_PROJECT_VERSION = 5;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"App/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 2KS4Z77UGE;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = App/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = MoWeSta;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.weather";
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = StartScreen;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 14.1;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mowesta.ios.App;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
MARKETING_VERSION = 1.3;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.mowesta.app;
|
||||
PRODUCT_NAME = MoWeSta;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@@ -554,7 +888,7 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
2C163302283A27D300F78CEE /* Build configuration list for PBXProject "App" */ = {
|
||||
2C163302283A27D300F78CEE /* Build configuration list for PBXProject "app" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
2C16332E283A27D600F78CEE /* Debug */,
|
||||
@@ -592,14 +926,25 @@
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
|
||||
/* Begin XCSwiftPackageProductDependency section */
|
||||
2C865E3A284271C800F1A89A /* MoWeStaApi */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = MoWeStaApi;
|
||||
};
|
||||
2CA4E74E2885E62500B901ED /* LocosLabLeafles */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = LocosLabLeafles;
|
||||
};
|
||||
/* End XCSwiftPackageProductDependency section */
|
||||
|
||||
/* Begin XCVersionGroup section */
|
||||
2C163315283A27D600F78CEE /* App.xcdatamodeld */ = {
|
||||
2CEB027F283EB09B00DF3151 /* Database.xcdatamodeld */ = {
|
||||
isa = XCVersionGroup;
|
||||
children = (
|
||||
2C163316283A27D600F78CEE /* App.xcdatamodel */,
|
||||
2CEB0280283EB09B00DF3151 /* Database.xcdatamodel */,
|
||||
);
|
||||
currentVersion = 2C163316283A27D600F78CEE /* App.xcdatamodel */;
|
||||
path = App.xcdatamodeld;
|
||||
currentVersion = 2CEB0280283EB09B00DF3151 /* Database.xcdatamodel */;
|
||||
path = Database.xcdatamodeld;
|
||||
sourceTree = "<group>";
|
||||
versionGroupType = wrapper.xcdatamodel;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1340"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2C163306283A27D300F78CEE"
|
||||
BuildableName = "MoWeSta.app"
|
||||
BlueprintName = "App"
|
||||
ReferencedContainer = "container:App.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2C16331B283A27D600F78CEE"
|
||||
BuildableName = "AppTests.xctest"
|
||||
BlueprintName = "AppTests"
|
||||
ReferencedContainer = "container:App.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2C163325283A27D600F78CEE"
|
||||
BuildableName = "AppUITests.xctest"
|
||||
BlueprintName = "AppUITests"
|
||||
ReferencedContainer = "container:App.xcodeproj">
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2C163306283A27D300F78CEE"
|
||||
BuildableName = "MoWeSta.app"
|
||||
BlueprintName = "App"
|
||||
ReferencedContainer = "container:App.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "2C163306283A27D300F78CEE"
|
||||
BuildableName = "MoWeSta.app"
|
||||
BlueprintName = "App"
|
||||
ReferencedContainer = "container:App.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.developer.networking.HotspotConfiguration</key>
|
||||
<true/>
|
||||
<key>com.apple.developer.networking.wifi-info</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="1" systemVersion="11A491" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="false" userDefinedModelVersionIdentifier="">
|
||||
<entity name="Item" representedClassName="Item" syncable="YES" codeGenerationType="class">
|
||||
<attribute name="timestamp" optional="YES" attributeType="Date" usesScalarValueType="NO"/>
|
||||
</entity>
|
||||
<elements>
|
||||
<element name="Item" positionX="-63" positionY="-18" width="128" height="44"/>
|
||||
</elements>
|
||||
</model>
|
||||
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// AppApp.swift
|
||||
// App
|
||||
//
|
||||
// Created by Marcus Handte on 22.05.22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct AppApp: App {
|
||||
let persistenceController = PersistenceController.shared
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.environment(\.managedObjectContext, persistenceController.container.viewContext)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// AppApp.swift
|
||||
// App
|
||||
//
|
||||
// Created by Marcus Handte on 22.05.22.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
@main
|
||||
struct Application: App {
|
||||
|
||||
let persistenceController = PersistenceController.shared
|
||||
@UIApplicationDelegateAdaptor(ApplicationDelegate.self) var appDelegate
|
||||
|
||||
@Environment(\.scenePhase) var scenePhase
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
.environment(\.managedObjectContext, persistenceController.container.viewContext)
|
||||
}.onChange(of: scenePhase) { phase in
|
||||
switch phase {
|
||||
case .background:
|
||||
appDelegate.background.scheduleTask()
|
||||
case .active:
|
||||
print("Executing foreground refresh.")
|
||||
RefreshTask().execute(completion: { success in
|
||||
print("Completed foreground refresh: \(success)")
|
||||
})
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ApplicationDelegate: NSObject, UIApplicationDelegate {
|
||||
|
||||
let background = Background()
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
background.registerTask()
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ArduinoConfig.swift
|
||||
// App
|
||||
//
|
||||
// Created by Marcus Handte on 01.11.22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
struct ArduinoConfig: Codable {
|
||||
var ssid: String
|
||||
var password: String
|
||||
var token: String
|
||||
var id: String
|
||||
var latitude: String
|
||||
var longitude: String
|
||||
|
||||
init(ssid: String, password: String, token: String, id: Int64, latitude: Double, longitude: Double) {
|
||||
self.ssid = ssid
|
||||
self.password = password
|
||||
self.token = token
|
||||
self.id = "\(id)"
|
||||
self.latitude = "\(latitude)"
|
||||
self.longitude = "\(longitude)"
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case ssid = "ssid"
|
||||
case password = "password"
|
||||
case token = "token"
|
||||
case id = "id"
|
||||
case latitude = "latitude"
|
||||
case longitude = "longitude"
|
||||
}
|
||||
|
||||
func toJson() -> Data? {
|
||||
let encoder = JSONEncoder()
|
||||
let encoded = try? encoder.encode(self)
|
||||
if let en = encoded, let string = String(data: en, encoding: .utf8) {
|
||||
return "\(string)\n".data(using: .utf8)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum ArduinoConstants: String {
|
||||
|
||||
/// The network name of the weather station.
|
||||
case ssid = "MoWeSta - WiFi"
|
||||
/// The network password of the weather station.
|
||||
case password = "mowesta123456wifi"
|
||||
/// The ip address of the weather station.
|
||||
case ip = "192.168.4.1"
|
||||
/// The port of the weather station.
|
||||
case port = "8080"
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// ArduinoLocator.swift - A utility class to implement one-shot
|
||||
// localization using core location.
|
||||
//
|
||||
// Created by Marcus Handte on 03.11.22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import CoreLocation
|
||||
|
||||
class ArduinoLocator: NSObject, ObservableObject, CLLocationManagerDelegate {
|
||||
|
||||
let locationManager = CLLocationManager()
|
||||
|
||||
var localizing = false { willSet { objectWillChange.send() }}
|
||||
|
||||
var disabled = false { willSet { objectWillChange.send() }}
|
||||
|
||||
private var listener: ((Double, Double) -> Void)?
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
locationManager.desiredAccuracy = 10
|
||||
locationManager.delegate = self
|
||||
disabled = locationManager.authorizationStatus == .denied
|
||||
}
|
||||
|
||||
func setListener(_ listener: @escaping (Double, Double) -> Void) {
|
||||
self.listener = listener
|
||||
localizing = true
|
||||
if locationManager.authorizationStatus != .authorizedWhenInUse &&
|
||||
locationManager.authorizationStatus != .authorizedAlways {
|
||||
locationManager.requestWhenInUseAuthorization()
|
||||
} else {
|
||||
locationManager.requestLocation()
|
||||
}
|
||||
}
|
||||
|
||||
func clearListener() {
|
||||
self.listener = nil
|
||||
localizing = false
|
||||
locationManager.stopUpdatingLocation()
|
||||
}
|
||||
|
||||
func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
|
||||
disabled = locationManager.authorizationStatus == .denied
|
||||
if listener != nil && (manager.authorizationStatus == .authorizedWhenInUse ||
|
||||
manager.authorizationStatus == .authorizedAlways) {
|
||||
manager.requestLocation()
|
||||
} else {
|
||||
localizing = false
|
||||
listener = nil
|
||||
}
|
||||
}
|
||||
|
||||
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
||||
if let location = locations.last {
|
||||
let lat = location.coordinate.latitude
|
||||
let lon = location.coordinate.longitude
|
||||
if let l = listener {
|
||||
l(lon, lat);
|
||||
listener = nil
|
||||
localizing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
|
||||
listener = nil
|
||||
localizing = false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ArduinoState.swift - The state object to store the state of the arduino process.
|
||||
//
|
||||
// Created by Marcus Handte on 03.11.22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import NetworkExtension
|
||||
|
||||
/// The state to track the progress of the arduino configuration
|
||||
class ArduinoState: ObservableObject {
|
||||
|
||||
var phase = ArduinoPhase.configure { willSet { objectWillChange.send() }}
|
||||
var failure: ArduinoPhase?
|
||||
var network = "" { willSet { objectWillChange.send() }}
|
||||
var password = "" { willSet { objectWillChange.send() }}
|
||||
var model = "Arduino" { willSet { objectWillChange.send() }}
|
||||
var longitude = "" { willSet { objectWillChange.send() }}
|
||||
var latitude = "" { willSet { objectWillChange.send() }}
|
||||
var lon: Double? {
|
||||
return Double(longitude)
|
||||
}
|
||||
var lat: Double? {
|
||||
return Double(latitude)
|
||||
}
|
||||
|
||||
init() {
|
||||
updateNetwork()
|
||||
}
|
||||
|
||||
func updateNetwork() {
|
||||
guard network.count == 0 else {
|
||||
return
|
||||
}
|
||||
NEHotspotNetwork.fetchCurrent(completionHandler: { net in
|
||||
if let n = net {
|
||||
if self.network.count == 0 {
|
||||
self.network = n.ssid
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func reset() {
|
||||
if phase == .failure || phase == .success{
|
||||
failure = nil
|
||||
phase = .configure
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func isExecutable() -> Bool {
|
||||
return phase == .configure &&
|
||||
network.count > 0 &&
|
||||
password.count >= 8 &&
|
||||
model.count > 0 &&
|
||||
lat != nil &&
|
||||
lon != nil
|
||||
}
|
||||
}
|
||||
|
||||
/// The phases of the configuration process
|
||||
enum ArduinoPhase {
|
||||
case configure
|
||||
case register
|
||||
case connect
|
||||
case transfer
|
||||
case success
|
||||
case failure
|
||||
}
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
//
|
||||
// ArduinoTask.swift - The task to configure an arduino
|
||||
// once all configuration has been provided.
|
||||
//
|
||||
// Created by Marcus Handte on 02.11.22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Network
|
||||
import NetworkExtension
|
||||
import MoWeStaApi
|
||||
|
||||
|
||||
class ArduinoTask: BaseTask {
|
||||
|
||||
let appState = AppState.shared
|
||||
let credentials = AppState.shared.credentials
|
||||
let taskState: ArduinoState
|
||||
|
||||
init(taskState: ArduinoState) {
|
||||
self.taskState = taskState
|
||||
}
|
||||
|
||||
public func execute() {
|
||||
taskState.phase = .register
|
||||
taskState.failure = nil
|
||||
super.execute(completion: { success in
|
||||
if success {
|
||||
self.taskState.phase = .success
|
||||
} else {
|
||||
self.taskState.failure = self.taskState.phase
|
||||
self.taskState.phase = .failure
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override func executeAsync() -> Bool {
|
||||
// check preconditions
|
||||
guard let c = credentials, let lon = taskState.lon, let lat = taskState.lat else {
|
||||
return false
|
||||
}
|
||||
let creator = ArduinoCreator(c, taskState.model)
|
||||
guard let handle = creator.createDevice(), let id = handle.id else {
|
||||
return false
|
||||
}
|
||||
let config = ArduinoConfig(ssid: taskState.network, password: taskState.password, token: handle.token, id: id, latitude: lat, longitude: lon)
|
||||
DispatchQueue.main.async {
|
||||
self.taskState.phase = .connect
|
||||
}
|
||||
// connect to the network
|
||||
let joiner = ArduinoJoiner()
|
||||
if !joiner.connect() {
|
||||
creator.deleteDevice()
|
||||
return false
|
||||
}
|
||||
DispatchQueue.main.async {
|
||||
self.taskState.phase = .transfer
|
||||
}
|
||||
// transfer the data
|
||||
let transfer = ArduinoTransfer(config)
|
||||
if !transfer.transfer() {
|
||||
joiner.disconnect()
|
||||
creator.deleteDevice()
|
||||
return false
|
||||
}
|
||||
// disconnect
|
||||
joiner.disconnect()
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ArduinoTransfer {
|
||||
|
||||
let config: ArduinoConfig
|
||||
var transmit = false
|
||||
var success = false
|
||||
|
||||
init(_ config: ArduinoConfig) {
|
||||
self.config = config
|
||||
}
|
||||
|
||||
public func transfer() -> Bool {
|
||||
let queue = DispatchQueue.init(label: "transfer")
|
||||
let tcpOptions = NWProtocolTCP.Options()
|
||||
tcpOptions.connectionTimeout = 60
|
||||
tcpOptions.noDelay = true
|
||||
tcpOptions.connectionDropTime = 30
|
||||
let connection = NWConnection(
|
||||
host: NWEndpoint.Host(ArduinoConstants.ip.rawValue),
|
||||
port: NWEndpoint.Port(rawValue: UInt16(ArduinoConstants.port.rawValue)!)!,
|
||||
using: NWParameters(tls: nil, tcp: tcpOptions))
|
||||
let sender = DispatchSemaphore(value: 0)
|
||||
let receiver = DispatchSemaphore(value: 0)
|
||||
connection.stateUpdateHandler = { state in
|
||||
switch state {
|
||||
case .setup:
|
||||
self.dprint("Tcp setup")
|
||||
case .cancelled:
|
||||
self.dprint("Tcp cancelled")
|
||||
sender.signal()
|
||||
case let .failed(error):
|
||||
self.dprint("Tcp failed \(error)")
|
||||
sender.signal()
|
||||
case .preparing:
|
||||
self.dprint("Tcp preparing")
|
||||
case .ready:
|
||||
self.dprint("Tcp ready")
|
||||
sender.signal()
|
||||
case let .waiting(error):
|
||||
self.dprint("Tcp waiting \(error)")
|
||||
default:
|
||||
self.dprint("Tcp unknown")
|
||||
}
|
||||
}
|
||||
dprint("Waitng for connection")
|
||||
connection.start(queue: queue)
|
||||
sender.wait()
|
||||
dprint("Continue connection")
|
||||
if connection.state != .ready {
|
||||
dprint("Connection state not ready but \(connection.state)")
|
||||
connection.cancel()
|
||||
return false
|
||||
}
|
||||
dprint("Start receiving data")
|
||||
connection.receive(minimumIncompleteLength: 5, maximumLength: 10, completion: {
|
||||
data, context, complete, error in
|
||||
if let d = data {
|
||||
let s = String(decoding: d, as: UTF8.self)
|
||||
self.dprint("Reception ok \(s)")
|
||||
self.success = s.lowercased().contains("success")
|
||||
receiver.signal()
|
||||
} else if let e = error {
|
||||
self.dprint("Reception error \(e)")
|
||||
receiver.signal()
|
||||
}
|
||||
})
|
||||
dprint("Sending data")
|
||||
connection.send(
|
||||
content: config.toJson(),
|
||||
completion: .contentProcessed({ error in
|
||||
self.dprint("Processed")
|
||||
if let e = error {
|
||||
self.dprint("Transmission error \(e)")
|
||||
}
|
||||
self.transmit = error == nil
|
||||
sender.signal()
|
||||
})
|
||||
)
|
||||
sender.wait()
|
||||
dprint("Continue sending")
|
||||
if !transmit {
|
||||
dprint("Aborting since sending failed")
|
||||
connection.cancel()
|
||||
return false
|
||||
}
|
||||
let result = receiver.wait(timeout: .now() + 30)
|
||||
if (result == .timedOut) {
|
||||
dprint("Timeout")
|
||||
}
|
||||
dprint("Closing connection \(success)")
|
||||
connection.cancel()
|
||||
return success
|
||||
}
|
||||
|
||||
func dprint(_ text: String) {
|
||||
// heavy debug
|
||||
// print(text)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// A class to join the wifi network of the station.
|
||||
class ArduinoJoiner {
|
||||
|
||||
let config: NEHotspotConfiguration
|
||||
var success = false
|
||||
|
||||
public init() {
|
||||
self.config = NEHotspotConfiguration(ssidPrefix: ArduinoConstants.ssid.rawValue, passphrase: ArduinoConstants.password.rawValue, isWEP: false)
|
||||
self.config.joinOnce = false
|
||||
}
|
||||
|
||||
public func connect() -> Bool {
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
|
||||
NEHotspotConfigurationManager.shared.apply(self.config) { error in
|
||||
if error == nil {
|
||||
self.success = true
|
||||
} else {
|
||||
self.success = false
|
||||
self.disconnect()
|
||||
}
|
||||
group.leave()
|
||||
}
|
||||
group.wait()
|
||||
return success
|
||||
}
|
||||
|
||||
public func disconnect() {
|
||||
NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: ArduinoConstants.ssid.rawValue)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// A class to create and delete a device entry for a weather station.
|
||||
class ArduinoCreator {
|
||||
|
||||
private static let MAX_ATTEMPT = 8
|
||||
|
||||
let credential: UserCredentials
|
||||
let model: String
|
||||
var handle: DeviceHandle? = nil
|
||||
|
||||
init(_ credential: UserCredentials, _ model: String) {
|
||||
self.credential = credential
|
||||
self.model = model
|
||||
}
|
||||
|
||||
public func createDevice() -> DeviceHandle? {
|
||||
print("Creating device handle.")
|
||||
let info = DeviceInfo(os: .arduino, manufacturer: "MoWeSta", device: "Arduino", model: model)
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
let rb = DefaultAPI.createDeviceWithRequestBuilder(deviceInfo: info)
|
||||
rb.addHeaders(ApiHeader.create(credential))
|
||||
rb.execute() { result in
|
||||
switch result {
|
||||
case let .success(response):
|
||||
print("Sucessfully created device.")
|
||||
self.handle = response.body
|
||||
case let .failure(.error(code, _, _, _)):
|
||||
print("Failed to create device \(code).")
|
||||
}
|
||||
group.leave()
|
||||
}
|
||||
group.wait()
|
||||
return handle
|
||||
}
|
||||
|
||||
public func deleteDevice() {
|
||||
retryDeleteDevice(attempt: 0)
|
||||
}
|
||||
|
||||
private func retryDeleteDevice(attempt: Int) {
|
||||
if let h = handle, let id = h.id {
|
||||
print("Deleting device \(id) (\(attempt)).")
|
||||
let group = DispatchGroup()
|
||||
group.enter()
|
||||
let rb = DefaultAPI.deleteDeviceWithRequestBuilder(id: id)
|
||||
rb.addHeaders(ApiHeader.create(credential))
|
||||
rb.execute() { result in
|
||||
switch result {
|
||||
case .success(_):
|
||||
print("Successfully deleted device.")
|
||||
self.handle = nil
|
||||
case let .failure(.error(code, _, _, _)):
|
||||
if (code == -1 && attempt < ArduinoCreator.MAX_ATTEMPT) {
|
||||
BaseTask.queue.asyncAfter(deadline: .now() + 5) {
|
||||
self.retryDeleteDevice(attempt: attempt + 1)
|
||||
}
|
||||
} else {
|
||||
print("Failed to delete device \(code).")
|
||||
}
|
||||
}
|
||||
group.leave()
|
||||
}
|
||||
group.wait()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,15 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x25",
|
||||
"green" : "0xA8",
|
||||
"red" : "0xF9"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
|
||||
@@ -1,86 +1,115 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "Icon-Spotlight-40.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-60.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Small.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Small@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Small@3x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Spotlight-40@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-60@2x-1.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-60@2x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-60@3x.png",
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"filename" : "mowesta.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Spotlight-41.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Small-1.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Small@2x-1.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Spotlight-42.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-Spotlight-40@2x-1.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-76.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-76@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"filename" : "Icon-iPadPro@2x.png",
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"filename" : "iTunesArtwork@2x.png",
|
||||
"idiom" : "ios-marketing",
|
||||
"scale" : "1x",
|
||||
"size" : "1024x1024"
|
||||
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 856 B |