Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #658

Merged
merged 380 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
380 commits
Select commit Hold shift + click to select a range
c943783
Update schema.sql
EmreBatuhan Dec 18, 2023
f140c02
Merge pull request #576 from bounswe/backend/feature/get-opened-polls
EmreBatuhan Dec 18, 2023
86ac4c3
Merge pull request #577 from bounswe/frontend/feature/moderatorUI_and…
enfurars Dec 19, 2023
d24de82
create edit profile api
aemresafak Dec 19, 2023
097c8fd
create editprofile vm
aemresafak Dec 19, 2023
aa25ba7
backe nd
aemresafak Dec 19, 2023
654e15a
added comment and report functionality
Dec 19, 2023
713f1dc
fix profile
aemresafak Dec 19, 2023
b49da91
added comment, share and report pop-up and implemented modal context …
selinisik Dec 19, 2023
390b25b
Merge pull request #578 from bounswe/mobile/feature/edit-profile
YigitSekerci Dec 19, 2023
7681aff
implemented guest user functionalities
selinisik Dec 19, 2023
ccc6902
Merge branch 'frontend/feature/pop-up' into frontend/feature/guestUser
selinisik Dec 19, 2023
42b0881
fixed poll card guest mechanism
selinisik Dec 19, 2023
6d584b8
Update index.jsx
AliNasra Dec 19, 2023
884638c
tag selection UI
enfurars Dec 19, 2023
fe917eb
Merge pull request #572 from bounswe/Annotation-UI
AliNasra Dec 19, 2023
4268e54
updated UI in selected tags
selinisik Dec 19, 2023
f8b774a
Add isMod data to profile response
EmreBatuhan Dec 19, 2023
6eb4d5c
Update package.json
AliNasra Dec 19, 2023
645a040
Update index.jsx
AliNasra Dec 19, 2023
2115159
Update package-lock.json
AliNasra Dec 19, 2023
3a843aa
Merge branch 'frontend/development' into frontend/feature/pop-up
selinisik Dec 19, 2023
6e6bb71
Merge branch 'frontend/development' into frontend/feature/guestUser
selinisik Dec 19, 2023
32a5935
Resolving conflicts and errors
AliNasra Dec 19, 2023
42cd016
Merge pull request #588 from bounswe/frontend/feature/moderation_tag_UI
AliNasra Dec 19, 2023
00b0293
Merge branch 'frontend/development' into frontend/feature/pop-up
AliNasra Dec 19, 2023
199b02d
Merge pull request #586 from bounswe/frontend/feature/pop-up
selinisik Dec 19, 2023
d1150ab
Merge branch 'frontend/development' into frontend/feature/guestUser
selinisik Dec 19, 2023
687ecde
Merge pull request #587 from bounswe/frontend/feature/guestUser
selinisik Dec 19, 2023
f7a67ea
moderation pages backend connection
enfurars Dec 20, 2023
7d01981
backend connection updates
enfurars Dec 20, 2023
5685a55
added moderation request and jury page route structure
selinisik Dec 21, 2023
35abf9e
created final jury page and jury modal
selinisik Dec 22, 2023
eaa4a62
Merge pull request #599 from bounswe/frontend/feature/moderation_not_…
AliNasra Dec 22, 2023
223e65b
update docker
Sefik-Palazoglu Dec 22, 2023
3485219
add readme
Sefik-Palazoglu Dec 22, 2023
71d457f
accept ld+json
Sefik-Palazoglu Dec 22, 2023
847685a
Implementation of leaderboard data
AliNasra Dec 22, 2023
8d80e73
fix typo bug
Sefik-Palazoglu Dec 22, 2023
ea23087
send as jsonld
Sefik-Palazoglu Dec 22, 2023
ce05591
allow empty affix
Sefik-Palazoglu Dec 22, 2023
9586c32
A small name change
EmreBatuhan Dec 22, 2023
2dbf52c
New methods to handle point distribution
EmreBatuhan Dec 22, 2023
83ed915
Update pollCloseRoutine.js
EmreBatuhan Dec 22, 2023
986826f
Update schema.sql
EmreBatuhan Dec 22, 2023
bb8be74
Merge pull request #604 from bounswe/backend/feature/jury-rewards
EmreBatuhan Dec 22, 2023
57c123f
Merge pull request #602 from bounswe/backend/feature/annotationDocker
Sefik-Palazoglu Dec 22, 2023
2d1ba5f
make examples realistic
Sefik-Palazoglu Dec 22, 2023
1ef70fe
remove unnecessary log
Sefik-Palazoglu Dec 22, 2023
bd5a95b
fix AnnotationPost
Sefik-Palazoglu Dec 22, 2023
cd5f7dc
make get response examples consistent
Sefik-Palazoglu Dec 22, 2023
68bff8e
add default annotation id
Sefik-Palazoglu Dec 22, 2023
d8961c7
fix default parameters
Sefik-Palazoglu Dec 22, 2023
78ad14b
Add new continuous poll grading methods
EmreBatuhan Dec 22, 2023
1fdd2d5
Update pollCloseRoutine.js
EmreBatuhan Dec 22, 2023
f9cd03f
Update schema.sql
EmreBatuhan Dec 22, 2023
c0c9718
Merge pull request #606 from bounswe/backend/feature/continuous-poll-…
EmreBatuhan Dec 22, 2023
76697fb
Merge pull request #607 from bounswe/backend/improvement/annoSwagger
Sefik-Palazoglu Dec 22, 2023
b447c5b
Bug fix
AliNasra Dec 23, 2023
f9be831
Update ProfileDB.js
AliNasra Dec 23, 2023
47f79a2
Update ProfileRouter.js
AliNasra Dec 23, 2023
95fe60f
Update ProfileDB.js
AliNasra Dec 23, 2023
c758b52
Update ProfileRouter.js
AliNasra Dec 23, 2023
7f34a99
implement share'
aemresafak Dec 23, 2023
bb1b5bb
remove unnecessary import
Sefik-Palazoglu Dec 23, 2023
480fb93
remove unnecessary import
Sefik-Palazoglu Dec 23, 2023
6117a8b
add basic test
Sefik-Palazoglu Dec 23, 2023
fd3b707
fix close error
Sefik-Palazoglu Dec 23, 2023
d8304bf
add test for getAnnotationWithId
Sefik-Palazoglu Dec 23, 2023
3571717
bring in ObjectID again
Sefik-Palazoglu Dec 23, 2023
4e13cd7
fix close error
Sefik-Palazoglu Dec 23, 2023
d7316e8
add create test
Sefik-Palazoglu Dec 23, 2023
16134c9
remove patch function
Sefik-Palazoglu Dec 23, 2023
abb58cc
add test
Sefik-Palazoglu Dec 23, 2023
51bbc11
add delete test
Sefik-Palazoglu Dec 23, 2023
ea5e0b9
fix close error
Sefik-Palazoglu Dec 23, 2023
78a95ce
add delete test
Sefik-Palazoglu Dec 23, 2023
80528d5
add delete test
Sefik-Palazoglu Dec 23, 2023
4ab5fe5
create forgot password ui
aemresafak Dec 23, 2023
7e6d136
Move request creation to moderator service
Dec 23, 2023
755475d
Remove unnecessary console.logs
Dec 23, 2023
e9fb0df
Update schema.sql
Dec 23, 2023
7d36c66
Merge pull request #611 from bounswe/backend/feature/jury-request-cle…
EmreBatuhan Dec 23, 2023
558f090
implemet reset password
aemresafak Dec 23, 2023
bc7e24d
Implement Distribution of Domain Point Logic
Dec 23, 2023
f7d6672
Merge pull request #613 from bounswe/backend/feature/reward-domain-point
EmreBatuhan Dec 23, 2023
d83afc5
Merge branch 'backend/development' into backend/feature/poll-closing-…
EmreBatuhan Dec 23, 2023
48426f7
Update ProfileRouter.js
AliNasra Dec 23, 2023
9e6439f
Merge pull request #603 from bounswe/backend-development-feature-lead…
AliNasra Dec 23, 2023
5fa61dd
Create .env
AliNasra Dec 23, 2023
9061788
Merge pull request #610 from bounswe/backend/feature/annotationTest
Sefik-Palazoglu Dec 23, 2023
4eb5c5b
Merge pull request #609 from bounswe/feature/share
YigitSekerci Dec 23, 2023
af15f74
Add Semantic Db
Dec 23, 2023
09da987
A small fix in schema
Dec 23, 2023
fdd5e65
Merge pull request #616 from bounswe/backend/feature/semantic-db
Sefik-Palazoglu Dec 23, 2023
d76f745
add semantic search function
Sefik-Palazoglu Dec 23, 2023
a953d8d
Merge pull request #612 from bounswe/feature/forgot-password
aemresafak Dec 23, 2023
7c7a600
Merge branch 'mobile/development' of https://github.com/bounswe/bouns…
aemresafak Dec 23, 2023
88a71d7
implement follow
aemresafak Dec 23, 2023
7f5b3c7
add router
Sefik-Palazoglu Dec 23, 2023
76b2d84
add router service
Sefik-Palazoglu Dec 23, 2023
6e07c04
implement router service
Sefik-Palazoglu Dec 23, 2023
88485a3
Merge pull request #618 from bounswe/backend/feature/semanticRequest
Sefik-Palazoglu Dec 23, 2023
58d26e3
implement followers and followed counts
aemresafak Dec 23, 2023
fc3f25e
implement follow unfollow
aemresafak Dec 23, 2023
00213b6
add route
Sefik-Palazoglu Dec 23, 2023
c7e9552
implement inserTag
Sefik-Palazoglu Dec 23, 2023
8335a75
Merge pull request #619 from bounswe/backend/feature/semanticInsert
Sefik-Palazoglu Dec 23, 2023
b27e618
Improvement
AliNasra Dec 23, 2023
ce0313e
Update ProfileDB.js
AliNasra Dec 23, 2023
75110dd
Update schedule time
Dec 23, 2023
a4b6df0
Merge pull request #614 from bounswe/backend/feature/poll-closing-&-g…
EmreBatuhan Dec 23, 2023
ecfc130
Update ProfileDB.js
AliNasra Dec 23, 2023
25b75af
add semantic search endpoint
Sefik-Palazoglu Dec 23, 2023
bc2126a
tag the swagger doc
Sefik-Palazoglu Dec 23, 2023
f296aeb
Merge pull request #620 from bounswe/backend/feature/semanticPollSearch
Sefik-Palazoglu Dec 23, 2023
37139b7
Fixes
AliNasra Dec 23, 2023
e064a42
fix typo
Sefik-Palazoglu Dec 23, 2023
4ef2c7a
implement moderation screen list page ui
YigitSekerci Dec 12, 2023
d76a381
move moderation list screen to new package
YigitSekerci Dec 19, 2023
da704c7
implement moderation apply screen
YigitSekerci Dec 19, 2023
c75d073
add moderation vote screen navigation
YigitSekerci Dec 22, 2023
46c446e
add moderation end points
YigitSekerci Dec 22, 2023
9d48dae
implmenet moderation use cases
YigitSekerci Dec 23, 2023
f8b76fd
implement moderation apply screen with backend
YigitSekerci Dec 23, 2023
3e5ebfd
add log to base repository
YigitSekerci Dec 23, 2023
08ee36e
implement initial backend requests in moderation list page
YigitSekerci Dec 23, 2023
1e3e741
improve moderation list page ui
YigitSekerci Dec 23, 2023
f1ecc99
improve moderation page poll ui
YigitSekerci Dec 23, 2023
f16b43e
implement moderator vote screen
YigitSekerci Dec 23, 2023
a835631
optimize import
YigitSekerci Dec 23, 2023
0ce8b80
updated logo
selinisik Dec 23, 2023
da141ae
Update ModeratorService.js
Dec 24, 2023
b815e62
Merge pull request #622 from bounswe/backend/feature/poll-closing-&-g…
EmreBatuhan Dec 24, 2023
bf80911
Update index.jsx
AliNasra Dec 24, 2023
b9c5774
Bug fix
Dec 24, 2023
b585428
Merge pull request #624 from bounswe/backend/feature/poll-closing-&-g…
EmreBatuhan Dec 24, 2023
2263312
Merge pull request #621 from bounswe/mobile/feature/moderation-new
YigitSekerci Dec 24, 2023
1b50076
added poll tag modal
selinisik Dec 24, 2023
a5ed0a6
Added creator image
Dec 24, 2023
919cc10
Merge pull request #625 from bounswe/backend/feature/poll-creator-image
EmreBatuhan Dec 24, 2023
592ef29
implement annotation data and domain layer
YigitSekerci Dec 24, 2023
975933f
Unit tests for not-moderator page
enfurars Dec 24, 2023
312f1c8
added swagger for report and comment
Dec 24, 2023
def6720
implement text toolbar for annotations
YigitSekerci Dec 24, 2023
affc0ba
add annotation fetch functionality to profiles
YigitSekerci Dec 24, 2023
d20ad1b
add annotation fetch functionality to poll vote page
YigitSekerci Dec 24, 2023
7f084f2
Merge branch 'backend/development' into backend/feature/pollreport
EmreBatuhan Dec 24, 2023
ef6afca
Merge pull request #627 from bounswe/backend/feature/pollreport
simsekhebun Dec 24, 2023
51fedfc
bugfix
Sefik-Palazoglu Dec 24, 2023
e868f0b
improve poll vote UI
YigitSekerci Dec 24, 2023
a4d8a9c
added other user poll data
selinisik Dec 24, 2023
e6d7228
Bugfix: wrong router function
Sefik-Palazoglu Dec 24, 2023
213c460
Merge pull request #626 from bounswe/frontend/test/moderation-not-mod…
AliNasra Dec 24, 2023
2b819e9
add tag select to create poll
selinisik Dec 24, 2023
ba82022
moderation request is added
selinisik Dec 24, 2023
6d5bd01
Merge branch 'frontend/development' into frontend/feature/moderationF…
selinisik Dec 24, 2023
5e74a40
add annotatabletexts poll details
YigitSekerci Dec 24, 2023
7e1174b
Merge branch 'frontend/feature/poll-tag' into frontend/feature/commen…
selinisik Dec 24, 2023
90e9eb7
Add annotation list to the vote page
YigitSekerci Dec 25, 2023
ff56ca2
removed unused routes
YigitSekerci Dec 25, 2023
11cc65c
add follower check
aemresafak Dec 25, 2023
c6d85b0
implement report system for poll details
YigitSekerci Dec 25, 2023
89acd64
Merge pull request #632 from bounswe/improvement/follow
YigitSekerci Dec 25, 2023
e6469b9
implement comment system in poll detail
YigitSekerci Dec 25, 2023
050f54e
added follow requests
selinisik Dec 25, 2023
c0dffd1
Update schema.sql
Dec 25, 2023
4d7d1ca
Leaderboard Implementation and Modal in Sign-Up page
AliNasra Dec 25, 2023
910d588
Update Router.jsx
AliNasra Dec 25, 2023
ee42b29
Update Router.jsx
AliNasra Dec 25, 2023
445daee
Update Router.jsx
AliNasra Dec 25, 2023
a31d652
fix photo not being uploaded
aemresafak Dec 25, 2023
120e244
Merge branch 'backend/development' of https://github.com/bounswe/boun…
AliNasra Dec 25, 2023
3ecf171
unit test for rendering moderation with mock data
enfurars Dec 25, 2023
9d8e122
implement leaderboard backend integration
YigitSekerci Dec 25, 2023
e04d0e2
fix comment fetch mechanism
YigitSekerci Dec 25, 2023
fa17201
Update ProfileDB.js
AliNasra Dec 25, 2023
e852b2e
Merge pull request #636 from bounswe/backend-follow-bug_fix
AliNasra Dec 25, 2023
566405f
Merge pull request #635 from bounswe/frontend/test/not-jury-page
AliNasra Dec 25, 2023
6f5eb92
isHidden Fix
Dec 25, 2023
5a45b57
leaderboard Profile photo
Dec 25, 2023
3e358ae
Add profile image to get poll id
Dec 25, 2023
0d1d1f8
make comments annotatable
YigitSekerci Dec 25, 2023
c9e889c
Merge pull request #639 from bounswe/backend/fix/isHidden
EmreBatuhan Dec 25, 2023
6113467
added report request
selinisik Dec 25, 2023
2bbfb2e
Error fixes
AliNasra Dec 25, 2023
92a24a9
Updated the sql query for get comments
Dec 25, 2023
a753eb6
Merge pull request #641 from bounswe/backend/feature/pollcomment
simsekhebun Dec 25, 2023
f3e57bf
fix annotation post
YigitSekerci Dec 25, 2023
b9180ac
improve annotation dialog UI
YigitSekerci Dec 25, 2023
19ab7f9
bugfix db connections
Sefik-Palazoglu Dec 25, 2023
5174e36
Merge branch 'backend/development' of https://github.com/bounswe/boun…
Sefik-Palazoglu Dec 25, 2023
3e08a02
bugfix moderatorDB
Sefik-Palazoglu Dec 25, 2023
b8042ba
Mod request filterization
Dec 25, 2023
4b9158b
Merge pull request #642 from bounswe/backend/fix/isHidden
EmreBatuhan Dec 25, 2023
b771e54
improve leaderboard tag selection
YigitSekerci Dec 25, 2023
7dfea93
change comment model
YigitSekerci Dec 25, 2023
85b194b
added username to comment modal
selinisik Dec 25, 2023
8cd106f
improve poll detail image size
YigitSekerci Dec 25, 2023
af99ad0
Merge pull request #640 from bounswe/return-usernames
Sefik-Palazoglu Dec 25, 2023
ae58c74
improve leaderboard UI
YigitSekerci Dec 25, 2023
d56ba2e
Merge branch 'mobile/development' into mobile/feature/annotations
YigitSekerci Dec 25, 2023
5d759b7
Fix same entry insertion error
Dec 25, 2023
a3df2e6
Merge pull request #645 from bounswe/backend/fix/mod-tags
EmreBatuhan Dec 25, 2023
9a7f3b3
Added the terms of use
AliNasra Dec 25, 2023
553bab0
Merge pull request #628 from bounswe/frontend/feature/poll-tag
AliNasra Dec 25, 2023
6f1fb76
Merge pull request #644 from bounswe/mobile/feature/annotations
aemresafak Dec 25, 2023
310d5c3
Merge pull request #634 from bounswe/bugfix/photo
YigitSekerci Dec 25, 2023
389d9ab
Merge branch 'frontend/development' into frontend/feature/moderationF…
selinisik Dec 25, 2023
adf5781
Merge pull request #629 from bounswe/frontend/feature/moderationFinal…
selinisik Dec 25, 2023
30a7aac
Update index.jsx
AliNasra Dec 25, 2023
5ba558e
Merge branch 'frontend/development' into frontend/feature/comment-bac…
selinisik Dec 25, 2023
f5dec05
Merge pull request #643 from bounswe/frontend/feature/comment-backend…
selinisik Dec 25, 2023
c6c022d
fix typo
YigitSekerci Dec 25, 2023
d633c18
Render images correctly
AliNasra Dec 25, 2023
69719b3
fix follow
aemresafak Dec 25, 2023
ada7e67
Merge branch 'frontend/development' into frontend/feature/follow
selinisik Dec 25, 2023
1ddd3e0
implement semantic search backend requests
YigitSekerci Dec 25, 2023
6bf835d
fix my profile
aemresafak Dec 25, 2023
5e68c57
improve tests
aemresafak Dec 25, 2023
a1238f3
points are shown
aemresafak Dec 25, 2023
3d44c04
Improvements
AliNasra Dec 25, 2023
98290f7
don't assume description or label is present
Sefik-Palazoglu Dec 25, 2023
a4f3664
implement semantic search
YigitSekerci Dec 25, 2023
0aef44b
Merge pull request #646 from bounswe/bugfix/follow
YigitSekerci Dec 25, 2023
d6ac6b6
Merge pull request #647 from bounswe/improvement/points
YigitSekerci Dec 25, 2023
6739548
Merge pull request #648 from bounswe/mobile/feature/semantic-search
selinisik Dec 25, 2023
594ef2e
improve general points box
YigitSekerci Dec 25, 2023
5098b08
change app logos
YigitSekerci Dec 25, 2023
d6cd223
remove buttons from poll UI
YigitSekerci Dec 25, 2023
2a53dd1
added follower and following modals
selinisik Dec 25, 2023
312a8d4
fix profile feed
YigitSekerci Dec 25, 2023
f27cc52
fix profile poll detail navigation
YigitSekerci Dec 25, 2023
eaa23b8
Merge pull request #651 from bounswe/mobile/bugfix/general-fixes
selinisik Dec 25, 2023
83637d4
fix release error
YigitSekerci Dec 25, 2023
6a1ecc0
fix vote screen scroll
YigitSekerci Dec 25, 2023
dea7ba1
Merge pull request #652 from bounswe/mobile/development
selinisik Dec 25, 2023
1ed5a2f
Semantic search backend integration
kutaysaran Dec 25, 2023
6d9c891
Merge pull request #633 from bounswe/Leaderboard-Backend-Connection
selinisik Dec 25, 2023
2b35a15
Merge pull request #653 from bounswe/frontend/feature/semantic-search
selinisik Dec 25, 2023
572e333
fixed the error on signup and moderation pages
enfurars Dec 25, 2023
55cb940
fixed id bug
selinisik Dec 25, 2023
7921f29
Merge pull request #650 from bounswe/frontend/feature/follow
AliNasra Dec 25, 2023
a6b1a62
Merge branch 'frontend/development' into frontend/bug/moderation-tags…
AliNasra Dec 25, 2023
ffb6c8e
Remove auth from profile followers and followed
Dec 25, 2023
77f397c
Merge pull request #654 from bounswe/frontend/bug/moderation-tags-and…
AliNasra Dec 25, 2023
cc9d00a
Create ModeratorService.test.js
Dec 25, 2023
95a4103
Merge pull request #655 from bounswe/backend/feature/moderator-test
EmreBatuhan Dec 25, 2023
501086c
Merge pull request #656 from bounswe/backend/development
Sefik-Palazoglu Dec 25, 2023
fd3cdc0
Merge pull request #657 from bounswe/frontend/development
Sefik-Palazoglu Dec 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion prediction-polls/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- For Android 13 (API level 33) and above -->
<uses-permission
android:name="android.permission.READ_MEDIA_IMAGES"
android:minSdkVersion="33" />

