Refresh token on start app.

This commit is contained in:
ivan agosto 2018-09-15 15:41:50 -05:00
parent 09dc380ff2
commit 11e329a654
7 changed files with 286 additions and 131 deletions

View File

@ -11,10 +11,13 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="a90c1ed9-b878-4668-a70f-a124e45496b4" name="Default" comment=""> <list default="true" id="a90c1ed9-b878-4668-a70f-a124e45496b4" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/Database.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/Database.kt" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt" />
<change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml" afterPath="$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt" />
<change beforePath="$PROJECT_DIR$/app/src/main/res/layout/content_main.xml" afterPath="$PROJECT_DIR$/app/src/main/res/layout/content_main.xml" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/models/TokenModel.kt" afterPath="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/models/TokenModel.kt" />
</list> </list>
<ignored path="$PROJECT_DIR$/build/classes/" /> <ignored path="$PROJECT_DIR$/build/classes/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@ -38,37 +41,34 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="content_main.xml" pinned="false" current-in-tab="true"> <file leaf-file-name="content_main.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml"> <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml">
<provider editor-type-id="text-editor"> <provider editor-type-id="android-designer2">
<state relative-caret-position="136">
<caret line="11" column="39" lean-forward="false" selection-start-line="11" selection-start-column="25" selection-end-line="11" selection-end-column="39" />
<folding />
</state>
</provider>
<provider selected="true" editor-type-id="android-designer2">
<state /> <state />
</provider> </provider>
</entry>
</file>
<file leaf-file-name="activity_reproductor.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml">
<provider editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
<provider selected="true" editor-type-id="android-designer2">
<state />
</provider>
</entry>
</file>
<file leaf-file-name="ReproductorActivity.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120"> <state relative-caret-position="150">
<caret line="13" column="42" lean-forward="false" selection-start-line="13" selection-start-column="42" selection-end-line="13" selection-end-column="42" /> <caret line="10" column="49" lean-forward="false" selection-start-line="10" selection-start-column="31" selection-end-line="10" selection-end-column="49" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="HostActivity.kt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="68" column="12" lean-forward="false" selection-start-line="68" selection-start-column="12" selection-end-line="68" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Client.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="23" column="66" lean-forward="false" selection-start-line="23" selection-start-column="66" selection-end-line="23" selection-end-column="66" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -77,18 +77,28 @@
<file leaf-file-name="MainActivity.kt" pinned="false" current-in-tab="false"> <file leaf-file-name="MainActivity.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt"> <entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360"> <state relative-caret-position="2325">
<caret line="96" column="13" lean-forward="false" selection-start-line="96" selection-start-column="13" selection-end-line="96" selection-end-column="13" /> <caret line="191" column="58" lean-forward="false" selection-start-line="191" selection-start-column="58" selection-end-line="191" selection-end-column="58" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="ManagerSingleton.kt" pinned="false" current-in-tab="false"> <file leaf-file-name="Auth.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt"> <entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255"> <state relative-caret-position="153">
<caret line="19" column="26" lean-forward="false" selection-start-line="19" selection-start-column="26" selection-end-line="19" selection-end-column="26" /> <caret line="76" column="12" lean-forward="false" selection-start-line="76" selection-start-column="12" selection-end-line="76" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="LoginActivity.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/LoginActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="47">
<caret line="44" column="11" lean-forward="false" selection-start-line="44" selection-start-column="11" selection-end-line="67" selection-end-column="13" />
<folding /> <folding />
</state> </state>
</provider> </provider>
@ -101,7 +111,16 @@
<find>Looper.prepare()</find> <find>Looper.prepare()</find>
<find>setData</find> <find>setData</find>
<find>logout</find> <find>logout</find>
<find>TokenModel</find>
<find>TokenModel(</find>
<find>token.token</find>
<find>token</find>
<find>Async</find>
<find>logout(</find>
</findStrings> </findStrings>
<dirStrings>
<dir>$PROJECT_DIR$/app</dir>
</dirStrings>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@ -2238,24 +2257,26 @@
<list> <list>
<option value="$PROJECT_DIR$/app/build.gradle" /> <option value="$PROJECT_DIR$/app/build.gradle" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/LoginActivity.kt" /> <option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/LoginActivity.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/RegisterActivity.kt" /> <option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/RegisterActivity.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt" /> <option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Videos.kt" />
<option value="$PROJECT_DIR$/build.gradle" /> <option value="$PROJECT_DIR$/build.gradle" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt" />
<option value="$PROJECT_DIR$/app/src/main/res/layout/content_main.xml" /> <option value="$PROJECT_DIR$/app/src/main/res/layout/content_main.xml" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt" /> <option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt" />
<option value="$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml" /> <option value="$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/models/TokenModel.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/Database.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt" />
<option value="$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds" extendedState="6"> <component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="10" /> <option name="x" value="189" />
<option name="y" value="51" /> <option name="y" value="31" />
<option name="width" value="1260" /> <option name="width" value="1258" />
<option name="height" value="729" /> <option name="height" value="727" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="AndroidView" proportions="" version="1"> <navigator currentView="AndroidView" proportions="" version="1">
@ -2272,10 +2293,6 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="ProjectPane" />
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="Scratches" />
<pane id="AndroidView"> <pane id="AndroidView">
<subPane> <subPane>
<expand> <expand>
@ -2283,6 +2300,11 @@
<item name="p2play" type="1abcf292:AndroidViewProjectNode" /> <item name="p2play" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" /> <item name="app" type="feadf853:AndroidModuleNode" />
</path> </path>
<path>
<item name="p2play" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" />
<item name="manifests" type="f94875db:AndroidManifestsGroupNode" />
</path>
<path> <path>
<item name="p2play" type="1abcf292:AndroidViewProjectNode" /> <item name="p2play" type="1abcf292:AndroidViewProjectNode" />
<item name="app" type="feadf853:AndroidModuleNode" /> <item name="app" type="feadf853:AndroidModuleNode" />
@ -2305,14 +2327,14 @@
<item name="res" type="d4f16f75:AndroidResFolderNode" /> <item name="res" type="d4f16f75:AndroidResFolderNode" />
<item name="layout" type="ddeffd01:AndroidResFolderTypeNode" /> <item name="layout" type="ddeffd01:AndroidResFolderTypeNode" />
</path> </path>
<path>
<item name="p2play" type="1abcf292:AndroidViewProjectNode" />
<item name="Gradle Scripts" type="ae0cef3a:AndroidBuildScriptsGroupNode" />
</path>
</expand> </expand>
<select /> <select />
</subPane> </subPane>
</pane> </pane>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="Scratches" />
<pane id="ProjectPane" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
@ -2498,15 +2520,16 @@
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3276923" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3276923" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Logcat" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21538462" sideWeight="0.49676898" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Logcat" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2923077" sideWeight="0.49676898" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1631664" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.1631664" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Build" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.30461538" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Build" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.30461538" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25384617" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Device File Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" /> <window_info id="Device File Explorer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Theme Preview" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@ -2517,17 +2540,72 @@
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32838285" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32838285" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout> </layout>
</component> </component>
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager /> <breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="kotlin-line">
<url>file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt</url>
<line>76</line>
<properties />
<option name="timeStamp" value="5" />
</line-breakpoint>
</breakpoints>
<option name="time" value="6" />
</breakpoint-manager>
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml">
<provider selected="true" editor-type-id="android-designer2">
<state />
</provider>
<provider editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml">
<provider selected="true" editor-type-id="android-designer2">
<state />
</provider>
<provider editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="195">
<caret line="13" column="42" lean-forward="false" selection-start-line="13" selection-start-column="42" selection-end-line="13" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1440">
<caret line="96" column="13" lean-forward="false" selection-start-line="96" selection-start-column="13" selection-end-line="96" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="19" column="26" lean-forward="false" selection-start-line="19" selection-start-column="26" selection-end-line="19" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml"> <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165"> <state relative-caret-position="165">
@ -2611,30 +2689,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="167">
<caret line="76" column="0" lean-forward="false" selection-start-line="76" selection-start-column="0" selection-end-line="76" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/LoginActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="167">
<caret line="43" column="0" lean-forward="false" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="15" column="99" lean-forward="false" selection-start-line="15" selection-start-column="90" selection-end-line="15" selection-end-column="99" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/RegisterActivity.kt"> <entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/RegisterActivity.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="383"> <state relative-caret-position="383">
@ -2651,14 +2705,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-300">
<caret line="20" column="24" lean-forward="false" selection-start-line="20" selection-start-column="24" selection-end-line="20" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/build.gradle"> <entry file="file://$PROJECT_DIR$/build.gradle">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150"> <state relative-caret-position="150">
@ -2675,30 +2721,6 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="19" column="26" lean-forward="false" selection-start-line="19" selection-start-column="26" selection-end-line="19" selection-end-column="26" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="360">
<caret line="96" column="13" lean-forward="false" selection-start-line="96" selection-start-column="13" selection-end-line="96" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="13" column="42" lean-forward="false" selection-start-line="13" selection-start-column="42" selection-end-line="13" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml"> <entry file="file://$PROJECT_DIR$/app/src/main/res/layout/activity_reproductor.xml">
<provider editor-type-id="text-editor"> <provider editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
@ -2710,16 +2732,88 @@
<state /> <state />
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml"> <entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ReproductorActivity.kt">
<provider editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136"> <state relative-caret-position="15">
<caret line="11" column="39" lean-forward="false" selection-start-line="11" selection-start-column="25" selection-end-line="11" selection-end-column="39" /> <caret line="13" column="42" lean-forward="false" selection-start-line="13" selection-start-column="42" selection-end-line="13" selection-end-column="42" />
<folding /> <folding />
</state> </state>
</provider> </provider>
<provider selected="true" editor-type-id="android-designer2"> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ManagerSingleton.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="300">
<caret line="20" column="24" lean-forward="true" selection-start-line="20" selection-start-column="24" selection-end-line="20" selection-end-column="24" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/models/TokenModel.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="30">
<caret line="2" column="16" lean-forward="false" selection-start-line="2" selection-start-column="6" selection-end-line="2" selection-end-column="16" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/Database.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="259">
<caret line="66" column="31" lean-forward="false" selection-start-line="66" selection-start-column="31" selection-end-line="66" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/LoginActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="47">
<caret line="44" column="11" lean-forward="false" selection-start-line="44" selection-start-column="11" selection-end-line="67" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Auth.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="153">
<caret line="76" column="12" lean-forward="false" selection-start-line="76" selection-start-column="12" selection-end-line="76" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/layout/content_main.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
<caret line="10" column="49" lean-forward="false" selection-start-line="10" selection-start-column="31" selection-end-line="10" selection-end-column="49" />
<folding />
</state>
</provider>
<provider editor-type-id="android-designer2">
<state /> <state />
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/MainActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2325">
<caret line="191" column="58" lean-forward="false" selection-start-line="191" selection-start-column="58" selection-end-line="191" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/ajax/Client.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="23" column="66" lean-forward="false" selection-start-line="23" selection-start-column="66" selection-end-line="23" selection-end-column="66" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/org/libre/agosto/p2play/HostActivity.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="375">
<caret line="68" column="12" lean-forward="false" selection-start-line="68" selection-start-column="12" selection-end-line="68" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</component> </component>
</project> </project>

View File

@ -13,7 +13,7 @@ class Database(context:Context): SQLiteOpenHelper(context,"p2play",null,1) {
private val dbUsers = "CREATE TABLE users(id INTEGER PRIMARY KEY AUTOINCREMENT, uuid INTEGER, username varchar(30), " + private val dbUsers = "CREATE TABLE users(id INTEGER PRIMARY KEY AUTOINCREMENT, uuid INTEGER, username varchar(30), " +
"nsfw INTEGER, email string, followers INTEGER, avatar string, status integer)" "nsfw INTEGER, email string, followers INTEGER, avatar string, status integer)"
private val dbTokens = "CREATE TABLE tokens(id INTEGER PRIMARY KEY AUTOINCREMENT, token STRING, status INTEGER)" private val dbTokens = "CREATE TABLE tokens(id INTEGER PRIMARY KEY AUTOINCREMENT, token STRING, refresh_token STRING, status INTEGER)"
override fun onCreate(db: SQLiteDatabase?) { override fun onCreate(db: SQLiteDatabase?) {
db?.execSQL(dbUsers) db?.execSQL(dbUsers)
db?.execSQL(dbTokens) db?.execSQL(dbTokens)
@ -30,6 +30,7 @@ class Database(context:Context): SQLiteOpenHelper(context,"p2play",null,1) {
this.closeTokens() this.closeTokens()
val newToken=ContentValues() val newToken=ContentValues()
newToken.put("token", token.token) newToken.put("token", token.token)
newToken.put("refresh_token", token.refresh_token)
newToken.put("status", token.status) newToken.put("status", token.status)
db.insert("tokens",null,newToken) db.insert("tokens",null,newToken)
@ -63,6 +64,7 @@ class Database(context:Context): SQLiteOpenHelper(context,"p2play",null,1) {
cursor.moveToFirst() cursor.moveToFirst()
token.token = cursor.getString(cursor.getColumnIndex("token")).toString() token.token = cursor.getString(cursor.getColumnIndex("token")).toString()
token.refresh_token = cursor.getString(cursor.getColumnIndex("refresh_token")).toString()
token.status = cursor.getString(cursor.getColumnIndex("status")).toInt() token.status = cursor.getString(cursor.getColumnIndex("status")).toInt()
cursor.close() cursor.close()

View File

@ -9,12 +9,13 @@ import android.os.Looper
import android.preference.PreferenceManager import android.preference.PreferenceManager
import android.util.Log import android.util.Log
import kotlinx.android.synthetic.main.activity_host.* import kotlinx.android.synthetic.main.activity_host.*
import org.libre.agosto.p2play.ajax.Auth
import org.libre.agosto.p2play.ajax.Client import org.libre.agosto.p2play.ajax.Client
class HostActivity : AppCompatActivity() { class HostActivity : AppCompatActivity() {
lateinit var settings: SharedPreferences lateinit var settings: SharedPreferences
lateinit var editor: SharedPreferences.Editor lateinit var editor: SharedPreferences.Editor
val client:Client = Client() val client:Auth = Auth()
val _db = Database(this) val _db = Database(this)
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
@ -44,15 +45,30 @@ class HostActivity : AppCompatActivity() {
fun checkUser(){ fun checkUser(){
val token = _db.getToken() val token = _db.getToken()
val user = _db.getUser() val user = _db.getUser()
if(token.status == 1 && user.status==1){ AsyncTask.execute {
if (Looper.myLooper() == null)
Looper.prepare()
if (token.status == 1 && user.status == 1) {
startApp()
val client_id = settings.getString("client_id", "")
val client_secret = settings.getString("client_secret", "")
val newToken = client.refreshToken(token, client_id, client_secret)
when (token.status.toString()) {
"1" -> {
_db.newToken(newToken)
ManagerSingleton.token = newToken
ManagerSingleton.user = user ManagerSingleton.user = user
ManagerSingleton.token = token
} }
else{ else -> _db.logout()
}
} else {
_db.logout() _db.logout()
} }
startApp() this.finish()
}
} }
fun saveHost(host: String){ fun saveHost(host: String){
@ -95,8 +111,6 @@ class HostActivity : AppCompatActivity() {
runOnUiThread { runOnUiThread {
val intent = Intent(ManagerSingleton.context,MainActivity::class.java) val intent = Intent(ManagerSingleton.context,MainActivity::class.java)
startActivity(intent) startActivity(intent)
this.finish()
} }
} }
} }

View File

@ -100,6 +100,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// Last videos // Last videos
fun getLastVideos(){ fun getLastVideos(){
swipeContainer.isRefreshing = true
section = "last" section = "last"
setTitle(R.string.title_recent) setTitle(R.string.title_recent)
AsyncTask.execute { AsyncTask.execute {
@ -112,6 +113,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
// //
fun getPopularVideos(){ fun getPopularVideos(){
swipeContainer.isRefreshing = true
section = "popular" section = "popular"
setTitle(R.string.title_popular) setTitle(R.string.title_popular)
AsyncTask.execute { AsyncTask.execute {
@ -123,6 +125,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
} }
fun getLocalVideos(){ fun getLocalVideos(){
swipeContainer.isRefreshing = true
section = "local" section = "local"
setTitle(R.string.title_local) setTitle(R.string.title_local)
AsyncTask.execute { AsyncTask.execute {
@ -134,6 +137,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
} }
fun getMyVideos(){ fun getMyVideos(){
swipeContainer.isRefreshing = true
section = "my_videos" section = "my_videos"
setTitle(R.string.title_myVideos) setTitle(R.string.title_myVideos)
AsyncTask.execute { AsyncTask.execute {
@ -245,6 +249,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
myMenu.findItem(R.id.action_login).isVisible = true myMenu.findItem(R.id.action_login).isVisible = true
myMenu.findItem(R.id.action_logout).isVisible = false myMenu.findItem(R.id.action_logout).isVisible = false
} }
side_usernameTxt?.text = getString(R.string.nav_header_title) side_usernameTxt?.text = getString(R.string.nav_header_title)
side_emailTxt?.text = getString(R.string.nav_header_subtitle) side_emailTxt?.text = getString(R.string.nav_header_subtitle)
side_imageView?.setImageResource(R.mipmap.ic_launcher_round) side_imageView?.setImageResource(R.mipmap.ic_launcher_round)
@ -252,6 +257,7 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte
_db.logout() _db.logout()
ManagerSingleton.logout() ManagerSingleton.logout()
this.refresh()
ManagerSingleton.Toast(getString(R.string.logout_msg)) ManagerSingleton.Toast(getString(R.string.logout_msg))
} }

View File

@ -27,7 +27,8 @@ class Auth: Client() {
while(data.hasNext()){ while(data.hasNext()){
val k = data.nextName() val k = data.nextName()
when(k.toString()){ when(k.toString()){
"access_token" -> token.token = "Bearer " + data.nextString() "access_token" -> token.token = data.nextString()
"refresh_token" -> token.refresh_token = data.nextString()
else -> data.skipValue() else -> data.skipValue()
} }
} }
@ -69,6 +70,43 @@ class Auth: Client() {
} }
fun refreshToken(token: TokenModel, client_id: String, client_secret: String): TokenModel{
var con = this._newCon("users/token", "POST", token.token)
val params:String = "refresh_token=${token.refresh_token}&response_type=code&grant_type=refresh_token&client_id=$client_id&client_secret=$client_secret"
con.outputStream.write(params.toByteArray())
var token = TokenModel()
try {
if(con.responseCode==200){
var response = InputStreamReader(con.inputStream)
var data = JsonReader(response)
data.beginObject()
while(data.hasNext()){
val k = data.nextName()
when(k.toString()){
"access_token" -> token.token = data.nextString()
"refresh_token" -> token.refresh_token = data.nextString()
else -> data.skipValue()
}
}
data.endObject()
token.status = 1
}
else{
Log.d("Status", con.responseMessage)
}
}
catch (err: Exception){
err.printStackTrace()
token.status = 0
}
return token
}
fun me(token: String): UserModel{ fun me(token: String): UserModel{
var con = this._newCon("users/me","GET", token) var con = this._newCon("users/me","GET", token)

View File

@ -21,7 +21,7 @@ open class Client {
con.setRequestProperty("Accept", "*/*") con.setRequestProperty("Accept", "*/*")
if(token != ""){ if(token != ""){
con.setRequestProperty("Authorization", token) con.setRequestProperty("Authorization", "Bearer ${token}")
} }
con.requestMethod=method con.requestMethod=method

View File

@ -2,5 +2,6 @@ package org.libre.agosto.p2play.models
class TokenModel ( class TokenModel (
var token: String = "", var token: String = "",
var refresh_token: String = "",
var status: Int = -1 var status: Int = -1
) )