Android Example [B4X] AS FeatureRequest - Approved and implemented requests


In this example I show how easy you can display 2 pages, with the features that are under development and the features that are already implemented.

Libraries that are needed:



B4X:
Private Sub LoadFeatureRequests(FeatureRequest As AS_FeatureRequest,LoadApproved As Boolean)
  
    FeatureRequest.Clear 'Clears the list
    FeatureRequest.ShowLoadingIndicator
  
    Try
  
        Dim CallFunction As Supabase_DatabaseRpc = xSupabase.Database.CallFunction
        CallFunction.Parameters(CreateMap("appid":1)) 'Change this to the app id in the dt_FeatureRequestApp
        CallFunction.Rpc("GetFeatureRequests".ToLowerCase)
        If LoadApproved Then
            CallFunction.Filter_Is(CreateMap("implementedversion":"null")) 'Load implemented items
        Else
            CallFunction.Filter_NotEqual(CreateMap("implementedversion":"")) 'Load approved items
        End If

        Wait For (CallFunction.Execute) Complete (RpcResult As SupabaseRpcResult)
        'Log(RpcResult.Error.ErrorMessage)
        If RpcResult.Error.Success Then
            'Log(RpcResult.Data)
      
            Dim parser As JSONParser
            parser.Initialize(RpcResult.Data)
            Dim jRoot As List = parser.NextArray
            For Each Row As Map In jRoot
          
                Dim StatusText As String = ""
                Select Row.Get("status")
                    Case 0
                        StatusText = "Submitted"
                    Case 1
                        StatusText = "Planned"
                    Case 2
                        StatusText = "In Development"
                    Case 3
                        StatusText = "Testing"
                    Case 4
                        StatusText = "Done"
                End Select
          
                Dim lstChips As List : lstChips.Initialize
                If Row.Get("implementedversion") <> Null Then lstChips.Add(FeatureRequest.CreateItemChip(Row.Get("implementedversion"),xui.Color_ARGB(255,73, 98, 164),xui.Color_White))
                lstChips.Add(FeatureRequest.CreateItemChip(StatusText,xui.Color_ARGB(255,45, 136, 121),xui.Color_White))
                If Row.Get("ispremiumfeature") Then lstChips.Add(FeatureRequest.CreateItemChip("Premium",xui.Color_ARGB(255,141, 68, 173),xui.Color_White))
              
                FeatureRequest.AddItem(Row.Get("title"),Row.Get("description"),lstChips,FeatureRequest.UserVoteStatus2Text(Row.Get("uservotestatus")),Row.Get("votecount"),Row.Get("id"))
              
            Next
      
        End If
  
    Catch
        Log(LastException)
    End Try
  
    FeatureRequest.HideLoadingIndicator
  
End Sub
 

Attachments

  • AS_FeatureRequest Supabase Approved and implemented requests Example.zip
    181.8 KB · Views: 15
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Example project updated through the changes in this tutorial:
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…