<!-- For below Android 13 -->
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />


<application
Expand All @@ -15,9 +24,9 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:usesCleartextTraffic="true"
android:supportsRtl="true"
android:theme="@style/Theme.PredictionPolls"
android:usesCleartextTraffic="true"
tools:targetApi="31">
<activity
android:name=".MainActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,49 @@ import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Text
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.navigation.NavOptions
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import com.bounswe.predictionpolls.data.remote.TokenManager
import com.bounswe.predictionpolls.ui.common.CommonAppbar
import com.bounswe.predictionpolls.ui.common.NavigationDrawer
import com.bounswe.predictionpolls.ui.create.createPollScreen
import com.bounswe.predictionpolls.ui.editProfile.editProfileScreen
import com.bounswe.predictionpolls.ui.feed.feedScreen
import com.bounswe.predictionpolls.ui.forgotPassword.forgotPasswordScreen
import com.bounswe.predictionpolls.ui.leaderboard.leaderboardScreen
import com.bounswe.predictionpolls.ui.login.loginScreen
import com.bounswe.predictionpolls.ui.main.MAIN_ROUTE
import com.bounswe.predictionpolls.ui.main.mainScreen
import com.bounswe.predictionpolls.ui.main.navigateToMainScreen
import com.bounswe.predictionpolls.ui.moderation.apply.moderationApplyScreen
import com.bounswe.predictionpolls.ui.moderation.list.MODERATION_ROUTE
import com.bounswe.predictionpolls.ui.moderation.list.moderationScreen
import com.bounswe.predictionpolls.ui.moderation.vote.moderationVoteScreen
import com.bounswe.predictionpolls.ui.profile.myProfileScreen
import com.bounswe.predictionpolls.ui.profile.profileScreen
import com.bounswe.predictionpolls.ui.signup.signupScreen
import com.bounswe.predictionpolls.ui.theme.PredictionPollsTheme
import com.bounswe.predictionpolls.ui.vote.pollVoteScreen
import com.bounswe.predictionpolls.utils.NavItem
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import javax.inject.Inject

val EXTRA_ROUTES_WITH_DRAWER = listOf(
MODERATION_ROUTE,
)

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
@Inject
Expand All @@ -43,8 +57,13 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
setContent {
PredictionPollsTheme {
val mainActivityViewModel: MainActivityViewModel = hiltViewModel()
val navController = rememberNavController()
val routesWithDrawer = remember { NavItem.entries.map { it.route }.toSet() }
val routesWithDrawer = remember {
NavItem.entries.map { it.route }.toSet().union(
EXTRA_ROUTES_WITH_DRAWER
)
}
val currentBackStack = navController.currentBackStackEntryAsState()
val currentRoute = rememberUpdatedState(currentBackStack.value?.destination?.route)
val isUserLoggedIn = tokenManager.isLoggedIn.collectAsState(initial = false)
Expand Down Expand Up @@ -83,11 +102,19 @@ class MainActivity : ComponentActivity() {
}
) { toggleDrawerState ->
Column {
val mainState by mainActivityViewModel.state.collectAsStateWithLifecycle()
CommonAppbar(
isVisible = currentRoute.value in routesWithDrawer,
onMenuClick = { toggleDrawerState() },
onNotificationClick = { /*TODO implement notification */ }
points = mainState.points
)

LaunchedEffect(Unit) {
navController.currentBackStackEntryFlow.collectLatest {
mainActivityViewModel.fetchCurrentUserProfile()
}
}

NavHost(navController = navController, startDestination = MAIN_ROUTE) {
mainScreen(navController)
loginScreen(navController)
Expand All @@ -97,14 +124,14 @@ class MainActivity : ComponentActivity() {
createPollScreen()
profileScreen(navController)
pollVoteScreen(navController)

// TODO: Remove placeholders
composable("settings") { Text(text = "Settings Page WIP") }
composable("notifications") { Text(text = "Notifications Page WIP") }
composable("moderation") { Text(text = "Moderation Page WIP") }
myProfileScreen(navController)
editProfileScreen(navController)
forgotPasswordScreen(navController)
moderationApplyScreen(navController)
moderationScreen(navController)
moderationVoteScreen(navController)
}
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.bounswe.predictionpolls

import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.bounswe.predictionpolls.common.Result
import com.bounswe.predictionpolls.domain.profile.GetCurrentUserProfileUseCase
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import javax.inject.Inject


data class MainActivityState(val points: Int? = null)

@HiltViewModel
class MainActivityViewModel @Inject constructor(private val fetchCurrentUserProfileUseCase: GetCurrentUserProfileUseCase) :
ViewModel() {


private val _state = MutableStateFlow(MainActivityState())
val state = _state.asStateFlow()


init {
viewModelScope.launch(Dispatchers.IO) {
fetchCurrentUserProfile()
}
}



suspend fun fetchCurrentUserProfile() {
when (val result = fetchCurrentUserProfileUseCase()) {
is Result.Success -> {
val profileInfo = result.data
_state.update {
it.copy(points = profileInfo.points)
}
}

is Result.Error -> {
// handle error
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.bounswe.predictionpolls.core

import android.util.Log
import java.io.IOException
import retrofit2.HttpException

Expand All @@ -26,6 +27,8 @@ abstract class BaseRepository {
else -> {
IOException("Unexpected error occurred. Please try again.")
}
}.also {
Log.d("BaseRepository", "handleException: ${exception.message}")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.bounswe.predictionpolls.data.editProfile

import com.google.gson.annotations.SerializedName
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.asRequestBody
import retrofit2.http.Body
import retrofit2.http.Multipart
import retrofit2.http.PATCH
import retrofit2.http.POST
import retrofit2.http.Part
import java.io.File


interface EditProfileApi {

@Multipart
@POST("profiles/profilePhoto")
suspend fun uploadProfilePhoto(
@Part image: MultipartBody.Part,
@Part("caption") caption: RequestBody
)

@PATCH("profiles")
suspend fun updateProfile(@Body body: EditProfileRequest)
}


data class EditProfileRequest(
val userId: Int?,
val username: String?,
val email: String?,
@SerializedName("profile_picture")
val profilePicture: String?,
val points: Int?,
val biography: String?,
val birthday: String?,
val isHidden: Boolean?
)

fun prepareFilePart(file: File): RequestBody = file.asRequestBody("image/*".toMediaTypeOrNull())
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.bounswe.predictionpolls.data.editProfile

import android.util.Log
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File
import javax.inject.Inject

class EditProfileRepository @Inject constructor(
private val editProfileApi: EditProfileApi
) {

suspend fun uploadProfilePhoto(file: File, caption: String) {

// Create RequestBody instances for image and caption
val requestFile = RequestBody.create("image/*".toMediaTypeOrNull(), file)
val imageBody = MultipartBody.Part.createFormData("image", file.name, requestFile)
val captionBody = RequestBody.create("text/plain".toMediaTypeOrNull(), caption)

try {
editProfileApi.uploadProfilePhoto(imageBody, captionBody)
} catch (error: Exception) {
// Handle network error
Log.e("TAG", "uploadProfilePhoto: $error", )
}
}

suspend fun updateProfile(body: EditProfileRequest) {
editProfileApi.updateProfile(body)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import com.bounswe.predictionpolls.domain.poll.PollOption
import com.google.gson.*
import com.google.gson.annotations.SerializedName
import com.google.gson.reflect.TypeToken
import kotlinx.collections.immutable.toImmutableList
import java.lang.reflect.Type
import kotlinx.collections.immutable.toImmutableList

data class PollResponse(
@SerializedName("error")
Expand Down Expand Up @@ -54,11 +54,13 @@ data class PollResponse(
rejectionText = rejectVotes,
commentCount = 0,
tags = tags,
pollCreatorUsername = creatorUsername,
inputType = when (contPollType) {
"numeric" -> ContinuousVoteInputType.Decimal
"date" -> ContinuousVoteInputType.Date
else -> ContinuousVoteInputType.Text
}
},
isOpen = isOpen
)
}

Expand All @@ -78,9 +80,11 @@ data class PollResponse(
pollCreatorName = creatorName,
pollQuestionTitle = question,
rejectionText = rejectVotes,
pollCreatorUsername = creatorUsername,
commentCount = 0,
tags = tags,
options = options.toImmutableList()
options = options.toImmutableList(),
isOpen = isOpen
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package com.bounswe.predictionpolls.data.profile

import com.bounswe.predictionpolls.data.profile.model.FollowRequest
import com.bounswe.predictionpolls.data.profile.model.GetFollowersRequest
import com.bounswe.predictionpolls.data.profile.model.ProfileInfoResponse
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query

interface ProfileApi {

@GET("profiles")
suspend fun fetchProfileInfo(@Query("username") username: String): ProfileInfoResponse

@POST("profiles/follow")
suspend fun followUser(@Body followRequest: FollowRequest)

@POST("profiles/unfollow")
suspend fun unfollowUser(@Body followRequest: FollowRequest)

@POST("profiles/follower")
suspend fun fetchFollowers(@Body getFollowersRequest: GetFollowersRequest): FollowerResponse

@POST("profiles/followed")
suspend fun fetchFollowed(@Body getFollowersRequest: GetFollowersRequest): FollowerResponse

@GET("profiles/myProfile")
suspend fun fetchCurrentUserProfileInfo(): ProfileInfoResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ interface ProfileInfoRemoteDataSource {

suspend fun fetchProfileInfo(username: String): Result<ProfileInfoResponse>
suspend fun fetchCurrentUserProfileInfo(): Result<ProfileInfoResponse>

suspend fun followUser(followerId: String, followedId: String): Result<Unit>
suspend fun unfollowUser(followerId: String, followedId: String): Result<Unit>
suspend fun fetchFollowers(userId: String): Result<List<String>>
suspend fun fetchFollowed(userId: String): Result<List<String>>
}
Loading