Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InstiApp
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RAHUL SHARMA
InstiApp
Commits
922d915b
Commit
922d915b
authored
Aug 02, 2018
by
Sajal Narang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement deep links for events
parent
eaa478ab
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
2 deletions
+47
-2
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+25
-2
app/src/main/java/app/insti/MainActivity.java
app/src/main/java/app/insti/MainActivity.java
+22
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
922d915b
...
@@ -24,7 +24,8 @@
...
@@ -24,7 +24,8 @@
<meta-data
<meta-data
android:name=
"com.google.firebase.messaging.default_notification_icon"
android:name=
"com.google.firebase.messaging.default_notification_icon"
android:resource=
"@drawable/ic_lotusgray"
/>
android:resource=
"@drawable/ic_lotusgray"
/>
<meta-data
android:name=
"com.google.firebase.messaging.default_notification_color"
<meta-data
android:name=
"com.google.firebase.messaging.default_notification_color"
android:resource=
"@color/colorPrimary"
/>
android:resource=
"@color/colorPrimary"
/>
<activity
<activity
...
@@ -61,6 +62,17 @@
...
@@ -61,6 +62,17 @@
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
android:scheme=
"https"
android:host=
"insti.app"
android:pathPattern=
"/event/.*"
/>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
<data
android:scheme=
"http"
android:scheme=
"http"
android:host=
"insti.app"
android:host=
"insti.app"
...
@@ -77,6 +89,17 @@
...
@@ -77,6 +89,17 @@
android:host=
"insti.app"
android:host=
"insti.app"
android:pathPattern=
"/user/.*"
/>
android:pathPattern=
"/user/.*"
/>
</intent-filter>
</intent-filter>
<intent-filter>
<action
android:name=
"android.intent.action.VIEW"
/>
<category
android:name=
"android.intent.category.DEFAULT"
/>
<category
android:name=
"android.intent.category.BROWSABLE"
/>
<data
android:scheme=
"http"
android:host=
"insti.app"
android:pathPattern=
"/event/.*"
/>
</intent-filter>
</activity>
</activity>
<activity
<activity
android:name=
".LoginActivity"
android:name=
".LoginActivity"
...
@@ -118,7 +141,7 @@
...
@@ -118,7 +141,7 @@
<meta-data
<meta-data
android:name=
"com.google.firebase.messaging.default_notification_channel_id"
android:name=
"com.google.firebase.messaging.default_notification_channel_id"
android:value=
"@string/default_notification_channel_id"
/>
android:value=
"@string/default_notification_channel_id"
/>
</application>
</application>
...
...
app/src/main/java/app/insti/MainActivity.java
View file @
922d915b
...
@@ -168,6 +168,24 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -168,6 +168,24 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case
"user"
:
case
"user"
:
ProfileFragment
profileFragment
=
ProfileFragment
.
newInstance
(
getID
(
appLinkData
));
ProfileFragment
profileFragment
=
ProfileFragment
.
newInstance
(
getID
(
appLinkData
));
updateFragment
(
profileFragment
);
updateFragment
(
profileFragment
);
break
;
case
"event"
:
RetrofitInterface
retrofitInterface
=
ServiceGenerator
.
createService
(
RetrofitInterface
.
class
);
retrofitInterface
.
getEvent
(
getSessionIDHeader
(),
getID
(
appLinkData
)).
enqueue
(
new
Callback
<
Event
>()
{
@Override
public
void
onResponse
(
Call
<
Event
>
call
,
Response
<
Event
>
response
)
{
EventFragment
eventFragment
=
new
EventFragment
();
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
Constants
.
EVENT_JSON
,
response
.
body
().
toString
());
eventFragment
.
setArguments
(
bundle
);
updateFragment
(
eventFragment
);
}
@Override
public
void
onFailure
(
Call
<
Event
>
call
,
Throwable
t
)
{
}
});
}
}
}
}
}
}
...
@@ -180,6 +198,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -180,6 +198,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"org"
)
+
4
);
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"org"
)
+
4
);
case
"user"
:
case
"user"
:
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"user"
)
+
5
);
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"user"
)
+
5
);
case
"event"
:
return
appLinkData
.
substring
(
appLinkData
.
indexOf
(
"event"
)
+
6
);
}
}
return
null
;
return
null
;
}
}
...
@@ -189,6 +209,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
...
@@ -189,6 +209,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
return
"body"
;
return
"body"
;
}
else
if
(
appLinkData
.
startsWith
(
"http://insti.app/user/"
)
||
appLinkData
.
startsWith
(
"https://insti.app/user/"
))
{
}
else
if
(
appLinkData
.
startsWith
(
"http://insti.app/user/"
)
||
appLinkData
.
startsWith
(
"https://insti.app/user/"
))
{
return
"user"
;
return
"user"
;
}
else
if
(
appLinkData
.
startsWith
(
"http://insti.app/event/"
)
||
appLinkData
.
startsWith
(
"https://insti.app/event/"
))
{
return
"event"
;
}
}
return
null
;
return
null
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment